diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments-2.18.0.dist-info/licenses/AUTHORS b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments-2.18.0.dist-info/licenses/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..4ec64ba1ef00d08ab0b3453984669efcc3569eae --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments-2.18.0.dist-info/licenses/AUTHORS @@ -0,0 +1,283 @@ +Pygments is written and maintained by Georg Brandl . + +Major developers are Tim Hatch and Armin Ronacher +. + +Other contributors, listed alphabetically, are: + +* Sam Aaron -- Ioke lexer +* Jean Abou Samra -- LilyPond lexer +* João Abecasis -- JSLT lexer +* Ali Afshar -- image formatter +* Thomas Aglassinger -- Easytrieve, JCL, Rexx, Transact-SQL and VBScript + lexers +* Maxence Ahlouche -- PostgreSQL Explain lexer +* Muthiah Annamalai -- Ezhil lexer +* Nikolay Antipov -- OpenSCAD lexer +* Kumar Appaiah -- Debian control lexer +* Andreas Amann -- AppleScript lexer +* Timothy Armstrong -- Dart lexer fixes +* Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers +* Eiríkr Åsheim -- Uxntal lexer +* Jeremy Ashkenas -- CoffeeScript lexer +* José Joaquín Atria -- Praat lexer +* Stefan Matthias Aust -- Smalltalk lexer +* Lucas Bajolet -- Nit lexer +* Ben Bangert -- Mako lexers +* Max Battcher -- Darcs patch lexer +* Thomas Baruchel -- APL lexer +* Tim Baumann -- (Literate) Agda lexer +* Paul Baumgart, 280 North, Inc. -- Objective-J lexer +* Michael Bayer -- Myghty lexers +* Thomas Beale -- Archetype lexers +* John Benediktsson -- Factor lexer +* David Benjamin, Google LLC -- TLS lexer +* Trevor Bergeron -- mIRC formatter +* Vincent Bernat -- LessCSS lexer +* Christopher Bertels -- Fancy lexer +* Sébastien Bigaret -- QVT Operational lexer +* Jarrett Billingsley -- MiniD lexer +* Adam Blinkinsop -- Haskell, Redcode lexers +* Stéphane Blondon -- Procfile, SGF and Sieve lexers +* Frits van Bommel -- assembler lexers +* Pierre Bourdon -- bugfixes +* Martijn Braam -- Kernel log lexer, BARE lexer +* Matthias Bussonnier -- ANSI style handling for terminal-256 formatter +* chebee7i -- Python traceback lexer improvements +* Hiram Chirino -- Scaml and Jade lexers +* Mauricio Caceres -- SAS and Stata lexers. +* Michael Camilleri, John Gabriele, sogaiu -- Janet lexer +* Ian Cooper -- VGL lexer +* David Corbett -- Inform, Jasmin, JSGF, Snowball, and TADS 3 lexers +* Leaf Corcoran -- MoonScript lexer +* Gabriel Corona -- ASN.1 lexer +* Christopher Creutzig -- MuPAD lexer +* Daniël W. Crompton -- Pike lexer +* Pete Curry -- bugfixes +* Bryan Davis -- EBNF lexer +* Bruno Deferrari -- Shen lexer +* Walter Dörwald -- UL4 lexer +* Luke Drummond -- Meson lexer +* Giedrius Dubinskas -- HTML formatter improvements +* Owen Durni -- Haxe lexer +* Alexander Dutton, Oxford University Computing Services -- SPARQL lexer +* James Edwards -- Terraform lexer +* Nick Efford -- Python 3 lexer +* Sven Efftinge -- Xtend lexer +* Artem Egorkine -- terminal256 formatter +* Matthew Fernandez -- CAmkES lexer +* Paweł Fertyk -- GDScript lexer, HTML formatter improvements +* Michael Ficarra -- CPSA lexer +* James H. Fisher -- PostScript lexer +* William S. Fulton -- SWIG lexer +* Carlos Galdino -- Elixir and Elixir Console lexers +* Michael Galloy -- IDL lexer +* Naveen Garg -- Autohotkey lexer +* Simon Garnotel -- FreeFem++ lexer +* Laurent Gautier -- R/S lexer +* Alex Gaynor -- PyPy log lexer +* Richard Gerkin -- Igor Pro lexer +* Alain Gilbert -- TypeScript lexer +* Alex Gilding -- BlitzBasic lexer +* GitHub, Inc -- DASM16, Augeas, TOML, and Slash lexers +* Bertrand Goetzmann -- Groovy lexer +* Krzysiek Goj -- Scala lexer +* Rostyslav Golda -- FloScript lexer +* Andrey Golovizin -- BibTeX lexers +* Matt Good -- Genshi, Cheetah lexers +* Michał Górny -- vim modeline support +* Alex Gosse -- TrafficScript lexer +* Patrick Gotthardt -- PHP namespaces support +* Hubert Gruniaux -- C and C++ lexer improvements +* Olivier Guibe -- Asymptote lexer +* Phil Hagelberg -- Fennel lexer +* Florian Hahn -- Boogie lexer +* Martin Harriman -- SNOBOL lexer +* Matthew Harrison -- SVG formatter +* Steven Hazel -- Tcl lexer +* Dan Michael Heggø -- Turtle lexer +* Aslak Hellesøy -- Gherkin lexer +* Greg Hendershott -- Racket lexer +* Justin Hendrick -- ParaSail lexer +* Jordi Gutiérrez Hermoso -- Octave lexer +* David Hess, Fish Software, Inc. -- Objective-J lexer +* Ken Hilton -- Typographic Number Theory and Arrow lexers +* Varun Hiremath -- Debian control lexer +* Rob Hoelz -- Perl 6 lexer +* Doug Hogan -- Mscgen lexer +* Ben Hollis -- Mason lexer +* Max Horn -- GAP lexer +* Fred Hornsey -- OMG IDL Lexer +* Alastair Houghton -- Lexer inheritance facility +* Tim Howard -- BlitzMax lexer +* Dustin Howett -- Logos lexer +* Ivan Inozemtsev -- Fantom lexer +* Hiroaki Itoh -- Shell console rewrite, Lexers for PowerShell session, + MSDOS session, BC, WDiff +* Brian R. Jackson -- Tea lexer +* Christian Jann -- ShellSession lexer +* Jonas Camillus Jeppesen -- Line numbers and line highlighting for + RTF-formatter +* Dennis Kaarsemaker -- sources.list lexer +* Dmitri Kabak -- Inferno Limbo lexer +* Igor Kalnitsky -- vhdl lexer +* Colin Kennedy - USD lexer +* Alexander Kit -- MaskJS lexer +* Pekka Klärck -- Robot Framework lexer +* Gerwin Klein -- Isabelle lexer +* Eric Knibbe -- Lasso lexer +* Stepan Koltsov -- Clay lexer +* Oliver Kopp - Friendly grayscale style +* Adam Koprowski -- Opa lexer +* Benjamin Kowarsch -- Modula-2 lexer +* Domen Kožar -- Nix lexer +* Oleh Krekel -- Emacs Lisp lexer +* Alexander Kriegisch -- Kconfig and AspectJ lexers +* Marek Kubica -- Scheme lexer +* Jochen Kupperschmidt -- Markdown processor +* Gerd Kurzbach -- Modelica lexer +* Jon Larimer, Google Inc. -- Smali lexer +* Olov Lassus -- Dart lexer +* Matt Layman -- TAP lexer +* Kristian Lyngstøl -- Varnish lexers +* Sylvestre Ledru -- Scilab lexer +* Chee Sing Lee -- Flatline lexer +* Mark Lee -- Vala lexer +* Thomas Linder Puls -- Visual Prolog lexer +* Pete Lomax -- Phix lexer +* Valentin Lorentz -- C++ lexer improvements +* Ben Mabey -- Gherkin lexer +* Angus MacArthur -- QML lexer +* Louis Mandel -- X10 lexer +* Louis Marchand -- Eiffel lexer +* Simone Margaritelli -- Hybris lexer +* Tim Martin - World of Warcraft TOC lexer +* Kirk McDonald -- D lexer +* Gordon McGregor -- SystemVerilog lexer +* Stephen McKamey -- Duel/JBST lexer +* Brian McKenna -- F# lexer +* Charles McLaughlin -- Puppet lexer +* Kurt McKee -- Tera Term macro lexer, PostgreSQL updates, MySQL overhaul, JSON lexer +* Joe Eli McIlvain -- Savi lexer +* Lukas Meuser -- BBCode formatter, Lua lexer +* Cat Miller -- Pig lexer +* Paul Miller -- LiveScript lexer +* Hong Minhee -- HTTP lexer +* Michael Mior -- Awk lexer +* Bruce Mitchener -- Dylan lexer rewrite +* Reuben Morais -- SourcePawn lexer +* Jon Morton -- Rust lexer +* Paulo Moura -- Logtalk lexer +* Mher Movsisyan -- DTD lexer +* Dejan Muhamedagic -- Crmsh lexer +* Adrien Nayrat -- PostgreSQL Explain lexer +* Ana Nelson -- Ragel, ANTLR, R console lexers +* David Neto, Google LLC -- WebGPU Shading Language lexer +* Kurt Neufeld -- Markdown lexer +* Nam T. Nguyen -- Monokai style +* Jesper Noehr -- HTML formatter "anchorlinenos" +* Mike Nolta -- Julia lexer +* Avery Nortonsmith -- Pointless lexer +* Jonas Obrist -- BBCode lexer +* Edward O'Callaghan -- Cryptol lexer +* David Oliva -- Rebol lexer +* Pat Pannuto -- nesC lexer +* Jon Parise -- Protocol buffers and Thrift lexers +* Benjamin Peterson -- Test suite refactoring +* Ronny Pfannschmidt -- BBCode lexer +* Dominik Picheta -- Nimrod lexer +* Andrew Pinkham -- RTF Formatter Refactoring +* Clément Prévost -- UrbiScript lexer +* Tanner Prynn -- cmdline -x option and loading lexers from files +* Oleh Prypin -- Crystal lexer (based on Ruby lexer) +* Nick Psaris -- K and Q lexers +* Xidorn Quan -- Web IDL lexer +* Elias Rabel -- Fortran fixed form lexer +* raichoo -- Idris lexer +* Daniel Ramirez -- GDScript lexer +* Kashif Rasul -- CUDA lexer +* Nathan Reed -- HLSL lexer +* Justin Reidy -- MXML lexer +* Jonathon Reinhart, Google LLC -- Soong lexer +* Norman Richards -- JSON lexer +* Corey Richardson -- Rust lexer updates +* Fabrizio Riguzzi -- cplint leder +* Lubomir Rintel -- GoodData MAQL and CL lexers +* Andre Roberge -- Tango style +* Georg Rollinger -- HSAIL lexer +* Michiel Roos -- TypoScript lexer +* Konrad Rudolph -- LaTeX formatter enhancements +* Mario Ruggier -- Evoque lexers +* Miikka Salminen -- Lovelace style, Hexdump lexer, lexer enhancements +* Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers +* Matteo Sasso -- Common Lisp lexer +* Joe Schafer -- Ada lexer +* Max Schillinger -- TiddlyWiki5 lexer +* Andrew Schmidt -- X++ lexer +* Ken Schutte -- Matlab lexers +* René Schwaiger -- Rainbow Dash style +* Sebastian Schweizer -- Whiley lexer +* Tassilo Schweyer -- Io, MOOCode lexers +* Pablo Seminario -- PromQL lexer +* Ted Shaw -- AutoIt lexer +* Joerg Sieker -- ABAP lexer +* Robert Simmons -- Standard ML lexer +* Kirill Simonov -- YAML lexer +* Corbin Simpson -- Monte lexer +* Ville Skyttä -- ASCII armored lexer +* Alexander Smishlajev -- Visual FoxPro lexer +* Steve Spigarelli -- XQuery lexer +* Jerome St-Louis -- eC lexer +* Camil Staps -- Clean and NuSMV lexers; Solarized style +* James Strachan -- Kotlin lexer +* Tom Stuart -- Treetop lexer +* Colin Sullivan -- SuperCollider lexer +* Ben Swift -- Extempore lexer +* tatt61880 -- Kuin lexer +* Edoardo Tenani -- Arduino lexer +* Tiberius Teng -- default style overhaul +* Jeremy Thurgood -- Erlang, Squid config lexers +* Brian Tiffin -- OpenCOBOL lexer +* Bob Tolbert -- Hy lexer +* Doug Torrance -- Macaulay2 lexer +* Matthias Trute -- Forth lexer +* Tuoa Spi T4 -- Bdd lexer +* Erick Tryzelaar -- Felix lexer +* Alexander Udalov -- Kotlin lexer improvements +* Thomas Van Doren -- Chapel lexer +* Dave Van Ee -- Uxntal lexer updates +* Daniele Varrazzo -- PostgreSQL lexers +* Abe Voelker -- OpenEdge ABL lexer +* Pepijn de Vos -- HTML formatter CTags support +* Matthias Vallentin -- Bro lexer +* Benoît Vinot -- AMPL lexer +* Linh Vu Hong -- RSL lexer +* Immanuel Washington -- Smithy lexer +* Nathan Weizenbaum -- Haml and Sass lexers +* Nathan Whetsell -- Csound lexers +* Dietmar Winkler -- Modelica lexer +* Nils Winter -- Smalltalk lexer +* Davy Wybiral -- Clojure lexer +* Whitney Young -- ObjectiveC lexer +* Diego Zamboni -- CFengine3 lexer +* Enrique Zamudio -- Ceylon lexer +* Alex Zimin -- Nemerle lexer +* Rob Zimmerman -- Kal lexer +* Vincent Zurczak -- Roboconf lexer +* Hubert Gruniaux -- C and C++ lexer improvements +* Thomas Symalla -- AMDGPU Lexer +* 15b3 -- Image Formatter improvements +* Fabian Neumann -- CDDL lexer +* Thomas Duboucher -- CDDL lexer +* Philipp Imhof -- Pango Markup formatter +* Thomas Voss -- Sed lexer +* Martin Fischer -- WCAG contrast testing +* Marc Auberer -- Spice lexer +* Amr Hesham -- Carbon lexer +* diskdance -- Wikitext lexer +* vanillajonathan -- PRQL lexer +* Nikolay Antipov -- OpenSCAD lexer +* Markus Meyer, Nextron Systems -- YARA lexer +* Hannes Römer -- Mojo lexer + +Many thanks for all contributions! diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments-2.18.0.dist-info/licenses/LICENSE b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments-2.18.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..446a1a805c8a949579fb8a9799f2bec7777349dc --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments-2.18.0.dist-info/licenses/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2006-2022 by the respective authors (see AUTHORS file). +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/filters/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/filters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..86e8dacf3dd4024afa8255a9183c9f421e4b8543 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/filters/__init__.py @@ -0,0 +1,940 @@ +""" + pygments.filters + ~~~~~~~~~~~~~~~~ + + Module containing filter lookup functions and default + filters. + + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.token import String, Comment, Keyword, Name, Error, Whitespace, \ + string_to_tokentype +from pygments.filter import Filter +from pygments.util import get_list_opt, get_int_opt, get_bool_opt, \ + get_choice_opt, ClassNotFound, OptionError +from pygments.plugin import find_plugin_filters + + +def find_filter_class(filtername): + """Lookup a filter by name. Return None if not found.""" + if filtername in FILTERS: + return FILTERS[filtername] + for name, cls in find_plugin_filters(): + if name == filtername: + return cls + return None + + +def get_filter_by_name(filtername, **options): + """Return an instantiated filter. + + Options are passed to the filter initializer if wanted. + Raise a ClassNotFound if not found. + """ + cls = find_filter_class(filtername) + if cls: + return cls(**options) + else: + raise ClassNotFound(f'filter {filtername!r} not found') + + +def get_all_filters(): + """Return a generator of all filter names.""" + yield from FILTERS + for name, _ in find_plugin_filters(): + yield name + + +def _replace_special(ttype, value, regex, specialttype, + replacefunc=lambda x: x): + last = 0 + for match in regex.finditer(value): + start, end = match.start(), match.end() + if start != last: + yield ttype, value[last:start] + yield specialttype, replacefunc(value[start:end]) + last = end + if last != len(value): + yield ttype, value[last:] + + +class CodeTagFilter(Filter): + """Highlight special code tags in comments and docstrings. + + Options accepted: + + `codetags` : list of strings + A list of strings that are flagged as code tags. The default is to + highlight ``XXX``, ``TODO``, ``FIXME``, ``BUG`` and ``NOTE``. + + .. versionchanged:: 2.13 + Now recognizes ``FIXME`` by default. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + tags = get_list_opt(options, 'codetags', + ['XXX', 'TODO', 'FIXME', 'BUG', 'NOTE']) + self.tag_re = re.compile(r'\b({})\b'.format('|'.join([ + re.escape(tag) for tag in tags if tag + ]))) + + def filter(self, lexer, stream): + regex = self.tag_re + for ttype, value in stream: + if ttype in String.Doc or \ + ttype in Comment and \ + ttype not in Comment.Preproc: + yield from _replace_special(ttype, value, regex, Comment.Special) + else: + yield ttype, value + + +class SymbolFilter(Filter): + """Convert mathematical symbols such as \\ in Isabelle + or \\longrightarrow in LaTeX into Unicode characters. + + This is mostly useful for HTML or console output when you want to + approximate the source rendering you'd see in an IDE. + + Options accepted: + + `lang` : string + The symbol language. Must be one of ``'isabelle'`` or + ``'latex'``. The default is ``'isabelle'``. + """ + + latex_symbols = { + '\\alpha' : '\U000003b1', + '\\beta' : '\U000003b2', + '\\gamma' : '\U000003b3', + '\\delta' : '\U000003b4', + '\\varepsilon' : '\U000003b5', + '\\zeta' : '\U000003b6', + '\\eta' : '\U000003b7', + '\\vartheta' : '\U000003b8', + '\\iota' : '\U000003b9', + '\\kappa' : '\U000003ba', + '\\lambda' : '\U000003bb', + '\\mu' : '\U000003bc', + '\\nu' : '\U000003bd', + '\\xi' : '\U000003be', + '\\pi' : '\U000003c0', + '\\varrho' : '\U000003c1', + '\\sigma' : '\U000003c3', + '\\tau' : '\U000003c4', + '\\upsilon' : '\U000003c5', + '\\varphi' : '\U000003c6', + '\\chi' : '\U000003c7', + '\\psi' : '\U000003c8', + '\\omega' : '\U000003c9', + '\\Gamma' : '\U00000393', + '\\Delta' : '\U00000394', + '\\Theta' : '\U00000398', + '\\Lambda' : '\U0000039b', + '\\Xi' : '\U0000039e', + '\\Pi' : '\U000003a0', + '\\Sigma' : '\U000003a3', + '\\Upsilon' : '\U000003a5', + '\\Phi' : '\U000003a6', + '\\Psi' : '\U000003a8', + '\\Omega' : '\U000003a9', + '\\leftarrow' : '\U00002190', + '\\longleftarrow' : '\U000027f5', + '\\rightarrow' : '\U00002192', + '\\longrightarrow' : '\U000027f6', + '\\Leftarrow' : '\U000021d0', + '\\Longleftarrow' : '\U000027f8', + '\\Rightarrow' : '\U000021d2', + '\\Longrightarrow' : '\U000027f9', + '\\leftrightarrow' : '\U00002194', + '\\longleftrightarrow' : '\U000027f7', + '\\Leftrightarrow' : '\U000021d4', + '\\Longleftrightarrow' : '\U000027fa', + '\\mapsto' : '\U000021a6', + '\\longmapsto' : '\U000027fc', + '\\relbar' : '\U00002500', + '\\Relbar' : '\U00002550', + '\\hookleftarrow' : '\U000021a9', + '\\hookrightarrow' : '\U000021aa', + '\\leftharpoondown' : '\U000021bd', + '\\rightharpoondown' : '\U000021c1', + '\\leftharpoonup' : '\U000021bc', + '\\rightharpoonup' : '\U000021c0', + '\\rightleftharpoons' : '\U000021cc', + '\\leadsto' : '\U0000219d', + '\\downharpoonleft' : '\U000021c3', + '\\downharpoonright' : '\U000021c2', + '\\upharpoonleft' : '\U000021bf', + '\\upharpoonright' : '\U000021be', + '\\restriction' : '\U000021be', + '\\uparrow' : '\U00002191', + '\\Uparrow' : '\U000021d1', + '\\downarrow' : '\U00002193', + '\\Downarrow' : '\U000021d3', + '\\updownarrow' : '\U00002195', + '\\Updownarrow' : '\U000021d5', + '\\langle' : '\U000027e8', + '\\rangle' : '\U000027e9', + '\\lceil' : '\U00002308', + '\\rceil' : '\U00002309', + '\\lfloor' : '\U0000230a', + '\\rfloor' : '\U0000230b', + '\\flqq' : '\U000000ab', + '\\frqq' : '\U000000bb', + '\\bot' : '\U000022a5', + '\\top' : '\U000022a4', + '\\wedge' : '\U00002227', + '\\bigwedge' : '\U000022c0', + '\\vee' : '\U00002228', + '\\bigvee' : '\U000022c1', + '\\forall' : '\U00002200', + '\\exists' : '\U00002203', + '\\nexists' : '\U00002204', + '\\neg' : '\U000000ac', + '\\Box' : '\U000025a1', + '\\Diamond' : '\U000025c7', + '\\vdash' : '\U000022a2', + '\\models' : '\U000022a8', + '\\dashv' : '\U000022a3', + '\\surd' : '\U0000221a', + '\\le' : '\U00002264', + '\\ge' : '\U00002265', + '\\ll' : '\U0000226a', + '\\gg' : '\U0000226b', + '\\lesssim' : '\U00002272', + '\\gtrsim' : '\U00002273', + '\\lessapprox' : '\U00002a85', + '\\gtrapprox' : '\U00002a86', + '\\in' : '\U00002208', + '\\notin' : '\U00002209', + '\\subset' : '\U00002282', + '\\supset' : '\U00002283', + '\\subseteq' : '\U00002286', + '\\supseteq' : '\U00002287', + '\\sqsubset' : '\U0000228f', + '\\sqsupset' : '\U00002290', + '\\sqsubseteq' : '\U00002291', + '\\sqsupseteq' : '\U00002292', + '\\cap' : '\U00002229', + '\\bigcap' : '\U000022c2', + '\\cup' : '\U0000222a', + '\\bigcup' : '\U000022c3', + '\\sqcup' : '\U00002294', + '\\bigsqcup' : '\U00002a06', + '\\sqcap' : '\U00002293', + '\\Bigsqcap' : '\U00002a05', + '\\setminus' : '\U00002216', + '\\propto' : '\U0000221d', + '\\uplus' : '\U0000228e', + '\\bigplus' : '\U00002a04', + '\\sim' : '\U0000223c', + '\\doteq' : '\U00002250', + '\\simeq' : '\U00002243', + '\\approx' : '\U00002248', + '\\asymp' : '\U0000224d', + '\\cong' : '\U00002245', + '\\equiv' : '\U00002261', + '\\Join' : '\U000022c8', + '\\bowtie' : '\U00002a1d', + '\\prec' : '\U0000227a', + '\\succ' : '\U0000227b', + '\\preceq' : '\U0000227c', + '\\succeq' : '\U0000227d', + '\\parallel' : '\U00002225', + '\\mid' : '\U000000a6', + '\\pm' : '\U000000b1', + '\\mp' : '\U00002213', + '\\times' : '\U000000d7', + '\\div' : '\U000000f7', + '\\cdot' : '\U000022c5', + '\\star' : '\U000022c6', + '\\circ' : '\U00002218', + '\\dagger' : '\U00002020', + '\\ddagger' : '\U00002021', + '\\lhd' : '\U000022b2', + '\\rhd' : '\U000022b3', + '\\unlhd' : '\U000022b4', + '\\unrhd' : '\U000022b5', + '\\triangleleft' : '\U000025c3', + '\\triangleright' : '\U000025b9', + '\\triangle' : '\U000025b3', + '\\triangleq' : '\U0000225c', + '\\oplus' : '\U00002295', + '\\bigoplus' : '\U00002a01', + '\\otimes' : '\U00002297', + '\\bigotimes' : '\U00002a02', + '\\odot' : '\U00002299', + '\\bigodot' : '\U00002a00', + '\\ominus' : '\U00002296', + '\\oslash' : '\U00002298', + '\\dots' : '\U00002026', + '\\cdots' : '\U000022ef', + '\\sum' : '\U00002211', + '\\prod' : '\U0000220f', + '\\coprod' : '\U00002210', + '\\infty' : '\U0000221e', + '\\int' : '\U0000222b', + '\\oint' : '\U0000222e', + '\\clubsuit' : '\U00002663', + '\\diamondsuit' : '\U00002662', + '\\heartsuit' : '\U00002661', + '\\spadesuit' : '\U00002660', + '\\aleph' : '\U00002135', + '\\emptyset' : '\U00002205', + '\\nabla' : '\U00002207', + '\\partial' : '\U00002202', + '\\flat' : '\U0000266d', + '\\natural' : '\U0000266e', + '\\sharp' : '\U0000266f', + '\\angle' : '\U00002220', + '\\copyright' : '\U000000a9', + '\\textregistered' : '\U000000ae', + '\\textonequarter' : '\U000000bc', + '\\textonehalf' : '\U000000bd', + '\\textthreequarters' : '\U000000be', + '\\textordfeminine' : '\U000000aa', + '\\textordmasculine' : '\U000000ba', + '\\euro' : '\U000020ac', + '\\pounds' : '\U000000a3', + '\\yen' : '\U000000a5', + '\\textcent' : '\U000000a2', + '\\textcurrency' : '\U000000a4', + '\\textdegree' : '\U000000b0', + } + + isabelle_symbols = { + '\\' : '\U0001d7ec', + '\\' : '\U0001d7ed', + '\\' : '\U0001d7ee', + '\\' : '\U0001d7ef', + '\\' : '\U0001d7f0', + '\\' : '\U0001d7f1', + '\\' : '\U0001d7f2', + '\\' : '\U0001d7f3', + '\\' : '\U0001d7f4', + '\\' : '\U0001d7f5', + '\\' : '\U0001d49c', + '\\' : '\U0000212c', + '\\' : '\U0001d49e', + '\\' : '\U0001d49f', + '\\' : '\U00002130', + '\\' : '\U00002131', + '\\' : '\U0001d4a2', + '\\' : '\U0000210b', + '\\' : '\U00002110', + '\\' : '\U0001d4a5', + '\\' : '\U0001d4a6', + '\\' : '\U00002112', + '\\' : '\U00002133', + '\\' : '\U0001d4a9', + '\\' : '\U0001d4aa', + '\\

' : '\U0001d5c9', + '\\' : '\U0001d5ca', + '\\' : '\U0001d5cb', + '\\' : '\U0001d5cc', + '\\' : '\U0001d5cd', + '\\' : '\U0001d5ce', + '\\' : '\U0001d5cf', + '\\' : '\U0001d5d0', + '\\' : '\U0001d5d1', + '\\' : '\U0001d5d2', + '\\' : '\U0001d5d3', + '\\' : '\U0001d504', + '\\' : '\U0001d505', + '\\' : '\U0000212d', + '\\

' : '\U0001d507', + '\\' : '\U0001d508', + '\\' : '\U0001d509', + '\\' : '\U0001d50a', + '\\' : '\U0000210c', + '\\' : '\U00002111', + '\\' : '\U0001d50d', + '\\' : '\U0001d50e', + '\\' : '\U0001d50f', + '\\' : '\U0001d510', + '\\' : '\U0001d511', + '\\' : '\U0001d512', + '\\' : '\U0001d513', + '\\' : '\U0001d514', + '\\' : '\U0000211c', + '\\' : '\U0001d516', + '\\' : '\U0001d517', + '\\' : '\U0001d518', + '\\' : '\U0001d519', + '\\' : '\U0001d51a', + '\\' : '\U0001d51b', + '\\' : '\U0001d51c', + '\\' : '\U00002128', + '\\' : '\U0001d51e', + '\\' : '\U0001d51f', + '\\' : '\U0001d520', + '\\
' : '\U0001d521', + '\\' : '\U0001d522', + '\\' : '\U0001d523', + '\\' : '\U0001d524', + '\\' : '\U0001d525', + '\\' : '\U0001d526', + '\\' : '\U0001d527', + '\\' : '\U0001d528', + '\\' : '\U0001d529', + '\\' : '\U0001d52a', + '\\' : '\U0001d52b', + '\\' : '\U0001d52c', + '\\' : '\U0001d52d', + '\\' : '\U0001d52e', + '\\' : '\U0001d52f', + '\\' : '\U0001d530', + '\\' : '\U0001d531', + '\\' : '\U0001d532', + '\\' : '\U0001d533', + '\\' : '\U0001d534', + '\\' : '\U0001d535', + '\\' : '\U0001d536', + '\\' : '\U0001d537', + '\\' : '\U000003b1', + '\\' : '\U000003b2', + '\\' : '\U000003b3', + '\\' : '\U000003b4', + '\\' : '\U000003b5', + '\\' : '\U000003b6', + '\\' : '\U000003b7', + '\\' : '\U000003b8', + '\\' : '\U000003b9', + '\\' : '\U000003ba', + '\\' : '\U000003bb', + '\\' : '\U000003bc', + '\\' : '\U000003bd', + '\\' : '\U000003be', + '\\' : '\U000003c0', + '\\' : '\U000003c1', + '\\' : '\U000003c3', + '\\' : '\U000003c4', + '\\' : '\U000003c5', + '\\' : '\U000003c6', + '\\' : '\U000003c7', + '\\' : '\U000003c8', + '\\' : '\U000003c9', + '\\' : '\U00000393', + '\\' : '\U00000394', + '\\' : '\U00000398', + '\\' : '\U0000039b', + '\\' : '\U0000039e', + '\\' : '\U000003a0', + '\\' : '\U000003a3', + '\\' : '\U000003a5', + '\\' : '\U000003a6', + '\\' : '\U000003a8', + '\\' : '\U000003a9', + '\\' : '\U0001d539', + '\\' : '\U00002102', + '\\' : '\U00002115', + '\\' : '\U0000211a', + '\\' : '\U0000211d', + '\\' : '\U00002124', + '\\' : '\U00002190', + '\\' : '\U000027f5', + '\\' : '\U00002192', + '\\' : '\U000027f6', + '\\' : '\U000021d0', + '\\' : '\U000027f8', + '\\' : '\U000021d2', + '\\' : '\U000027f9', + '\\' : '\U00002194', + '\\' : '\U000027f7', + '\\' : '\U000021d4', + '\\' : '\U000027fa', + '\\' : '\U000021a6', + '\\' : '\U000027fc', + '\\' : '\U00002500', + '\\' : '\U00002550', + '\\' : '\U000021a9', + '\\' : '\U000021aa', + '\\' : '\U000021bd', + '\\' : '\U000021c1', + '\\' : '\U000021bc', + '\\' : '\U000021c0', + '\\' : '\U000021cc', + '\\' : '\U0000219d', + '\\' : '\U000021c3', + '\\' : '\U000021c2', + '\\' : '\U000021bf', + '\\' : '\U000021be', + '\\' : '\U000021be', + '\\' : '\U00002237', + '\\' : '\U00002191', + '\\' : '\U000021d1', + '\\' : '\U00002193', + '\\' : '\U000021d3', + '\\' : '\U00002195', + '\\' : '\U000021d5', + '\\' : '\U000027e8', + '\\' : '\U000027e9', + '\\' : '\U00002308', + '\\' : '\U00002309', + '\\' : '\U0000230a', + '\\' : '\U0000230b', + '\\' : '\U00002987', + '\\' : '\U00002988', + '\\' : '\U000027e6', + '\\' : '\U000027e7', + '\\' : '\U00002983', + '\\' : '\U00002984', + '\\' : '\U000000ab', + '\\' : '\U000000bb', + '\\' : '\U000022a5', + '\\' : '\U000022a4', + '\\' : '\U00002227', + '\\' : '\U000022c0', + '\\' : '\U00002228', + '\\' : '\U000022c1', + '\\' : '\U00002200', + '\\' : '\U00002203', + '\\' : '\U00002204', + '\\' : '\U000000ac', + '\\' : '\U000025a1', + '\\' : '\U000025c7', + '\\' : '\U000022a2', + '\\' : '\U000022a8', + '\\' : '\U000022a9', + '\\' : '\U000022ab', + '\\' : '\U000022a3', + '\\' : '\U0000221a', + '\\' : '\U00002264', + '\\' : '\U00002265', + '\\' : '\U0000226a', + '\\' : '\U0000226b', + '\\' : '\U00002272', + '\\' : '\U00002273', + '\\' : '\U00002a85', + '\\' : '\U00002a86', + '\\' : '\U00002208', + '\\' : '\U00002209', + '\\' : '\U00002282', + '\\' : '\U00002283', + '\\' : '\U00002286', + '\\' : '\U00002287', + '\\' : '\U0000228f', + '\\' : '\U00002290', + '\\' : '\U00002291', + '\\' : '\U00002292', + '\\' : '\U00002229', + '\\' : '\U000022c2', + '\\' : '\U0000222a', + '\\' : '\U000022c3', + '\\' : '\U00002294', + '\\' : '\U00002a06', + '\\' : '\U00002293', + '\\' : '\U00002a05', + '\\' : '\U00002216', + '\\' : '\U0000221d', + '\\' : '\U0000228e', + '\\' : '\U00002a04', + '\\' : '\U00002260', + '\\' : '\U0000223c', + '\\' : '\U00002250', + '\\' : '\U00002243', + '\\' : '\U00002248', + '\\' : '\U0000224d', + '\\' : '\U00002245', + '\\' : '\U00002323', + '\\' : '\U00002261', + '\\' : '\U00002322', + '\\' : '\U000022c8', + '\\' : '\U00002a1d', + '\\' : '\U0000227a', + '\\' : '\U0000227b', + '\\' : '\U0000227c', + '\\' : '\U0000227d', + '\\' : '\U00002225', + '\\' : '\U000000a6', + '\\' : '\U000000b1', + '\\' : '\U00002213', + '\\' : '\U000000d7', + '\\
' : '\U000000f7', + '\\' : '\U000022c5', + '\\' : '\U000022c6', + '\\' : '\U00002219', + '\\' : '\U00002218', + '\\' : '\U00002020', + '\\' : '\U00002021', + '\\' : '\U000022b2', + '\\' : '\U000022b3', + '\\' : '\U000022b4', + '\\' : '\U000022b5', + '\\' : '\U000025c3', + '\\' : '\U000025b9', + '\\' : '\U000025b3', + '\\' : '\U0000225c', + '\\' : '\U00002295', + '\\' : '\U00002a01', + '\\' : '\U00002297', + '\\' : '\U00002a02', + '\\' : '\U00002299', + '\\' : '\U00002a00', + '\\' : '\U00002296', + '\\' : '\U00002298', + '\\' : '\U00002026', + '\\' : '\U000022ef', + '\\' : '\U00002211', + '\\' : '\U0000220f', + '\\' : '\U00002210', + '\\' : '\U0000221e', + '\\' : '\U0000222b', + '\\' : '\U0000222e', + '\\' : '\U00002663', + '\\' : '\U00002662', + '\\' : '\U00002661', + '\\' : '\U00002660', + '\\' : '\U00002135', + '\\' : '\U00002205', + '\\' : '\U00002207', + '\\' : '\U00002202', + '\\' : '\U0000266d', + '\\' : '\U0000266e', + '\\' : '\U0000266f', + '\\' : '\U00002220', + '\\' : '\U000000a9', + '\\' : '\U000000ae', + '\\' : '\U000000ad', + '\\' : '\U000000af', + '\\' : '\U000000bc', + '\\' : '\U000000bd', + '\\' : '\U000000be', + '\\' : '\U000000aa', + '\\' : '\U000000ba', + '\\
' : '\U000000a7', + '\\' : '\U000000b6', + '\\' : '\U000000a1', + '\\' : '\U000000bf', + '\\' : '\U000020ac', + '\\' : '\U000000a3', + '\\' : '\U000000a5', + '\\' : '\U000000a2', + '\\' : '\U000000a4', + '\\' : '\U000000b0', + '\\' : '\U00002a3f', + '\\' : '\U00002127', + '\\' : '\U000025ca', + '\\' : '\U00002118', + '\\' : '\U00002240', + '\\' : '\U000022c4', + '\\' : '\U000000b4', + '\\' : '\U00000131', + '\\' : '\U000000a8', + '\\' : '\U000000b8', + '\\' : '\U000002dd', + '\\' : '\U000003f5', + '\\' : '\U000023ce', + '\\' : '\U00002039', + '\\' : '\U0000203a', + '\\' : '\U00002302', + '\\<^sub>' : '\U000021e9', + '\\<^sup>' : '\U000021e7', + '\\<^bold>' : '\U00002759', + '\\<^bsub>' : '\U000021d8', + '\\<^esub>' : '\U000021d9', + '\\<^bsup>' : '\U000021d7', + '\\<^esup>' : '\U000021d6', + } + + lang_map = {'isabelle' : isabelle_symbols, 'latex' : latex_symbols} + + def __init__(self, **options): + Filter.__init__(self, **options) + lang = get_choice_opt(options, 'lang', + ['isabelle', 'latex'], 'isabelle') + self.symbols = self.lang_map[lang] + + def filter(self, lexer, stream): + for ttype, value in stream: + if value in self.symbols: + yield ttype, self.symbols[value] + else: + yield ttype, value + + +class KeywordCaseFilter(Filter): + """Convert keywords to lowercase or uppercase or capitalize them, which + means first letter uppercase, rest lowercase. + + This can be useful e.g. if you highlight Pascal code and want to adapt the + code to your styleguide. + + Options accepted: + + `case` : string + The casing to convert keywords to. Must be one of ``'lower'``, + ``'upper'`` or ``'capitalize'``. The default is ``'lower'``. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + case = get_choice_opt(options, 'case', + ['lower', 'upper', 'capitalize'], 'lower') + self.convert = getattr(str, case) + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype in Keyword: + yield ttype, self.convert(value) + else: + yield ttype, value + + +class NameHighlightFilter(Filter): + """Highlight a normal Name (and Name.*) token with a different token type. + + Example:: + + filter = NameHighlightFilter( + names=['foo', 'bar', 'baz'], + tokentype=Name.Function, + ) + + This would highlight the names "foo", "bar" and "baz" + as functions. `Name.Function` is the default token type. + + Options accepted: + + `names` : list of strings + A list of names that should be given the different token type. + There is no default. + `tokentype` : TokenType or string + A token type or a string containing a token type name that is + used for highlighting the strings in `names`. The default is + `Name.Function`. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + self.names = set(get_list_opt(options, 'names', [])) + tokentype = options.get('tokentype') + if tokentype: + self.tokentype = string_to_tokentype(tokentype) + else: + self.tokentype = Name.Function + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype in Name and value in self.names: + yield self.tokentype, value + else: + yield ttype, value + + +class ErrorToken(Exception): + pass + + +class RaiseOnErrorTokenFilter(Filter): + """Raise an exception when the lexer generates an error token. + + Options accepted: + + `excclass` : Exception class + The exception class to raise. + The default is `pygments.filters.ErrorToken`. + + .. versionadded:: 0.8 + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + self.exception = options.get('excclass', ErrorToken) + try: + # issubclass() will raise TypeError if first argument is not a class + if not issubclass(self.exception, Exception): + raise TypeError + except TypeError: + raise OptionError('excclass option is not an exception class') + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype is Error: + raise self.exception(value) + yield ttype, value + + +class VisibleWhitespaceFilter(Filter): + """Convert tabs, newlines and/or spaces to visible characters. + + Options accepted: + + `spaces` : string or bool + If this is a one-character string, spaces will be replaces by this string. + If it is another true value, spaces will be replaced by ``·`` (unicode + MIDDLE DOT). If it is a false value, spaces will not be replaced. The + default is ``False``. + `tabs` : string or bool + The same as for `spaces`, but the default replacement character is ``»`` + (unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value + is ``False``. Note: this will not work if the `tabsize` option for the + lexer is nonzero, as tabs will already have been expanded then. + `tabsize` : int + If tabs are to be replaced by this filter (see the `tabs` option), this + is the total number of characters that a tab should be expanded to. + The default is ``8``. + `newlines` : string or bool + The same as for `spaces`, but the default replacement character is ``¶`` + (unicode PILCROW SIGN). The default value is ``False``. + `wstokentype` : bool + If true, give whitespace the special `Whitespace` token type. This allows + styling the visible whitespace differently (e.g. greyed out), but it can + disrupt background colors. The default is ``True``. + + .. versionadded:: 0.8 + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + for name, default in [('spaces', '·'), + ('tabs', '»'), + ('newlines', '¶')]: + opt = options.get(name, False) + if isinstance(opt, str) and len(opt) == 1: + setattr(self, name, opt) + else: + setattr(self, name, (opt and default or '')) + tabsize = get_int_opt(options, 'tabsize', 8) + if self.tabs: + self.tabs += ' ' * (tabsize - 1) + if self.newlines: + self.newlines += '\n' + self.wstt = get_bool_opt(options, 'wstokentype', True) + + def filter(self, lexer, stream): + if self.wstt: + spaces = self.spaces or ' ' + tabs = self.tabs or '\t' + newlines = self.newlines or '\n' + regex = re.compile(r'\s') + + def replacefunc(wschar): + if wschar == ' ': + return spaces + elif wschar == '\t': + return tabs + elif wschar == '\n': + return newlines + return wschar + + for ttype, value in stream: + yield from _replace_special(ttype, value, regex, Whitespace, + replacefunc) + else: + spaces, tabs, newlines = self.spaces, self.tabs, self.newlines + # simpler processing + for ttype, value in stream: + if spaces: + value = value.replace(' ', spaces) + if tabs: + value = value.replace('\t', tabs) + if newlines: + value = value.replace('\n', newlines) + yield ttype, value + + +class GobbleFilter(Filter): + """Gobbles source code lines (eats initial characters). + + This filter drops the first ``n`` characters off every line of code. This + may be useful when the source code fed to the lexer is indented by a fixed + amount of space that isn't desired in the output. + + Options accepted: + + `n` : int + The number of characters to gobble. + + .. versionadded:: 1.2 + """ + def __init__(self, **options): + Filter.__init__(self, **options) + self.n = get_int_opt(options, 'n', 0) + + def gobble(self, value, left): + if left < len(value): + return value[left:], 0 + else: + return '', left - len(value) + + def filter(self, lexer, stream): + n = self.n + left = n # How many characters left to gobble. + for ttype, value in stream: + # Remove ``left`` tokens from first line, ``n`` from all others. + parts = value.split('\n') + (parts[0], left) = self.gobble(parts[0], left) + for i in range(1, len(parts)): + (parts[i], left) = self.gobble(parts[i], n) + value = '\n'.join(parts) + + if value != '': + yield ttype, value + + +class TokenMergeFilter(Filter): + """Merges consecutive tokens with the same token type in the output + stream of a lexer. + + .. versionadded:: 1.2 + """ + def __init__(self, **options): + Filter.__init__(self, **options) + + def filter(self, lexer, stream): + current_type = None + current_value = None + for ttype, value in stream: + if ttype is current_type: + current_value += value + else: + if current_type is not None: + yield current_type, current_value + current_type = ttype + current_value = value + if current_type is not None: + yield current_type, current_value + + +FILTERS = { + 'codetagify': CodeTagFilter, + 'keywordcase': KeywordCaseFilter, + 'highlight': NameHighlightFilter, + 'raiseonerror': RaiseOnErrorTokenFilter, + 'whitespace': VisibleWhitespaceFilter, + 'gobble': GobbleFilter, + 'tokenmerge': TokenMergeFilter, + 'symbols': SymbolFilter, +} diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..014de975f5d5a054057f2a2491b3d7c0f618bb98 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/__init__.py @@ -0,0 +1,157 @@ +""" + pygments.formatters + ~~~~~~~~~~~~~~~~~~~ + + Pygments formatters. + + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +import sys +import types +import fnmatch +from os.path import basename + +from pygments.formatters._mapping import FORMATTERS +from pygments.plugin import find_plugin_formatters +from pygments.util import ClassNotFound + +__all__ = ['get_formatter_by_name', 'get_formatter_for_filename', + 'get_all_formatters', 'load_formatter_from_file'] + list(FORMATTERS) + +_formatter_cache = {} # classes by name +_pattern_cache = {} + + +def _fn_matches(fn, glob): + """Return whether the supplied file name fn matches pattern filename.""" + if glob not in _pattern_cache: + pattern = _pattern_cache[glob] = re.compile(fnmatch.translate(glob)) + return pattern.match(fn) + return _pattern_cache[glob].match(fn) + + +def _load_formatters(module_name): + """Load a formatter (and all others in the module too).""" + mod = __import__(module_name, None, None, ['__all__']) + for formatter_name in mod.__all__: + cls = getattr(mod, formatter_name) + _formatter_cache[cls.name] = cls + + +def get_all_formatters(): + """Return a generator for all formatter classes.""" + # NB: this returns formatter classes, not info like get_all_lexers(). + for info in FORMATTERS.values(): + if info[1] not in _formatter_cache: + _load_formatters(info[0]) + yield _formatter_cache[info[1]] + for _, formatter in find_plugin_formatters(): + yield formatter + + +def find_formatter_class(alias): + """Lookup a formatter by alias. + + Returns None if not found. + """ + for module_name, name, aliases, _, _ in FORMATTERS.values(): + if alias in aliases: + if name not in _formatter_cache: + _load_formatters(module_name) + return _formatter_cache[name] + for _, cls in find_plugin_formatters(): + if alias in cls.aliases: + return cls + + +def get_formatter_by_name(_alias, **options): + """ + Return an instance of a :class:`.Formatter` subclass that has `alias` in its + aliases list. The formatter is given the `options` at its instantiation. + + Will raise :exc:`pygments.util.ClassNotFound` if no formatter with that + alias is found. + """ + cls = find_formatter_class(_alias) + if cls is None: + raise ClassNotFound(f"no formatter found for name {_alias!r}") + return cls(**options) + + +def load_formatter_from_file(filename, formattername="CustomFormatter", **options): + """ + Return a `Formatter` subclass instance loaded from the provided file, relative + to the current directory. + + The file is expected to contain a Formatter class named ``formattername`` + (by default, CustomFormatter). Users should be very careful with the input, because + this method is equivalent to running ``eval()`` on the input file. The formatter is + given the `options` at its instantiation. + + :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading + the formatter. + + .. versionadded:: 2.2 + """ + try: + # This empty dict will contain the namespace for the exec'd file + custom_namespace = {} + with open(filename, 'rb') as f: + exec(f.read(), custom_namespace) + # Retrieve the class `formattername` from that namespace + if formattername not in custom_namespace: + raise ClassNotFound(f'no valid {formattername} class found in {filename}') + formatter_class = custom_namespace[formattername] + # And finally instantiate it with the options + return formatter_class(**options) + except OSError as err: + raise ClassNotFound(f'cannot read {filename}: {err}') + except ClassNotFound: + raise + except Exception as err: + raise ClassNotFound(f'error when loading custom formatter: {err}') + + +def get_formatter_for_filename(fn, **options): + """ + Return a :class:`.Formatter` subclass instance that has a filename pattern + matching `fn`. The formatter is given the `options` at its instantiation. + + Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename + is found. + """ + fn = basename(fn) + for modname, name, _, filenames, _ in FORMATTERS.values(): + for filename in filenames: + if _fn_matches(fn, filename): + if name not in _formatter_cache: + _load_formatters(modname) + return _formatter_cache[name](**options) + for _name, cls in find_plugin_formatters(): + for filename in cls.filenames: + if _fn_matches(fn, filename): + return cls(**options) + raise ClassNotFound(f"no formatter found for file name {fn!r}") + + +class _automodule(types.ModuleType): + """Automatically import formatters.""" + + def __getattr__(self, name): + info = FORMATTERS.get(name) + if info: + _load_formatters(info[0]) + cls = _formatter_cache[info[1]] + setattr(self, name, cls) + return cls + raise AttributeError(name) + + +oldmod = sys.modules[__name__] +newmod = _automodule(__name__) +newmod.__dict__.update(oldmod.__dict__) +sys.modules[__name__] = newmod +del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/_mapping.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/_mapping.py new file mode 100644 index 0000000000000000000000000000000000000000..72ca84040b626183e3328679db600c13472021be --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/_mapping.py @@ -0,0 +1,23 @@ +# Automatically generated by scripts/gen_mapfiles.py. +# DO NOT EDIT BY HAND; run `tox -e mapfiles` instead. + +FORMATTERS = { + 'BBCodeFormatter': ('pygments.formatters.bbcode', 'BBCode', ('bbcode', 'bb'), (), 'Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.'), + 'BmpImageFormatter': ('pygments.formatters.img', 'img_bmp', ('bmp', 'bitmap'), ('*.bmp',), 'Create a bitmap image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'GifImageFormatter': ('pygments.formatters.img', 'img_gif', ('gif',), ('*.gif',), 'Create a GIF image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'GroffFormatter': ('pygments.formatters.groff', 'groff', ('groff', 'troff', 'roff'), (), 'Format tokens with groff escapes to change their color and font style.'), + 'HtmlFormatter': ('pygments.formatters.html', 'HTML', ('html',), ('*.html', '*.htm'), "Format tokens as HTML 4 ```` tags. By default, the content is enclosed in a ``
`` tag, itself wrapped in a ``
`` tag (but see the `nowrap` option). The ``
``'s CSS class can be set by the `cssclass` option."), + 'IRCFormatter': ('pygments.formatters.irc', 'IRC', ('irc', 'IRC'), (), 'Format tokens with IRC color sequences'), + 'ImageFormatter': ('pygments.formatters.img', 'img', ('img', 'IMG', 'png'), ('*.png',), 'Create a PNG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'JpgImageFormatter': ('pygments.formatters.img', 'img_jpg', ('jpg', 'jpeg'), ('*.jpg',), 'Create a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'LatexFormatter': ('pygments.formatters.latex', 'LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'), + 'NullFormatter': ('pygments.formatters.other', 'Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'), + 'PangoMarkupFormatter': ('pygments.formatters.pangomarkup', 'Pango Markup', ('pango', 'pangomarkup'), (), 'Format tokens as Pango Markup code. It can then be rendered to an SVG.'), + 'RawTokenFormatter': ('pygments.formatters.other', 'Raw tokens', ('raw', 'tokens'), ('*.raw',), 'Format tokens as a raw representation for storing token streams.'), + 'RtfFormatter': ('pygments.formatters.rtf', 'RTF', ('rtf',), ('*.rtf',), 'Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents.'), + 'SvgFormatter': ('pygments.formatters.svg', 'SVG', ('svg',), ('*.svg',), 'Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ```` element with explicit ``x`` and ``y`` coordinates containing ```` elements with the individual token styles.'), + 'Terminal256Formatter': ('pygments.formatters.terminal256', 'Terminal256', ('terminal256', 'console256', '256'), (), 'Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), + 'TerminalFormatter': ('pygments.formatters.terminal', 'Terminal', ('terminal', 'console'), (), 'Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.'), + 'TerminalTrueColorFormatter': ('pygments.formatters.terminal256', 'TerminalTrueColor', ('terminal16m', 'console16m', '16m'), (), 'Format tokens with ANSI color sequences, for output in a true-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), + 'TestcaseFormatter': ('pygments.formatters.other', 'Testcase', ('testcase',), (), 'Format tokens as appropriate for a new testcase.'), +} diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/bbcode.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/bbcode.py new file mode 100644 index 0000000000000000000000000000000000000000..9554081062a781138fb523b18448bc9d92e537bf --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/bbcode.py @@ -0,0 +1,108 @@ +""" + pygments.formatters.bbcode + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + BBcode formatter. + + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + + +from pygments.formatter import Formatter +from pygments.util import get_bool_opt + +__all__ = ['BBCodeFormatter'] + + +class BBCodeFormatter(Formatter): + """ + Format tokens with BBcodes. These formatting codes are used by many + bulletin boards, so you can highlight your sourcecode with pygments before + posting it there. + + This formatter has no support for background colors and borders, as there + are no common BBcode tags for that. + + Some board systems (e.g. phpBB) don't support colors in their [code] tag, + so you can't use the highlighting together with that tag. + Text in a [code] tag usually is shown with a monospace font (which this + formatter can do with the ``monofont`` option) and no spaces (which you + need for indentation) are removed. + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `codetag` + If set to true, put the output into ``[code]`` tags (default: + ``false``) + + `monofont` + If set to true, add a tag to show the code with a monospace font + (default: ``false``). + """ + name = 'BBCode' + aliases = ['bbcode', 'bb'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + self._code = get_bool_opt(options, 'codetag', False) + self._mono = get_bool_opt(options, 'monofont', False) + + self.styles = {} + self._make_styles() + + def _make_styles(self): + for ttype, ndef in self.style: + start = end = '' + if ndef['color']: + start += '[color=#{}]'.format(ndef['color']) + end = '[/color]' + end + if ndef['bold']: + start += '[b]' + end = '[/b]' + end + if ndef['italic']: + start += '[i]' + end = '[/i]' + end + if ndef['underline']: + start += '[u]' + end = '[/u]' + end + # there are no common BBcodes for background-color and border + + self.styles[ttype] = start, end + + def format_unencoded(self, tokensource, outfile): + if self._code: + outfile.write('[code]') + if self._mono: + outfile.write('[font=monospace]') + + lastval = '' + lasttype = None + + for ttype, value in tokensource: + while ttype not in self.styles: + ttype = ttype.parent + if ttype == lasttype: + lastval += value + else: + if lastval: + start, end = self.styles[lasttype] + outfile.write(''.join((start, lastval, end))) + lastval = value + lasttype = ttype + + if lastval: + start, end = self.styles[lasttype] + outfile.write(''.join((start, lastval, end))) + + if self._mono: + outfile.write('[/font]') + if self._code: + outfile.write('[/code]') + if self._code or self._mono: + outfile.write('\n') diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/groff.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/groff.py new file mode 100644 index 0000000000000000000000000000000000000000..a9e071128bd57f23092e2164f20fc672fa538f25 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/groff.py @@ -0,0 +1,170 @@ +""" + pygments.formatters.groff + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for groff output. + + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import math +from pygments.formatter import Formatter +from pygments.util import get_bool_opt, get_int_opt + +__all__ = ['GroffFormatter'] + + +class GroffFormatter(Formatter): + """ + Format tokens with groff escapes to change their color and font style. + + .. versionadded:: 2.11 + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `monospaced` + If set to true, monospace font will be used (default: ``true``). + + `linenos` + If set to true, print the line numbers (default: ``false``). + + `wrap` + Wrap lines to the specified number of characters. Disabled if set to 0 + (default: ``0``). + """ + + name = 'groff' + aliases = ['groff','troff','roff'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + + self.monospaced = get_bool_opt(options, 'monospaced', True) + self.linenos = get_bool_opt(options, 'linenos', False) + self._lineno = 0 + self.wrap = get_int_opt(options, 'wrap', 0) + self._linelen = 0 + + self.styles = {} + self._make_styles() + + + def _make_styles(self): + regular = '\\f[CR]' if self.monospaced else '\\f[R]' + bold = '\\f[CB]' if self.monospaced else '\\f[B]' + italic = '\\f[CI]' if self.monospaced else '\\f[I]' + + for ttype, ndef in self.style: + start = end = '' + if ndef['color']: + start += '\\m[{}]'.format(ndef['color']) + end = '\\m[]' + end + if ndef['bold']: + start += bold + end = regular + end + if ndef['italic']: + start += italic + end = regular + end + if ndef['bgcolor']: + start += '\\M[{}]'.format(ndef['bgcolor']) + end = '\\M[]' + end + + self.styles[ttype] = start, end + + + def _define_colors(self, outfile): + colors = set() + for _, ndef in self.style: + if ndef['color'] is not None: + colors.add(ndef['color']) + + for color in sorted(colors): + outfile.write('.defcolor ' + color + ' rgb #' + color + '\n') + + + def _write_lineno(self, outfile): + self._lineno += 1 + outfile.write("%s% 4d " % (self._lineno != 1 and '\n' or '', self._lineno)) + + + def _wrap_line(self, line): + length = len(line.rstrip('\n')) + space = ' ' if self.linenos else '' + newline = '' + + if length > self.wrap: + for i in range(0, math.floor(length / self.wrap)): + chunk = line[i*self.wrap:i*self.wrap+self.wrap] + newline += (chunk + '\n' + space) + remainder = length % self.wrap + if remainder > 0: + newline += line[-remainder-1:] + self._linelen = remainder + elif self._linelen + length > self.wrap: + newline = ('\n' + space) + line + self._linelen = length + else: + newline = line + self._linelen += length + + return newline + + + def _escape_chars(self, text): + text = text.replace('\\', '\\[u005C]'). \ + replace('.', '\\[char46]'). \ + replace('\'', '\\[u0027]'). \ + replace('`', '\\[u0060]'). \ + replace('~', '\\[u007E]') + copy = text + + for char in copy: + if len(char) != len(char.encode()): + uni = char.encode('unicode_escape') \ + .decode()[1:] \ + .replace('x', 'u00') \ + .upper() + text = text.replace(char, '\\[u' + uni[1:] + ']') + + return text + + + def format_unencoded(self, tokensource, outfile): + self._define_colors(outfile) + + outfile.write('.nf\n\\f[CR]\n') + + if self.linenos: + self._write_lineno(outfile) + + for ttype, value in tokensource: + while ttype not in self.styles: + ttype = ttype.parent + start, end = self.styles[ttype] + + for line in value.splitlines(True): + if self.wrap > 0: + line = self._wrap_line(line) + + if start and end: + text = self._escape_chars(line.rstrip('\n')) + if text != '': + outfile.write(''.join((start, text, end))) + else: + outfile.write(self._escape_chars(line.rstrip('\n'))) + + if line.endswith('\n'): + if self.linenos: + self._write_lineno(outfile) + self._linelen = 0 + else: + outfile.write('\n') + self._linelen = 0 + + outfile.write('\n.fi') diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/html.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/html.py new file mode 100644 index 0000000000000000000000000000000000000000..3330c1d5888e28d301cd06fb646a3bfe463d7a35 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pygments/formatters/html.py @@ -0,0 +1,987 @@ +""" + pygments.formatters.html + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for HTML output. + + :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import functools +import os +import sys +import os.path +from io import StringIO + +from pygments.formatter import Formatter +from pygments.token import Token, Text, STANDARD_TYPES +from pygments.util import get_bool_opt, get_int_opt, get_list_opt + +try: + import ctags +except ImportError: + ctags = None + +__all__ = ['HtmlFormatter'] + + +_escape_html_table = { + ord('&'): '&', + ord('<'): '<', + ord('>'): '>', + ord('"'): '"', + ord("'"): ''', +} + + +def escape_html(text, table=_escape_html_table): + """Escape &, <, > as well as single and double quotes for HTML.""" + return text.translate(table) + + +def webify(color): + if color.startswith('calc') or color.startswith('var'): + return color + else: + return '#' + color + + +def _get_ttype_class(ttype): + fname = STANDARD_TYPES.get(ttype) + if fname: + return fname + aname = '' + while fname is None: + aname = '-' + ttype[-1] + aname + ttype = ttype.parent + fname = STANDARD_TYPES.get(ttype) + return fname + aname + + +CSSFILE_TEMPLATE = '''\ +/* +generated by Pygments +Copyright 2006-2024 by the Pygments team. +Licensed under the BSD license, see LICENSE for details. +*/ +%(styledefs)s +''' + +DOC_HEADER = '''\ + + + + + %(title)s + + + + +

%(title)s

+ +''' + +DOC_HEADER_EXTERNALCSS = '''\ + + + + + %(title)s + + + + +

%(title)s

+ +''' + +DOC_FOOTER = '''\ + + +''' + + +class HtmlFormatter(Formatter): + r""" + Format tokens as HTML 4 ```` tags. By default, the content is enclosed + in a ``
`` tag, itself wrapped in a ``
`` tag (but see the `nowrap` option). + The ``
``'s CSS class can be set by the `cssclass` option. + + If the `linenos` option is set to ``"table"``, the ``
`` is
+    additionally wrapped inside a ```` which has one row and two
+    cells: one containing the line numbers and one containing the code.
+    Example:
+
+    .. sourcecode:: html
+
+        
+
+ + +
+
1
+            2
+
+
def foo(bar):
+              pass
+            
+
+ + (whitespace added to improve clarity). + + A list of lines can be specified using the `hl_lines` option to make these + lines highlighted (as of Pygments 0.11). + + With the `full` option, a complete HTML 4 document is output, including + the style definitions inside a `` + {% else %} + {{ head | safe }} + {% endif %} +{% if not embed %} + + +{% endif %} +{{ body | safe }} +{% for diagram in diagrams %} +
+

{{ diagram.title }}

+
{{ diagram.text }}
+
+ {{ diagram.svg }} +
+
+{% endfor %} +{% if not embed %} + + +{% endif %} +""" + +template = Template(jinja2_template_source) + +# Note: ideally this would be a dataclass, but we're supporting Python 3.5+ so we can't do this yet +NamedDiagram = NamedTuple( + "NamedDiagram", + [("name", str), ("diagram", typing.Optional[railroad.DiagramItem]), ("index", int)], +) +""" +A simple structure for associating a name with a railroad diagram +""" + +T = TypeVar("T") + + +class EachItem(railroad.Group): + """ + Custom railroad item to compose a: + - Group containing a + - OneOrMore containing a + - Choice of the elements in the Each + with the group label indicating that all must be matched + """ + + all_label = "[ALL]" + + def __init__(self, *items): + choice_item = railroad.Choice(len(items) - 1, *items) + one_or_more_item = railroad.OneOrMore(item=choice_item) + super().__init__(one_or_more_item, label=self.all_label) + + +class AnnotatedItem(railroad.Group): + """ + Simple subclass of Group that creates an annotation label + """ + + def __init__(self, label: str, item): + super().__init__(item=item, label="[{}]".format(label) if label else label) + + +class EditablePartial(Generic[T]): + """ + Acts like a functools.partial, but can be edited. In other words, it represents a type that hasn't yet been + constructed. + """ + + # We need this here because the railroad constructors actually transform the data, so can't be called until the + # entire tree is assembled + + def __init__(self, func: Callable[..., T], args: list, kwargs: dict): + self.func = func + self.args = args + self.kwargs = kwargs + + @classmethod + def from_call(cls, func: Callable[..., T], *args, **kwargs) -> "EditablePartial[T]": + """ + If you call this function in the same way that you would call the constructor, it will store the arguments + as you expect. For example EditablePartial.from_call(Fraction, 1, 3)() == Fraction(1, 3) + """ + return EditablePartial(func=func, args=list(args), kwargs=kwargs) + + @property + def name(self): + return self.kwargs["name"] + + def __call__(self) -> T: + """ + Evaluate the partial and return the result + """ + args = self.args.copy() + kwargs = self.kwargs.copy() + + # This is a helpful hack to allow you to specify varargs parameters (e.g. *args) as keyword args (e.g. + # args=['list', 'of', 'things']) + arg_spec = inspect.getfullargspec(self.func) + if arg_spec.varargs in self.kwargs: + args += kwargs.pop(arg_spec.varargs) + + return self.func(*args, **kwargs) + + +def railroad_to_html(diagrams: List[NamedDiagram], embed=False, **kwargs) -> str: + """ + Given a list of NamedDiagram, produce a single HTML string that visualises those diagrams + :params kwargs: kwargs to be passed in to the template + """ + data = [] + for diagram in diagrams: + if diagram.diagram is None: + continue + io = StringIO() + try: + css = kwargs.get('css') + diagram.diagram.writeStandalone(io.write, css=css) + except AttributeError: + diagram.diagram.writeSvg(io.write) + title = diagram.name + if diagram.index == 0: + title += " (root)" + data.append({"title": title, "text": "", "svg": io.getvalue()}) + + return template.render(diagrams=data, embed=embed, **kwargs) + + +def resolve_partial(partial: "EditablePartial[T]") -> T: + """ + Recursively resolves a collection of Partials into whatever type they are + """ + if isinstance(partial, EditablePartial): + partial.args = resolve_partial(partial.args) + partial.kwargs = resolve_partial(partial.kwargs) + return partial() + elif isinstance(partial, list): + return [resolve_partial(x) for x in partial] + elif isinstance(partial, dict): + return {key: resolve_partial(x) for key, x in partial.items()} + else: + return partial + + +def to_railroad( + element: pyparsing.ParserElement, + diagram_kwargs: typing.Optional[dict] = None, + vertical: int = 3, + show_results_names: bool = False, + show_groups: bool = False, +) -> List[NamedDiagram]: + """ + Convert a pyparsing element tree into a list of diagrams. This is the recommended entrypoint to diagram + creation if you want to access the Railroad tree before it is converted to HTML + :param element: base element of the parser being diagrammed + :param diagram_kwargs: kwargs to pass to the Diagram() constructor + :param vertical: (optional) - int - limit at which number of alternatives should be + shown vertically instead of horizontally + :param show_results_names - bool to indicate whether results name annotations should be + included in the diagram + :param show_groups - bool to indicate whether groups should be highlighted with an unlabeled + surrounding box + """ + # Convert the whole tree underneath the root + lookup = ConverterState(diagram_kwargs=diagram_kwargs or {}) + _to_diagram_element( + element, + lookup=lookup, + parent=None, + vertical=vertical, + show_results_names=show_results_names, + show_groups=show_groups, + ) + + root_id = id(element) + # Convert the root if it hasn't been already + if root_id in lookup: + if not element.customName: + lookup[root_id].name = "" + lookup[root_id].mark_for_extraction(root_id, lookup, force=True) + + # Now that we're finished, we can convert from intermediate structures into Railroad elements + diags = list(lookup.diagrams.values()) + if len(diags) > 1: + # collapse out duplicate diags with the same name + seen = set() + deduped_diags = [] + for d in diags: + # don't extract SkipTo elements, they are uninformative as subdiagrams + if d.name == "...": + continue + if d.name is not None and d.name not in seen: + seen.add(d.name) + deduped_diags.append(d) + resolved = [resolve_partial(partial) for partial in deduped_diags] + else: + # special case - if just one diagram, always display it, even if + # it has no name + resolved = [resolve_partial(partial) for partial in diags] + return sorted(resolved, key=lambda diag: diag.index) + + +def _should_vertical( + specification: int, exprs: Iterable[pyparsing.ParserElement] +) -> bool: + """ + Returns true if we should return a vertical list of elements + """ + if specification is None: + return False + else: + return len(_visible_exprs(exprs)) >= specification + + +class ElementState: + """ + State recorded for an individual pyparsing Element + """ + + # Note: this should be a dataclass, but we have to support Python 3.5 + def __init__( + self, + element: pyparsing.ParserElement, + converted: EditablePartial, + parent: EditablePartial, + number: int, + name: str = None, + parent_index: typing.Optional[int] = None, + ): + #: The pyparsing element that this represents + self.element: pyparsing.ParserElement = element + #: The name of the element + self.name: typing.Optional[str] = name + #: The output Railroad element in an unconverted state + self.converted: EditablePartial = converted + #: The parent Railroad element, which we store so that we can extract this if it's duplicated + self.parent: EditablePartial = parent + #: The order in which we found this element, used for sorting diagrams if this is extracted into a diagram + self.number: int = number + #: The index of this inside its parent + self.parent_index: typing.Optional[int] = parent_index + #: If true, we should extract this out into a subdiagram + self.extract: bool = False + #: If true, all of this element's children have been filled out + self.complete: bool = False + + def mark_for_extraction( + self, el_id: int, state: "ConverterState", name: str = None, force: bool = False + ): + """ + Called when this instance has been seen twice, and thus should eventually be extracted into a sub-diagram + :param el_id: id of the element + :param state: element/diagram state tracker + :param name: name to use for this element's text + :param force: If true, force extraction now, regardless of the state of this. Only useful for extracting the + root element when we know we're finished + """ + self.extract = True + + # Set the name + if not self.name: + if name: + # Allow forcing a custom name + self.name = name + elif self.element.customName: + self.name = self.element.customName + else: + self.name = "" + + # Just because this is marked for extraction doesn't mean we can do it yet. We may have to wait for children + # to be added + # Also, if this is just a string literal etc, don't bother extracting it + if force or (self.complete and _worth_extracting(self.element)): + state.extract_into_diagram(el_id) + + +class ConverterState: + """ + Stores some state that persists between recursions into the element tree + """ + + def __init__(self, diagram_kwargs: typing.Optional[dict] = None): + #: A dictionary mapping ParserElements to state relating to them + self._element_diagram_states: Dict[int, ElementState] = {} + #: A dictionary mapping ParserElement IDs to subdiagrams generated from them + self.diagrams: Dict[int, EditablePartial[NamedDiagram]] = {} + #: The index of the next unnamed element + self.unnamed_index: int = 1 + #: The index of the next element. This is used for sorting + self.index: int = 0 + #: Shared kwargs that are used to customize the construction of diagrams + self.diagram_kwargs: dict = diagram_kwargs or {} + self.extracted_diagram_names: Set[str] = set() + + def __setitem__(self, key: int, value: ElementState): + self._element_diagram_states[key] = value + + def __getitem__(self, key: int) -> ElementState: + return self._element_diagram_states[key] + + def __delitem__(self, key: int): + del self._element_diagram_states[key] + + def __contains__(self, key: int): + return key in self._element_diagram_states + + def generate_unnamed(self) -> int: + """ + Generate a number used in the name of an otherwise unnamed diagram + """ + self.unnamed_index += 1 + return self.unnamed_index + + def generate_index(self) -> int: + """ + Generate a number used to index a diagram + """ + self.index += 1 + return self.index + + def extract_into_diagram(self, el_id: int): + """ + Used when we encounter the same token twice in the same tree. When this + happens, we replace all instances of that token with a terminal, and + create a new subdiagram for the token + """ + position = self[el_id] + + # Replace the original definition of this element with a regular block + if position.parent: + ret = EditablePartial.from_call(railroad.NonTerminal, text=position.name) + if "item" in position.parent.kwargs: + position.parent.kwargs["item"] = ret + elif "items" in position.parent.kwargs: + position.parent.kwargs["items"][position.parent_index] = ret + + # If the element we're extracting is a group, skip to its content but keep the title + if position.converted.func == railroad.Group: + content = position.converted.kwargs["item"] + else: + content = position.converted + + self.diagrams[el_id] = EditablePartial.from_call( + NamedDiagram, + name=position.name, + diagram=EditablePartial.from_call( + railroad.Diagram, content, **self.diagram_kwargs + ), + index=position.number, + ) + + del self[el_id] + + +def _worth_extracting(element: pyparsing.ParserElement) -> bool: + """ + Returns true if this element is worth having its own sub-diagram. Simply, if any of its children + themselves have children, then its complex enough to extract + """ + children = element.recurse() + return any(child.recurse() for child in children) + + +def _apply_diagram_item_enhancements(fn): + """ + decorator to ensure enhancements to a diagram item (such as results name annotations) + get applied on return from _to_diagram_element (we do this since there are several + returns in _to_diagram_element) + """ + + def _inner( + element: pyparsing.ParserElement, + parent: typing.Optional[EditablePartial], + lookup: ConverterState = None, + vertical: int = None, + index: int = 0, + name_hint: str = None, + show_results_names: bool = False, + show_groups: bool = False, + ) -> typing.Optional[EditablePartial]: + ret = fn( + element, + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + ) + + # apply annotation for results name, if present + if show_results_names and ret is not None: + element_results_name = element.resultsName + if element_results_name: + # add "*" to indicate if this is a "list all results" name + element_results_name += "" if element.modalResults else "*" + ret = EditablePartial.from_call( + railroad.Group, item=ret, label=element_results_name + ) + + return ret + + return _inner + + +def _visible_exprs(exprs: Iterable[pyparsing.ParserElement]): + non_diagramming_exprs = ( + pyparsing.ParseElementEnhance, + pyparsing.PositionToken, + pyparsing.And._ErrorStop, + ) + return [ + e + for e in exprs + if not (e.customName or e.resultsName or isinstance(e, non_diagramming_exprs)) + ] + + +@_apply_diagram_item_enhancements +def _to_diagram_element( + element: pyparsing.ParserElement, + parent: typing.Optional[EditablePartial], + lookup: ConverterState = None, + vertical: int = None, + index: int = 0, + name_hint: str = None, + show_results_names: bool = False, + show_groups: bool = False, +) -> typing.Optional[EditablePartial]: + """ + Recursively converts a PyParsing Element to a railroad Element + :param lookup: The shared converter state that keeps track of useful things + :param index: The index of this element within the parent + :param parent: The parent of this element in the output tree + :param vertical: Controls at what point we make a list of elements vertical. If this is an integer (the default), + it sets the threshold of the number of items before we go vertical. If True, always go vertical, if False, never + do so + :param name_hint: If provided, this will override the generated name + :param show_results_names: bool flag indicating whether to add annotations for results names + :returns: The converted version of the input element, but as a Partial that hasn't yet been constructed + :param show_groups: bool flag indicating whether to show groups using bounding box + """ + exprs = element.recurse() + name = name_hint or element.customName or type(element).__name__ + + # Python's id() is used to provide a unique identifier for elements + el_id = id(element) + + element_results_name = element.resultsName + + # Here we basically bypass processing certain wrapper elements if they contribute nothing to the diagram + if not element.customName: + if isinstance( + element, + ( + # pyparsing.TokenConverter, + # pyparsing.Forward, + pyparsing.Located, + ), + ): + # However, if this element has a useful custom name, and its child does not, we can pass it on to the child + if exprs: + if not exprs[0].customName: + propagated_name = name + else: + propagated_name = None + + return _to_diagram_element( + element.expr, + parent=parent, + lookup=lookup, + vertical=vertical, + index=index, + name_hint=propagated_name, + show_results_names=show_results_names, + show_groups=show_groups, + ) + + # If the element isn't worth extracting, we always treat it as the first time we say it + if _worth_extracting(element): + if el_id in lookup: + # If we've seen this element exactly once before, we are only just now finding out that it's a duplicate, + # so we have to extract it into a new diagram. + looked_up = lookup[el_id] + looked_up.mark_for_extraction(el_id, lookup, name=name_hint) + ret = EditablePartial.from_call(railroad.NonTerminal, text=looked_up.name) + return ret + + elif el_id in lookup.diagrams: + # If we have seen the element at least twice before, and have already extracted it into a subdiagram, we + # just put in a marker element that refers to the sub-diagram + ret = EditablePartial.from_call( + railroad.NonTerminal, text=lookup.diagrams[el_id].kwargs["name"] + ) + return ret + + # Recursively convert child elements + # Here we find the most relevant Railroad element for matching pyparsing Element + # We use ``items=[]`` here to hold the place for where the child elements will go once created + if isinstance(element, pyparsing.And): + # detect And's created with ``expr*N`` notation - for these use a OneOrMore with a repeat + # (all will have the same name, and resultsName) + if not exprs: + return None + if len(set((e.name, e.resultsName) for e in exprs)) == 1: + ret = EditablePartial.from_call( + railroad.OneOrMore, item="", repeat=str(len(exprs)) + ) + elif _should_vertical(vertical, exprs): + ret = EditablePartial.from_call(railroad.Stack, items=[]) + else: + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + elif isinstance(element, (pyparsing.Or, pyparsing.MatchFirst)): + if not exprs: + return None + if _should_vertical(vertical, exprs): + ret = EditablePartial.from_call(railroad.Choice, 0, items=[]) + else: + ret = EditablePartial.from_call(railroad.HorizontalChoice, items=[]) + elif isinstance(element, pyparsing.Each): + if not exprs: + return None + ret = EditablePartial.from_call(EachItem, items=[]) + elif isinstance(element, pyparsing.NotAny): + ret = EditablePartial.from_call(AnnotatedItem, label="NOT", item="") + elif isinstance(element, pyparsing.FollowedBy): + ret = EditablePartial.from_call(AnnotatedItem, label="LOOKAHEAD", item="") + elif isinstance(element, pyparsing.PrecededBy): + ret = EditablePartial.from_call(AnnotatedItem, label="LOOKBEHIND", item="") + elif isinstance(element, pyparsing.Group): + if show_groups: + ret = EditablePartial.from_call(AnnotatedItem, label="", item="") + else: + ret = EditablePartial.from_call(railroad.Group, label="", item="") + elif isinstance(element, pyparsing.TokenConverter): + label = type(element).__name__.lower() + if label == "tokenconverter": + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + else: + ret = EditablePartial.from_call(AnnotatedItem, label=label, item="") + elif isinstance(element, pyparsing.Opt): + ret = EditablePartial.from_call(railroad.Optional, item="") + elif isinstance(element, pyparsing.OneOrMore): + ret = EditablePartial.from_call(railroad.OneOrMore, item="") + elif isinstance(element, pyparsing.ZeroOrMore): + ret = EditablePartial.from_call(railroad.ZeroOrMore, item="") + elif isinstance(element, pyparsing.Group): + ret = EditablePartial.from_call( + railroad.Group, item=None, label=element_results_name + ) + elif isinstance(element, pyparsing.Empty) and not element.customName: + # Skip unnamed "Empty" elements + ret = None + elif isinstance(element, pyparsing.ParseElementEnhance): + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + elif len(exprs) > 0 and not element_results_name: + ret = EditablePartial.from_call(railroad.Group, item="", label=name) + elif len(exprs) > 0: + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + else: + terminal = EditablePartial.from_call(railroad.Terminal, element.defaultName) + ret = terminal + + if ret is None: + return + + # Indicate this element's position in the tree so we can extract it if necessary + lookup[el_id] = ElementState( + element=element, + converted=ret, + parent=parent, + parent_index=index, + number=lookup.generate_index(), + ) + if element.customName: + lookup[el_id].mark_for_extraction(el_id, lookup, element.customName) + + i = 0 + for expr in exprs: + # Add a placeholder index in case we have to extract the child before we even add it to the parent + if "items" in ret.kwargs: + ret.kwargs["items"].insert(i, None) + + item = _to_diagram_element( + expr, + parent=ret, + lookup=lookup, + vertical=vertical, + index=i, + show_results_names=show_results_names, + show_groups=show_groups, + ) + + # Some elements don't need to be shown in the diagram + if item is not None: + if "item" in ret.kwargs: + ret.kwargs["item"] = item + elif "items" in ret.kwargs: + # If we've already extracted the child, don't touch this index, since it's occupied by a nonterminal + ret.kwargs["items"][i] = item + i += 1 + elif "items" in ret.kwargs: + # If we're supposed to skip this element, remove it from the parent + del ret.kwargs["items"][i] + + # If all this items children are none, skip this item + if ret and ( + ("items" in ret.kwargs and len(ret.kwargs["items"]) == 0) + or ("item" in ret.kwargs and ret.kwargs["item"] is None) + ): + ret = EditablePartial.from_call(railroad.Terminal, name) + + # Mark this element as "complete", ie it has all of its children + if el_id in lookup: + lookup[el_id].complete = True + + if el_id in lookup and lookup[el_id].extract and lookup[el_id].complete: + lookup.extract_into_diagram(el_id) + if ret is not None: + ret = EditablePartial.from_call( + railroad.NonTerminal, text=lookup.diagrams[el_id].kwargs["name"] + ) + + return ret diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py new file mode 100644 index 0000000000000000000000000000000000000000..da771da115cee9e0819df92002562149581a6e2c --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py @@ -0,0 +1,258 @@ +# basictimerapp - a really simple timer application. +# This should be run using the command line: +# pythonwin /app demos\basictimerapp.py +import sys +import time + +import timer +import win32api +import win32con +import win32ui +from pywin.framework import app, cmdline, dlgappcore + + +class TimerAppDialog(dlgappcore.AppDialog): + softspace = 1 + + def __init__(self, appName=""): + dlgappcore.AppDialog.__init__(self, win32ui.IDD_GENERAL_STATUS) + self.timerAppName = appName + self.argOff = 0 + if len(self.timerAppName) == 0: + if len(sys.argv) > 1 and sys.argv[1][0] != "/": + self.timerAppName = sys.argv[1] + self.argOff = 1 + + def PreDoModal(self): + # sys.stderr = sys.stdout + pass + + def ProcessArgs(self, args): + for arg in args: + if arg == "/now": + self.OnOK() + + def OnInitDialog(self): + win32ui.SetProfileFileName("pytimer.ini") + self.title = win32ui.GetProfileVal( + self.timerAppName, "Title", "Remote System Timer" + ) + self.buildTimer = win32ui.GetProfileVal( + self.timerAppName, "Timer", "EachMinuteIntervaler()" + ) + self.doWork = win32ui.GetProfileVal(self.timerAppName, "Work", "DoDemoWork()") + # replace "\n" with real \n. + self.doWork = self.doWork.replace("\\n", "\n") + dlgappcore.AppDialog.OnInitDialog(self) + + self.SetWindowText(self.title) + self.prompt1 = self.GetDlgItem(win32ui.IDC_PROMPT1) + self.prompt2 = self.GetDlgItem(win32ui.IDC_PROMPT2) + self.prompt3 = self.GetDlgItem(win32ui.IDC_PROMPT3) + self.butOK = self.GetDlgItem(win32con.IDOK) + self.butCancel = self.GetDlgItem(win32con.IDCANCEL) + self.prompt1.SetWindowText("Python Timer App") + self.prompt2.SetWindowText("") + self.prompt3.SetWindowText("") + self.butOK.SetWindowText("Do it now") + self.butCancel.SetWindowText("Close") + + self.timerManager = TimerManager(self) + self.ProcessArgs(sys.argv[self.argOff :]) + self.timerManager.go() + return 1 + + def OnDestroy(self, msg): + dlgappcore.AppDialog.OnDestroy(self, msg) + self.timerManager.stop() + + def OnOK(self): + # stop the timer, then restart after setting special boolean + self.timerManager.stop() + self.timerManager.bConnectNow = 1 + self.timerManager.go() + return + + +# def OnCancel(self): default behaviour - cancel == close. +# return + + +class TimerManager: + def __init__(self, dlg): + self.dlg = dlg + self.timerId = None + self.intervaler = eval(self.dlg.buildTimer) + self.bConnectNow = 0 + self.bHaveSetPrompt1 = 0 + + def CaptureOutput(self): + self.oldOut = sys.stdout + self.oldErr = sys.stderr + sys.stdout = sys.stderr = self + self.bHaveSetPrompt1 = 0 + + def ReleaseOutput(self): + sys.stdout = self.oldOut + sys.stderr = self.oldErr + + def write(self, str): + s = str.strip() + if len(s): + if self.bHaveSetPrompt1: + dest = self.dlg.prompt3 + else: + dest = self.dlg.prompt1 + self.bHaveSetPrompt1 = 1 + dest.SetWindowText(s) + + def go(self): + self.OnTimer(None, None) + + def stop(self): + if self.timerId: + timer.kill_timer(self.timerId) + self.timerId = None + + def OnTimer(self, id, timeVal): + if id: + timer.kill_timer(id) + if self.intervaler.IsTime() or self.bConnectNow: + # do the work. + try: + self.dlg.SetWindowText(self.dlg.title + " - Working...") + self.dlg.butOK.EnableWindow(0) + self.dlg.butCancel.EnableWindow(0) + self.CaptureOutput() + try: + exec(self.dlg.doWork) + print("The last operation completed successfully.") + except: + t, v, tb = sys.exc_info() + str = "Failed: %s: %s" % (t, repr(v)) + print(str) + self.oldErr.write(str) + tb = None # Prevent cycle + finally: + self.ReleaseOutput() + self.dlg.butOK.EnableWindow() + self.dlg.butCancel.EnableWindow() + self.dlg.SetWindowText(self.dlg.title) + else: + now = time.time() + nextTime = self.intervaler.GetNextTime() + if nextTime: + timeDiffSeconds = nextTime - now + timeDiffMinutes = int(timeDiffSeconds / 60) + timeDiffSeconds = timeDiffSeconds % 60 + timeDiffHours = int(timeDiffMinutes / 60) + timeDiffMinutes = timeDiffMinutes % 60 + self.dlg.prompt1.SetWindowText( + "Next connection due in %02d:%02d:%02d" + % (timeDiffHours, timeDiffMinutes, timeDiffSeconds) + ) + self.timerId = timer.set_timer( + self.intervaler.GetWakeupInterval(), self.OnTimer + ) + self.bConnectNow = 0 + + +class TimerIntervaler: + def __init__(self): + self.nextTime = None + self.wakeUpInterval = 2000 + + def GetWakeupInterval(self): + return self.wakeUpInterval + + def GetNextTime(self): + return self.nextTime + + def IsTime(self): + now = time.time() + if self.nextTime is None: + self.nextTime = self.SetFirstTime(now) + ret = 0 + if now >= self.nextTime: + ret = 1 + self.nextTime = self.SetNextTime(self.nextTime, now) + # do the work. + return ret + + +class EachAnyIntervaler(TimerIntervaler): + def __init__(self, timeAt, timePos, timeAdd, wakeUpInterval=None): + TimerIntervaler.__init__(self) + self.timeAt = timeAt + self.timePos = timePos + self.timeAdd = timeAdd + if wakeUpInterval: + self.wakeUpInterval = wakeUpInterval + + def SetFirstTime(self, now): + timeTup = time.localtime(now) + lst = [] + for item in timeTup: + lst.append(item) + bAdd = timeTup[self.timePos] > self.timeAt + lst[self.timePos] = self.timeAt + for pos in range(self.timePos + 1, 6): + lst[pos] = 0 + ret = time.mktime(tuple(lst)) + if bAdd: + ret = ret + self.timeAdd + return ret + + def SetNextTime(self, lastTime, now): + return lastTime + self.timeAdd + + +class EachMinuteIntervaler(EachAnyIntervaler): + def __init__(self, at=0): + EachAnyIntervaler.__init__(self, at, 5, 60, 2000) + + +class EachHourIntervaler(EachAnyIntervaler): + def __init__(self, at=0): + EachAnyIntervaler.__init__(self, at, 4, 3600, 10000) + + +class EachDayIntervaler(EachAnyIntervaler): + def __init__(self, at=0): + EachAnyIntervaler.__init__(self, at, 3, 86400, 10000) + + +class TimerDialogApp(dlgappcore.DialogApp): + def CreateDialog(self): + return TimerAppDialog() + + +def DoDemoWork(): + print("Doing the work...") + print("About to connect") + win32api.MessageBeep(win32con.MB_ICONASTERISK) + win32api.Sleep(2000) + print("Doing something else...") + win32api.MessageBeep(win32con.MB_ICONEXCLAMATION) + win32api.Sleep(2000) + print("More work.") + win32api.MessageBeep(win32con.MB_ICONHAND) + win32api.Sleep(2000) + print("The last bit.") + win32api.MessageBeep(win32con.MB_OK) + win32api.Sleep(2000) + + +app = TimerDialogApp() + + +def t(): + t = TimerAppDialog("Test Dialog") + t.DoModal() + return t + + +if __name__ == "__main__": + import demoutils + + demoutils.NeedApp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py new file mode 100644 index 0000000000000000000000000000000000000000..356073e5fb73c2a125caf2c1634c05a412adb4e1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py @@ -0,0 +1,186 @@ +# A demo of an Application object that has some custom print functionality. + +# If you desire, you can also run this from inside Pythonwin, in which +# case it will do the demo inside the Pythonwin environment. + +# This sample was contributed by Roger Burnham. + +import win32api +import win32con +import win32ui +from pywin.framework import app +from pywin.mfc import afxres, dialog, docview + +PRINTDLGORD = 1538 +IDC_PRINT_MAG_EDIT = 1010 + + +class PrintDemoTemplate(docview.DocTemplate): + def _SetupSharedMenu_(self): + pass + + +class PrintDemoView(docview.ScrollView): + def OnInitialUpdate(self): + ret = self._obj_.OnInitialUpdate() + self.colors = { + "Black": (0x00 << 0) + (0x00 << 8) + (0x00 << 16), + "Red": (0xFF << 0) + (0x00 << 8) + (0x00 << 16), + "Green": (0x00 << 0) + (0xFF << 8) + (0x00 << 16), + "Blue": (0x00 << 0) + (0x00 << 8) + (0xFF << 16), + "Cyan": (0x00 << 0) + (0xFF << 8) + (0xFF << 16), + "Magenta": (0xFF << 0) + (0x00 << 8) + (0xFF << 16), + "Yellow": (0xFF << 0) + (0xFF << 8) + (0x00 << 16), + } + self.pens = {} + for name, color in self.colors.items(): + self.pens[name] = win32ui.CreatePen(win32con.PS_SOLID, 5, color) + self.pen = None + self.size = (128, 128) + self.SetScaleToFitSize(self.size) + self.HookCommand(self.OnFilePrint, afxres.ID_FILE_PRINT) + self.HookCommand(self.OnFilePrintPreview, win32ui.ID_FILE_PRINT_PREVIEW) + return ret + + def OnDraw(self, dc): + oldPen = None + x, y = self.size + delta = 2 + colors = list(self.colors.keys()) + colors.sort() + colors = colors * 2 + for color in colors: + if oldPen is None: + oldPen = dc.SelectObject(self.pens[color]) + else: + dc.SelectObject(self.pens[color]) + dc.MoveTo((delta, delta)) + dc.LineTo((x - delta, delta)) + dc.LineTo((x - delta, y - delta)) + dc.LineTo((delta, y - delta)) + dc.LineTo((delta, delta)) + delta = delta + 4 + if x - delta <= 0 or y - delta <= 0: + break + dc.SelectObject(oldPen) + + def OnPrepareDC(self, dc, pInfo): + if dc.IsPrinting(): + mag = self.prtDlg["mag"] + dc.SetMapMode(win32con.MM_ANISOTROPIC) + dc.SetWindowOrg((0, 0)) + dc.SetWindowExt((1, 1)) + dc.SetViewportOrg((0, 0)) + dc.SetViewportExt((mag, mag)) + + def OnPreparePrinting(self, pInfo): + flags = ( + win32ui.PD_USEDEVMODECOPIES + | win32ui.PD_PAGENUMS + | win32ui.PD_NOPAGENUMS + | win32ui.PD_NOSELECTION + ) + self.prtDlg = ImagePrintDialog(pInfo, PRINTDLGORD, flags) + pInfo.SetPrintDialog(self.prtDlg) + pInfo.SetMinPage(1) + pInfo.SetMaxPage(1) + pInfo.SetFromPage(1) + pInfo.SetToPage(1) + ret = self.DoPreparePrinting(pInfo) + return ret + + def OnBeginPrinting(self, dc, pInfo): + return self._obj_.OnBeginPrinting(dc, pInfo) + + def OnEndPrinting(self, dc, pInfo): + del self.prtDlg + return self._obj_.OnEndPrinting(dc, pInfo) + + def OnFilePrintPreview(self, *arg): + self._obj_.OnFilePrintPreview() + + def OnFilePrint(self, *arg): + self._obj_.OnFilePrint() + + def OnPrint(self, dc, pInfo): + doc = self.GetDocument() + metrics = dc.GetTextMetrics() + cxChar = metrics["tmAveCharWidth"] + cyChar = metrics["tmHeight"] + left, top, right, bottom = pInfo.GetDraw() + dc.TextOut(0, 2 * cyChar, doc.GetTitle()) + top = top + (7 * cyChar) / 2 + dc.MoveTo(left, top) + dc.LineTo(right, top) + top = top + cyChar + # this seems to have not effect... + # get what I want with the dc.SetWindowOrg calls + pInfo.SetDraw((left, top, right, bottom)) + dc.SetWindowOrg((0, -top)) + + self.OnDraw(dc) + dc.SetTextAlign(win32con.TA_LEFT | win32con.TA_BOTTOM) + + rect = self.GetWindowRect() + rect = self.ScreenToClient(rect) + height = rect[3] - rect[1] + dc.SetWindowOrg((0, -(top + height + cyChar))) + dc.MoveTo(left, 0) + dc.LineTo(right, 0) + + x = 0 + y = (3 * cyChar) / 2 + + dc.TextOut(x, y, doc.GetTitle()) + y = y + cyChar + + +class PrintDemoApp(app.CApp): + def __init__(self): + app.CApp.__init__(self) + + def InitInstance(self): + template = PrintDemoTemplate(None, None, None, PrintDemoView) + self.AddDocTemplate(template) + self._obj_.InitMDIInstance() + self.LoadMainFrame() + doc = template.OpenDocumentFile(None) + doc.SetTitle("Custom Print Document") + + +class ImagePrintDialog(dialog.PrintDialog): + sectionPos = "Image Print Demo" + + def __init__(self, pInfo, dlgID, flags=win32ui.PD_USEDEVMODECOPIES): + dialog.PrintDialog.__init__(self, pInfo, dlgID, flags=flags) + mag = win32ui.GetProfileVal(self.sectionPos, "Document Magnification", 0) + if mag <= 0: + mag = 2 + win32ui.WriteProfileVal(self.sectionPos, "Document Magnification", mag) + + self["mag"] = mag + + def OnInitDialog(self): + self.magCtl = self.GetDlgItem(IDC_PRINT_MAG_EDIT) + self.magCtl.SetWindowText(repr(self["mag"])) + return dialog.PrintDialog.OnInitDialog(self) + + def OnOK(self): + dialog.PrintDialog.OnOK(self) + strMag = self.magCtl.GetWindowText() + try: + self["mag"] = int(strMag) + except: + pass + win32ui.WriteProfileVal(self.sectionPos, "Document Magnification", self["mag"]) + + +if __name__ == "__main__": + # Running under Pythonwin + def test(): + template = PrintDemoTemplate(None, None, None, PrintDemoView) + template.OpenDocumentFile(None) + + test() +else: + app = PrintDemoApp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py new file mode 100644 index 0000000000000000000000000000000000000000..ee1fefcfad0f0d77f60056a38b0a7e69397ec58c --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py @@ -0,0 +1,65 @@ +# Utilities for the demos + +import sys + +import win32api +import win32con +import win32ui + +NotScriptMsg = """\ +This demo program is not designed to be run as a Script, but is +probably used by some other test program. Please try another demo. +""" + +NeedGUIMsg = """\ +This demo program can only be run from inside of Pythonwin + +You must start Pythonwin, and select 'Run' from the toolbar or File menu +""" + + +NeedAppMsg = """\ +This demo program is a 'Pythonwin Application'. + +It is more demo code than an example of Pythonwin's capabilities. + +To run it, you must execute the command: +pythonwin.exe /app "%s" + +Would you like to execute it now? +""" + + +def NotAScript(): + import win32ui + + win32ui.MessageBox(NotScriptMsg, "Demos") + + +def NeedGoodGUI(): + from pywin.framework.app import HaveGoodGUI + + rc = HaveGoodGUI() + if not rc: + win32ui.MessageBox(NeedGUIMsg, "Demos") + return rc + + +def NeedApp(): + import win32ui + + rc = win32ui.MessageBox(NeedAppMsg % sys.argv[0], "Demos", win32con.MB_YESNO) + if rc == win32con.IDYES: + try: + parent = win32ui.GetMainFrame().GetSafeHwnd() + win32api.ShellExecute( + parent, None, "pythonwin.exe", '/app "%s"' % sys.argv[0], None, 1 + ) + except win32api.error as details: + win32ui.MessageBox("Error executing command - %s" % (details), "Demos") + + +if __name__ == "__main__": + import demoutils + + demoutils.NotAScript() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/dlgappdemo.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/dlgappdemo.py new file mode 100644 index 0000000000000000000000000000000000000000..38659a62fc1840ec69e459caa0475a91f51fd69f --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/dlgappdemo.py @@ -0,0 +1,51 @@ +# dlgappdemo - a demo of a dialog application. +# This is a demonstration of both a custom "application" module, +# and a Python program in a dialog box. +# +# NOTE: You CAN NOT import this module from either PythonWin or Python. +# This module must be specified on the commandline to PythonWin only. +# eg, PythonWin /app dlgappdemo.py + +import sys + +import win32ui +from pywin.framework import app, dlgappcore + + +class TestDialogApp(dlgappcore.DialogApp): + def CreateDialog(self): + return TestAppDialog() + + +class TestAppDialog(dlgappcore.AppDialog): + def __init__(self): + self.edit = None + dlgappcore.AppDialog.__init__(self, win32ui.IDD_LARGE_EDIT) + + def OnInitDialog(self): + self.SetWindowText("Test dialog application") + self.edit = self.GetDlgItem(win32ui.IDC_EDIT1) + print("Hello from Python") + print("args are:", end=" ") + for arg in sys.argv: + print(arg) + return 1 + + def PreDoModal(self): + sys.stdout = sys.stderr = self + + def write(self, str): + if self.edit: + self.edit.SetSel(-2) + # translate \n to \n\r + self.edit.ReplaceSel(str.replace("\n", "\r\n")) + else: + win32ui.OutputDebug("dlgapp - no edit control! >>\n%s\n<<\n" % str) + + +app.AppBuilder = TestDialogApp + +if __name__ == "__main__": + import demoutils + + demoutils.NeedApp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/dojobapp.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/dojobapp.py new file mode 100644 index 0000000000000000000000000000000000000000..d97ce5e2a8fca72ebc3ff825f1c20f97693220f2 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/dojobapp.py @@ -0,0 +1,72 @@ +# dojobapp - do a job, show the result in a dialog, and exit. +# +# Very simple - faily minimal dialog based app. +# +# This should be run using the command line: +# pythonwin /app demos\dojobapp.py + + +import win32api +import win32con +import win32ui +from pywin.framework import app, dlgappcore + + +class DoJobAppDialog(dlgappcore.AppDialog): + softspace = 1 + + def __init__(self, appName=""): + self.appName = appName + dlgappcore.AppDialog.__init__(self, win32ui.IDD_GENERAL_STATUS) + + def PreDoModal(self): + pass + + def ProcessArgs(self, args): + pass + + def OnInitDialog(self): + self.SetWindowText(self.appName) + butCancel = self.GetDlgItem(win32con.IDCANCEL) + butCancel.ShowWindow(win32con.SW_HIDE) + p1 = self.GetDlgItem(win32ui.IDC_PROMPT1) + p2 = self.GetDlgItem(win32ui.IDC_PROMPT2) + + # Do something here! + + p1.SetWindowText("Hello there") + p2.SetWindowText("from the demo") + + def OnDestroy(self, msg): + pass + + +# def OnOK(self): +# pass +# def OnCancel(self): default behaviour - cancel == close. +# return + + +class DoJobDialogApp(dlgappcore.DialogApp): + def CreateDialog(self): + return DoJobAppDialog("Do Something") + + +class CopyToDialogApp(DoJobDialogApp): + def __init__(self): + DoJobDialogApp.__init__(self) + + +app.AppBuilder = DoJobDialogApp + + +def t(): + t = DoJobAppDialog("Copy To") + t.DoModal() + return t + + +if __name__ == "__main__": + import demoutils + + demoutils.NeedApp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/helloapp.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/helloapp.py new file mode 100644 index 0000000000000000000000000000000000000000..876f16f71d3ea22f23112c9a37f4ebde19c80a1d --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/app/helloapp.py @@ -0,0 +1,53 @@ +## +## helloapp.py +## +## +## A nice, small 'hello world' Pythonwin application. +## NOT an MDI application - just a single, normal, top-level window. +## +## MUST be run with the command line "pythonwin.exe /app helloapp.py" +## (or if you are really keen, rename "pythonwin.exe" to something else, then +## using MSVC or similar, edit the string section in the .EXE to name this file) +## +## Originally by Willy Heineman + + +import win32con +import win32ui +from pywin.mfc import afxres, dialog, window +from pywin.mfc.thread import WinApp + + +# The main frame. +# Does almost nothing at all - doesnt even create a child window! +class HelloWindow(window.Wnd): + def __init__(self): + # The window.Wnd ctor creates a Window object, and places it in + # self._obj_. Note the window object exists, but the window itself + # does not! + window.Wnd.__init__(self, win32ui.CreateWnd()) + + # Now we ask the window object to create the window itself. + self._obj_.CreateWindowEx( + win32con.WS_EX_CLIENTEDGE, + win32ui.RegisterWndClass(0, 0, win32con.COLOR_WINDOW + 1), + "Hello World!", + win32con.WS_OVERLAPPEDWINDOW, + (100, 100, 400, 300), + None, + 0, + None, + ) + + +# The application object itself. +class HelloApp(WinApp): + def InitInstance(self): + self.frame = HelloWindow() + self.frame.ShowWindow(win32con.SW_SHOWNORMAL) + # We need to tell MFC what our main frame is. + self.SetMainFrame(self.frame) + + +# Now create the application object itself! +app = HelloApp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py new file mode 100644 index 0000000000000000000000000000000000000000..7b1c257a386ab48218614ebfd4ed11a6bee6114d --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py @@ -0,0 +1,116 @@ +# cmdserver.py + +# Demo code that is not Pythonwin related, but too good to throw away... + +import _thread +import sys +import traceback + +import win32api +from pywin.framework import winout + + +class ThreadWriter: + "Assign an instance to sys.stdout for per-thread printing objects - Courtesy Guido!" + + def __init__(self): + "Constructor -- initialize the table of writers" + self.writers = {} + self.origStdOut = None + + def register(self, writer): + "Register the writer for the current thread" + self.writers[_thread.get_ident()] = writer + if self.origStdOut is None: + self.origStdOut = sys.stdout + sys.stdout = self + + def unregister(self): + "Remove the writer for the current thread, if any" + try: + del self.writers[_thread.get_ident()] + except KeyError: + pass + if len(self.writers) == 0: + sys.stdout = self.origStdOut + self.origStdOut = None + + def getwriter(self): + "Return the current thread's writer, default sys.stdout" + try: + return self.writers[_thread.get_ident()] + except KeyError: + return self.origStdOut + + def write(self, str): + "Write to the current thread's writer, default sys.stdout" + self.getwriter().write(str) + + +def Test(): + num = 1 + while num < 1000: + print("Hello there no " + str(num)) + win32api.Sleep(50) + num = num + 1 + + +class flags: + SERVER_BEST = 0 + SERVER_IMMEDIATE = 1 + SERVER_THREAD = 2 + SERVER_PROCESS = 3 + + +def StartServer(cmd, title=None, bCloseOnEnd=0, serverFlags=flags.SERVER_BEST): + out = winout.WindowOutput(title, None, winout.flags.WQ_IDLE) + if not title: + title = cmd + out.Create(title) + # ServerThread((out, cmd, title, bCloseOnEnd)) + # out = sys.stdout + _thread.start_new_thread(ServerThread, (out, cmd, title, bCloseOnEnd)) + + +def ServerThread(myout, cmd, title, bCloseOnEnd): + try: + writer.register(myout) + print('Executing "%s"\n' % cmd) + bOK = 1 + try: + import __main__ + + exec(cmd + "\n", __main__.__dict__) + except: + bOK = 0 + if bOK: + print("Command terminated without errors.") + else: + t, v, tb = sys.exc_info() + print(t, ": ", v) + traceback.print_tb(tb) + tb = None # prevent a cycle + print("Command terminated with an unhandled exception") + writer.unregister() + if bOK and bCloseOnEnd: + myout.frame.DestroyWindow() + + # Unhandled exception of any kind in a thread kills the gui! + except: + t, v, tb = sys.exc_info() + print(t, ": ", v) + traceback.print_tb(tb) + tb = None + print("Thread failed") + + +# assist for reloading (when debugging) - use only 1 tracer object, +# else a large chain of tracer objects will exist. +# try: +# writer +# except NameError: +# writer=ThreadWriter() +if __name__ == "__main__": + import demoutils + + demoutils.NotAScript() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/createwin.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/createwin.py new file mode 100644 index 0000000000000000000000000000000000000000..38f6947edd85cd6001d519010c22023dffe543ad --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/createwin.py @@ -0,0 +1,114 @@ +# +# Window creation example +# +# This example creates a minimal "control" that just fills in its +# window with red. To make your own control, subclass Control and +# write your own OnPaint() method. See PyCWnd.HookMessage for what +# the parameters to OnPaint are. +# + +import win32api +import win32con +import win32ui +from pywin.mfc import dialog, window + + +class Control(window.Wnd): + """Generic control class""" + + def __init__(self): + window.Wnd.__init__(self, win32ui.CreateWnd()) + + def OnPaint(self): + dc, paintStruct = self.BeginPaint() + self.DoPaint(dc) + self.EndPaint(paintStruct) + + def DoPaint(self, dc): # Override this! + pass + + +class RedBox(Control): + def DoPaint(self, dc): + dc.FillSolidRect(self.GetClientRect(), win32api.RGB(255, 0, 0)) + + +class RedBoxWithPie(RedBox): + def DoPaint(self, dc): + RedBox.DoPaint(self, dc) + r = self.GetClientRect() + dc.Pie(r[0], r[1], r[2], r[3], 0, 0, r[2], r[3] // 2) + + +def MakeDlgTemplate(): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + + w = 64 + h = 64 + + dlg = [ + ["Red box", (0, 0, w, h), style, None, (8, "MS Sans Serif")], + ] + + s = win32con.WS_TABSTOP | cs + + dlg.append( + [ + 128, + "Cancel", + win32con.IDCANCEL, + (7, h - 18, 50, 14), + s | win32con.BS_PUSHBUTTON, + ] + ) + + return dlg + + +class TestDialog(dialog.Dialog): + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + self.redbox = RedBox() + self.redbox.CreateWindow( + None, + "RedBox", + win32con.WS_CHILD | win32con.WS_VISIBLE, + (5, 5, 90, 68), + self, + 1003, + ) + return rc + + +class TestPieDialog(dialog.Dialog): + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + self.control = RedBoxWithPie() + self.control.CreateWindow( + None, + "RedBox with Pie", + win32con.WS_CHILD | win32con.WS_VISIBLE, + (5, 5, 90, 68), + self, + 1003, + ) + + +def demo(modal=0): + d = TestPieDialog(MakeDlgTemplate()) + if modal: + d.DoModal() + else: + d.CreateWindow() + + +if __name__ == "__main__": + demo(1) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/demoutils.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/demoutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f6080c465b606fed58fd9e255d54c3db573ff095 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/demoutils.py @@ -0,0 +1,67 @@ +# Utilities for the demos + +import sys + +import win32api +import win32con +import win32ui + +NotScriptMsg = """\ +This demo program is not designed to be run as a Script, but is +probably used by some other test program. Please try another demo. +""" + +NeedGUIMsg = """\ +This demo program can only be run from inside of Pythonwin + +You must start Pythonwin, and select 'Run' from the toolbar or File menu +""" + + +NeedAppMsg = """\ +This demo program is a 'Pythonwin Application'. + +It is more demo code than an example of Pythonwin's capabilities. + +To run it, you must execute the command: +pythonwin.exe /app "%s" + +Would you like to execute it now? +""" + + +def NotAScript(): + import win32ui + + win32ui.MessageBox(NotScriptMsg, "Demos") + + +def NeedGoodGUI(): + from pywin.framework.app import HaveGoodGUI + + rc = HaveGoodGUI() + if not rc: + win32ui.MessageBox(NeedGUIMsg, "Demos") + return rc + + +def NeedApp(): + import win32ui + + rc = win32ui.MessageBox(NeedAppMsg % sys.argv[0], "Demos", win32con.MB_YESNO) + if rc == win32con.IDYES: + try: + parent = win32ui.GetMainFrame().GetSafeHwnd() + win32api.ShellExecute( + parent, None, "pythonwin.exe", '/app "%s"' % sys.argv[0], None, 1 + ) + except win32api.error as details: + win32ui.MessageBox("Error executing command - %s" % (details), "Demos") + + +from pywin.framework.app import HaveGoodGUI + +if __name__ == "__main__": + import demoutils + + demoutils.NotAScript() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py new file mode 100644 index 0000000000000000000000000000000000000000..615227abf294924af9f992e56b3325e8ad3a6613 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py @@ -0,0 +1,73 @@ +# A demo which creates a view and a frame which displays a PPM format bitmap +# +# This hasnnt been run in a while, as I dont have many of that format around! + +import win32api +import win32con +import win32ui + + +class DIBView: + def __init__(self, doc, dib): + self.dib = dib + self.view = win32ui.CreateView(doc) + self.width = self.height = 0 + # set up message handlers + # self.view.OnPrepareDC = self.OnPrepareDC + self.view.HookMessage(self.OnSize, win32con.WM_SIZE) + + def OnSize(self, params): + lParam = params[3] + self.width = win32api.LOWORD(lParam) + self.height = win32api.HIWORD(lParam) + + def OnDraw(self, ob, dc): + # set sizes used for "non strecth" mode. + self.view.SetScrollSizes(win32con.MM_TEXT, self.dib.GetSize()) + dibSize = self.dib.GetSize() + dibRect = (0, 0, dibSize[0], dibSize[1]) + # stretch BMP. + # self.dib.Paint(dc, (0,0,self.width, self.height),dibRect) + # non stretch. + self.dib.Paint(dc) + + +class DIBDemo: + def __init__(self, filename, *bPBM): + # init data members + f = open(filename, "rb") + dib = win32ui.CreateDIBitmap() + if len(bPBM) > 0: + magic = f.readline() + if magic != "P6\n": + print("The file is not a PBM format file") + raise ValueError("Failed - The file is not a PBM format file") + # check magic? + rowcollist = f.readline().split() + cols = int(rowcollist[0]) + rows = int(rowcollist[1]) + f.readline() # whats this one? + dib.LoadPBMData(f, (cols, rows)) + else: + dib.LoadWindowsFormatFile(f) + f.close() + # create doc/view + self.doc = win32ui.CreateDoc() + self.dibView = DIBView(self.doc, dib) + self.frame = win32ui.CreateMDIFrame() + self.frame.LoadFrame() # this will force OnCreateClient + self.doc.SetTitle("DIB Demo") + self.frame.ShowWindow() + + # display the sucka + self.frame.ActivateFrame() + + def OnCreateClient(self, createparams, context): + self.dibView.view.CreateWindow(self.frame) + return 1 + + +if __name__ == "__main__": + import demoutils + + demoutils.NotAScript() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dlgtest.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dlgtest.py new file mode 100644 index 0000000000000000000000000000000000000000..8dcb0e5efa4f9026b56c3435bd80ae43596707c3 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dlgtest.py @@ -0,0 +1,145 @@ +# A Demo of Pythonwin's Dialog and Property Page support. + +################### +# +# First demo - use the built-in to Pythonwin "Tab Stop" dialog, but +# customise it heavily. +# +# ID's for the tabstop dialog - out test. +# +import win32con +import win32ui +from pywin.mfc import dialog +from win32con import IDCANCEL +from win32ui import IDC_EDIT_TABS, IDC_PROMPT_TABS, IDD_SET_TABSTOPS + + +class TestDialog(dialog.Dialog): + def __init__(self, modal=1): + dialog.Dialog.__init__(self, IDD_SET_TABSTOPS) + self.counter = 0 + if modal: + self.DoModal() + else: + self.CreateWindow() + + def OnInitDialog(self): + # Set the caption of the dialog itself. + self.SetWindowText("Used to be Tab Stops!") + # Get a child control, remember it, and change its text. + self.edit = self.GetDlgItem(IDC_EDIT_TABS) # the text box. + self.edit.SetWindowText("Test") + # Hook a Windows message for the dialog. + self.edit.HookMessage(self.KillFocus, win32con.WM_KILLFOCUS) + # Get the prompt control, and change its next. + prompt = self.GetDlgItem(IDC_PROMPT_TABS) # the prompt box. + prompt.SetWindowText("Prompt") + # And the same for the button.. + cancel = self.GetDlgItem(IDCANCEL) # the cancel button + cancel.SetWindowText("&Kill me") + + # And just for demonstration purposes, we hook the notify message for the dialog. + # This allows us to be notified when the Edit Control text changes. + self.HookCommand(self.OnNotify, IDC_EDIT_TABS) + + def OnNotify(self, controlid, code): + if code == win32con.EN_CHANGE: + print("Edit text changed!") + return 1 # I handled this, so no need to call defaults! + + # kill focus for the edit box. + # Simply increment the value in the text box. + def KillFocus(self, msg): + self.counter = self.counter + 1 + if self.edit != None: + self.edit.SetWindowText(str(self.counter)) + + # Called when the dialog box is terminating... + def OnDestroy(self, msg): + del self.edit + del self.counter + + +# A very simply Property Sheet. +# We only make a new class for demonstration purposes. +class TestSheet(dialog.PropertySheet): + def __init__(self, title): + dialog.PropertySheet.__init__(self, title) + self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE) + + def OnActivate(self, msg): + pass + + +# A very simply Property Page, which will be "owned" by the above +# Property Sheet. +# We create a new class, just so we can hook a control notification. +class TestPage(dialog.PropertyPage): + def OnInitDialog(self): + # We use the HookNotify function to allow Python to respond to + # Windows WM_NOTIFY messages. + # In this case, we are interested in BN_CLICKED messages. + self.HookNotify(self.OnNotify, win32con.BN_CLICKED) + + def OnNotify(self, std, extra): + print("OnNotify", std, extra) + + +# Some code that actually uses these objects. +def demo(modal=0): + TestDialog(modal) + + # property sheet/page demo + ps = win32ui.CreatePropertySheet("Property Sheet/Page Demo") + # Create a completely standard PropertyPage. + page1 = win32ui.CreatePropertyPage(win32ui.IDD_PROPDEMO1) + # Create our custom property page. + page2 = TestPage(win32ui.IDD_PROPDEMO2) + ps.AddPage(page1) + ps.AddPage(page2) + if modal: + ps.DoModal() + else: + style = ( + win32con.WS_SYSMENU + | win32con.WS_POPUP + | win32con.WS_CAPTION + | win32con.DS_MODALFRAME + | win32con.WS_VISIBLE + ) + styleex = win32con.WS_EX_DLGMODALFRAME | win32con.WS_EX_PALETTEWINDOW + ps.CreateWindow(win32ui.GetMainFrame(), style, styleex) + + +def test(modal=1): + # dlg=dialog.Dialog(1010) + # dlg.CreateWindow() + # dlg.EndDialog(0) + # del dlg + # return + # property sheet/page demo + ps = TestSheet("Property Sheet/Page Demo") + page1 = win32ui.CreatePropertyPage(win32ui.IDD_PROPDEMO1) + page2 = win32ui.CreatePropertyPage(win32ui.IDD_PROPDEMO2) + ps.AddPage(page1) + ps.AddPage(page2) + del page1 + del page2 + if modal: + ps.DoModal() + else: + ps.CreateWindow(win32ui.GetMainFrame()) + return ps + + +def d(): + dlg = win32ui.CreateDialog(win32ui.IDD_DEBUGGER) + dlg.datalist.append((win32ui.IDC_DBG_RADIOSTACK, "radio")) + print("data list is ", dlg.datalist) + dlg.data["radio"] = 1 + dlg.DoModal() + print(dlg.data["radio"]) + + +if __name__ == "__main__": + demo(1) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dyndlg.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dyndlg.py new file mode 100644 index 0000000000000000000000000000000000000000..46a4e7fc67dce5884f7384e945a8efdbf7b5df4c --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/dyndlg.py @@ -0,0 +1,104 @@ +# dyndlg.py +# contributed by Curt Hagenlocher + +# Dialog Template params: +# Parameter 0 - Window caption +# Parameter 1 - Bounds (rect tuple) +# Parameter 2 - Window style +# Parameter 3 - Extended style +# Parameter 4 - Font tuple +# Parameter 5 - Menu name +# Parameter 6 - Window class +# Dialog item params: +# Parameter 0 - Window class +# Parameter 1 - Text +# Parameter 2 - ID +# Parameter 3 - Bounds +# Parameter 4 - Style +# Parameter 5 - Extended style +# Parameter 6 - Extra data + + +import win32con +import win32ui +from pywin.mfc import dialog, window + + +def MakeDlgTemplate(): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + dlg = [ + ["Select Warehouse", (0, 0, 177, 93), style, None, (8, "MS Sans Serif")], + ] + dlg.append([130, "Current Warehouse:", -1, (7, 7, 69, 9), cs | win32con.SS_LEFT]) + dlg.append([130, "ASTORIA", 128, (16, 17, 99, 7), cs | win32con.SS_LEFT]) + dlg.append([130, "New &Warehouse:", -1, (7, 29, 69, 9), cs | win32con.SS_LEFT]) + s = win32con.WS_TABSTOP | cs + # dlg.append([131, None, 130, (5, 40, 110, 48), + # s | win32con.LBS_NOTIFY | win32con.LBS_SORT | win32con.LBS_NOINTEGRALHEIGHT | win32con.WS_VSCROLL | win32con.WS_BORDER]) + dlg.append( + [ + "{8E27C92B-1264-101C-8A2F-040224009C02}", + None, + 131, + (5, 40, 110, 48), + win32con.WS_TABSTOP, + ] + ) + + dlg.append( + [128, "OK", win32con.IDOK, (124, 5, 50, 14), s | win32con.BS_DEFPUSHBUTTON] + ) + s = win32con.BS_PUSHBUTTON | s + dlg.append([128, "Cancel", win32con.IDCANCEL, (124, 22, 50, 14), s]) + dlg.append([128, "&Help", 100, (124, 74, 50, 14), s]) + + return dlg + + +def test1(): + win32ui.CreateDialogIndirect(MakeDlgTemplate()).DoModal() + + +def test2(): + dialog.Dialog(MakeDlgTemplate()).DoModal() + + +def test3(): + dlg = win32ui.LoadDialogResource(win32ui.IDD_SET_TABSTOPS) + dlg[0][0] = "New Dialog Title" + dlg[0][1] = (80, 20, 161, 60) + dlg[1][1] = "&Confusion:" + cs = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | win32con.WS_TABSTOP + | win32con.BS_PUSHBUTTON + ) + dlg.append([128, "&Help", 100, (111, 41, 40, 14), cs]) + dialog.Dialog(dlg).DoModal() + + +def test4(): + page1 = dialog.PropertyPage(win32ui.LoadDialogResource(win32ui.IDD_PROPDEMO1)) + page2 = dialog.PropertyPage(win32ui.LoadDialogResource(win32ui.IDD_PROPDEMO2)) + ps = dialog.PropertySheet("Property Sheet/Page Demo", None, [page1, page2]) + ps.DoModal() + + +def testall(): + test1() + test2() + test3() + test4() + + +if __name__ == "__main__": + testall() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/fontdemo.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/fontdemo.py new file mode 100644 index 0000000000000000000000000000000000000000..fc35f4ca388e6ed05616119898d1d6ef46dd4c66 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/fontdemo.py @@ -0,0 +1,86 @@ +# Demo of Generic document windows, DC, and Font usage +# by Dave Brennan (brennan@hal.com) + +# usage examples: + +# >>> from fontdemo import * +# >>> d = FontDemo('Hello, Python') +# >>> f1 = { 'name':'Arial', 'height':36, 'weight':win32con.FW_BOLD} +# >>> d.SetFont(f1) +# >>> f2 = {'name':'Courier New', 'height':24, 'italic':1} +# >>> d.SetFont (f2) + +import win32api +import win32con +import win32ui +from pywin.mfc import docview + +# font is a dictionary in which the following elements matter: +# (the best matching font to supplied parameters is returned) +# name string name of the font as known by Windows +# size point size of font in logical units +# weight weight of font (win32con.FW_NORMAL, win32con.FW_BOLD) +# italic boolean; true if set to anything but None +# underline boolean; true if set to anything but None + + +class FontView(docview.ScrollView): + def __init__( + self, doc, text="Python Rules!", font_spec={"name": "Arial", "height": 42} + ): + docview.ScrollView.__init__(self, doc) + self.font = win32ui.CreateFont(font_spec) + self.text = text + self.width = self.height = 0 + # set up message handlers + self.HookMessage(self.OnSize, win32con.WM_SIZE) + + def OnAttachedObjectDeath(self): + docview.ScrollView.OnAttachedObjectDeath(self) + del self.font + + def SetFont(self, new_font): + # Change font on the fly + self.font = win32ui.CreateFont(new_font) + # redraw the entire client window + selfInvalidateRect(None) + + def OnSize(self, params): + lParam = params[3] + self.width = win32api.LOWORD(lParam) + self.height = win32api.HIWORD(lParam) + + def OnPrepareDC(self, dc, printinfo): + # Set up the DC for forthcoming OnDraw call + self.SetScrollSizes(win32con.MM_TEXT, (100, 100)) + dc.SetTextColor(win32api.RGB(0, 0, 255)) + dc.SetBkColor(win32api.GetSysColor(win32con.COLOR_WINDOW)) + dc.SelectObject(self.font) + dc.SetTextAlign(win32con.TA_CENTER | win32con.TA_BASELINE) + + def OnDraw(self, dc): + if self.width == 0 and self.height == 0: + left, top, right, bottom = self.GetClientRect() + self.width = right - left + self.height = bottom - top + x, y = self.width // 2, self.height // 2 + dc.TextOut(x, y, self.text) + + +def FontDemo(): + # create doc/view + template = docview.DocTemplate(win32ui.IDR_PYTHONTYPE, None, None, FontView) + doc = template.OpenDocumentFile(None) + doc.SetTitle("Font Demo") + # print "template is ", template, "obj is", template._obj_ + template.close() + + +# print "closed" +# del template + +if __name__ == "__main__": + import demoutils + + if demoutils.NeedGoodGUI(): + FontDemo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py new file mode 100644 index 0000000000000000000000000000000000000000..b4d88159a0257e7db4a2db2e6e81a837895d8fe1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py @@ -0,0 +1,86 @@ +# GUI Demo - just a worker script to invoke all the other demo/test scripts. +import sys + +import __main__ +import regutil +import win32api +import win32ui + +demos = [ # ('Font', 'import fontdemo;fontdemo.FontDemo()'), + ("Open GL Demo", "import openGLDemo;openGLDemo.test()"), + ("Threaded GUI", "import threadedgui;threadedgui.ThreadedDemo()"), + ("Tree View Demo", "import hiertest;hiertest.demoboth()"), + ("3-Way Splitter Window", "import splittst;splittst.demo()"), + ("Custom Toolbars and Tooltips", "import toolbar;toolbar.test()"), + ("Progress Bar", "import progressbar;progressbar.demo()"), + ("Slider Control", "import sliderdemo;sliderdemo.demo()"), + ("Dynamic window creation", "import createwin;createwin.demo()"), + ("Various Dialog demos", "import dlgtest;dlgtest.demo()"), + ("OCX Control Demo", "from ocx import ocxtest;ocxtest.demo()"), + ("OCX Serial Port Demo", "from ocx import ocxserialtest; ocxserialtest.test()"), + ( + "IE4 Control Demo", + 'from ocx import webbrowser; webbrowser.Demo("http://www.python.org")', + ), +] + + +def demo(): + try: + # seeif I can locate the demo files. + import fontdemo + except ImportError: + # else put the demos direectory on the path (if not already) + try: + instPath = regutil.GetRegistryDefaultValue( + regutil.BuildDefaultPythonKey() + "\\InstallPath" + ) + except win32api.error: + print( + "The InstallPath can not be located, and the Demos directory is not on the path" + ) + instPath = "." + + demosDir = win32ui.FullPath(instPath + "\\Demos") + for path in sys.path: + if win32ui.FullPath(path) == demosDir: + break + else: + sys.path.append(demosDir) + import fontdemo + + import sys + + if "/go" in sys.argv: + for name, cmd in demos: + try: + exec(cmd) + except: + print( + "Demo of %s failed - %s:%s" + % (cmd, sys.exc_info()[0], sys.exc_info()[1]) + ) + return + # Otherwise allow the user to select the demo to run + + import pywin.dialogs.list + + while 1: + rc = pywin.dialogs.list.SelectFromLists("Select a Demo", demos, ["Demo Title"]) + if rc is None: + break + title, cmd = demos[rc] + try: + exec(cmd) + except: + print( + "Demo of %s failed - %s:%s" + % (title, sys.exc_info()[0], sys.exc_info()[1]) + ) + + +if __name__ == __main__.__name__: + import demoutils + + if demoutils.NeedGoodGUI(): + demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/hiertest.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/hiertest.py new file mode 100644 index 0000000000000000000000000000000000000000..287b71dafac59d8de2d06f26f1642154b9a90bc2 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/hiertest.py @@ -0,0 +1,138 @@ +import os + +import commctrl +import win32ui +from pywin.mfc import docview, window +from pywin.tools import hierlist + + +# directory listbox +# This has obvious limitations - doesnt track subdirs, etc. Demonstrates +# simple use of Python code for querying the tree as needed. +# Only use strings, and lists of strings (from curdir()) +class DirHierList(hierlist.HierList): + def __init__(self, root, listBoxID=win32ui.IDC_LIST1): + hierlist.HierList.__init__(self, root, win32ui.IDB_HIERFOLDERS, listBoxID) + + def GetText(self, item): + return os.path.basename(item) + + def GetSubList(self, item): + if os.path.isdir(item): + ret = [os.path.join(item, fname) for fname in os.listdir(item)] + else: + ret = None + return ret + + # if the item is a dir, it is expandable. + def IsExpandable(self, item): + return os.path.isdir(item) + + def GetSelectedBitmapColumn(self, item): + return self.GetBitmapColumn(item) + 6 # Use different color for selection + + +class TestDocument(docview.Document): + def __init__(self, template): + docview.Document.__init__(self, template) + self.hierlist = hierlist.HierListWithItems( + HLIFileDir("\\"), win32ui.IDB_HIERFOLDERS, win32ui.AFX_IDW_PANE_FIRST + ) + + +class HierListView(docview.TreeView): + def OnInitialUpdate(self): + rc = self._obj_.OnInitialUpdate() + self.hierList = self.GetDocument().hierlist + self.hierList.HierInit(self.GetParent()) + self.hierList.SetStyle( + commctrl.TVS_HASLINES | commctrl.TVS_LINESATROOT | commctrl.TVS_HASBUTTONS + ) + return rc + + +class HierListFrame(window.MDIChildWnd): + pass + + +def GetTestRoot(): + tree1 = ("Tree 1", [("Item 1", "Item 1 data"), "Item 2", 3]) + tree2 = ("Tree 2", [("Item 2.1", "Item 2 data"), "Item 2.2", 2.3]) + return ("Root", [tree1, tree2, "Item 3"]) + + +def demoboth(): + template = docview.DocTemplate( + win32ui.IDR_PYTHONTYPE, TestDocument, HierListFrame, HierListView + ) + template.OpenDocumentFile(None).SetTitle("Hierlist demo") + + demomodeless() + + +def demomodeless(): + testList2 = DirHierList("\\") + dlg = hierlist.HierDialog("hier list test", testList2) + dlg.CreateWindow() + + +def demodlg(): + testList2 = DirHierList("\\") + dlg = hierlist.HierDialog("hier list test", testList2) + dlg.DoModal() + + +def demo(): + template = docview.DocTemplate( + win32ui.IDR_PYTHONTYPE, TestDocument, HierListFrame, HierListView + ) + template.OpenDocumentFile(None).SetTitle("Hierlist demo") + + +# +# Demo/Test for HierList items. +# +# Easy to make a better directory program. +# +class HLIFileDir(hierlist.HierListItem): + def __init__(self, filename): + self.filename = filename + hierlist.HierListItem.__init__(self) + + def GetText(self): + try: + return "%-20s %d bytes" % ( + os.path.basename(self.filename), + os.stat(self.filename)[6], + ) + except os.error as details: + return "%-20s - %s" % (self.filename, details[1]) + + def IsExpandable(self): + return os.path.isdir(self.filename) + + def GetSubList(self): + ret = [] + for newname in os.listdir(self.filename): + if newname not in (".", ".."): + ret.append(HLIFileDir(os.path.join(self.filename, newname))) + return ret + + +def demohli(): + template = docview.DocTemplate( + win32ui.IDR_PYTHONTYPE, + TestDocument, + hierlist.HierListFrame, + hierlist.HierListView, + ) + template.OpenDocumentFile(None).SetTitle("Hierlist demo") + + +if __name__ == "__main__": + import demoutils + + if demoutils.HaveGoodGUI(): + demoboth() + else: + demodlg() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/menutest.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/menutest.py new file mode 100644 index 0000000000000000000000000000000000000000..d2ba65b6dd4bc3310b13cf5911883d199e58c28f --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/menutest.py @@ -0,0 +1,13 @@ +# Run this as a python script, to gray "close" off the edit window system menu. +import win32con +from pywin.framework import interact + +if __name__ == "__main__": + import demoutils + + if demoutils.NeedGoodGUI(): + win = interact.edit.currentView.GetParent() + menu = win.GetSystemMenu() + id = menu.GetMenuItemID(6) + menu.EnableMenuItem(id, win32con.MF_BYCOMMAND | win32con.MF_GRAYED) + print("The interactive window's 'Close' menu item is now disabled.") diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/objdoc.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/objdoc.py new file mode 100644 index 0000000000000000000000000000000000000000..fff7925360da164cbb01f250917ca68fafc55d10 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/objdoc.py @@ -0,0 +1,57 @@ +# This is a sample file, and shows the basic framework for using an "Object" based +# document, rather than a "filename" based document. +# This is referenced by the Pythonwin .html documentation. + +# In the example below, the OpenObject() method is used instead of OpenDocumentFile, +# and all the core MFC document open functionality is retained. + +import win32ui +from pywin.mfc import docview + + +class object_template(docview.DocTemplate): + def __init__(self): + docview.DocTemplate.__init__(self, None, None, None, object_view) + + def OpenObject(self, object): # Use this instead of OpenDocumentFile. + # Look for existing open document + for doc in self.GetDocumentList(): + print("document is ", doc) + if doc.object is object: + doc.GetFirstView().ActivateFrame() + return doc + # not found - new one. + doc = object_document(self, object) + frame = self.CreateNewFrame(doc) + doc.OnNewDocument() + doc.SetTitle(str(object)) + self.InitialUpdateFrame(frame, doc) + return doc + + +class object_document(docview.Document): + def __init__(self, template, object): + docview.Document.__init__(self, template) + self.object = object + + def OnOpenDocument(self, name): + raise RuntimeError("Should not be called if template strings set up correctly") + return 0 + + +class object_view(docview.EditView): + def OnInitialUpdate(self): + self.ReplaceSel("Object is %s" % repr(self.GetDocument().object)) + + +def demo(): + t = object_template() + d = t.OpenObject(win32ui) + return (t, d) + + +if __name__ == "__main__": + import demoutils + + if demoutils.NeedGoodGUI(): + demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/demoutils.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/demoutils.py new file mode 100644 index 0000000000000000000000000000000000000000..27fa091cbc7de620f490d2a8b4fb61a35940a99a --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/demoutils.py @@ -0,0 +1,67 @@ +# Utilities for the demos + +import sys + +import win32api +import win32con +import win32ui + +NotScriptMsg = """\ +This demo program is not designed to be run as a Script, but is +probably used by some other test program. Please try another demo. +""" + +NeedGUIMsg = """\ +This demo program can only be run from inside of Pythonwin + +You must start Pythonwin, and select 'Run' from the toolbar or File menu +""" + + +NeedAppMsg = """\ +This demo program is a 'Pythonwin Application'. + +It is more demo code than an example of Pythonwin's capabilities. + +To run it, you must execute the command: +pythonwin.exe /app "%s" + +Would you like to execute it now? +""" + + +def NotAScript(): + import win32ui + + win32ui.MessageBox(NotScriptMsg, "Demos") + + +def NeedGoodGUI(): + from pywin.framework.app import HaveGoodGUI + + rc = HaveGoodGUI() + if not rc: + win32ui.MessageBox(NeedGUIMsg, "Demos") + return rc + + +def NeedApp(): + import win32ui + + rc = win32ui.MessageBox(NeedAppMsg % sys.argv[0], "Demos", win32con.MB_YESNO) + if rc == win32con.IDYES: + try: + parent = win32ui.GetMainFrame().GetSafeHwnd() + win32api.ShellExecute( + parent, None, "pythonwin.exe", '/app "%s"' % sys.argv[0], None, 1 + ) + except win32api.error as details: + win32ui.MessageBox("Error executing command - %s" % (details), "Demos") + + +from pywin.framework.app import HaveGoodGUI + +if __name__ == "__main__": + from . import demoutils + + demoutils.NotAScript() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/flash.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/flash.py new file mode 100644 index 0000000000000000000000000000000000000000..239240ee33a0791e391cf54df1f12afe491cbf48 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/flash.py @@ -0,0 +1,95 @@ +# By Bradley Schatz +# simple flash/python application demonstrating bidirectional +# communicaion between flash and python. Click the sphere to see +# behavior. Uses Bounce.swf from FlashBounce.zip, available from +# http://pages.cpsc.ucalgary.ca/~saul/vb_examples/tutorial12/ + +# Update to the path of the .swf file (note it could be a true URL) +flash_url = "c:\\bounce.swf" + +import sys + +import regutil +import win32api +import win32con +import win32ui +from pywin.mfc import activex, window +from win32com.client import gencache + +FlashModule = gencache.EnsureModule("{D27CDB6B-AE6D-11CF-96B8-444553540000}", 0, 1, 0) + +if FlashModule is None: + raise ImportError("Flash does not appear to be installed.") + + +class MyFlashComponent(activex.Control, FlashModule.ShockwaveFlash): + def __init__(self): + activex.Control.__init__(self) + FlashModule.ShockwaveFlash.__init__(self) + self.x = 50 + self.y = 50 + self.angle = 30 + self.started = 0 + + def OnFSCommand(self, command, args): + print("FSCommend", command, args) + self.x = self.x + 20 + self.y = self.y + 20 + self.angle = self.angle + 20 + if self.x > 200 or self.y > 200: + self.x = 0 + self.y = 0 + if self.angle > 360: + self.angle = 0 + self.SetVariable("xVal", self.x) + self.SetVariable("yVal", self.y) + self.SetVariable("angle", self.angle) + self.TPlay("_root.mikeBall") + + def OnProgress(self, percentDone): + print("PercentDone", percentDone) + + def OnReadyStateChange(self, newState): + # 0=Loading, 1=Uninitialized, 2=Loaded, 3=Interactive, 4=Complete + print("State", newState) + + +class BrowserFrame(window.MDIChildWnd): + def __init__(self, url=None): + if url is None: + self.url = regutil.GetRegisteredHelpFile("Main Python Documentation") + else: + self.url = url + pass # Dont call base class doc/view version... + + def Create(self, title, rect=None, parent=None): + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW + self._obj_ = win32ui.CreateMDIChild() + self._obj_.AttachObject(self) + self._obj_.CreateWindow(None, title, style, rect, parent) + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.ocx = MyFlashComponent() + self.ocx.CreateControl( + "Flash Player", win32con.WS_VISIBLE | win32con.WS_CHILD, rect, self, 1000 + ) + self.ocx.LoadMovie(0, flash_url) + self.ocx.Play() + self.HookMessage(self.OnSize, win32con.WM_SIZE) + + def OnSize(self, params): + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.ocx.SetWindowPos(0, rect, 0) + + +def Demo(): + url = None + if len(sys.argv) > 1: + url = win32api.GetFullPathName(sys.argv[1]) + f = BrowserFrame(url) + f.Create("Flash Player") + + +if __name__ == "__main__": + Demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/msoffice.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/msoffice.py new file mode 100644 index 0000000000000000000000000000000000000000..be24ead82f8f3358f221c07dac4f6c6a685bbca4 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/msoffice.py @@ -0,0 +1,152 @@ +# This demo uses some of the Microsoft Office components. +# +# It was taken from an MSDN article showing how to embed excel. +# It is not comlpete yet, but it _does_ show an Excel spreadsheet in a frame! +# + +import regutil +import win32con +import win32ui +import win32uiole +from pywin.mfc import activex, docview, object, window +from win32com.client import gencache + +# WordModule = gencache.EnsureModule('{00020905-0000-0000-C000-000000000046}', 1033, 8, 0) +# if WordModule is None: +# raise ImportError, "Microsoft Word version 8 does not appear to be installed." + + +class OleClientItem(object.CmdTarget): + def __init__(self, doc): + object.CmdTarget.__init__(self, win32uiole.CreateOleClientItem(doc)) + + def OnGetItemPosition(self): + # For now return a hard-coded rect. + return (10, 10, 210, 210) + + def OnActivate(self): + # Allow only one inplace activate item per frame + view = self.GetActiveView() + item = self.GetDocument().GetInPlaceActiveItem(view) + if item is not None and item._obj_ != self._obj_: + item.Close() + self._obj_.OnActivate() + + def OnChange(self, oleNotification, dwParam): + self._obj_.OnChange(oleNotification, dwParam) + self.GetDocument().UpdateAllViews(None) + + def OnChangeItemPosition(self, rect): + # During in-place activation CEmbed_ExcelCntrItem::OnChangeItemPosition + # is called by the server to change the position of the in-place + # window. Usually, this is a result of the data in the server + # document changing such that the extent has changed or as a result + # of in-place resizing. + # + # The default here is to call the base class, which will call + # COleClientItem::SetItemRects to move the item + # to the new position. + if not self._obj_.OnChangeItemPosition(self, rect): + return 0 + + # TODO: update any cache you may have of the item's rectangle/extent + return 1 + + +class OleDocument(object.CmdTarget): + def __init__(self, template): + object.CmdTarget.__init__(self, win32uiole.CreateOleDocument(template)) + self.EnableCompoundFile() + + +class ExcelView(docview.ScrollView): + def OnInitialUpdate(self): + self.HookMessage(self.OnSetFocus, win32con.WM_SETFOCUS) + self.HookMessage(self.OnSize, win32con.WM_SIZE) + + self.SetScrollSizes(win32con.MM_TEXT, (100, 100)) + rc = self._obj_.OnInitialUpdate() + self.EmbedExcel() + return rc + + def EmbedExcel(self): + doc = self.GetDocument() + self.clientItem = OleClientItem(doc) + self.clientItem.CreateNewItem("Excel.Sheet") + self.clientItem.DoVerb(-1, self) + doc.UpdateAllViews(None) + + def OnDraw(self, dc): + doc = self.GetDocument() + pos = doc.GetStartPosition() + clientItem, pos = doc.GetNextItem(pos) + clientItem.Draw(dc, (10, 10, 210, 210)) + + # Special handling of OnSetFocus and OnSize are required for a container + # when an object is being edited in-place. + def OnSetFocus(self, msg): + item = self.GetDocument().GetInPlaceActiveItem(self) + if ( + item is not None + and item.GetItemState() == win32uiole.COleClientItem_activeUIState + ): + wnd = item.GetInPlaceWindow() + if wnd is not None: + wnd.SetFocus() + return 0 # Dont get the base version called. + return 1 # Call the base version. + + def OnSize(self, params): + item = self.GetDocument().GetInPlaceActiveItem(self) + if item is not None: + item.SetItemRects() + return 1 # do call the base! + + +class OleTemplate(docview.DocTemplate): + def __init__( + self, resourceId=None, MakeDocument=None, MakeFrame=None, MakeView=None + ): + if MakeDocument is None: + MakeDocument = OleDocument + if MakeView is None: + MakeView = ExcelView + docview.DocTemplate.__init__( + self, resourceId, MakeDocument, MakeFrame, MakeView + ) + + +class WordFrame(window.MDIChildWnd): + def __init__(self, doc=None): + self._obj_ = win32ui.CreateMDIChild() + self._obj_.AttachObject(self) + # Dont call base class doc/view version... + + def Create(self, title, rect=None, parent=None): + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW + self._obj_.CreateWindow(None, title, style, rect, parent) + + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.ocx = MyWordControl() + self.ocx.CreateControl( + "Microsoft Word", win32con.WS_VISIBLE | win32con.WS_CHILD, rect, self, 20000 + ) + + +def Demo(): + import sys + + import win32api + + docName = None + if len(sys.argv) > 1: + docName = win32api.GetFullPathName(sys.argv[1]) + OleTemplate().OpenDocumentFile(None) + + +# f = WordFrame(docName) +# f.Create("Microsoft Office") + +if __name__ == "__main__": + Demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxserialtest.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxserialtest.py new file mode 100644 index 0000000000000000000000000000000000000000..326d312c8f59d7e4d31820d0f57e88551dc24bfc --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxserialtest.py @@ -0,0 +1,133 @@ +# ocxserialtest.py +# +# Sample that uses the mscomm OCX to talk to a serial +# device. + +# Very simple - queries a modem for ATI responses + +import pythoncom +import win32con +import win32ui +import win32uiole +from pywin.mfc import activex, dialog +from win32com.client import gencache + +SERIAL_SETTINGS = "19200,n,8,1" +SERIAL_PORT = 2 + +win32ui.DoWaitCursor(1) +serialModule = gencache.EnsureModule("{648A5603-2C6E-101B-82B6-000000000014}", 0, 1, 1) +win32ui.DoWaitCursor(0) +if serialModule is None: + raise ImportError("MS COMM Control does not appear to be installed on the PC") + + +def MakeDlgTemplate(): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + dlg = [ + ["Very Basic Terminal", (0, 0, 350, 180), style, None, (8, "MS Sans Serif")], + ] + s = win32con.WS_TABSTOP | cs + dlg.append( + [ + "RICHEDIT", + None, + 132, + (5, 5, 340, 170), + s + | win32con.ES_WANTRETURN + | win32con.ES_MULTILINE + | win32con.ES_AUTOVSCROLL + | win32con.WS_VSCROLL, + ] + ) + return dlg + + +#################################### +# +# Serial Control +# +class MySerialControl(activex.Control, serialModule.MSComm): + def __init__(self, parent): + activex.Control.__init__(self) + serialModule.MSComm.__init__(self) + self.parent = parent + + def OnComm(self): + self.parent.OnComm() + + +class TestSerDialog(dialog.Dialog): + def __init__(self, *args): + dialog.Dialog.__init__(*(self,) + args) + self.olectl = None + + def OnComm(self): + event = self.olectl.CommEvent + if event == serialModule.OnCommConstants.comEvReceive: + self.editwindow.ReplaceSel(self.olectl.Input) + + def OnKey(self, key): + if self.olectl: + self.olectl.Output = chr(key) + + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + self.editwindow = self.GetDlgItem(132) + self.editwindow.HookAllKeyStrokes(self.OnKey) + + self.olectl = MySerialControl(self) + try: + self.olectl.CreateControl( + "OCX", + win32con.WS_TABSTOP | win32con.WS_VISIBLE, + (7, 43, 500, 300), + self._obj_, + 131, + ) + except win32ui.error: + self.MessageBox("The Serial Control could not be created") + self.olectl = None + self.EndDialog(win32con.IDCANCEL) + if self.olectl: + self.olectl.Settings = SERIAL_SETTINGS + self.olectl.CommPort = SERIAL_PORT + self.olectl.RThreshold = 1 + try: + self.olectl.PortOpen = 1 + except pythoncom.com_error as details: + print( + "Could not open the specified serial port - %s" + % (details.excepinfo[2]) + ) + self.EndDialog(win32con.IDCANCEL) + return rc + + def OnDestroy(self, msg): + if self.olectl: + try: + self.olectl.PortOpen = 0 + except pythoncom.com_error as details: + print("Error closing port - %s" % (details.excepinfo[2])) + return dialog.Dialog.OnDestroy(self, msg) + + +def test(): + d = TestSerDialog(MakeDlgTemplate()) + d.DoModal() + + +if __name__ == "__main__": + from . import demoutils + + if demoutils.NeedGoodGUI(): + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxtest.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxtest.py new file mode 100644 index 0000000000000000000000000000000000000000..4a3d73363d904132007c219642e87fe3b75a0744 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxtest.py @@ -0,0 +1,250 @@ +# OCX Tester for Pythonwin +# +# This file _is_ ready to run. All that is required is that the OCXs being tested +# are installed on your machine. +# +# The .py files behind the OCXs will be automatically generated and imported. + +import glob +import os + +import win32api +import win32con +import win32ui +import win32uiole +from pywin.mfc import activex, dialog, window +from win32com.client import gencache + + +def MakeDlgTemplate(): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + dlg = [ + ["OCX Demos", (0, 0, 350, 350), style, None, (8, "MS Sans Serif")], + ] + s = win32con.WS_TABSTOP | cs + # dlg.append([131, None, 130, (5, 40, 110, 48), + # s | win32con.LBS_NOTIFY | win32con.LBS_SORT | win32con.LBS_NOINTEGRALHEIGHT | win32con.WS_VSCROLL | win32con.WS_BORDER]) + # dlg.append(["{8E27C92B-1264-101C-8A2F-040224009C02}", None, 131, (5, 40, 110, 48),win32con.WS_TABSTOP]) + + dlg.append( + [128, "About", win32con.IDOK, (124, 5, 50, 14), s | win32con.BS_DEFPUSHBUTTON] + ) + s = win32con.BS_PUSHBUTTON | s + dlg.append([128, "Close", win32con.IDCANCEL, (124, 22, 50, 14), s]) + + return dlg + + +#################################### +# +# Calendar test code +# + + +def GetTestCalendarClass(): + global calendarParentModule + win32ui.DoWaitCursor(1) + calendarParentModule = gencache.EnsureModule( + "{8E27C92E-1264-101C-8A2F-040224009C02}", 0, 7, 0 + ) + win32ui.DoWaitCursor(0) + if calendarParentModule is None: + return None + + class TestCalDialog(dialog.Dialog): + def OnInitDialog(self): + class MyCal(activex.Control, calendarParentModule.Calendar): + def OnAfterUpdate(self): + print("OnAfterUpdate") + + def OnClick(self): + print("OnClick") + + def OnDblClick(self): + print("OnDblClick") + + def OnKeyDown(self, KeyCode, Shift): + print("OnKeyDown", KeyCode, Shift) + + def OnKeyPress(self, KeyAscii): + print("OnKeyPress", KeyAscii) + + def OnKeyUp(self, KeyCode, Shift): + print("OnKeyUp", KeyCode, Shift) + + def OnBeforeUpdate(self, Cancel): + print("OnBeforeUpdate", Cancel) + + def OnNewMonth(self): + print("OnNewMonth") + + def OnNewYear(self): + print("OnNewYear") + + rc = dialog.Dialog.OnInitDialog(self) + self.olectl = MyCal() + try: + self.olectl.CreateControl( + "OCX", + win32con.WS_TABSTOP | win32con.WS_VISIBLE, + (7, 43, 500, 300), + self._obj_, + 131, + ) + except win32ui.error: + self.MessageBox("The Calendar Control could not be created") + self.olectl = None + self.EndDialog(win32con.IDCANCEL) + + return rc + + def OnOK(self): + self.olectl.AboutBox() + + return TestCalDialog + + +#################################### +# +# Video Control +# +def GetTestVideoModule(): + global videoControlModule, videoControlFileName + win32ui.DoWaitCursor(1) + videoControlModule = gencache.EnsureModule( + "{05589FA0-C356-11CE-BF01-00AA0055595A}", 0, 2, 0 + ) + win32ui.DoWaitCursor(0) + if videoControlModule is None: + return None + fnames = glob.glob(os.path.join(win32api.GetWindowsDirectory(), "*.avi")) + if not fnames: + print("No AVI files available in system directory") + return None + videoControlFileName = fnames[0] + return videoControlModule + + +def GetTestVideoDialogClass(): + if GetTestVideoModule() is None: + return None + + class TestVideoDialog(dialog.Dialog): + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + try: + self.olectl = activex.MakeControlInstance( + videoControlModule.ActiveMovie + ) + self.olectl.CreateControl( + "", + win32con.WS_TABSTOP | win32con.WS_VISIBLE, + (7, 43, 500, 300), + self._obj_, + 131, + ) + except win32ui.error: + self.MessageBox("The Video Control could not be created") + self.olectl = None + self.EndDialog(win32con.IDCANCEL) + return + + self.olectl.FileName = videoControlFileName + # self.olectl.Run() + return rc + + def OnOK(self): + self.olectl.AboutBox() + + return TestVideoDialog + + +############### +# +# An OCX in an MDI Frame +# +class OCXFrame(window.MDIChildWnd): + def __init__(self): + pass # Dont call base class doc/view version... + + def Create(self, controlClass, title, rect=None, parent=None): + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW + self._obj_ = win32ui.CreateMDIChild() + self._obj_.AttachObject(self) + self._obj_.CreateWindow(None, title, style, rect, parent) + + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.ocx = controlClass() + self.ocx.CreateControl( + "", win32con.WS_VISIBLE | win32con.WS_CHILD, rect, self, 1000 + ) + + +def MDITest(): + calendarParentModule = gencache.EnsureModule( + "{8E27C92E-1264-101C-8A2F-040224009C02}", 0, 7, 0 + ) + + class MyCal(activex.Control, calendarParentModule.Calendar): + def OnAfterUpdate(self): + print("OnAfterUpdate") + + def OnClick(self): + print("OnClick") + + f = OCXFrame() + f.Create(MyCal, "Calendar Test") + + +def test1(): + klass = GetTestCalendarClass() + if klass is None: + print( + "Can not test the MSAccess Calendar control - it does not appear to be installed" + ) + return + + d = klass(MakeDlgTemplate()) + d.DoModal() + + +def test2(): + klass = GetTestVideoDialogClass() + if klass is None: + print("Can not test the Video OCX - it does not appear to be installed,") + print("or no AVI files can be found.") + return + d = klass(MakeDlgTemplate()) + d.DoModal() + d = None + + +def test3(): + d = TestCOMMDialog(MakeDlgTemplate()) + d.DoModal() + d = None + + +def testall(): + test1() + test2() + + +def demo(): + testall() + + +if __name__ == "__main__": + from . import demoutils + + if demoutils.NeedGoodGUI(): + testall() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/webbrowser.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/webbrowser.py new file mode 100644 index 0000000000000000000000000000000000000000..cc17445e9ad08a469c88032eb291796c3fde1b82 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/ocx/webbrowser.py @@ -0,0 +1,72 @@ +# This demo uses the IE4 Web Browser control. + +# It catches an "OnNavigate" event, and updates the frame title. +# (event stuff by Neil Hodgson) + +import sys + +import regutil +import win32api +import win32con +import win32ui +from pywin.mfc import activex, window +from win32com.client import gencache + +WebBrowserModule = gencache.EnsureModule( + "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1 +) +if WebBrowserModule is None: + raise ImportError("IE4 does not appear to be installed.") + + +class MyWebBrowser(activex.Control, WebBrowserModule.WebBrowser): + def OnBeforeNavigate2( + self, pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel + ): + self.GetParent().OnNavigate(URL) + # print "BeforeNavigate2", pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel + + +class BrowserFrame(window.MDIChildWnd): + def __init__(self, url=None): + if url is None: + self.url = regutil.GetRegisteredHelpFile("Main Python Documentation") + if self.url is None: + self.url = "http://www.python.org" + else: + self.url = url + pass # Dont call base class doc/view version... + + def Create(self, title, rect=None, parent=None): + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW + self._obj_ = win32ui.CreateMDIChild() + self._obj_.AttachObject(self) + self._obj_.CreateWindow(None, title, style, rect, parent) + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.ocx = MyWebBrowser() + self.ocx.CreateControl( + "Web Browser", win32con.WS_VISIBLE | win32con.WS_CHILD, rect, self, 1000 + ) + self.ocx.Navigate(self.url) + self.HookMessage(self.OnSize, win32con.WM_SIZE) + + def OnSize(self, params): + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.ocx.SetWindowPos(0, rect, 0) + + def OnNavigate(self, url): + title = "Web Browser - %s" % (url,) + self.SetWindowText(title) + + +def Demo(url=None): + if url is None and len(sys.argv) > 1: + url = win32api.GetFullPathName(sys.argv[1]) + f = BrowserFrame(url) + f.Create("Web Browser") + + +if __name__ == "__main__": + Demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/openGLDemo.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/openGLDemo.py new file mode 100644 index 0000000000000000000000000000000000000000..9274949dea90a07eba5bb964c85388bb8e5d2ddb --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/openGLDemo.py @@ -0,0 +1,370 @@ +# Ported from the win32 and MFC OpenGL Samples. + +import sys + +from pywin.mfc import docview + +try: + from OpenGL.GL import * # nopycln: import + from OpenGL.GLU import * # nopycln: import +except ImportError: + print("The OpenGL extensions do not appear to be installed.") + print("This Pythonwin demo can not run") + sys.exit(1) + +import timer +import win32api +import win32con +import win32ui + +PFD_TYPE_RGBA = 0 +PFD_TYPE_COLORINDEX = 1 +PFD_MAIN_PLANE = 0 +PFD_OVERLAY_PLANE = 1 +PFD_UNDERLAY_PLANE = -1 +PFD_DOUBLEBUFFER = 0x00000001 +PFD_STEREO = 0x00000002 +PFD_DRAW_TO_WINDOW = 0x00000004 +PFD_DRAW_TO_BITMAP = 0x00000008 +PFD_SUPPORT_GDI = 0x00000010 +PFD_SUPPORT_OPENGL = 0x00000020 +PFD_GENERIC_FORMAT = 0x00000040 +PFD_NEED_PALETTE = 0x00000080 +PFD_NEED_SYSTEM_PALETTE = 0x00000100 +PFD_SWAP_EXCHANGE = 0x00000200 +PFD_SWAP_COPY = 0x00000400 +PFD_SWAP_LAYER_BUFFERS = 0x00000800 +PFD_GENERIC_ACCELERATED = 0x00001000 +PFD_DEPTH_DONTCARE = 0x20000000 +PFD_DOUBLEBUFFER_DONTCARE = 0x40000000 +PFD_STEREO_DONTCARE = 0x80000000 + + +# threeto8 = [0, 0o111>>1, 0o222>>1, 0o333>>1, 0o444>>1, 0o555>>1, 0o666>>1, 0o377] +threeto8 = [0, 73 >> 1, 146 >> 1, 219 >> 1, 292 >> 1, 365 >> 1, 438 >> 1, 255] +twoto8 = [0, 0x55, 0xAA, 0xFF] +oneto8 = [0, 255] + + +def ComponentFromIndex(i, nbits, shift): + # val = (unsigned char) (i >> shift); + val = (i >> shift) & 0xF + if nbits == 1: + val = val & 0x1 + return oneto8[val] + elif nbits == 2: + val = val & 0x3 + return twoto8[val] + elif nbits == 3: + val = val & 0x7 + return threeto8[val] + else: + return 0 + + +OpenGLViewParent = docview.ScrollView + + +class OpenGLView(OpenGLViewParent): + def PreCreateWindow(self, cc): + self.HookMessage(self.OnSize, win32con.WM_SIZE) + # An OpenGL window must be created with the following flags and must not + # include CS_PARENTDC for the class style. Refer to SetPixelFormat + # documentation in the "Comments" section for further information. + style = cc[5] + style = style | win32con.WS_CLIPSIBLINGS | win32con.WS_CLIPCHILDREN + cc = cc[0], cc[1], cc[2], cc[3], cc[4], style, cc[6], cc[7], cc[8] + cc = self._obj_.PreCreateWindow(cc) + return cc + + def OnSize(self, params): + lParam = params[3] + cx = win32api.LOWORD(lParam) + cy = win32api.HIWORD(lParam) + glViewport(0, 0, cx, cy) + + if self.oldrect[2] > cx or self.oldrect[3] > cy: + self.RedrawWindow() + + self.OnSizeChange(cx, cy) + + self.oldrect = self.oldrect[0], self.oldrect[1], cx, cy + + def OnInitialUpdate(self): + self.SetScaleToFitSize( + (100, 100) + ) # or SetScrollSizes() - A Pythonwin requirement + return self._obj_.OnInitialUpdate() + + # return rc + + def OnCreate(self, cs): + self.oldrect = self.GetClientRect() + self._InitContexts() + self.Init() + + def OnDestroy(self, msg): + self.Term() + self._DestroyContexts() + return OpenGLViewParent.OnDestroy(self, msg) + + def OnDraw(self, dc): + self.DrawScene() + + def OnEraseBkgnd(self, dc): + return 1 + + # The OpenGL helpers + def _SetupPixelFormat(self): + dc = self.dc.GetSafeHdc() + pfd = CreatePIXELFORMATDESCRIPTOR() + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER + pfd.iPixelType = PFD_TYPE_RGBA + pfd.cColorBits = 24 + pfd.cDepthBits = 32 + pfd.iLayerType = PFD_MAIN_PLANE + pixelformat = ChoosePixelFormat(dc, pfd) + SetPixelFormat(dc, pixelformat, pfd) + self._CreateRGBPalette() + + def _CreateRGBPalette(self): + dc = self.dc.GetSafeHdc() + n = GetPixelFormat(dc) + pfd = DescribePixelFormat(dc, n) + if pfd.dwFlags & PFD_NEED_PALETTE: + n = 1 << pfd.cColorBits + pal = [] + for i in range(n): + this = ( + ComponentFromIndex(i, pfd.cRedBits, pfd.cRedShift), + ComponentFromIndex(i, pfd.cGreenBits, pfd.cGreenShift), + ComponentFromIndex(i, pfd.cBlueBits, pfd.cBlueShift), + 0, + ) + pal.append(this) + hpal = win32ui.CreatePalette(pal) + self.dc.SelectPalette(hpal, 0) + self.dc.RealizePalette() + + def _InitContexts(self): + self.dc = self.GetDC() + self._SetupPixelFormat() + hrc = wglCreateContext(self.dc.GetSafeHdc()) + wglMakeCurrent(self.dc.GetSafeHdc(), hrc) + + def _DestroyContexts(self): + hrc = wglGetCurrentContext() + wglMakeCurrent(0, 0) + if hrc: + wglDeleteContext(hrc) + + # The methods to support OpenGL + def DrawScene(self): + assert 0, "You must override this method" + + def Init(self): + assert 0, "You must override this method" + + def OnSizeChange(self, cx, cy): + pass + + def Term(self): + pass + + +class TestView(OpenGLView): + def OnSizeChange(self, right, bottom): + glClearColor(0.0, 0.0, 0.0, 1.0) + glClearDepth(1.0) + glEnable(GL_DEPTH_TEST) + + glMatrixMode(GL_PROJECTION) + if bottom: + aspect = right / bottom + else: + aspect = 0 # When window created! + glLoadIdentity() + gluPerspective(45.0, aspect, 3.0, 7.0) + glMatrixMode(GL_MODELVIEW) + + near_plane = 3.0 + far_plane = 7.0 + maxObjectSize = 3.0 + self.radius = near_plane + maxObjectSize / 2.0 + + def Init(self): + pass + + def DrawScene(self): + glClearColor(0.0, 0.0, 0.0, 1.0) + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) + + glPushMatrix() + glTranslatef(0.0, 0.0, -self.radius) + + self._DrawCone() + + self._DrawPyramid() + + glPopMatrix() + glFinish() + + SwapBuffers(wglGetCurrentDC()) + + def _DrawCone(self): + glColor3f(0.0, 1.0, 0.0) + + glPushMatrix() + glTranslatef(-1.0, 0.0, 0.0) + quadObj = gluNewQuadric() + gluQuadricDrawStyle(quadObj, GLU_FILL) + gluQuadricNormals(quadObj, GLU_SMOOTH) + gluCylinder(quadObj, 1.0, 0.0, 1.0, 20, 10) + # gluDeleteQuadric(quadObj); + glPopMatrix() + + def _DrawPyramid(self): + glPushMatrix() + glTranslatef(1.0, 0.0, 0.0) + glBegin(GL_TRIANGLE_FAN) + glColor3f(1.0, 0.0, 0.0) + glVertex3f(0.0, 1.0, 0.0) + glColor3f(0.0, 1.0, 0.0) + glVertex3f(-1.0, 0.0, 0.0) + glColor3f(0.0, 0.0, 1.0) + glVertex3f(0.0, 0.0, 1.0) + glColor3f(0.0, 1.0, 0.0) + glVertex3f(1.0, 0.0, 0.0) + glEnd() + glPopMatrix() + + +class CubeView(OpenGLView): + def OnSizeChange(self, right, bottom): + glClearColor(0.0, 0.0, 0.0, 1.0) + glClearDepth(1.0) + glEnable(GL_DEPTH_TEST) + + glMatrixMode(GL_PROJECTION) + if bottom: + aspect = right / bottom + else: + aspect = 0 # When window created! + glLoadIdentity() + gluPerspective(45.0, aspect, 3.0, 7.0) + glMatrixMode(GL_MODELVIEW) + + near_plane = 3.0 + far_plane = 7.0 + maxObjectSize = 3.0 + self.radius = near_plane + maxObjectSize / 2.0 + + def Init(self): + self.busy = 0 + self.wAngleY = 10.0 + self.wAngleX = 1.0 + self.wAngleZ = 5.0 + self.timerid = timer.set_timer(150, self.OnTimer) + + def OnTimer(self, id, timeVal): + self.DrawScene() + + def Term(self): + timer.kill_timer(self.timerid) + + def DrawScene(self): + if self.busy: + return + self.busy = 1 + + glClearColor(0.0, 0.0, 0.0, 1.0) + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) + + glPushMatrix() + + glTranslatef(0.0, 0.0, -self.radius) + glRotatef(self.wAngleX, 1.0, 0.0, 0.0) + glRotatef(self.wAngleY, 0.0, 1.0, 0.0) + glRotatef(self.wAngleZ, 0.0, 0.0, 1.0) + + self.wAngleX = self.wAngleX + 1.0 + self.wAngleY = self.wAngleY + 10.0 + self.wAngleZ = self.wAngleZ + 5.0 + + glBegin(GL_QUAD_STRIP) + glColor3f(1.0, 0.0, 1.0) + glVertex3f(-0.5, 0.5, 0.5) + + glColor3f(1.0, 0.0, 0.0) + glVertex3f(-0.5, -0.5, 0.5) + + glColor3f(1.0, 1.0, 1.0) + glVertex3f(0.5, 0.5, 0.5) + + glColor3f(1.0, 1.0, 0.0) + glVertex3f(0.5, -0.5, 0.5) + + glColor3f(0.0, 1.0, 1.0) + glVertex3f(0.5, 0.5, -0.5) + + glColor3f(0.0, 1.0, 0.0) + glVertex3f(0.5, -0.5, -0.5) + + glColor3f(0.0, 0.0, 1.0) + glVertex3f(-0.5, 0.5, -0.5) + + glColor3f(0.0, 0.0, 0.0) + glVertex3f(-0.5, -0.5, -0.5) + + glColor3f(1.0, 0.0, 1.0) + glVertex3f(-0.5, 0.5, 0.5) + + glColor3f(1.0, 0.0, 0.0) + glVertex3f(-0.5, -0.5, 0.5) + + glEnd() + + glBegin(GL_QUADS) + glColor3f(1.0, 0.0, 1.0) + glVertex3f(-0.5, 0.5, 0.5) + + glColor3f(1.0, 1.0, 1.0) + glVertex3f(0.5, 0.5, 0.5) + + glColor3f(0.0, 1.0, 1.0) + glVertex3f(0.5, 0.5, -0.5) + + glColor3f(0.0, 0.0, 1.0) + glVertex3f(-0.5, 0.5, -0.5) + glEnd() + + glBegin(GL_QUADS) + glColor3f(1.0, 0.0, 0.0) + glVertex3f(-0.5, -0.5, 0.5) + + glColor3f(1.0, 1.0, 0.0) + glVertex3f(0.5, -0.5, 0.5) + + glColor3f(0.0, 1.0, 0.0) + glVertex3f(0.5, -0.5, -0.5) + + glColor3f(0.0, 0.0, 0.0) + glVertex3f(-0.5, -0.5, -0.5) + glEnd() + + glPopMatrix() + + glFinish() + SwapBuffers(wglGetCurrentDC()) + + self.busy = 0 + + +def test(): + template = docview.DocTemplate(None, None, None, CubeView) + # template = docview.DocTemplate(None, None, None, TestView ) + template.OpenDocumentFile(None) + + +if __name__ == "__main__": + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/progressbar.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/progressbar.py new file mode 100644 index 0000000000000000000000000000000000000000..81cd7e381d7677aad6220f3627dfbaa220e32a10 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/progressbar.py @@ -0,0 +1,105 @@ +# +# Progress bar control example +# +# PyCProgressCtrl encapsulates the MFC CProgressCtrl class. To use it, +# you: +# +# - Create the control with win32ui.CreateProgressCtrl() +# - Create the control window with PyCProgressCtrl.CreateWindow() +# - Initialize the range if you want it to be other than (0, 100) using +# PyCProgressCtrl.SetRange() +# - Either: +# - Set the step size with PyCProgressCtrl.SetStep(), and +# - Increment using PyCProgressCtrl.StepIt() +# or: +# - Set the amount completed using PyCProgressCtrl.SetPos() +# +# Example and progress bar code courtesy of KDL Technologies, Ltd., Hong Kong SAR, China. +# + +import win32con +import win32ui +from pywin.mfc import dialog + + +def MakeDlgTemplate(): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + + w = 215 + h = 36 + + dlg = [ + [ + "Progress bar control example", + (0, 0, w, h), + style, + None, + (8, "MS Sans Serif"), + ], + ] + + s = win32con.WS_TABSTOP | cs + + dlg.append( + [ + 128, + "Tick", + win32con.IDOK, + (10, h - 18, 50, 14), + s | win32con.BS_DEFPUSHBUTTON, + ] + ) + + dlg.append( + [ + 128, + "Cancel", + win32con.IDCANCEL, + (w - 60, h - 18, 50, 14), + s | win32con.BS_PUSHBUTTON, + ] + ) + + return dlg + + +class TestDialog(dialog.Dialog): + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + self.pbar = win32ui.CreateProgressCtrl() + self.pbar.CreateWindow( + win32con.WS_CHILD | win32con.WS_VISIBLE, (10, 10, 310, 24), self, 1001 + ) + # self.pbar.SetStep (5) + self.progress = 0 + self.pincr = 5 + return rc + + def OnOK(self): + # NB: StepIt wraps at the end if you increment past the upper limit! + # self.pbar.StepIt() + self.progress = self.progress + self.pincr + if self.progress > 100: + self.progress = 100 + if self.progress <= 100: + self.pbar.SetPos(self.progress) + + +def demo(modal=0): + d = TestDialog(MakeDlgTemplate()) + if modal: + d.DoModal() + else: + d.CreateWindow() + + +if __name__ == "__main__": + demo(1) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/sliderdemo.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/sliderdemo.py new file mode 100644 index 0000000000000000000000000000000000000000..9fc7b570576f569ff57da97560eb5dab806cbc75 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/sliderdemo.py @@ -0,0 +1,76 @@ +# sliderdemo.py +# Demo of the slider control courtesy of Mike Fletcher. + +import win32con +import win32ui +from pywin.mfc import dialog + + +class MyDialog(dialog.Dialog): + """ + Example using simple controls + """ + + _dialogstyle = ( + win32con.WS_MINIMIZEBOX + | win32con.WS_DLGFRAME + | win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + _buttonstyle = ( + win32con.BS_PUSHBUTTON + | win32con.WS_TABSTOP + | win32con.WS_CHILD + | win32con.WS_VISIBLE + ) + ### The static template, contains all "normal" dialog items + DIALOGTEMPLATE = [ + # the dialog itself is the first element in the template + ["Example slider", (0, 0, 50, 43), _dialogstyle, None, (8, "MS SansSerif")], + # rest of elements are the controls within the dialog + # standard "Close" button + [128, "Close", win32con.IDCANCEL, (0, 30, 50, 13), _buttonstyle], + ] + ### ID of the control to be created during dialog initialisation + IDC_SLIDER = 9500 + + def __init__(self): + dialog.Dialog.__init__(self, self.DIALOGTEMPLATE) + + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + # now initialise your controls that you want to create + # programmatically, including those which are OLE controls + # those created directly by win32ui.Create* + # and your "custom controls" which are subclasses/whatever + win32ui.EnableControlContainer() + self.slider = win32ui.CreateSliderCtrl() + self.slider.CreateWindow( + win32con.WS_TABSTOP | win32con.WS_VISIBLE, + (0, 0, 100, 30), + self._obj_, + self.IDC_SLIDER, + ) + self.HookMessage(self.OnSliderMove, win32con.WM_HSCROLL) + return rc + + def OnSliderMove(self, params): + print("Slider moved") + + def OnCancel(self): + print("The slider control is at position", self.slider.GetPos()) + self._obj_.OnCancel() + + +### +def demo(): + dia = MyDialog() + dia.DoModal() + + +if __name__ == "__main__": + demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/splittst.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/splittst.py new file mode 100644 index 0000000000000000000000000000000000000000..0114bf09a3ec8f40de4c6678a7f1dcee63d98cdc --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/splittst.py @@ -0,0 +1,79 @@ +import commctrl +import fontdemo +import win32ui +from pywin.mfc import docview, window + +# derive from CMDIChild. This does much work for us. + + +class SplitterFrame(window.MDIChildWnd): + def __init__(self): + # call base CreateFrame + self.images = None + window.MDIChildWnd.__init__(self) + + def OnCreateClient(self, cp, context): + splitter = win32ui.CreateSplitter() + doc = context.doc + frame_rect = self.GetWindowRect() + size = ((frame_rect[2] - frame_rect[0]), (frame_rect[3] - frame_rect[1]) // 2) + sub_size = (size[0] // 2, size[1]) + splitter.CreateStatic(self, 2, 1) + self.v1 = win32ui.CreateEditView(doc) + self.v2 = fontdemo.FontView(doc) + # CListControl view + self.v3 = win32ui.CreateListView(doc) + sub_splitter = win32ui.CreateSplitter() + # pass "splitter" so each view knows how to get to the others + sub_splitter.CreateStatic(splitter, 1, 2) + sub_splitter.CreateView(self.v1, 0, 0, (sub_size)) + sub_splitter.CreateView(self.v2, 0, 1, (0, 0)) # size ignored. + splitter.SetRowInfo(0, size[1], 0) + splitter.CreateView(self.v3, 1, 0, (0, 0)) # size ignored. + # Setup items in the imagelist + self.images = win32ui.CreateImageList(32, 32, 1, 5, 5) + self.images.Add(win32ui.GetApp().LoadIcon(win32ui.IDR_MAINFRAME)) + self.images.Add(win32ui.GetApp().LoadIcon(win32ui.IDR_PYTHONCONTYPE)) + self.images.Add(win32ui.GetApp().LoadIcon(win32ui.IDR_TEXTTYPE)) + self.v3.SetImageList(self.images, commctrl.LVSIL_NORMAL) + self.v3.InsertItem(0, "Icon 1", 0) + self.v3.InsertItem(0, "Icon 2", 1) + self.v3.InsertItem(0, "Icon 3", 2) + # self.v3.Arrange(commctrl.LVA_DEFAULT) Hmmm - win95 aligns left always??? + return 1 + + def OnDestroy(self, msg): + window.MDIChildWnd.OnDestroy(self, msg) + if self.images: + self.images.DeleteImageList() + self.images = None + + def InitialUpdateFrame(self, doc, makeVisible): + self.v1.ReplaceSel("Hello from Edit Window 1") + self.v1.SetModifiedFlag(0) + + +class SampleTemplate(docview.DocTemplate): + def __init__(self): + docview.DocTemplate.__init__( + self, win32ui.IDR_PYTHONTYPE, None, SplitterFrame, None + ) + + def InitialUpdateFrame(self, frame, doc, makeVisible): + # print "frame is ", frame, frame._obj_ + # print "doc is ", doc, doc._obj_ + self._obj_.InitialUpdateFrame(frame, doc, makeVisible) # call default handler. + frame.InitialUpdateFrame(doc, makeVisible) + + +def demo(): + template = SampleTemplate() + doc = template.OpenDocumentFile(None) + doc.SetTitle("Splitter Demo") + + +if __name__ == "__main__": + import demoutils + + if demoutils.NeedGoodGUI(): + demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/threadedgui.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/threadedgui.py new file mode 100644 index 0000000000000000000000000000000000000000..bbe1369e482fda1475298c52400ce12c1aa46a08 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/threadedgui.py @@ -0,0 +1,189 @@ +# Demo of using just windows, without documents and views. + +# Also demo of a GUI thread, pretty much direct from the MFC C++ sample MTMDI. + +import timer +import win32api +import win32con +import win32ui +from pywin.mfc import docview, thread, window +from pywin.mfc.thread import WinThread + +WM_USER_PREPARE_TO_CLOSE = win32con.WM_USER + 32 + +# font is a dictionary in which the following elements matter: +# (the best matching font to supplied parameters is returned) +# name string name of the font as known by Windows +# size point size of font in logical units +# weight weight of font (win32con.FW_NORMAL, win32con.FW_BOLD) +# italic boolean; true if set to anything but None +# underline boolean; true if set to anything but None + + +# This window is a child window of a frame. It is not the frame window itself. +class FontWindow(window.Wnd): + def __init__(self, text="Python Rules!"): + window.Wnd.__init__(self) + self.text = text + self.index = 0 + self.incr = 1 + self.width = self.height = 0 + self.ChangeAttributes() + # set up message handlers + + def Create(self, title, style, rect, parent): + classStyle = win32con.CS_HREDRAW | win32con.CS_VREDRAW + className = win32ui.RegisterWndClass( + classStyle, 0, win32con.COLOR_WINDOW + 1, 0 + ) + self._obj_ = win32ui.CreateWnd() + self._obj_.AttachObject(self) + self._obj_.CreateWindow( + className, title, style, rect, parent, win32ui.AFX_IDW_PANE_FIRST + ) + self.HookMessage(self.OnSize, win32con.WM_SIZE) + self.HookMessage(self.OnPrepareToClose, WM_USER_PREPARE_TO_CLOSE) + self.HookMessage(self.OnDestroy, win32con.WM_DESTROY) + self.timerid = timer.set_timer(100, self.OnTimer) + self.InvalidateRect() + + def OnDestroy(self, msg): + timer.kill_timer(self.timerid) + + def OnTimer(self, id, timeVal): + self.index = self.index + self.incr + if self.index > len(self.text): + self.incr = -1 + self.index = len(self.text) + elif self.index < 0: + self.incr = 1 + self.index = 0 + self.InvalidateRect() + + def OnPaint(self): + # print "Paint message from thread", win32api.GetCurrentThreadId() + dc, paintStruct = self.BeginPaint() + self.OnPrepareDC(dc, None) + + if self.width == 0 and self.height == 0: + left, top, right, bottom = self.GetClientRect() + self.width = right - left + self.height = bottom - top + x, y = self.width // 2, self.height // 2 + dc.TextOut(x, y, self.text[: self.index]) + self.EndPaint(paintStruct) + + def ChangeAttributes(self): + font_spec = {"name": "Arial", "height": 42} + self.font = win32ui.CreateFont(font_spec) + + def OnPrepareToClose(self, params): + self.DestroyWindow() + + def OnSize(self, params): + lParam = params[3] + self.width = win32api.LOWORD(lParam) + self.height = win32api.HIWORD(lParam) + + def OnPrepareDC(self, dc, printinfo): + # Set up the DC for forthcoming OnDraw call + dc.SetTextColor(win32api.RGB(0, 0, 255)) + dc.SetBkColor(win32api.GetSysColor(win32con.COLOR_WINDOW)) + dc.SelectObject(self.font) + dc.SetTextAlign(win32con.TA_CENTER | win32con.TA_BASELINE) + + +class FontFrame(window.MDIChildWnd): + def __init__(self): + pass # Dont call base class doc/view version... + + def Create(self, title, rect=None, parent=None): + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW + self._obj_ = win32ui.CreateMDIChild() + self._obj_.AttachObject(self) + + self._obj_.CreateWindow(None, title, style, rect, parent) + rect = self.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + self.child = FontWindow("Not threaded") + self.child.Create( + "FontDemo", win32con.WS_CHILD | win32con.WS_VISIBLE, rect, self + ) + + +class TestThread(WinThread): + def __init__(self, parentWindow): + self.parentWindow = parentWindow + self.child = None + WinThread.__init__(self) + + def InitInstance(self): + rect = self.parentWindow.GetClientRect() + rect = (0, 0, rect[2] - rect[0], rect[3] - rect[1]) + + self.child = FontWindow() + self.child.Create( + "FontDemo", win32con.WS_CHILD | win32con.WS_VISIBLE, rect, self.parentWindow + ) + self.SetMainFrame(self.child) + return WinThread.InitInstance(self) + + def ExitInstance(self): + return 0 + + +class ThreadedFontFrame(window.MDIChildWnd): + def __init__(self): + pass # Dont call base class doc/view version... + self.thread = None + + def Create(self, title, rect=None, parent=None): + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW + self._obj_ = win32ui.CreateMDIChild() + self._obj_.CreateWindow(None, title, style, rect, parent) + self._obj_.HookMessage(self.OnDestroy, win32con.WM_DESTROY) + self._obj_.HookMessage(self.OnSize, win32con.WM_SIZE) + + self.thread = TestThread(self) + self.thread.CreateThread() + + def OnSize(self, msg): + pass + + def OnDestroy(self, msg): + win32ui.OutputDebugString("OnDestroy\n") + if self.thread and self.thread.child: + child = self.thread.child + child.SendMessage(WM_USER_PREPARE_TO_CLOSE, 0, 0) + win32ui.OutputDebugString("Destroyed\n") + + +def Demo(): + f = FontFrame() + f.Create("Font Demo") + + +def ThreadedDemo(): + rect = win32ui.GetMainFrame().GetMDIClient().GetClientRect() + rect = rect[0], int(rect[3] * 3 / 4), int(rect[2] / 4), rect[3] + incr = rect[2] + for i in range(4): + if i == 0: + f = FontFrame() + title = "Not threaded" + else: + f = ThreadedFontFrame() + title = "Threaded GUI Demo" + f.Create(title, rect) + rect = rect[0] + incr, rect[1], rect[2] + incr, rect[3] + # Givem a chance to start + win32api.Sleep(100) + win32ui.PumpWaitingMessages() + + +if __name__ == "__main__": + import demoutils + + if demoutils.NeedGoodGUI(): + ThreadedDemo() +# Demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/toolbar.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/toolbar.py new file mode 100644 index 0000000000000000000000000000000000000000..e56aefef18fd3440fd747cb86861149877c8cf9f --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/Demos/toolbar.py @@ -0,0 +1,106 @@ +# Demo of ToolBars + +# Shows the toolbar control. +# Demos how to make custom tooltips, etc. + +import commctrl +import win32api +import win32con +import win32ui +from pywin.mfc import afxres, docview, window + + +class GenericFrame(window.MDIChildWnd): + def OnCreateClient(self, cp, context): + # handlers for toolbar buttons + self.HookCommand(self.OnPrevious, 401) + self.HookCommand(self.OnNext, 402) + # Its not necessary for us to hook both of these - the + # common controls should fall-back all by themselves. + # Indeed, given we hook TTN_NEEDTEXTW, commctrl.TTN_NEEDTEXTA + # will not be called. + self.HookNotify(self.GetTTText, commctrl.TTN_NEEDTEXT) + self.HookNotify(self.GetTTText, commctrl.TTN_NEEDTEXTW) + + # parent = win32ui.GetMainFrame() + parent = self + style = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | afxres.CBRS_SIZE_DYNAMIC + | afxres.CBRS_TOP + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + ) + + buttons = (win32ui.ID_APP_ABOUT, win32ui.ID_VIEW_INTERACTIVE) + bitmap = win32ui.IDB_BROWSER_HIER + tbid = 0xE840 + self.toolbar = tb = win32ui.CreateToolBar(parent, style, tbid) + tb.LoadBitmap(bitmap) + tb.SetButtons(buttons) + + tb.EnableDocking(afxres.CBRS_ALIGN_ANY) + tb.SetWindowText("Test") + parent.EnableDocking(afxres.CBRS_ALIGN_ANY) + parent.DockControlBar(tb) + parent.LoadBarState("ToolbarTest") + window.MDIChildWnd.OnCreateClient(self, cp, context) + return 1 + + def OnDestroy(self, msg): + self.SaveBarState("ToolbarTest") + + def GetTTText(self, std, extra): + (hwndFrom, idFrom, code) = std + text, hinst, flags = extra + if flags & commctrl.TTF_IDISHWND: + return # Not handled + if idFrom == win32ui.ID_APP_ABOUT: + # our 'extra' return value needs to be the following + # entries from a NMTTDISPINFO[W] struct: + # (szText, hinst, uFlags). None means 'don't change + # the value' + return 0, ("It works!", None, None) + return None # not handled. + + def GetMessageString(self, id): + if id == win32ui.ID_APP_ABOUT: + return "Dialog Test\nTest" + else: + return self._obj_.GetMessageString(id) + + def OnSize(self, params): + print("OnSize called with ", params) + + def OnNext(self, id, cmd): + print("OnNext called") + + def OnPrevious(self, id, cmd): + print("OnPrevious called") + + +msg = """\ +This toolbar was dynamically created.\r +\r +The first item's tooltips is provided by Python code.\r +\r +(Dont close the window with the toolbar in a floating state - it may not re-appear!)\r +""" + + +def test(): + template = docview.DocTemplate( + win32ui.IDR_PYTHONTYPE, None, GenericFrame, docview.EditView + ) + doc = template.OpenDocumentFile(None) + doc.SetTitle("Toolbar Test") + view = doc.GetFirstView() + view.SetWindowText(msg) + + +if __name__ == "__main__": + import demoutils + + if demoutils.NeedGoodGUI(): + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/IDLE.cfg b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/IDLE.cfg new file mode 100644 index 0000000000000000000000000000000000000000..b1987b14c1c7ba33a8950ccd350537ad7fa0b59f --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/IDLE.cfg @@ -0,0 +1,29 @@ +[General] +# We base this configuration on the default config. +# You can list "Based On" as many times as you like +Based On = default + +[Keys] +# Only list keys different to default. +# Note you may wish to rebind some of the default +# Pythonwin keys to "Beep" or "DoNothing" + +Alt+L = LocateSelectedFile +Ctrl+Q = AppExit + +# Other non-default Pythonwin keys +Alt+A = EditSelectAll +Alt+M = LocateModule + +# Movement +Ctrl+D = GotoEndOfFile + +# Tabs and other indent features +Alt+T = <> +Ctrl+[ = <> +Ctrl+] = <> + +[Keys:Interactive] +Alt+P = <> +Alt+N = <> + diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2e44fba5ca11a1242c6359738b8473e3245386e5 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/__init__.py @@ -0,0 +1,10 @@ +# is_platform_unicode is an old variable that was never correctly used and +# is no longer referenced in pywin32. It is staying for a few releases incase +# others are looking at it, but it will go away soon! +is_platform_unicode = 0 + +# Ditto default_platform_encoding - not referenced and will die. +default_platform_encoding = "mbcs" + +# This one *is* real and used - but in practice can't be changed. +default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5f41960d362087fe29e05e2f8fb460ac07fa8dde --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/__init__.py @@ -0,0 +1,139 @@ +import sys + + +# Some cruft to deal with the Pythonwin GUI booting up from a non GUI app. +def _MakeDebuggerGUI(): + app.InitInstance() + + +isInprocApp = -1 + + +def _CheckNeedGUI(): + global isInprocApp + if isInprocApp == -1: + import win32ui + + isInprocApp = win32ui.GetApp().IsInproc() + if isInprocApp: + # MAY Need it - may already have one + need = "pywin.framework.app" not in sys.modules + else: + need = 0 + if need: + import pywin.framework.app + + from . import dbgpyapp + + pywin.framework.app.CreateDefaultGUI(dbgpyapp.DebuggerPythonApp) + + else: + # Check we have the appropriate editor + # No longer necessary! + pass + return need + + +# Inject some methods in the top level name-space. +currentDebugger = None # Wipe out any old one on reload. + + +def _GetCurrentDebugger(): + global currentDebugger + if currentDebugger is None: + _CheckNeedGUI() + from . import debugger + + currentDebugger = debugger.Debugger() + return currentDebugger + + +def GetDebugger(): + # An error here is not nice - as we are probably trying to + # break into the debugger on a Python error, any + # error raised by this is usually silent, and causes + # big problems later! + try: + rc = _GetCurrentDebugger() + rc.GUICheckInit() + return rc + except: + print("Could not create the debugger!") + import traceback + + traceback.print_exc() + return None + + +def close(): + if currentDebugger is not None: + currentDebugger.close() + + +def run(cmd, globals=None, locals=None, start_stepping=1): + _GetCurrentDebugger().run(cmd, globals, locals, start_stepping) + + +def runeval(expression, globals=None, locals=None): + return _GetCurrentDebugger().runeval(expression, globals, locals) + + +def runcall(*args): + return _GetCurrentDebugger().runcall(*args) + + +def set_trace(): + import sys + + d = _GetCurrentDebugger() + + if d.frameShutdown: + return # App closing + + if d.stopframe != d.botframe: + # If im not "running" + return + + sys.settrace(None) # May be hooked + d.reset() + d.set_trace() + + +# "brk" is an alias for "set_trace" ("break" is a reserved word :-( +brk = set_trace + +# Post-Mortem interface + + +def post_mortem(t=None): + if t is None: + t = sys.exc_info()[2] # Will be valid if we are called from an except handler. + if t is None: + try: + t = sys.last_traceback + except AttributeError: + print( + "No traceback can be found from which to perform post-mortem debugging!" + ) + print("No debugging can continue") + return + p = _GetCurrentDebugger() + if p.frameShutdown: + return # App closing + # No idea why I need to settrace to None - it should have been reset by now? + sys.settrace(None) + p.reset() + while t.tb_next != None: + t = t.tb_next + p.bAtPostMortem = 1 + p.prep_run(None) + try: + p.interaction(t.tb_frame, t) + finally: + t = None + p.bAtPostMortem = 0 + p.done_run() + + +def pm(t=None): + post_mortem(t) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/configui.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/configui.py new file mode 100644 index 0000000000000000000000000000000000000000..32de4ee5ff0c25fe33b4b71b594c914553eb88ef --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/configui.py @@ -0,0 +1,34 @@ +import win32ui +from pywin.mfc import dialog + +from . import dbgcon + + +class DebuggerOptionsPropPage(dialog.PropertyPage): + def __init__(self): + dialog.PropertyPage.__init__(self, win32ui.IDD_PP_DEBUGGER) + + def OnInitDialog(self): + options = self.options = dbgcon.LoadDebuggerOptions() + self.AddDDX(win32ui.IDC_CHECK1, dbgcon.OPT_HIDE) + self[dbgcon.OPT_STOP_EXCEPTIONS] = options[dbgcon.OPT_STOP_EXCEPTIONS] + self.AddDDX(win32ui.IDC_CHECK2, dbgcon.OPT_STOP_EXCEPTIONS) + self[dbgcon.OPT_HIDE] = options[dbgcon.OPT_HIDE] + return dialog.PropertyPage.OnInitDialog(self) + + def OnOK(self): + self.UpdateData() + dirty = 0 + for key, val in list(self.items()): + if key in self.options: + if self.options[key] != val: + self.options[key] = val + dirty = 1 + if dirty: + dbgcon.SaveDebuggerOptions(self.options) + # If there is a debugger open, then set its options. + import pywin.debugger + + if pywin.debugger.currentDebugger is not None: + pywin.debugger.currentDebugger.options = self.options + return 1 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/dbgcon.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/dbgcon.py new file mode 100644 index 0000000000000000000000000000000000000000..402ec64b353a793e1ff5cf2f3c4a113957d6fba9 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/dbgcon.py @@ -0,0 +1,32 @@ +# General constants for the debugger + +DBGSTATE_NOT_DEBUGGING = 0 +DBGSTATE_RUNNING = 1 +DBGSTATE_BREAK = 2 +DBGSTATE_QUITTING = 3 # Attempting to back out of the debug session. + +LINESTATE_CURRENT = 0x1 # This line is where we are stopped +LINESTATE_BREAKPOINT = 0x2 # This line is a breakpoint +LINESTATE_CALLSTACK = 0x4 # This line is in the callstack. + +OPT_HIDE = "hide" +OPT_STOP_EXCEPTIONS = "stopatexceptions" + +import win32api +import win32ui + + +def DoGetOption(optsDict, optName, default): + optsDict[optName] = win32ui.GetProfileVal("Debugger Options", optName, default) + + +def LoadDebuggerOptions(): + opts = {} + DoGetOption(opts, OPT_HIDE, 0) + DoGetOption(opts, OPT_STOP_EXCEPTIONS, 1) + return opts + + +def SaveDebuggerOptions(opts): + for key, val in opts.items(): + win32ui.WriteProfileVal("Debugger Options", key, val) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/dbgpyapp.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/dbgpyapp.py new file mode 100644 index 0000000000000000000000000000000000000000..207f404938e60e5bf01301c614d5602f8d1832c2 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/dbgpyapp.py @@ -0,0 +1,48 @@ +# dbgpyapp.py - Debugger Python application class +# +import sys + +import win32con +import win32ui +from pywin.framework import intpyapp + +version = "0.3.0" + + +class DebuggerPythonApp(intpyapp.InteractivePythonApp): + def LoadMainFrame(self): + "Create the main applications frame" + self.frame = self.CreateMainFrame() + self.SetMainFrame(self.frame) + self.frame.LoadFrame(win32ui.IDR_DEBUGGER, win32con.WS_OVERLAPPEDWINDOW) + self.frame.DragAcceptFiles() # we can accept these. + self.frame.ShowWindow(win32con.SW_HIDE) + self.frame.UpdateWindow() + + # but we do rehook, hooking the new code objects. + self.HookCommands() + + def InitInstance(self): + # Use a registry path of "Python\Pythonwin Debugger + win32ui.SetAppName(win32ui.LoadString(win32ui.IDR_DEBUGGER)) + win32ui.SetRegistryKey("Python %s" % (sys.winver,)) + # We _need_ the Scintilla color editor. + # (and we _always_ get it now :-) + + numMRU = win32ui.GetProfileVal("Settings", "Recent File List Size", 10) + win32ui.LoadStdProfileSettings(numMRU) + + self.LoadMainFrame() + + # Display the interactive window if the user wants it. + from pywin.framework import interact + + interact.CreateInteractiveWindowUserPreference() + + # Load the modules we use internally. + self.LoadSystemModules() + # Load additional module the user may want. + self.LoadUserModules() + + # win32ui.CreateDebuggerThread() + win32ui.EnableControlContainer() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/debugger.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/debugger.py new file mode 100644 index 0000000000000000000000000000000000000000..4acf9bc4d29f4d0032858a329f1f577d6c309e82 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/debugger.py @@ -0,0 +1,1105 @@ +# debugger.py + +# A debugger for Pythonwin. Built from pdb. + +# Mark Hammond (MHammond@skippinet.com.au) - Dec 94. + +# usage: +# >>> import pywin.debugger +# >>> pywin.debugger.GetDebugger().run("command") + +import bdb +import os +import pdb +import string +import sys +import traceback +import types + +import commctrl +import pywin.docking.DockingBar +import win32api +import win32con +import win32ui +from pywin.framework import app, editor, interact, scriptutils +from pywin.framework.editor.color.coloreditor import MARKER_BREAKPOINT, MARKER_CURRENT +from pywin.mfc import afxres, dialog, object, window +from pywin.tools import browser, hierlist + +# import win32traceutil +if win32ui.UNICODE: + LVN_ENDLABELEDIT = commctrl.LVN_ENDLABELEDITW +else: + LVN_ENDLABELEDIT = commctrl.LVN_ENDLABELEDITA + +from .dbgcon import * + +error = "pywin.debugger.error" + + +def SetInteractiveContext(globs, locs): + if interact.edit is not None and interact.edit.currentView is not None: + interact.edit.currentView.SetContext(globs, locs) + + +def _LineStateToMarker(ls): + if ls == LINESTATE_CURRENT: + return MARKER_CURRENT + # elif ls == LINESTATE_CALLSTACK: + # return MARKER_CALLSTACK + return MARKER_BREAKPOINT + + +class HierListItem(browser.HLIPythonObject): + pass + + +class HierFrameItem(HierListItem): + def __init__(self, frame, debugger): + HierListItem.__init__(self, frame, repr(frame)) + self.debugger = debugger + + def GetText(self): + name = self.myobject.f_code.co_name + if not name or name == "?": + # See if locals has a '__name__' (ie, a module) + if "__name__" in self.myobject.f_locals: + name = str(self.myobject.f_locals["__name__"]) + " module" + else: + name = "" + + return "%s (%s:%d)" % ( + name, + os.path.split(self.myobject.f_code.co_filename)[1], + self.myobject.f_lineno, + ) + + def GetBitmapColumn(self): + if self.debugger.curframe is self.myobject: + return 7 + else: + return 8 + + def GetSubList(self): + ret = [] + ret.append(HierFrameDict(self.myobject.f_locals, "Locals", 2)) + ret.append(HierFrameDict(self.myobject.f_globals, "Globals", 1)) + return ret + + def IsExpandable(self): + return 1 + + def TakeDefaultAction(self): + # Set the default frame to be this frame. + self.debugger.set_cur_frame(self.myobject) + return 1 + + +class HierFrameDict(browser.HLIDict): + def __init__(self, dict, name, bitmapColumn): + self.bitmapColumn = bitmapColumn + browser.HLIDict.__init__(self, dict, name) + + def GetBitmapColumn(self): + return self.bitmapColumn + + +class NoStackAvailableItem(HierListItem): + def __init__(self, why): + HierListItem.__init__(self, None, why) + + def IsExpandable(self): + return 0 + + def GetText(self): + return self.name + + def GetBitmapColumn(self): + return 8 + + +class HierStackRoot(HierListItem): + def __init__(self, debugger): + HierListItem.__init__(self, debugger, None) + self.last_stack = [] + + ## def __del__(self): + ## print "HierStackRoot dieing" + def GetSubList(self): + debugger = self.myobject + # print self.debugger.stack, self.debugger.curframe + ret = [] + if debugger.debuggerState == DBGSTATE_BREAK: + stackUse = debugger.stack[:] + stackUse.reverse() + self.last_stack = [] + for frame, lineno in stackUse: + self.last_stack.append((frame, lineno)) + if ( + frame is debugger.userbotframe + ): # Dont bother showing frames below our bottom frame. + break + for frame, lineno in self.last_stack: + ret.append(HierFrameItem(frame, debugger)) + ## elif debugger.debuggerState==DBGSTATE_NOT_DEBUGGING: + ## ret.append(NoStackAvailableItem('')) + ## else: + ## ret.append(NoStackAvailableItem('')) + return ret + + def GetText(self): + return "root item" + + def IsExpandable(self): + return 1 + + +class HierListDebugger(hierlist.HierListWithItems): + """Hier List of stack frames, breakpoints, whatever""" + + def __init__(self): + hierlist.HierListWithItems.__init__( + self, None, win32ui.IDB_DEBUGGER_HIER, None, win32api.RGB(255, 0, 0) + ) + + def Setup(self, debugger): + root = HierStackRoot(debugger) + self.AcceptRoot(root) + + +# def Refresh(self): +# self.Setup() + + +class DebuggerWindow(window.Wnd): + def __init__(self, ob): + window.Wnd.__init__(self, ob) + self.debugger = None + + def Init(self, debugger): + self.debugger = debugger + + def GetDefRect(self): + defRect = app.LoadWindowSize("Debugger Windows\\" + self.title) + if defRect[2] - defRect[0] == 0: + defRect = 0, 0, 150, 150 + return defRect + + def OnDestroy(self, msg): + newSize = self.GetWindowPlacement()[4] + pywin.framework.app.SaveWindowSize("Debugger Windows\\" + self.title, newSize) + return window.Wnd.OnDestroy(self, msg) + + def OnKeyDown(self, msg): + key = msg[2] + if key in (13, 27, 32): + return 1 + if key in (46, 8): # delete/BS key + self.DeleteSelected() + return 0 + view = scriptutils.GetActiveView() + try: + firer = view.bindings.fire_key_event + except AttributeError: + firer = None + if firer is not None: + return firer(msg) + else: + return 1 + + def DeleteSelected(self): + win32api.MessageBeep() + + def EditSelected(self): + win32api.MessageBeep() + + +class DebuggerStackWindow(DebuggerWindow): + title = "Stack" + + def __init__(self): + DebuggerWindow.__init__(self, win32ui.CreateTreeCtrl()) + self.list = HierListDebugger() + self.listOK = 0 + + def SaveState(self): + self.list.DeleteAllItems() + self.listOK = 0 + win32ui.WriteProfileVal( + "Debugger Windows\\" + self.title, "Visible", self.IsWindowVisible() + ) + + def CreateWindow(self, parent): + style = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | win32con.WS_BORDER + | commctrl.TVS_HASLINES + | commctrl.TVS_LINESATROOT + | commctrl.TVS_HASBUTTONS + ) + self._obj_.CreateWindow(style, self.GetDefRect(), parent, win32ui.IDC_LIST1) + self.HookMessage(self.OnKeyDown, win32con.WM_KEYDOWN) + self.HookMessage(self.OnKeyDown, win32con.WM_SYSKEYDOWN) + self.list.HierInit(parent, self) + self.listOK = 0 # delayed setup + # self.list.Setup() + + def RespondDebuggerState(self, state): + assert self.debugger is not None, "Init not called" + if not self.listOK: + self.listOK = 1 + self.list.Setup(self.debugger) + else: + self.list.Refresh() + + def RespondDebuggerData(self): + try: + handle = self.GetChildItem(0) + except win32ui.error: + return # No items + while 1: + item = self.list.ItemFromHandle(handle) + col = self.list.GetBitmapColumn(item) + selCol = self.list.GetSelectedBitmapColumn(item) + if selCol is None: + selCol = col + if self.list.GetItemImage(handle) != (col, selCol): + self.list.SetItemImage(handle, col, selCol) + try: + handle = self.GetNextSiblingItem(handle) + except win32ui.error: + break + + +class DebuggerListViewWindow(DebuggerWindow): + def __init__(self): + DebuggerWindow.__init__(self, win32ui.CreateListCtrl()) + + def CreateWindow(self, parent): + list = self + style = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | win32con.WS_BORDER + | commctrl.LVS_EDITLABELS + | commctrl.LVS_REPORT + ) + self._obj_.CreateWindow(style, self.GetDefRect(), parent, win32ui.IDC_LIST1) + self.HookMessage(self.OnKeyDown, win32con.WM_KEYDOWN) + self.HookMessage(self.OnKeyDown, win32con.WM_SYSKEYDOWN) + list = self + title, width = self.columns[0] + itemDetails = (commctrl.LVCFMT_LEFT, width, title, 0) + list.InsertColumn(0, itemDetails) + col = 1 + for title, width in self.columns[1:]: + col = col + 1 + itemDetails = (commctrl.LVCFMT_LEFT, width, title, 0) + list.InsertColumn(col, itemDetails) + parent.HookNotify(self.OnListEndLabelEdit, LVN_ENDLABELEDIT) + parent.HookNotify(self.OnItemRightClick, commctrl.NM_RCLICK) + parent.HookNotify(self.OnItemDoubleClick, commctrl.NM_DBLCLK) + + def RespondDebuggerData(self): + pass + + def RespondDebuggerState(self, state): + pass + + def EditSelected(self): + try: + sel = self.GetNextItem(-1, commctrl.LVNI_SELECTED) + except win32ui.error: + return + self.EditLabel(sel) + + def OnKeyDown(self, msg): + key = msg[2] + # If someone starts typing, they probably are trying to edit the text! + if chr(key) in string.ascii_uppercase: + self.EditSelected() + return 0 + return DebuggerWindow.OnKeyDown(self, msg) + + def OnItemDoubleClick(self, notify_data, extra): + self.EditSelected() + + def OnItemRightClick(self, notify_data, extra): + # First select the item we right-clicked on. + pt = self.ScreenToClient(win32api.GetCursorPos()) + flags, hItem, subitem = self.HitTest(pt) + if hItem == -1 or commctrl.TVHT_ONITEM & flags == 0: + return None + self.SetItemState(hItem, commctrl.LVIS_SELECTED, commctrl.LVIS_SELECTED) + + menu = win32ui.CreatePopupMenu() + menu.AppendMenu(win32con.MF_STRING | win32con.MF_ENABLED, 1000, "Edit item") + menu.AppendMenu(win32con.MF_STRING | win32con.MF_ENABLED, 1001, "Delete item") + dockbar = self.GetParent() + if dockbar.IsFloating(): + hook_parent = win32ui.GetMainFrame() + else: + hook_parent = self.GetParentFrame() + hook_parent.HookCommand(self.OnEditItem, 1000) + hook_parent.HookCommand(self.OnDeleteItem, 1001) + menu.TrackPopupMenu(win32api.GetCursorPos()) # track at mouse position. + return None + + def OnDeleteItem(self, command, code): + self.DeleteSelected() + + def OnEditItem(self, command, code): + self.EditSelected() + + +class DebuggerBreakpointsWindow(DebuggerListViewWindow): + title = "Breakpoints" + columns = [("Condition", 70), ("Location", 1024)] + + def SaveState(self): + items = [] + for i in range(self.GetItemCount()): + items.append(self.GetItemText(i, 0)) + items.append(self.GetItemText(i, 1)) + win32ui.WriteProfileVal( + "Debugger Windows\\" + self.title, "BreakpointList", "\t".join(items) + ) + win32ui.WriteProfileVal( + "Debugger Windows\\" + self.title, "Visible", self.IsWindowVisible() + ) + return 1 + + def OnListEndLabelEdit(self, std, extra): + item = extra[0] + text = item[4] + if text is None: + return + + item_id = self.GetItem(item[0])[6] + + from bdb import Breakpoint + + for bplist in Breakpoint.bplist.values(): + for bp in bplist: + if id(bp) == item_id: + if text.strip().lower() == "none": + text = None + bp.cond = text + break + self.RespondDebuggerData() + + def DeleteSelected(self): + try: + num = self.GetNextItem(-1, commctrl.LVNI_SELECTED) + item_id = self.GetItem(num)[6] + from bdb import Breakpoint + + for bplist in list(Breakpoint.bplist.values()): + for bp in bplist: + if id(bp) == item_id: + self.debugger.clear_break(bp.file, bp.line) + break + except win32ui.error: + win32api.MessageBeep() + self.RespondDebuggerData() + + def RespondDebuggerData(self): + l = self + l.DeleteAllItems() + index = -1 + from bdb import Breakpoint + + for bplist in Breakpoint.bplist.values(): + for bp in bplist: + baseName = os.path.split(bp.file)[1] + cond = bp.cond + item = index + 1, 0, 0, 0, str(cond), 0, id(bp) + index = l.InsertItem(item) + l.SetItemText(index, 1, "%s: %s" % (baseName, bp.line)) + + +class DebuggerWatchWindow(DebuggerListViewWindow): + title = "Watch" + columns = [("Expression", 70), ("Value", 1024)] + + def CreateWindow(self, parent): + DebuggerListViewWindow.CreateWindow(self, parent) + items = win32ui.GetProfileVal( + "Debugger Windows\\" + self.title, "Items", "" + ).split("\t") + index = -1 + for item in items: + if item: + index = self.InsertItem(index + 1, item) + self.InsertItem(index + 1, "") + + def SaveState(self): + items = [] + for i in range(self.GetItemCount() - 1): + items.append(self.GetItemText(i, 0)) + win32ui.WriteProfileVal( + "Debugger Windows\\" + self.title, "Items", "\t".join(items) + ) + win32ui.WriteProfileVal( + "Debugger Windows\\" + self.title, "Visible", self.IsWindowVisible() + ) + return 1 + + def OnListEndLabelEdit(self, std, extra): + item = extra[0] + itemno = item[0] + text = item[4] + if text is None: + return + self.SetItemText(itemno, 0, text) + if itemno == self.GetItemCount() - 1: + self.InsertItem(itemno + 1, "") + self.RespondDebuggerState(self.debugger.debuggerState) + + def DeleteSelected(self): + try: + num = self.GetNextItem(-1, commctrl.LVNI_SELECTED) + if num < self.GetItemCount() - 1: # We cant delete the last + self.DeleteItem(num) + except win32ui.error: + win32api.MessageBeep() + + def RespondDebuggerState(self, state): + globs = locs = None + if state == DBGSTATE_BREAK: + if self.debugger.curframe: + globs = self.debugger.curframe.f_globals + locs = self.debugger.curframe.f_locals + elif state == DBGSTATE_NOT_DEBUGGING: + import __main__ + + globs = locs = __main__.__dict__ + for i in range(self.GetItemCount() - 1): + text = self.GetItemText(i, 0) + if globs is None: + val = "" + else: + try: + val = repr(eval(text, globs, locs)) + except SyntaxError: + val = "Syntax Error" + except: + t, v, tb = sys.exc_info() + val = traceback.format_exception_only(t, v)[0].strip() + tb = None # prevent a cycle. + self.SetItemText(i, 1, val) + + +def CreateDebuggerDialog(parent, klass): + control = klass() + control.CreateWindow(parent) + return control + + +DebuggerDialogInfos = ( + (0xE810, DebuggerStackWindow, None), + (0xE811, DebuggerBreakpointsWindow, (10, 10)), + (0xE812, DebuggerWatchWindow, None), +) + + +# Prepare all the "control bars" for this package. +# If control bars are not all loaded when the toolbar-state functions are +# called, things go horribly wrong. +def PrepareControlBars(frame): + style = ( + win32con.WS_CHILD + | afxres.CBRS_SIZE_DYNAMIC + | afxres.CBRS_TOP + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + ) + tbd = win32ui.CreateToolBar(frame, style, win32ui.ID_VIEW_TOOLBAR_DBG) + tbd.ModifyStyle(0, commctrl.TBSTYLE_FLAT) + tbd.LoadToolBar(win32ui.IDR_DEBUGGER) + tbd.EnableDocking(afxres.CBRS_ALIGN_ANY) + tbd.SetWindowText("Debugger") + frame.DockControlBar(tbd) + + # and the other windows. + for id, klass, float in DebuggerDialogInfos: + try: + frame.GetControlBar(id) + exists = 1 + except win32ui.error: + exists = 0 + if exists: + continue + bar = pywin.docking.DockingBar.DockingBar() + style = win32con.WS_CHILD | afxres.CBRS_LEFT # don't create visible. + bar.CreateWindow( + frame, + CreateDebuggerDialog, + klass.title, + id, + style, + childCreatorArgs=(klass,), + ) + bar.SetBarStyle( + bar.GetBarStyle() + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + | afxres.CBRS_SIZE_DYNAMIC + ) + bar.EnableDocking(afxres.CBRS_ALIGN_ANY) + if float is None: + frame.DockControlBar(bar) + else: + frame.FloatControlBar(bar, float, afxres.CBRS_ALIGN_ANY) + + ## frame.ShowControlBar(bar, 0, 1) + + +SKIP_NONE = 0 +SKIP_STEP = 1 +SKIP_RUN = 2 + +debugger_parent = pdb.Pdb + + +class Debugger(debugger_parent): + def __init__(self): + self.inited = 0 + self.skipBotFrame = SKIP_NONE + self.userbotframe = None + self.frameShutdown = 0 + self.pumping = 0 + self.debuggerState = DBGSTATE_NOT_DEBUGGING # Assume so, anyway. + self.shownLineCurrent = None # The last filename I highlighted. + self.shownLineCallstack = None # The last filename I highlighted. + self.last_cmd_debugged = "" + self.abortClosed = 0 + self.isInitialBreakpoint = 0 + debugger_parent.__init__(self) + + # See if any break-points have been set in the editor + for doc in editor.editorTemplate.GetDocumentList(): + lineNo = -1 + while 1: + lineNo = doc.MarkerGetNext(lineNo + 1, MARKER_BREAKPOINT) + if lineNo <= 0: + break + self.set_break(doc.GetPathName(), lineNo) + + self.reset() + self.inForcedGUI = win32ui.GetApp().IsInproc() + self.options = LoadDebuggerOptions() + self.bAtException = self.bAtPostMortem = 0 + + def __del__(self): + self.close() + + def close(self, frameShutdown=0): + # abortClose indicates if we have total shutdown + # (ie, main window is dieing) + if self.pumping: + # Can stop pump here, as it only posts a message, and + # returns immediately. + if not self.StopDebuggerPump(): # User cancelled close. + return 0 + # NOTE - from this point on the close can not be + # stopped - the WM_QUIT message is already in the queue. + self.frameShutdown = frameShutdown + if not self.inited: + return 1 + self.inited = 0 + + SetInteractiveContext(None, None) + + frame = win32ui.GetMainFrame() + # Hide the debuger toolbars (as they wont normally form part of the main toolbar state. + for id, klass, float in DebuggerDialogInfos: + try: + tb = frame.GetControlBar(id) + if tb.dialog is not None: # We may never have actually been shown. + tb.dialog.SaveState() + frame.ShowControlBar(tb, 0, 1) + except win32ui.error: + pass + + self._UnshowCurrentLine() + self.set_quit() + return 1 + + def StopDebuggerPump(self): + assert self.pumping, "Can't stop the debugger pump if Im not pumping!" + # After stopping a pump, I may never return. + if self.GUIAboutToFinishInteract(): + self.pumping = 0 + win32ui.StopDebuggerPump() # Posts a message, so we do return. + return 1 + return 0 + + def get_option(self, option): + """Public interface into debugger options""" + try: + return self.options[option] + except KeyError: + raise error("Option %s is not a valid option" % option) + + def prep_run(self, cmd): + pass + + def done_run(self, cmd=None): + self.RespondDebuggerState(DBGSTATE_NOT_DEBUGGING) + self.close() + + def canonic(self, fname): + return os.path.abspath(fname).lower() + + def reset(self): + debugger_parent.reset(self) + self.userbotframe = None + self.UpdateAllLineStates() + self._UnshowCurrentLine() + + def setup(self, f, t): + debugger_parent.setup(self, f, t) + self.bAtException = t is not None + + def set_break(self, filename, lineno, temporary=0, cond=None): + filename = self.canonic(filename) + self.SetLineState(filename, lineno, LINESTATE_BREAKPOINT) + return debugger_parent.set_break(self, filename, lineno, temporary, cond) + + def clear_break(self, filename, lineno): + filename = self.canonic(filename) + self.ResetLineState(filename, lineno, LINESTATE_BREAKPOINT) + return debugger_parent.clear_break(self, filename, lineno) + + def cmdloop(self): + if self.frameShutdown: + return # App in the process of closing - never break in! + self.GUIAboutToBreak() + + def print_stack_entry(self, frame): + # We dont want a stack printed - our GUI is better :-) + pass + + def user_return(self, frame, return_value): + # Same as parent, just no "print" + # This function is called when a return trap is set here + frame.f_locals["__return__"] = return_value + self.interaction(frame, None) + + def user_call(self, frame, args): + # base class has an annoying 'print' that adds no value to us... + if self.stop_here(frame): + self.interaction(frame, None) + + def user_exception(self, frame, exc_info): + # This function is called if an exception occurs, + # but only if we are to stop at or just below this level + (exc_type, exc_value, exc_traceback) = exc_info + if self.get_option(OPT_STOP_EXCEPTIONS): + frame.f_locals["__exception__"] = exc_type, exc_value + print("Unhandled exception while debugging...") + # on both py2k and py3k, we may be called with exc_value + # being the args to the exception, or it may already be + # instantiated (IOW, PyErr_Normalize() hasn't been + # called on the args). In py2k this is fine, but in + # py3k, traceback.print_exception fails. So on py3k + # we instantiate an exception instance to print. + if sys.version_info > (3,) and not isinstance(exc_value, BaseException): + # they are args - may be a single item or already a tuple + if not isinstance(exc_value, tuple): + exc_value = (exc_value,) + exc_value = exc_type(*exc_value) + + traceback.print_exception(exc_type, exc_value, exc_traceback) + self.interaction(frame, exc_traceback) + + def user_line(self, frame): + if frame.f_lineno == 0: + return + debugger_parent.user_line(self, frame) + + def stop_here(self, frame): + if self.isInitialBreakpoint: + self.isInitialBreakpoint = 0 + self.set_continue() + return 0 + if frame is self.botframe and self.skipBotFrame == SKIP_RUN: + self.set_continue() + return 0 + if frame is self.botframe and self.skipBotFrame == SKIP_STEP: + self.set_step() + return 0 + return debugger_parent.stop_here(self, frame) + + def run(self, cmd, globals=None, locals=None, start_stepping=1): + if not isinstance(cmd, (str, types.CodeType)): + raise TypeError("Only strings can be run") + self.last_cmd_debugged = cmd + if start_stepping: + self.isInitialBreakpoint = 0 + else: + self.isInitialBreakpoint = 1 + try: + if globals is None: + import __main__ + + globals = __main__.__dict__ + if locals is None: + locals = globals + self.reset() + self.prep_run(cmd) + sys.settrace(self.trace_dispatch) + if type(cmd) != types.CodeType: + cmd = cmd + "\n" + try: + try: + if start_stepping: + self.skipBotFrame = SKIP_STEP + else: + self.skipBotFrame = SKIP_RUN + exec(cmd, globals, locals) + except bdb.BdbQuit: + pass + finally: + self.skipBotFrame = SKIP_NONE + self.quitting = 1 + sys.settrace(None) + + finally: + self.done_run(cmd) + + def runeval(self, expr, globals=None, locals=None): + self.prep_run(expr) + try: + debugger_parent.runeval(self, expr, globals, locals) + finally: + self.done_run(expr) + + def runexec(self, what, globs=None, locs=None): + self.reset() + sys.settrace(self.trace_dispatch) + try: + try: + exec(what, globs, locs) + except bdb.BdbQuit: + pass + finally: + self.quitting = 1 + sys.settrace(None) + + def do_set_step(self): + if self.GUIAboutToRun(): + self.set_step() + + def do_set_next(self): + if self.GUIAboutToRun(): + self.set_next(self.curframe) + + def do_set_return(self): + if self.GUIAboutToRun(): + self.set_return(self.curframe) + + def do_set_continue(self): + if self.GUIAboutToRun(): + self.set_continue() + + def set_quit(self): + ok = 1 + if self.pumping: + ok = self.StopDebuggerPump() + if ok: + debugger_parent.set_quit(self) + + def _dump_frame_(self, frame, name=None): + if name is None: + name = "" + if frame: + if frame.f_code and frame.f_code.co_filename: + fname = os.path.split(frame.f_code.co_filename)[1] + else: + fname = "??" + print(repr(name), fname, frame.f_lineno, frame) + else: + print(repr(name), "None") + + def set_trace(self): + # Start debugging from _2_ levels up! + try: + 1 + "" + except: + frame = sys.exc_info()[2].tb_frame.f_back.f_back + self.reset() + self.userbotframe = None + while frame: + # scriptutils.py creates a local variable with name + # '_debugger_stop_frame_', and we dont go past it + # (everything above this is Pythonwin framework code) + if "_debugger_stop_frame_" in frame.f_locals: + self.userbotframe = frame + break + + frame.f_trace = self.trace_dispatch + self.botframe = frame + frame = frame.f_back + self.set_step() + sys.settrace(self.trace_dispatch) + + def set_cur_frame(self, frame): + # Sets the "current" frame - ie, the frame with focus. This is the + # frame on which "step out" etc actions are taken. + # This may or may not be the top of the stack. + assert frame is not None, "You must pass a valid frame" + self.curframe = frame + for f, index in self.stack: + if f is frame: + self.curindex = index + break + else: + assert 0, "Can't find the frame in the stack." + SetInteractiveContext(frame.f_globals, frame.f_locals) + self.GUIRespondDebuggerData() + self.ShowCurrentLine() + + def IsBreak(self): + return self.debuggerState == DBGSTATE_BREAK + + def IsDebugging(self): + return self.debuggerState != DBGSTATE_NOT_DEBUGGING + + def RespondDebuggerState(self, state): + if state == self.debuggerState: + return + if state == DBGSTATE_NOT_DEBUGGING: # Debugger exists, but not doing anything + title = "" + elif state == DBGSTATE_RUNNING: # Code is running under the debugger. + title = " - running" + elif state == DBGSTATE_BREAK: # We are at a breakpoint or stepping or whatever. + if self.bAtException: + if self.bAtPostMortem: + title = " - post mortem exception" + else: + title = " - exception" + else: + title = " - break" + else: + raise error("Invalid debugger state passed!") + win32ui.GetMainFrame().SetWindowText( + win32ui.LoadString(win32ui.IDR_MAINFRAME) + title + ) + if self.debuggerState == DBGSTATE_QUITTING and state != DBGSTATE_NOT_DEBUGGING: + print("Ignoring state change cos Im trying to stop!", state) + return + self.debuggerState = state + try: + frame = win32ui.GetMainFrame() + except win32ui.error: + frame = None + if frame is not None: + for id, klass, float in DebuggerDialogInfos: + cb = win32ui.GetMainFrame().GetControlBar(id).dialog + cb.RespondDebuggerState(state) + # Tell each open editor window about the state transition + for doc in editor.editorTemplate.GetDocumentList(): + doc.OnDebuggerStateChange(state) + self.ShowCurrentLine() + + # + # GUI debugger interface. + # + def GUICheckInit(self): + if self.inited: + return + self.inited = 1 + frame = win32ui.GetMainFrame() + + # Ensure the debugger windows are attached to the debugger. + for id, klass, float in DebuggerDialogInfos: + w = frame.GetControlBar(id) + w.dialog.Init(self) + # Show toolbar if it was visible during last debug session + # This would be better done using a CDockState, but that class is not wrapped yet + if win32ui.GetProfileVal( + "Debugger Windows\\" + w.dialog.title, "Visible", 0 + ): + frame.ShowControlBar(w, 1, 1) + + # ALWAYS show debugging toolbar, regardless of saved state + tb = frame.GetControlBar(win32ui.ID_VIEW_TOOLBAR_DBG) + frame.ShowControlBar(tb, 1, 1) + self.GUIRespondDebuggerData() + + # frame.RecalcLayout() + + def GetDebuggerBar(self, barName): + frame = win32ui.GetMainFrame() + for id, klass, float in DebuggerDialogInfos: + if klass.title == barName: + return frame.GetControlBar(id) + assert 0, "Can't find a bar of that name!" + + def GUIRespondDebuggerData(self): + if not self.inited: # GUI not inited - no toolbars etc. + return + + for id, klass, float in DebuggerDialogInfos: + cb = win32ui.GetMainFrame().GetControlBar(id).dialog + cb.RespondDebuggerData() + + def GUIAboutToRun(self): + if not self.StopDebuggerPump(): + return 0 + self._UnshowCurrentLine() + self.RespondDebuggerState(DBGSTATE_RUNNING) + SetInteractiveContext(None, None) + return 1 + + def GUIAboutToBreak(self): + "Called as the GUI debugger is about to get context, and take control of the running program." + self.GUICheckInit() + self.RespondDebuggerState(DBGSTATE_BREAK) + self.GUIAboutToInteract() + if self.pumping: + print("!!! Already pumping - outa here") + return + self.pumping = 1 + win32ui.StartDebuggerPump() # NOTE - This will NOT return until the user is finished interacting + assert not self.pumping, "Should not be pumping once the pump has finished" + if self.frameShutdown: # User shut down app while debugging + win32ui.GetMainFrame().PostMessage(win32con.WM_CLOSE) + + def GUIAboutToInteract(self): + "Called as the GUI is about to perform any interaction with the user" + frame = win32ui.GetMainFrame() + # Remember the enabled state of our main frame + # may be disabled primarily if a modal dialog is displayed. + # Only get at enabled via GetWindowLong. + self.bFrameEnabled = frame.IsWindowEnabled() + self.oldForeground = None + fw = win32ui.GetForegroundWindow() + if fw is not frame: + self.oldForeground = fw + # fw.EnableWindow(0) Leave enabled for now? + self.oldFrameEnableState = frame.IsWindowEnabled() + frame.EnableWindow(1) + if self.inForcedGUI and not frame.IsWindowVisible(): + frame.ShowWindow(win32con.SW_SHOW) + frame.UpdateWindow() + if self.curframe: + SetInteractiveContext(self.curframe.f_globals, self.curframe.f_locals) + else: + SetInteractiveContext(None, None) + self.GUIRespondDebuggerData() + + def GUIAboutToFinishInteract(self): + """Called as the GUI is about to finish any interaction with the user + Returns non zero if we are allowed to stop interacting""" + if self.oldForeground is not None: + try: + win32ui.GetMainFrame().EnableWindow(self.oldFrameEnableState) + self.oldForeground.EnableWindow(1) + except win32ui.error: + # old window may be dead. + pass + # self.oldForeground.SetForegroundWindow() - fails?? + if not self.inForcedGUI: + return 1 # Never a problem, and nothing else to do. + # If we are running a forced GUI, we may never get an opportunity + # to interact again. Therefore we perform a "SaveAll", to makesure that + # any documents are saved before leaving. + for template in win32ui.GetApp().GetDocTemplateList(): + for doc in template.GetDocumentList(): + if not doc.SaveModified(): + return 0 + # All documents saved - now hide the app and debugger. + if self.get_option(OPT_HIDE): + frame = win32ui.GetMainFrame() + frame.ShowWindow(win32con.SW_HIDE) + return 1 + + # + # Pythonwin interface - all stuff to do with showing source files, + # changing line states etc. + # + def ShowLineState(self, fileName, lineNo, lineState): + # Set the state of a line, open if not already + self.ShowLineNo(fileName, lineNo) + self.SetLineState(fileName, lineNo, lineState) + + def SetLineState(self, fileName, lineNo, lineState): + # Set the state of a line if the document is open. + doc = editor.editorTemplate.FindOpenDocument(fileName) + if doc is not None: + marker = _LineStateToMarker(lineState) + if not doc.MarkerCheck(lineNo, marker): + doc.MarkerAdd(lineNo, marker) + + def ResetLineState(self, fileName, lineNo, lineState): + # Set the state of a line if the document is open. + doc = editor.editorTemplate.FindOpenDocument(fileName) + if doc is not None: + marker = _LineStateToMarker(lineState) + doc.MarkerDelete(lineNo, marker) + + def UpdateDocumentLineStates(self, doc): + # Show all lines in their special status color. If the doc is open + # all line states are reset. + doc.MarkerDeleteAll(MARKER_BREAKPOINT) + doc.MarkerDeleteAll(MARKER_CURRENT) + fname = self.canonic(doc.GetPathName()) + # Now loop over all break-points + for line in self.breaks.get(fname, []): + doc.MarkerAdd(line, MARKER_BREAKPOINT) + # And the current line if in this document. + if self.shownLineCurrent and fname == self.shownLineCurrent[0]: + lineNo = self.shownLineCurrent[1] + if not doc.MarkerCheck(lineNo, MARKER_CURRENT): + doc.MarkerAdd(lineNo, MARKER_CURRENT) + + # if self.shownLineCallstack and fname == self.shownLineCallstack[0]: + # doc.MarkerAdd(self.shownLineCallstack[1], MARKER_CURRENT) + + def UpdateAllLineStates(self): + for doc in editor.editorTemplate.GetDocumentList(): + self.UpdateDocumentLineStates(doc) + + def ShowCurrentLine(self): + # Show the current line. Only ever 1 current line - undoes last current + # The "Current Line" is self.curframe. + # The "Callstack Line" is the top of the stack. + # If current == callstack, only show as current. + self._UnshowCurrentLine() # un-highlight the old one. + if self.curframe: + fileName = self.canonic(self.curframe.f_code.co_filename) + lineNo = self.curframe.f_lineno + self.shownLineCurrent = fileName, lineNo + self.ShowLineState(fileName, lineNo, LINESTATE_CURRENT) + + def _UnshowCurrentLine(self): + "Unshow the current line, and forget it" + if self.shownLineCurrent is not None: + fname, lineno = self.shownLineCurrent + self.ResetLineState(fname, lineno, LINESTATE_CURRENT) + self.shownLineCurrent = None + + def ShowLineNo(self, filename, lineno): + wasOpen = editor.editorTemplate.FindOpenDocument(filename) is not None + if os.path.isfile(filename) and scriptutils.JumpToDocument(filename, lineno): + if not wasOpen: + doc = editor.editorTemplate.FindOpenDocument(filename) + if doc is not None: + self.UpdateDocumentLineStates(doc) + return 1 + return 0 + return 1 + else: + # Can't find the source file - linecache may have it? + import linecache + + line = linecache.getline(filename, lineno) + print( + "%s(%d): %s" + % (os.path.basename(filename), lineno, line[:-1].expandtabs(4)) + ) + return 0 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/fail.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/fail.py new file mode 100644 index 0000000000000000000000000000000000000000..97721576c8224cf49c08f52c97743086c41d83d6 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/debugger/fail.py @@ -0,0 +1,54 @@ +# NOTE NOTE - This module is designed to fail! +# +# The ONLY purpose for this script is testing/demoing the +# Pythonwin debugger package. + +# It does nothing useful, and it even doesnt do that! + +import sys +import time + +import pywin.debugger + + +def a(): + a = 1 + try: + b() + except: + # Break into the debugger with the exception information. + pywin.debugger.post_mortem(sys.exc_info()[2]) + a = 1 + a = 2 + a = 3 + a = 4 + + +def b(): + b = 1 + pywin.debugger.set_trace() + # After importing or running this module, you are likely to be + # sitting at the next line. This is because we explicitely + # broke into the debugger using the "set_trace() function + # "pywin.debugger.brk()" is a shorter alias for this. + c() + + +def c(): + c = 1 + d() + + +def d(): + d = 1 + e(d) + raise ValueError("Hi") + + +def e(arg): + e = 1 + time.sleep(1) + return e + + +a() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/default.cfg b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/default.cfg new file mode 100644 index 0000000000000000000000000000000000000000..55371f6b216662151fd9f97c2ef4651fbf09888b --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/default.cfg @@ -0,0 +1,215 @@ +# The default keyboard etc configuration file for Pythonwin. +# +# The format of this file is very similar to a Windows INI file. +# Sections are identified with [Section] lines, but comments +# use the standatd Python # character. Depending on the section, +# lines may not be in the standard "key=value" format. + +# NOTE: You should not need to modify this file. +# Simply create a new .CFG file, and add an entry: +# [General] +# BasedOn = Default +# +# and add your customisations. Then select your new configuration +# from the Pythonwin View/Options/Editor dialog. +# This way you get to add your own customisations, +# but still take advantage of changes to the default +# configuration in new releases. + +# See IDLE.cfg for an example extension configuration. +# +########################################################################## + +[IDLE Extensions] + +# The list of IDLE extensions to load. The extensions +# AutoIndent, AutoFormat and possibly others are +# "built-in", so do not need specifying. + +FormatParagraph +CallTips + + +[Keys] + +# The list of _default_ key definitions. +# See [Keys:Interactive] and [Keys:Editor] below for further defs. + +#Events of the format <> +# are events defined in IDLE extensions. + +Alt+Q = <> + +Ctrl+W = ViewWhitespace +Ctrl+Shift+8 = ViewWhitespace # The MSVC default key def. + +Ctrl+Shift+F = ViewFixedFont + +# Auto-complete, call-tips, etc. +Alt+/ = <> +Ctrl+Space = <> +( = <> +) = <> +Up = <> +Down = <> +Left = <> +Right = <> +. = KeyDot + +# Debugger - These are the MSVC default keys, for want of a better choice. +F9 = DbgBreakpointToggle +F5 = DbgGo +Shift+F5 = DbgClose +F11 = DbgStep +F10 = DbgStepOver +Shift+F11 = DbgStepOut + +Ctrl+F3 = AutoFindNext + + +[Keys:Editor] +# Key bindings specific to the editor +F2 = GotoNextBookmark +Ctrl+F2 = ToggleBookmark +Ctrl+G = GotoLine + +Alt+I = ShowInteractiveWindow +Alt-B = AddBanner # A sample Event defined in this file. + +# Block operations +Alt+3 = <> +Shift+Alt+3 = <> +Alt+4 = <> # IDLE default. +Alt+5 = <> +Alt+6 = <> + +# Tabs and other indent features +Back = <> +Ctrl+T = <> +Alt+U = <> +Enter = EnterKey +Tab = TabKey +Shift-Tab = <> + +# Folding +Add = FoldExpand +Alt+Add = FoldExpandAll +Shift+Add = FoldExpandSecondLevel +Subtract = FoldCollapse +Alt+Subtract = FoldCollapseAll +Shift+Subtract = FoldCollapseSecondLevel +Multiply = FoldTopLevel + +[Keys:Interactive] +# Key bindings specific to the interactive window. +# History for the interactive window +Ctrl+Up = <> +Ctrl+Down = <> +Enter = ProcessEnter +Ctrl+Enter = ProcessEnter +Shift+Enter = ProcessEnter +Esc = ProcessEsc +Alt+I = WindowBack # Toggle back to previous window. +Home = InteractiveHome # A sample Event defined in this file. +Shift+Home = InteractiveHomeExtend # A sample Event defined in this file. + +# When docked, the Ctrl+Tab and Shift+Ctrl+Tab keys dont work as expected. +Ctrl+Tab = MDINext +Ctrl+Shift+Tab = MDIPrev + +[Extensions] +# Python event handlers specific to this config file. +# All functions not starting with an "_" are assumed +# to be events, and take 2 params: +# * editor_window is the same object passed to IDLE +# extensions. editor_window.text is a text widget +# that conforms to the Tk text widget interface. +# * event is the event being fired. Will always be None +# in the current implementation. + +# Simply by defining these functions, they are available as +# events. +# Note that we bind keystrokes to these events in the various +# [Keys] sections. + +# Add a simple file/class/function simple banner +def AddBanner(editor_window, event): + + text = editor_window.text + big_line = "#" * 70 + banner = "%s\n## \n## \n## \n%s\n" % (big_line, big_line) + + # Insert at the start of the current line. + pos = text.index("insert linestart") + + text.undo_block_start() # Allow action to be undone as a single unit. + text.insert(pos, banner) + text.undo_block_stop() + + # Now set the insert point to the middle of the banner. + line, col = [int(s) for s in pos.split(".")] + text.mark_set("insert", "%d.1 lineend" % (line+2, ) ) + + +# Here is a sample event bound to the "Home" key in the +# interactive window +def InteractiveHome(editor_window, event): + return _DoInteractiveHome(editor_window.text, 0) + +def InteractiveHomeExtend(editor_window, event): + return _DoInteractiveHome(editor_window.text, 1) + +def _DoInteractiveHome(text, extend): + import sys + # If Scintilla has an autocomplete window open, then let Scintilla handle it. + if text.edit.SCIAutoCActive(): + return 1 + of_interest = "insert linestart + %d c" % len(sys.ps1) + if not text.compare("insert", "==", of_interest) and \ + text.get("insert linestart", of_interest) in [sys.ps1, sys.ps2]: # Not sys.ps? line + end = of_interest + else: + end = "insert linestart" + + if extend: start = "insert" + else: start = end + text.tag_add("sel", start, end) + +# From Niki Spahie +def AutoFindNext(editor_window, event): + "find selected text or word under cursor" + + from pywin.scintilla import find + from pywin.scintilla import scintillacon + + try: + sci = editor_window.edit + word = sci.GetSelText() + if word: + find.lastSearch.findText = word + find.lastSearch.sel = sci.GetSel() + else: + pos = sci.SendScintilla( scintillacon.SCI_GETCURRENTPOS ) + start = sci.SendScintilla( scintillacon.SCI_WORDSTARTPOSITION, pos, 1 ) + end = sci.SendScintilla( scintillacon.SCI_WORDENDPOSITION, pos, 1 ) + word = sci.GetTextRange( start, end ) + if word: + find.lastSearch.findText = word + find.lastSearch.sel = (start,end) + except Exception: + import traceback + traceback.print_exc() + find.FindNext() + + +# A couple of generic events. +def Beep(editor_window, event): + editor_window.text.beep() + +def DoNothing(editor_window, event): + pass + +def ContinueEvent(editor_window, event): + # Almost an "unbind" - allows Pythonwin/MFC to handle the keystroke + return 1 + diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/ideoptions.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/ideoptions.py new file mode 100644 index 0000000000000000000000000000000000000000..f1bae90df7f62330b486db44893133aca69ac3e7 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/ideoptions.py @@ -0,0 +1,139 @@ +# The property page to define generic IDE options for Pythonwin + +import win32con +import win32ui +from pywin.framework import interact +from pywin.mfc import dialog + +buttonControlMap = { + win32ui.IDC_BUTTON1: win32ui.IDC_EDIT1, + win32ui.IDC_BUTTON2: win32ui.IDC_EDIT2, + win32ui.IDC_BUTTON3: win32ui.IDC_EDIT3, +} + + +class OptionsPropPage(dialog.PropertyPage): + def __init__(self): + dialog.PropertyPage.__init__(self, win32ui.IDD_PP_IDE) + self.AddDDX(win32ui.IDC_CHECK1, "bShowAtStartup") + self.AddDDX(win32ui.IDC_CHECK2, "bDocking") + self.AddDDX(win32ui.IDC_EDIT4, "MRUSize", "i") + + def OnInitDialog(self): + edit = self.GetDlgItem(win32ui.IDC_EDIT1) + format = eval( + win32ui.GetProfileVal( + interact.sectionProfile, + interact.STYLE_INTERACTIVE_PROMPT, + str(interact.formatInput), + ) + ) + edit.SetDefaultCharFormat(format) + edit.SetWindowText("Input Text") + + edit = self.GetDlgItem(win32ui.IDC_EDIT2) + format = eval( + win32ui.GetProfileVal( + interact.sectionProfile, + interact.STYLE_INTERACTIVE_OUTPUT, + str(interact.formatOutput), + ) + ) + edit.SetDefaultCharFormat(format) + edit.SetWindowText("Output Text") + + edit = self.GetDlgItem(win32ui.IDC_EDIT3) + format = eval( + win32ui.GetProfileVal( + interact.sectionProfile, + interact.STYLE_INTERACTIVE_ERROR, + str(interact.formatOutputError), + ) + ) + edit.SetDefaultCharFormat(format) + edit.SetWindowText("Error Text") + + self["bShowAtStartup"] = interact.LoadPreference("Show at startup", 1) + self["bDocking"] = interact.LoadPreference("Docking", 0) + self["MRUSize"] = win32ui.GetProfileVal("Settings", "Recent File List Size", 10) + + # Hook the button clicks. + self.HookCommand(self.HandleCharFormatChange, win32ui.IDC_BUTTON1) + self.HookCommand(self.HandleCharFormatChange, win32ui.IDC_BUTTON2) + self.HookCommand(self.HandleCharFormatChange, win32ui.IDC_BUTTON3) + + # Ensure the spin control remains in range. + spinner = self.GetDlgItem(win32ui.IDC_SPIN1) + spinner.SetRange(1, 16) + + return dialog.PropertyPage.OnInitDialog(self) + + # Called to save away the new format tuple for the specified item. + def HandleCharFormatChange(self, id, code): + if code == win32con.BN_CLICKED: + editId = buttonControlMap.get(id) + assert editId is not None, "Format button has no associated edit control" + editControl = self.GetDlgItem(editId) + existingFormat = editControl.GetDefaultCharFormat() + flags = win32con.CF_SCREENFONTS + d = win32ui.CreateFontDialog(existingFormat, flags, None, self) + if d.DoModal() == win32con.IDOK: + cf = d.GetCharFormat() + editControl.SetDefaultCharFormat(cf) + self.SetModified(1) + return 0 # We handled this fully! + + def OnOK(self): + # Handle the edit controls - get all the fonts, put them back into interact, then + # get interact to save its stuff! + controlAttrs = [ + (win32ui.IDC_EDIT1, interact.STYLE_INTERACTIVE_PROMPT), + (win32ui.IDC_EDIT2, interact.STYLE_INTERACTIVE_OUTPUT), + (win32ui.IDC_EDIT3, interact.STYLE_INTERACTIVE_ERROR), + ] + for id, key in controlAttrs: + control = self.GetDlgItem(id) + fmt = control.GetDefaultCharFormat() + win32ui.WriteProfileVal(interact.sectionProfile, key, str(fmt)) + + # Save the other interactive window options. + interact.SavePreference("Show at startup", self["bShowAtStartup"]) + interact.SavePreference("Docking", self["bDocking"]) + + # And the other options. + win32ui.WriteProfileVal("Settings", "Recent File List Size", self["MRUSize"]) + + return 1 + + def ChangeFormat(self, fmtAttribute, fmt): + dlg = win32ui.CreateFontDialog(fmt) + if dlg.DoModal() != win32con.IDOK: + return None + return dlg.GetCharFormat() + + def OnFormatTitle(self, command, code): + fmt = self.GetFormat(interact.formatTitle) + if fmt: + formatTitle = fmt + SaveFontPreferences() + + def OnFormatInput(self, command, code): + global formatInput + fmt = self.GetFormat(formatInput) + if fmt: + formatInput = fmt + SaveFontPreferences() + + def OnFormatOutput(self, command, code): + global formatOutput + fmt = self.GetFormat(formatOutput) + if fmt: + formatOutput = fmt + SaveFontPreferences() + + def OnFormatError(self, command, code): + global formatOutputError + fmt = self.GetFormat(formatOutputError) + if fmt: + formatOutputError = fmt + SaveFontPreferences() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/list.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/list.py new file mode 100644 index 0000000000000000000000000000000000000000..b9934ce71d764f5c9e1adaa33360555ed79d1d58 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/list.py @@ -0,0 +1,143 @@ +import commctrl +import win32api +import win32con +import win32ui +from pywin.mfc import dialog + + +class ListDialog(dialog.Dialog): + def __init__(self, title, list): + dialog.Dialog.__init__(self, self._maketemplate(title)) + self.HookMessage(self.on_size, win32con.WM_SIZE) + self.HookNotify(self.OnListItemChange, commctrl.LVN_ITEMCHANGED) + self.HookCommand(self.OnListClick, win32ui.IDC_LIST1) + self.items = list + + def _maketemplate(self, title): + style = win32con.WS_DLGFRAME | win32con.WS_SYSMENU | win32con.WS_VISIBLE + ls = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | commctrl.LVS_ALIGNLEFT + | commctrl.LVS_REPORT + ) + bs = win32con.WS_CHILD | win32con.WS_VISIBLE + return [ + [title, (0, 0, 200, 200), style, None, (8, "MS Sans Serif")], + ["SysListView32", None, win32ui.IDC_LIST1, (0, 0, 200, 200), ls], + [128, "OK", win32con.IDOK, (10, 0, 50, 14), bs | win32con.BS_DEFPUSHBUTTON], + [128, "Cancel", win32con.IDCANCEL, (0, 0, 50, 14), bs], + ] + + def FillList(self): + size = self.GetWindowRect() + width = size[2] - size[0] - (10) + itemDetails = (commctrl.LVCFMT_LEFT, width, "Item", 0) + self.itemsControl.InsertColumn(0, itemDetails) + index = 0 + for item in self.items: + index = self.itemsControl.InsertItem(index + 1, str(item), 0) + + def OnListClick(self, id, code): + if code == commctrl.NM_DBLCLK: + self.EndDialog(win32con.IDOK) + return 1 + + def OnListItemChange(self, std, extra): + (hwndFrom, idFrom, code), ( + itemNotify, + sub, + newState, + oldState, + change, + point, + lparam, + ) = (std, extra) + oldSel = (oldState & commctrl.LVIS_SELECTED) != 0 + newSel = (newState & commctrl.LVIS_SELECTED) != 0 + if oldSel != newSel: + try: + self.selecteditem = itemNotify + self.butOK.EnableWindow(1) + except win32ui.error: + self.selecteditem = None + + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + self.itemsControl = self.GetDlgItem(win32ui.IDC_LIST1) + self.butOK = self.GetDlgItem(win32con.IDOK) + self.butCancel = self.GetDlgItem(win32con.IDCANCEL) + + self.FillList() + + size = self.GetWindowRect() + self.LayoutControls(size[2] - size[0], size[3] - size[1]) + self.butOK.EnableWindow(0) # wait for first selection + return rc + + def LayoutControls(self, w, h): + self.itemsControl.MoveWindow((0, 0, w, h - 30)) + self.butCancel.MoveWindow((10, h - 24, 60, h - 4)) + self.butOK.MoveWindow((w - 60, h - 24, w - 10, h - 4)) + + def on_size(self, params): + lparam = params[3] + w = win32api.LOWORD(lparam) + h = win32api.HIWORD(lparam) + self.LayoutControls(w, h) + + +class ListsDialog(ListDialog): + def __init__(self, title, list, colHeadings=["Item"]): + ListDialog.__init__(self, title, list) + self.colHeadings = colHeadings + + def FillList(self): + index = 0 + size = self.GetWindowRect() + width = ( + size[2] - size[0] - (10) - win32api.GetSystemMetrics(win32con.SM_CXVSCROLL) + ) + numCols = len(self.colHeadings) + + for col in self.colHeadings: + itemDetails = (commctrl.LVCFMT_LEFT, int(width / numCols), col, 0) + self.itemsControl.InsertColumn(index, itemDetails) + index = index + 1 + index = 0 + for items in self.items: + index = self.itemsControl.InsertItem(index + 1, str(items[0]), 0) + for itemno in range(1, numCols): + item = items[itemno] + self.itemsControl.SetItemText(index, itemno, str(item)) + + +def SelectFromList(title, lst): + dlg = ListDialog(title, lst) + if dlg.DoModal() == win32con.IDOK: + return dlg.selecteditem + else: + return None + + +def SelectFromLists(title, lists, headings): + dlg = ListsDialog(title, lists, headings) + if dlg.DoModal() == win32con.IDOK: + return dlg.selecteditem + else: + return None + + +def test(): + # print SelectFromList('Single list', [1,2,3]) + print( + SelectFromLists( + "Multi-List", + [("1", 1, "a"), ("2", 2, "b"), ("3", 3, "c")], + ["Col 1", "Col 2"], + ) + ) + + +if __name__ == "__main__": + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/login.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/login.py new file mode 100644 index 0000000000000000000000000000000000000000..2a3295693e920cd9ed4ac054371ce803f798a302 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/login.py @@ -0,0 +1,156 @@ +"""login -- PythonWin user ID and password dialog box + +(Adapted from originally distributed with Mark Hammond's PythonWin - +this now replaces it!) + +login.GetLogin() displays a modal "OK/Cancel" dialog box with input +fields for a user ID and password. The password field input is masked +with *'s. GetLogin takes two optional parameters, a window title, and a +default user ID. If these parameters are omitted, the title defaults to +"Login", and the user ID is left blank. GetLogin returns a (userid, password) +tuple. GetLogin can be called from scripts running on the console - i.e. you +don't need to write a full-blown GUI app to use it. + +login.GetPassword() is similar, except there is no username field. + +Example: +import pywin.dialogs.login +title = "FTP Login" +def_user = "fred" +userid, password = pywin.dialogs.login.GetLogin(title, def_user) + +Jim Eggleston, 28 August 1996 +Merged with dlgpass and moved to pywin.dialogs by Mark Hammond Jan 1998. +""" + +import win32api +import win32con +import win32ui +from pywin.mfc import dialog + + +def MakeLoginDlgTemplate(title): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + + # Window frame and title + dlg = [ + [title, (0, 0, 184, 40), style, None, (8, "MS Sans Serif")], + ] + + # ID label and text box + dlg.append([130, "User ID:", -1, (7, 9, 69, 9), cs | win32con.SS_LEFT]) + s = cs | win32con.WS_TABSTOP | win32con.WS_BORDER + dlg.append(["EDIT", None, win32ui.IDC_EDIT1, (50, 7, 60, 12), s]) + + # Password label and text box + dlg.append([130, "Password:", -1, (7, 22, 69, 9), cs | win32con.SS_LEFT]) + s = cs | win32con.WS_TABSTOP | win32con.WS_BORDER + dlg.append( + ["EDIT", None, win32ui.IDC_EDIT2, (50, 20, 60, 12), s | win32con.ES_PASSWORD] + ) + + # OK/Cancel Buttons + s = cs | win32con.WS_TABSTOP + dlg.append( + [128, "OK", win32con.IDOK, (124, 5, 50, 14), s | win32con.BS_DEFPUSHBUTTON] + ) + s = win32con.BS_PUSHBUTTON | s + dlg.append([128, "Cancel", win32con.IDCANCEL, (124, 20, 50, 14), s]) + return dlg + + +def MakePasswordDlgTemplate(title): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + # Window frame and title + dlg = [ + [title, (0, 0, 177, 45), style, None, (8, "MS Sans Serif")], + ] + + # Password label and text box + dlg.append([130, "Password:", -1, (7, 7, 69, 9), cs | win32con.SS_LEFT]) + s = cs | win32con.WS_TABSTOP | win32con.WS_BORDER + dlg.append( + ["EDIT", None, win32ui.IDC_EDIT1, (50, 7, 60, 12), s | win32con.ES_PASSWORD] + ) + + # OK/Cancel Buttons + s = cs | win32con.WS_TABSTOP | win32con.BS_PUSHBUTTON + dlg.append( + [128, "OK", win32con.IDOK, (124, 5, 50, 14), s | win32con.BS_DEFPUSHBUTTON] + ) + dlg.append([128, "Cancel", win32con.IDCANCEL, (124, 22, 50, 14), s]) + return dlg + + +class LoginDlg(dialog.Dialog): + Cancel = 0 + + def __init__(self, title): + dialog.Dialog.__init__(self, MakeLoginDlgTemplate(title)) + self.AddDDX(win32ui.IDC_EDIT1, "userid") + self.AddDDX(win32ui.IDC_EDIT2, "password") + + +def GetLogin(title="Login", userid="", password=""): + d = LoginDlg(title) + d["userid"] = userid + d["password"] = password + if d.DoModal() != win32con.IDOK: + return (None, None) + else: + return (d["userid"], d["password"]) + + +class PasswordDlg(dialog.Dialog): + def __init__(self, title): + dialog.Dialog.__init__(self, MakePasswordDlgTemplate(title)) + self.AddDDX(win32ui.IDC_EDIT1, "password") + + +def GetPassword(title="Password", password=""): + d = PasswordDlg(title) + d["password"] = password + if d.DoModal() != win32con.IDOK: + return None + return d["password"] + + +if __name__ == "__main__": + import sys + + title = "Login" + def_user = "" + if len(sys.argv) > 1: + title = sys.argv[1] + if len(sys.argv) > 2: + def_userid = sys.argv[2] + userid, password = GetLogin(title, def_user) + if userid == password == None: + print("User pressed Cancel") + else: + print("User ID: ", userid) + print("Password:", password) + newpassword = GetPassword("Reenter just for fun", password) + if newpassword is None: + print("User cancelled") + else: + what = "" + if newpassword != password: + what = "not " + print("The passwords did %smatch" % (what)) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/status.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/status.py new file mode 100644 index 0000000000000000000000000000000000000000..aef339148811532bdbd53594cd28d5b1276ce021 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/dialogs/status.py @@ -0,0 +1,242 @@ +# No cancel button. + +import threading +import time + +import win32api +import win32con +import win32ui +from pywin.mfc import dialog +from pywin.mfc.thread import WinThread + + +def MakeProgressDlgTemplate(caption, staticText=""): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + cs = win32con.WS_CHILD | win32con.WS_VISIBLE + + w = 215 + h = 36 # With button + h = 40 + + dlg = [ + [caption, (0, 0, w, h), style, None, (8, "MS Sans Serif")], + ] + + s = win32con.WS_TABSTOP | cs + + dlg.append([130, staticText, 1000, (7, 7, w - 7, h - 32), cs | win32con.SS_LEFT]) + + # dlg.append([128, + # "Cancel", + # win32con.IDCANCEL, + # (w - 60, h - 18, 50, 14), s | win32con.BS_PUSHBUTTON]) + + return dlg + + +class CStatusProgressDialog(dialog.Dialog): + def __init__(self, title, msg="", maxticks=100, tickincr=1): + self.initMsg = msg + templ = MakeProgressDlgTemplate(title, msg) + dialog.Dialog.__init__(self, templ) + self.maxticks = maxticks + self.tickincr = tickincr + self.pbar = None + + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + self.static = self.GetDlgItem(1000) + self.pbar = win32ui.CreateProgressCtrl() + self.pbar.CreateWindow( + win32con.WS_CHILD | win32con.WS_VISIBLE, (10, 30, 310, 44), self, 1001 + ) + self.pbar.SetRange(0, self.maxticks) + self.pbar.SetStep(self.tickincr) + self.progress = 0 + self.pincr = 5 + return rc + + def Close(self): + self.EndDialog(0) + + def SetMaxTicks(self, maxticks): + if self.pbar is not None: + self.pbar.SetRange(0, maxticks) + + def Tick(self): + if self.pbar is not None: + self.pbar.StepIt() + + def SetTitle(self, text): + self.SetWindowText(text) + + def SetText(self, text): + self.SetDlgItemText(1000, text) + + def Set(self, pos, max=None): + if self.pbar is not None: + self.pbar.SetPos(pos) + if max is not None: + self.pbar.SetRange(0, max) + + +# a progress dialog created in a new thread - especially suitable for +# console apps with no message loop. +MYWM_SETTITLE = win32con.WM_USER + 10 +MYWM_SETMSG = win32con.WM_USER + 11 +MYWM_TICK = win32con.WM_USER + 12 +MYWM_SETMAXTICKS = win32con.WM_USER + 13 +MYWM_SET = win32con.WM_USER + 14 + + +class CThreadedStatusProcessDialog(CStatusProgressDialog): + def __init__(self, title, msg="", maxticks=100, tickincr=1): + self.title = title + self.msg = msg + self.threadid = win32api.GetCurrentThreadId() + CStatusProgressDialog.__init__(self, title, msg, maxticks, tickincr) + + def OnInitDialog(self): + rc = CStatusProgressDialog.OnInitDialog(self) + self.HookMessage(self.OnTitle, MYWM_SETTITLE) + self.HookMessage(self.OnMsg, MYWM_SETMSG) + self.HookMessage(self.OnTick, MYWM_TICK) + self.HookMessage(self.OnMaxTicks, MYWM_SETMAXTICKS) + self.HookMessage(self.OnSet, MYWM_SET) + return rc + + def _Send(self, msg): + try: + self.PostMessage(msg) + except win32ui.error: + # the user closed the window - but this does not cancel the + # process - so just ignore it. + pass + + def OnTitle(self, msg): + CStatusProgressDialog.SetTitle(self, self.title) + + def OnMsg(self, msg): + CStatusProgressDialog.SetText(self, self.msg) + + def OnTick(self, msg): + CStatusProgressDialog.Tick(self) + + def OnMaxTicks(self, msg): + CStatusProgressDialog.SetMaxTicks(self, self.maxticks) + + def OnSet(self, msg): + CStatusProgressDialog.Set(self, self.pos, self.max) + + def Close(self): + assert self.threadid, "No thread!" + win32api.PostThreadMessage(self.threadid, win32con.WM_QUIT, 0, 0) + + def SetMaxTicks(self, maxticks): + self.maxticks = maxticks + self._Send(MYWM_SETMAXTICKS) + + def SetTitle(self, title): + self.title = title + self._Send(MYWM_SETTITLE) + + def SetText(self, text): + self.msg = text + self._Send(MYWM_SETMSG) + + def Tick(self): + self._Send(MYWM_TICK) + + def Set(self, pos, max=None): + self.pos = pos + self.max = max + self._Send(MYWM_SET) + + +class ProgressThread(WinThread): + def __init__(self, title, msg="", maxticks=100, tickincr=1): + self.title = title + self.msg = msg + self.maxticks = maxticks + self.tickincr = tickincr + self.dialog = None + WinThread.__init__(self) + self.createdEvent = threading.Event() + + def InitInstance(self): + self.dialog = CThreadedStatusProcessDialog( + self.title, self.msg, self.maxticks, self.tickincr + ) + self.dialog.CreateWindow() + try: + self.dialog.SetForegroundWindow() + except win32ui.error: + pass + self.createdEvent.set() + return WinThread.InitInstance(self) + + def ExitInstance(self): + return 0 + + +def StatusProgressDialog(title, msg="", maxticks=100, parent=None): + d = CStatusProgressDialog(title, msg, maxticks) + d.CreateWindow(parent) + return d + + +def ThreadedStatusProgressDialog(title, msg="", maxticks=100): + t = ProgressThread(title, msg, maxticks) + t.CreateThread() + # Need to run a basic "PumpWaitingMessages" loop just incase we are + # running inside Pythonwin. + # Basic timeout incase things go terribly wrong. Ideally we should use + # win32event.MsgWaitForMultipleObjects(), but we use a threading module + # event - so use a dumb strategy + end_time = time.time() + 10 + while time.time() < end_time: + if t.createdEvent.isSet(): + break + win32ui.PumpWaitingMessages() + time.sleep(0.1) + return t.dialog + + +def demo(): + d = StatusProgressDialog("A Demo", "Doing something...") + import win32api + + for i in range(100): + if i == 50: + d.SetText("Getting there...") + if i == 90: + d.SetText("Nearly done...") + win32api.Sleep(20) + d.Tick() + d.Close() + + +def thread_demo(): + d = ThreadedStatusProgressDialog("A threaded demo", "Doing something") + import win32api + + for i in range(100): + if i == 50: + d.SetText("Getting there...") + if i == 90: + d.SetText("Nearly done...") + win32api.Sleep(20) + d.Tick() + d.Close() + + +if __name__ == "__main__": + thread_demo() + # demo() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/docking/DockingBar.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/docking/DockingBar.py new file mode 100644 index 0000000000000000000000000000000000000000..3e51eb7031468c961dbe93e6b839fe2dc88176e1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/docking/DockingBar.py @@ -0,0 +1,679 @@ +# DockingBar.py + +# Ported directly (comments and all) from the samples at www.codeguru.com + +# WARNING: Use at your own risk, as this interface is highly likely to change. +# Currently we support only one child per DockingBar. Later we need to add +# support for multiple children. + +import struct + +import win32api +import win32con +import win32ui +from pywin.mfc import afxres, window + +clrBtnHilight = win32api.GetSysColor(win32con.COLOR_BTNHILIGHT) +clrBtnShadow = win32api.GetSysColor(win32con.COLOR_BTNSHADOW) + + +def CenterPoint(rect): + width = rect[2] - rect[0] + height = rect[3] - rect[1] + return rect[0] + width // 2, rect[1] + height // 2 + + +def OffsetRect(rect, point): + (x, y) = point + return rect[0] + x, rect[1] + y, rect[2] + x, rect[3] + y + + +def DeflateRect(rect, point): + (x, y) = point + return rect[0] + x, rect[1] + y, rect[2] - x, rect[3] - y + + +def PtInRect(rect, pt): + return rect[0] <= pt[0] < rect[2] and rect[1] <= pt[1] < rect[3] + + +class DockingBar(window.Wnd): + def __init__(self, obj=None): + if obj is None: + obj = win32ui.CreateControlBar() + window.Wnd.__init__(self, obj) + self.dialog = None + self.nDockBarID = 0 + self.sizeMin = 32, 32 + self.sizeHorz = 200, 200 + self.sizeVert = 200, 200 + self.sizeFloat = 200, 200 + self.bTracking = 0 + self.bInRecalcNC = 0 + self.cxEdge = 6 + self.cxBorder = 3 + self.cxGripper = 20 + self.brushBkgd = win32ui.CreateBrush() + self.brushBkgd.CreateSolidBrush(win32api.GetSysColor(win32con.COLOR_BTNFACE)) + + # Support for diagonal resizing + self.cyBorder = 3 + self.cCaptionSize = win32api.GetSystemMetrics(win32con.SM_CYSMCAPTION) + self.cMinWidth = win32api.GetSystemMetrics(win32con.SM_CXMIN) + self.cMinHeight = win32api.GetSystemMetrics(win32con.SM_CYMIN) + self.rectUndock = (0, 0, 0, 0) + + def OnUpdateCmdUI(self, target, bDisableIfNoHndler): + return self.UpdateDialogControls(target, bDisableIfNoHndler) + + def CreateWindow( + self, + parent, + childCreator, + title, + id, + style=win32con.WS_CHILD | win32con.WS_VISIBLE | afxres.CBRS_LEFT, + childCreatorArgs=(), + ): + assert not ( + (style & afxres.CBRS_SIZE_FIXED) and (style & afxres.CBRS_SIZE_DYNAMIC) + ), "Invalid style" + self.rectClose = self.rectBorder = self.rectGripper = self.rectTracker = ( + 0, + 0, + 0, + 0, + ) + + # save the style + self._obj_.dwStyle = style & afxres.CBRS_ALL + + cursor = win32api.LoadCursor(0, win32con.IDC_ARROW) + wndClass = win32ui.RegisterWndClass( + win32con.CS_DBLCLKS, cursor, self.brushBkgd.GetSafeHandle(), 0 + ) + + self._obj_.CreateWindow(wndClass, title, style, (0, 0, 0, 0), parent, id) + + # Create the child dialog + self.dialog = childCreator(*(self,) + childCreatorArgs) + + # use the dialog dimensions as default base dimensions + assert self.dialog.IsWindow(), ( + "The childCreator function %s did not create a window!" % childCreator + ) + rect = self.dialog.GetWindowRect() + self.sizeHorz = self.sizeVert = self.sizeFloat = ( + rect[2] - rect[0], + rect[3] - rect[1], + ) + + self.sizeHorz = self.sizeHorz[0], self.sizeHorz[1] + self.cxEdge + self.cxBorder + self.sizeVert = self.sizeVert[0] + self.cxEdge + self.cxBorder, self.sizeVert[1] + self.HookMessages() + + def CalcFixedLayout(self, bStretch, bHorz): + rectTop = self.dockSite.GetControlBar( + afxres.AFX_IDW_DOCKBAR_TOP + ).GetWindowRect() + rectLeft = self.dockSite.GetControlBar( + afxres.AFX_IDW_DOCKBAR_LEFT + ).GetWindowRect() + if bStretch: + nHorzDockBarWidth = 32767 + nVertDockBarHeight = 32767 + else: + nHorzDockBarWidth = rectTop[2] - rectTop[0] + 4 + nVertDockBarHeight = rectLeft[3] - rectLeft[1] + 4 + + if self.IsFloating(): + return self.sizeFloat + if bHorz: + return nHorzDockBarWidth, self.sizeHorz[1] + return self.sizeVert[0], nVertDockBarHeight + + def CalcDynamicLayout(self, length, mode): + # Support for diagonal sizing. + if self.IsFloating(): + self.GetParent().GetParent().ModifyStyle(win32ui.MFS_4THICKFRAME, 0) + if mode & (win32ui.LM_HORZDOCK | win32ui.LM_VERTDOCK): + flags = ( + win32con.SWP_NOSIZE + | win32con.SWP_NOMOVE + | win32con.SWP_NOZORDER + | win32con.SWP_NOACTIVATE + | win32con.SWP_FRAMECHANGED + ) + self.SetWindowPos( + 0, + ( + 0, + 0, + 0, + 0, + ), + flags, + ) + self.dockSite.RecalcLayout() + return self._obj_.CalcDynamicLayout(length, mode) + + if mode & win32ui.LM_MRUWIDTH: + return self.sizeFloat + if mode & win32ui.LM_COMMIT: + self.sizeFloat = length, self.sizeFloat[1] + return self.sizeFloat + # More diagonal sizing. + if self.IsFloating(): + dc = self.dockContext + pt = win32api.GetCursorPos() + windowRect = self.GetParent().GetParent().GetWindowRect() + + hittest = dc.nHitTest + if hittest == win32con.HTTOPLEFT: + cx = max(windowRect[2] - pt[0], self.cMinWidth) - self.cxBorder + cy = max(windowRect[3] - self.cCaptionSize - pt[1], self.cMinHeight) - 1 + self.sizeFloat = cx, cy + + top = ( + min(pt[1], windowRect[3] - self.cCaptionSize - self.cMinHeight) + - self.cyBorder + ) + left = min(pt[0], windowRect[2] - self.cMinWidth) - 1 + dc.rectFrameDragHorz = ( + left, + top, + dc.rectFrameDragHorz[2], + dc.rectFrameDragHorz[3], + ) + return self.sizeFloat + if hittest == win32con.HTTOPRIGHT: + cx = max(pt[0] - windowRect[0], self.cMinWidth) + cy = max(windowRect[3] - self.cCaptionSize - pt[1], self.cMinHeight) - 1 + self.sizeFloat = cx, cy + + top = ( + min(pt[1], windowRect[3] - self.cCaptionSize - self.cMinHeight) + - self.cyBorder + ) + dc.rectFrameDragHorz = ( + dc.rectFrameDragHorz[0], + top, + dc.rectFrameDragHorz[2], + dc.rectFrameDragHorz[3], + ) + return self.sizeFloat + + if hittest == win32con.HTBOTTOMLEFT: + cx = max(windowRect[2] - pt[0], self.cMinWidth) - self.cxBorder + cy = max(pt[1] - windowRect[1] - self.cCaptionSize, self.cMinHeight) + self.sizeFloat = cx, cy + + left = min(pt[0], windowRect[2] - self.cMinWidth) - 1 + dc.rectFrameDragHorz = ( + left, + dc.rectFrameDragHorz[1], + dc.rectFrameDragHorz[2], + dc.rectFrameDragHorz[3], + ) + return self.sizeFloat + + if hittest == win32con.HTBOTTOMRIGHT: + cx = max(pt[0] - windowRect[0], self.cMinWidth) + cy = max(pt[1] - windowRect[1] - self.cCaptionSize, self.cMinHeight) + self.sizeFloat = cx, cy + return self.sizeFloat + + if mode & win32ui.LM_LENGTHY: + self.sizeFloat = self.sizeFloat[0], max(self.sizeMin[1], length) + return self.sizeFloat + else: + return max(self.sizeMin[0], length), self.sizeFloat[1] + + def OnWindowPosChanged(self, msg): + if self.GetSafeHwnd() == 0 or self.dialog is None: + return 0 + lparam = msg[3] + """ LPARAM used with WM_WINDOWPOSCHANGED: + typedef struct { + HWND hwnd; + HWND hwndInsertAfter; + int x; + int y; + int cx; + int cy; + UINT flags;} WINDOWPOS; + """ + format = "PPiiiii" + bytes = win32ui.GetBytes(lparam, struct.calcsize(format)) + hwnd, hwndAfter, x, y, cx, cy, flags = struct.unpack(format, bytes) + + if self.bInRecalcNC: + rc = self.GetClientRect() + self.dialog.MoveWindow(rc) + return 0 + # Find on which side are we docked + nDockBarID = self.GetParent().GetDlgCtrlID() + # Return if dropped at same location + # no docking side change and no size change + if ( + (nDockBarID == self.nDockBarID) + and (flags & win32con.SWP_NOSIZE) + and ( + (self._obj_.dwStyle & afxres.CBRS_BORDER_ANY) != afxres.CBRS_BORDER_ANY + ) + ): + return + self.nDockBarID = nDockBarID + + # Force recalc the non-client area + self.bInRecalcNC = 1 + try: + swpflags = ( + win32con.SWP_NOSIZE + | win32con.SWP_NOMOVE + | win32con.SWP_NOZORDER + | win32con.SWP_FRAMECHANGED + ) + self.SetWindowPos(0, (0, 0, 0, 0), swpflags) + finally: + self.bInRecalcNC = 0 + return 0 + + # This is a virtual and not a message hook. + def OnSetCursor(self, window, nHitTest, wMouseMsg): + if nHitTest != win32con.HTSIZE or self.bTracking: + return self._obj_.OnSetCursor(window, nHitTest, wMouseMsg) + + if self.IsHorz(): + win32api.SetCursor(win32api.LoadCursor(0, win32con.IDC_SIZENS)) + else: + win32api.SetCursor(win32api.LoadCursor(0, win32con.IDC_SIZEWE)) + return 1 + + # Mouse Handling + def OnLButtonUp(self, msg): + if not self.bTracking: + return 1 # pass it on. + self.StopTracking(1) + return 0 # Dont pass on + + def OnLButtonDown(self, msg): + # UINT nFlags, CPoint point) + # only start dragging if clicked in "void" space + if self.dockBar is not None: + # start the drag + pt = msg[5] + pt = self.ClientToScreen(pt) + self.dockContext.StartDrag(pt) + return 0 + return 1 + + def OnNcLButtonDown(self, msg): + if self.bTracking: + return 0 + nHitTest = wparam = msg[2] + pt = msg[5] + + if nHitTest == win32con.HTSYSMENU and not self.IsFloating(): + self.GetDockingFrame().ShowControlBar(self, 0, 0) + elif nHitTest == win32con.HTMINBUTTON and not self.IsFloating(): + self.dockContext.ToggleDocking() + elif ( + nHitTest == win32con.HTCAPTION + and not self.IsFloating() + and self.dockBar is not None + ): + self.dockContext.StartDrag(pt) + elif nHitTest == win32con.HTSIZE and not self.IsFloating(): + self.StartTracking() + else: + return 1 + return 0 + + def OnLButtonDblClk(self, msg): + # only toggle docking if clicked in "void" space + if self.dockBar is not None: + # toggle docking + self.dockContext.ToggleDocking() + return 0 + return 1 + + def OnNcLButtonDblClk(self, msg): + nHitTest = wparam = msg[2] + # UINT nHitTest, CPoint point) + if self.dockBar is not None and nHitTest == win32con.HTCAPTION: + # toggle docking + self.dockContext.ToggleDocking() + return 0 + return 1 + + def OnMouseMove(self, msg): + flags = wparam = msg[2] + lparam = msg[3] + if self.IsFloating() or not self.bTracking: + return 1 + + # Convert unsigned 16 bit to signed 32 bit. + x = win32api.LOWORD(lparam) + if x & 32768: + x = x | -65536 + y = win32api.HIWORD(lparam) + if y & 32768: + y = y | -65536 + pt = x, y + cpt = CenterPoint(self.rectTracker) + pt = self.ClientToWnd(pt) + if self.IsHorz(): + if cpt[1] != pt[1]: + self.OnInvertTracker(self.rectTracker) + self.rectTracker = OffsetRect(self.rectTracker, (0, pt[1] - cpt[1])) + self.OnInvertTracker(self.rectTracker) + else: + if cpt[0] != pt[0]: + self.OnInvertTracker(self.rectTracker) + self.rectTracker = OffsetRect(self.rectTracker, (pt[0] - cpt[0], 0)) + self.OnInvertTracker(self.rectTracker) + + return 0 # Dont pass it on. + + # def OnBarStyleChange(self, old, new): + + def OnNcCalcSize(self, bCalcValid, size_info): + (rc0, rc1, rc2, pos) = size_info + self.rectBorder = self.GetWindowRect() + self.rectBorder = OffsetRect( + self.rectBorder, (-self.rectBorder[0], -self.rectBorder[1]) + ) + + dwBorderStyle = self._obj_.dwStyle | afxres.CBRS_BORDER_ANY + + if self.nDockBarID == afxres.AFX_IDW_DOCKBAR_TOP: + dwBorderStyle = dwBorderStyle & ~afxres.CBRS_BORDER_BOTTOM + rc0.left = rc0.left + self.cxGripper + rc0.bottom = rc0.bottom - self.cxEdge + rc0.top = rc0.top + self.cxBorder + rc0.right = rc0.right - self.cxBorder + self.rectBorder = ( + self.rectBorder[0], + self.rectBorder[3] - self.cxEdge, + self.rectBorder[2], + self.rectBorder[3], + ) + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_BOTTOM: + dwBorderStyle = dwBorderStyle & ~afxres.CBRS_BORDER_TOP + rc0.left = rc0.left + self.cxGripper + rc0.top = rc0.top + self.cxEdge + rc0.bottom = rc0.bottom - self.cxBorder + rc0.right = rc0.right - self.cxBorder + self.rectBorder = ( + self.rectBorder[0], + self.rectBorder[1], + self.rectBorder[2], + self.rectBorder[1] + self.cxEdge, + ) + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_LEFT: + dwBorderStyle = dwBorderStyle & ~afxres.CBRS_BORDER_RIGHT + rc0.right = rc0.right - self.cxEdge + rc0.left = rc0.left + self.cxBorder + rc0.bottom = rc0.bottom - self.cxBorder + rc0.top = rc0.top + self.cxGripper + self.rectBorder = ( + self.rectBorder[2] - self.cxEdge, + self.rectBorder[1], + self.rectBorder[2], + self.rectBorder[3], + ) + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_RIGHT: + dwBorderStyle = dwBorderStyle & ~afxres.CBRS_BORDER_LEFT + rc0.left = rc0.left + self.cxEdge + rc0.right = rc0.right - self.cxBorder + rc0.bottom = rc0.bottom - self.cxBorder + rc0.top = rc0.top + self.cxGripper + self.rectBorder = ( + self.rectBorder[0], + self.rectBorder[1], + self.rectBorder[0] + self.cxEdge, + self.rectBorder[3], + ) + else: + self.rectBorder = 0, 0, 0, 0 + + self.SetBarStyle(dwBorderStyle) + return 0 + + def OnNcPaint(self, msg): + self.EraseNonClient() + dc = self.GetWindowDC() + ctl = win32api.GetSysColor(win32con.COLOR_BTNHIGHLIGHT) + cbr = win32api.GetSysColor(win32con.COLOR_BTNSHADOW) + dc.Draw3dRect(self.rectBorder, ctl, cbr) + + self.DrawGripper(dc) + + rect = self.GetClientRect() + self.InvalidateRect(rect, 1) + return 0 + + def OnNcHitTest(self, pt): # A virtual, not a hooked message. + if self.IsFloating(): + return 1 + + ptOrig = pt + rect = self.GetWindowRect() + pt = pt[0] - rect[0], pt[1] - rect[1] + + if PtInRect(self.rectClose, pt): + return win32con.HTSYSMENU + elif PtInRect(self.rectUndock, pt): + return win32con.HTMINBUTTON + elif PtInRect(self.rectGripper, pt): + return win32con.HTCAPTION + elif PtInRect(self.rectBorder, pt): + return win32con.HTSIZE + else: + return self._obj_.OnNcHitTest(ptOrig) + + def StartTracking(self): + self.SetCapture() + + # make sure no updates are pending + self.RedrawWindow(None, None, win32con.RDW_ALLCHILDREN | win32con.RDW_UPDATENOW) + self.dockSite.LockWindowUpdate() + + self.ptOld = CenterPoint(self.rectBorder) + self.bTracking = 1 + + self.rectTracker = self.rectBorder + if not self.IsHorz(): + l, t, r, b = self.rectTracker + b = b - 4 + self.rectTracker = l, t, r, b + + self.OnInvertTracker(self.rectTracker) + + def OnCaptureChanged(self, msg): + hwnd = lparam = msg[3] + if self.bTracking and hwnd != self.GetSafeHwnd(): + self.StopTracking(0) # cancel tracking + return 1 + + def StopTracking(self, bAccept): + self.OnInvertTracker(self.rectTracker) + self.dockSite.UnlockWindowUpdate() + self.bTracking = 0 + self.ReleaseCapture() + if not bAccept: + return + + rcc = self.dockSite.GetWindowRect() + if self.IsHorz(): + newsize = self.sizeHorz[1] + maxsize = newsize + (rcc[3] - rcc[1]) + minsize = self.sizeMin[1] + else: + newsize = self.sizeVert[0] + maxsize = newsize + (rcc[2] - rcc[0]) + minsize = self.sizeMin[0] + + pt = CenterPoint(self.rectTracker) + if self.nDockBarID == afxres.AFX_IDW_DOCKBAR_TOP: + newsize = newsize + (pt[1] - self.ptOld[1]) + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_BOTTOM: + newsize = newsize + (-pt[1] + self.ptOld[1]) + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_LEFT: + newsize = newsize + (pt[0] - self.ptOld[0]) + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_RIGHT: + newsize = newsize + (-pt[0] + self.ptOld[0]) + newsize = max(minsize, min(maxsize, newsize)) + if self.IsHorz(): + self.sizeHorz = self.sizeHorz[0], newsize + else: + self.sizeVert = newsize, self.sizeVert[1] + self.dockSite.RecalcLayout() + return 0 + + def OnInvertTracker(self, rect): + assert rect[2] - rect[0] > 0 and rect[3] - rect[1] > 0, "rect is empty" + assert self.bTracking + rcc = self.GetWindowRect() + rcf = self.dockSite.GetWindowRect() + + rect = OffsetRect(rect, (rcc[0] - rcf[0], rcc[1] - rcf[1])) + rect = DeflateRect(rect, (1, 1)) + + flags = win32con.DCX_WINDOW | win32con.DCX_CACHE | win32con.DCX_LOCKWINDOWUPDATE + dc = self.dockSite.GetDCEx(None, flags) + try: + brush = win32ui.GetHalftoneBrush() + oldBrush = dc.SelectObject(brush) + + dc.PatBlt( + (rect[0], rect[1]), + (rect[2] - rect[0], rect[3] - rect[1]), + win32con.PATINVERT, + ) + dc.SelectObject(oldBrush) + finally: + self.dockSite.ReleaseDC(dc) + + def IsHorz(self): + return ( + self.nDockBarID == afxres.AFX_IDW_DOCKBAR_TOP + or self.nDockBarID == afxres.AFX_IDW_DOCKBAR_BOTTOM + ) + + def ClientToWnd(self, pt): + x, y = pt + if self.nDockBarID == afxres.AFX_IDW_DOCKBAR_BOTTOM: + y = y + self.cxEdge + elif self.nDockBarID == afxres.AFX_IDW_DOCKBAR_RIGHT: + x = x + self.cxEdge + return x, y + + def DrawGripper(self, dc): + # no gripper if floating + if self._obj_.dwStyle & afxres.CBRS_FLOATING: + return + + # -==HACK==- + # in order to calculate the client area properly after docking, + # the client area must be recalculated twice (I have no idea why) + self.dockSite.RecalcLayout() + # -==END HACK==- + + gripper = self.GetWindowRect() + gripper = self.ScreenToClient(gripper) + gripper = OffsetRect(gripper, (-gripper[0], -gripper[1])) + gl, gt, gr, gb = gripper + + if self._obj_.dwStyle & afxres.CBRS_ORIENT_HORZ: + # gripper at left + self.rectGripper = gl, gt + 40, gl + 20, gb + # draw close box + self.rectClose = gl + 7, gt + 10, gl + 19, gt + 22 + dc.DrawFrameControl( + self.rectClose, win32con.DFC_CAPTION, win32con.DFCS_CAPTIONCLOSE + ) + # draw docking toggle box + self.rectUndock = OffsetRect(self.rectClose, (0, 13)) + dc.DrawFrameControl( + self.rectUndock, win32con.DFC_CAPTION, win32con.DFCS_CAPTIONMAX + ) + + gt = gt + 38 + gb = gb - 10 + gl = gl + 10 + gr = gl + 3 + gripper = gl, gt, gr, gb + dc.Draw3dRect(gripper, clrBtnHilight, clrBtnShadow) + dc.Draw3dRect(OffsetRect(gripper, (4, 0)), clrBtnHilight, clrBtnShadow) + else: + # gripper at top + self.rectGripper = gl, gt, gr - 40, gt + 20 + # draw close box + self.rectClose = gr - 21, gt + 7, gr - 10, gt + 18 + dc.DrawFrameControl( + self.rectClose, win32con.DFC_CAPTION, win32con.DFCS_CAPTIONCLOSE + ) + # draw docking toggle box + self.rectUndock = OffsetRect(self.rectClose, (-13, 0)) + dc.DrawFrameControl( + self.rectUndock, win32con.DFC_CAPTION, win32con.DFCS_CAPTIONMAX + ) + gr = gr - 38 + gl = gl + 10 + gt = gt + 10 + gb = gt + 3 + + gripper = gl, gt, gr, gb + dc.Draw3dRect(gripper, clrBtnHilight, clrBtnShadow) + dc.Draw3dRect(OffsetRect(gripper, (0, 4)), clrBtnHilight, clrBtnShadow) + + def HookMessages(self): + self.HookMessage(self.OnLButtonUp, win32con.WM_LBUTTONUP) + self.HookMessage(self.OnLButtonDown, win32con.WM_LBUTTONDOWN) + self.HookMessage(self.OnLButtonDblClk, win32con.WM_LBUTTONDBLCLK) + self.HookMessage(self.OnNcLButtonDown, win32con.WM_NCLBUTTONDOWN) + self.HookMessage(self.OnNcLButtonDblClk, win32con.WM_NCLBUTTONDBLCLK) + self.HookMessage(self.OnMouseMove, win32con.WM_MOUSEMOVE) + self.HookMessage(self.OnNcPaint, win32con.WM_NCPAINT) + self.HookMessage(self.OnCaptureChanged, win32con.WM_CAPTURECHANGED) + self.HookMessage(self.OnWindowPosChanged, win32con.WM_WINDOWPOSCHANGED) + + +# self.HookMessage(self.OnSize, win32con.WM_SIZE) + + +def EditCreator(parent): + d = win32ui.CreateEdit() + es = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | win32con.WS_BORDER + | win32con.ES_MULTILINE + | win32con.ES_WANTRETURN + ) + d.CreateWindow(es, (0, 0, 150, 150), parent, 1000) + return d + + +def test(): + import pywin.mfc.dialog + + global bar + bar = DockingBar() + creator = EditCreator + bar.CreateWindow(win32ui.GetMainFrame(), creator, "Coolbar Demo", 0xFFFFF) + # win32ui.GetMainFrame().ShowControlBar(bar, 1, 0) + bar.SetBarStyle( + bar.GetBarStyle() + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + | afxres.CBRS_SIZE_DYNAMIC + ) + bar.EnableDocking(afxres.CBRS_ALIGN_ANY) + win32ui.GetMainFrame().DockControlBar(bar, afxres.AFX_IDW_DOCKBAR_BOTTOM) + + +if __name__ == "__main__": + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/docking/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/docking/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/app.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/app.py new file mode 100644 index 0000000000000000000000000000000000000000..f994f99f91fea16bf9e310cba504f94abaf6b305 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/app.py @@ -0,0 +1,457 @@ +# App.py +# Application stuff. +# The application is responsible for managing the main frame window. +# +# We also grab the FileOpen command, to invoke our Python editor +" The PythonWin application code. Manages most aspects of MDI, etc " +import os +import sys +import traceback + +import regutil +import win32api +import win32con +import win32ui +from pywin.mfc import afxres, dialog, window +from pywin.mfc.thread import WinApp + +from . import scriptutils + +## NOTE: App and AppBuild should NOT be used - instead, you should contruct your +## APP class manually whenever you like (just ensure you leave these 2 params None!) +## Whoever wants the generic "Application" should get it via win32iu.GetApp() + +# These are "legacy" +AppBuilder = None +App = None # default - if used, must end up a CApp derived class. + + +# Helpers that should one day be removed! +def AddIdleHandler(handler): + print( + "app.AddIdleHandler is deprecated - please use win32ui.GetApp().AddIdleHandler() instead." + ) + return win32ui.GetApp().AddIdleHandler(handler) + + +def DeleteIdleHandler(handler): + print( + "app.DeleteIdleHandler is deprecated - please use win32ui.GetApp().DeleteIdleHandler() instead." + ) + return win32ui.GetApp().DeleteIdleHandler(handler) + + +# Helper for writing a Window position by name, and later loading it. +def SaveWindowSize(section, rect, state=""): + """Writes a rectangle to an INI file + Args: section = section name in the applications INI file + rect = a rectangle in a (cy, cx, y, x) tuple + (same format as CREATESTRUCT position tuples).""" + left, top, right, bottom = rect + if state: + state = state + " " + win32ui.WriteProfileVal(section, state + "left", left) + win32ui.WriteProfileVal(section, state + "top", top) + win32ui.WriteProfileVal(section, state + "right", right) + win32ui.WriteProfileVal(section, state + "bottom", bottom) + + +def LoadWindowSize(section, state=""): + """Loads a section from an INI file, and returns a rect in a tuple (see SaveWindowSize)""" + if state: + state = state + " " + left = win32ui.GetProfileVal(section, state + "left", 0) + top = win32ui.GetProfileVal(section, state + "top", 0) + right = win32ui.GetProfileVal(section, state + "right", 0) + bottom = win32ui.GetProfileVal(section, state + "bottom", 0) + return (left, top, right, bottom) + + +def RectToCreateStructRect(rect): + return (rect[3] - rect[1], rect[2] - rect[0], rect[1], rect[0]) + + +# Define FrameWindow and Application objects +# +# The Main Frame of the application. +class MainFrame(window.MDIFrameWnd): + sectionPos = "Main Window" + statusBarIndicators = ( + afxres.ID_SEPARATOR, # // status line indicator + afxres.ID_INDICATOR_CAPS, + afxres.ID_INDICATOR_NUM, + afxres.ID_INDICATOR_SCRL, + win32ui.ID_INDICATOR_LINENUM, + win32ui.ID_INDICATOR_COLNUM, + ) + + def OnCreate(self, cs): + self._CreateStatusBar() + return 0 + + def _CreateStatusBar(self): + self.statusBar = win32ui.CreateStatusBar(self) + self.statusBar.SetIndicators(self.statusBarIndicators) + self.HookCommandUpdate(self.OnUpdatePosIndicator, win32ui.ID_INDICATOR_LINENUM) + self.HookCommandUpdate(self.OnUpdatePosIndicator, win32ui.ID_INDICATOR_COLNUM) + + def OnUpdatePosIndicator(self, cmdui): + editControl = scriptutils.GetActiveEditControl() + value = " " * 5 + if editControl is not None: + try: + startChar, endChar = editControl.GetSel() + lineNo = editControl.LineFromChar(startChar) + colNo = endChar - editControl.LineIndex(lineNo) + + if cmdui.m_nID == win32ui.ID_INDICATOR_LINENUM: + value = "%0*d" % (5, lineNo + 1) + else: + value = "%0*d" % (3, colNo + 1) + except win32ui.error: + pass + cmdui.SetText(value) + cmdui.Enable() + + def PreCreateWindow(self, cc): + cc = self._obj_.PreCreateWindow(cc) + pos = LoadWindowSize(self.sectionPos) + self.startRect = pos + if pos[2] - pos[0]: + rect = RectToCreateStructRect(pos) + cc = cc[0], cc[1], cc[2], cc[3], rect, cc[5], cc[6], cc[7], cc[8] + return cc + + def OnDestroy(self, msg): + # use GetWindowPlacement(), as it works even when min'd or max'd + rectNow = self.GetWindowPlacement()[4] + if rectNow != self.startRect: + SaveWindowSize(self.sectionPos, rectNow) + return 0 + + +class CApp(WinApp): + "A class for the application" + + def __init__(self): + self.oldCallbackCaller = None + WinApp.__init__(self, win32ui.GetApp()) + self.idleHandlers = [] + + def InitInstance(self): + "Called to crank up the app" + HookInput() + numMRU = win32ui.GetProfileVal("Settings", "Recent File List Size", 10) + win32ui.LoadStdProfileSettings(numMRU) + # self._obj_.InitMDIInstance() + if win32api.GetVersionEx()[0] < 4: + win32ui.SetDialogBkColor() + win32ui.Enable3dControls() + + # install a "callback caller" - a manager for the callbacks + # self.oldCallbackCaller = win32ui.InstallCallbackCaller(self.CallbackManager) + self.LoadMainFrame() + self.SetApplicationPaths() + + def ExitInstance(self): + "Called as the app dies - too late to prevent it here!" + win32ui.OutputDebug("Application shutdown\n") + # Restore the callback manager, if any. + try: + win32ui.InstallCallbackCaller(self.oldCallbackCaller) + except AttributeError: + pass + if self.oldCallbackCaller: + del self.oldCallbackCaller + self.frame = None # clean Python references to the now destroyed window object. + self.idleHandlers = [] + # Attempt cleanup if not already done! + if self._obj_: + self._obj_.AttachObject(None) + self._obj_ = None + global App + global AppBuilder + App = None + AppBuilder = None + return 0 + + def HaveIdleHandler(self, handler): + return handler in self.idleHandlers + + def AddIdleHandler(self, handler): + self.idleHandlers.append(handler) + + def DeleteIdleHandler(self, handler): + self.idleHandlers.remove(handler) + + def OnIdle(self, count): + try: + ret = 0 + handlers = self.idleHandlers[:] # copy list, as may be modified during loop + for handler in handlers: + try: + thisRet = handler(handler, count) + except: + print("Idle handler %s failed" % (repr(handler))) + traceback.print_exc() + print("Idle handler removed from list") + try: + self.DeleteIdleHandler(handler) + except ValueError: # Item not in list. + pass + thisRet = 0 + ret = ret or thisRet + return ret + except KeyboardInterrupt: + pass + + def CreateMainFrame(self): + return MainFrame() + + def LoadMainFrame(self): + "Create the main applications frame" + self.frame = self.CreateMainFrame() + self.SetMainFrame(self.frame) + self.frame.LoadFrame(win32ui.IDR_MAINFRAME, win32con.WS_OVERLAPPEDWINDOW) + self.frame.DragAcceptFiles() # we can accept these. + self.frame.ShowWindow(win32ui.GetInitialStateRequest()) + self.frame.UpdateWindow() + self.HookCommands() + + def OnHelp(self, id, code): + try: + if id == win32ui.ID_HELP_GUI_REF: + helpFile = regutil.GetRegisteredHelpFile("Pythonwin Reference") + helpCmd = win32con.HELP_CONTENTS + else: + helpFile = regutil.GetRegisteredHelpFile("Main Python Documentation") + helpCmd = win32con.HELP_FINDER + if helpFile is None: + win32ui.MessageBox("The help file is not registered!") + else: + from . import help + + help.OpenHelpFile(helpFile, helpCmd) + except: + t, v, tb = sys.exc_info() + win32ui.MessageBox( + "Internal error in help file processing\r\n%s: %s" % (t, v) + ) + tb = None # Prevent a cycle + + def DoLoadModules(self, modules): + # XXX - this should go, but the debugger uses it :-( + # dont do much checking! + for module in modules: + __import__(module) + + def HookCommands(self): + self.frame.HookMessage(self.OnDropFiles, win32con.WM_DROPFILES) + self.HookCommand(self.HandleOnFileOpen, win32ui.ID_FILE_OPEN) + self.HookCommand(self.HandleOnFileNew, win32ui.ID_FILE_NEW) + self.HookCommand(self.OnFileMRU, win32ui.ID_FILE_MRU_FILE1) + self.HookCommand(self.OnHelpAbout, win32ui.ID_APP_ABOUT) + self.HookCommand(self.OnHelp, win32ui.ID_HELP_PYTHON) + self.HookCommand(self.OnHelp, win32ui.ID_HELP_GUI_REF) + # Hook for the right-click menu. + self.frame.GetWindow(win32con.GW_CHILD).HookMessage( + self.OnRClick, win32con.WM_RBUTTONDOWN + ) + + def SetApplicationPaths(self): + # Load the users/application paths + new_path = [] + apppath = win32ui.GetProfileVal("Python", "Application Path", "").split(";") + for path in apppath: + if len(path) > 0: + new_path.append(win32ui.FullPath(path)) + for extra_num in range(1, 11): + apppath = win32ui.GetProfileVal( + "Python", "Application Path %d" % extra_num, "" + ).split(";") + if len(apppath) == 0: + break + for path in apppath: + if len(path) > 0: + new_path.append(win32ui.FullPath(path)) + sys.path = new_path + sys.path + + def OnRClick(self, params): + "Handle right click message" + # put up the entire FILE menu! + menu = win32ui.LoadMenu(win32ui.IDR_TEXTTYPE).GetSubMenu(0) + menu.TrackPopupMenu(params[5]) # track at mouse position. + return 0 + + def OnDropFiles(self, msg): + "Handle a file being dropped from file manager" + hDropInfo = msg[2] + self.frame.SetActiveWindow() # active us + nFiles = win32api.DragQueryFile(hDropInfo) + try: + for iFile in range(0, nFiles): + fileName = win32api.DragQueryFile(hDropInfo, iFile) + win32ui.GetApp().OpenDocumentFile(fileName) + finally: + win32api.DragFinish(hDropInfo) + + return 0 + + # No longer used by Pythonwin, as the C++ code has this same basic functionality + # but handles errors slightly better. + # It all still works, tho, so if you need similar functionality, you can use it. + # Therefore I havent deleted this code completely! + # def CallbackManager( self, ob, args = () ): + # """Manage win32 callbacks. Trap exceptions, report on them, then return 'All OK' + # to the frame-work. """ + # import traceback + # try: + # ret = apply(ob, args) + # return ret + # except: + # # take copies of the exception values, else other (handled) exceptions may get + # # copied over by the other fns called. + # win32ui.SetStatusText('An exception occured in a windows command handler.') + # t, v, tb = sys.exc_info() + # traceback.print_exception(t, v, tb.tb_next) + # try: + # sys.stdout.flush() + # except (NameError, AttributeError): + # pass + + # Command handlers. + def OnFileMRU(self, id, code): + "Called when a File 1-n message is recieved" + fileName = win32ui.GetRecentFileList()[id - win32ui.ID_FILE_MRU_FILE1] + win32ui.GetApp().OpenDocumentFile(fileName) + + def HandleOnFileOpen(self, id, code): + "Called when FileOpen message is received" + win32ui.GetApp().OnFileOpen() + + def HandleOnFileNew(self, id, code): + "Called when FileNew message is received" + win32ui.GetApp().OnFileNew() + + def OnHelpAbout(self, id, code): + "Called when HelpAbout message is received. Displays the About dialog." + win32ui.InitRichEdit() + dlg = AboutBox() + dlg.DoModal() + + +def _GetRegistryValue(key, val, default=None): + # val is registry value - None for default val. + try: + hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, key) + return win32api.RegQueryValueEx(hkey, val)[0] + except win32api.error: + try: + hkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, key) + return win32api.RegQueryValueEx(hkey, val)[0] + except win32api.error: + return default + + +scintilla = "Scintilla is Copyright 1998-2008 Neil Hodgson (http://www.scintilla.org)" +idle = "This program uses IDLE extensions by Guido van Rossum, Tim Peters and others." +contributors = "Thanks to the following people for making significant contributions: Roger Upole, Sidnei da Silva, Sam Rushing, Curt Hagenlocher, Dave Brennan, Roger Burnham, Gordon McMillan, Neil Hodgson, Laramie Leavitt. (let me know if I have forgotten you!)" + + +# The About Box +class AboutBox(dialog.Dialog): + def __init__(self, idd=win32ui.IDD_ABOUTBOX): + dialog.Dialog.__init__(self, idd) + + def OnInitDialog(self): + text = ( + "Pythonwin - Python IDE and GUI Framework for Windows.\n\n%s\n\nPython is %s\n\n%s\n\n%s\n\n%s" + % (win32ui.copyright, sys.copyright, scintilla, idle, contributors) + ) + self.SetDlgItemText(win32ui.IDC_EDIT1, text) + # Get the build number - written by installers. + # For distutils build, read pywin32.version.txt + import sysconfig + + site_packages = sysconfig.get_paths()["platlib"] + try: + build_no = ( + open(os.path.join(site_packages, "pywin32.version.txt")).read().strip() + ) + ver = "pywin32 build %s" % build_no + except EnvironmentError: + ver = None + if ver is None: + # See if we are Part of Active Python + ver = _GetRegistryValue( + "SOFTWARE\\ActiveState\\ActivePython", "CurrentVersion" + ) + if ver is not None: + ver = "ActivePython build %s" % (ver,) + if ver is None: + ver = "" + self.SetDlgItemText(win32ui.IDC_ABOUT_VERSION, ver) + self.HookCommand(self.OnButHomePage, win32ui.IDC_BUTTON1) + + def OnButHomePage(self, id, code): + if code == win32con.BN_CLICKED: + win32api.ShellExecute( + 0, "open", "https://github.com/mhammond/pywin32", None, "", 1 + ) + + +def Win32RawInput(prompt=None): + "Provide raw_input() for gui apps" + # flush stderr/out first. + try: + sys.stdout.flush() + sys.stderr.flush() + except: + pass + if prompt is None: + prompt = "" + ret = dialog.GetSimpleInput(prompt) + if ret == None: + raise KeyboardInterrupt("operation cancelled") + return ret + + +def Win32Input(prompt=None): + "Provide input() for gui apps" + return eval(input(prompt)) + + +def HookInput(): + try: + raw_input + # must be py2x... + sys.modules["__builtin__"].raw_input = Win32RawInput + sys.modules["__builtin__"].input = Win32Input + except NameError: + # must be py3k + import code + + sys.modules["builtins"].input = Win32RawInput + + +def HaveGoodGUI(): + """Returns true if we currently have a good gui available.""" + return "pywin.framework.startup" in sys.modules + + +def CreateDefaultGUI(appClass=None): + """Creates a default GUI environment""" + if appClass is None: + from . import intpyapp # Bring in the default app - could be param'd later. + + appClass = intpyapp.InteractivePythonApp + # Create and init the app. + appClass().InitInstance() + + +def CheckCreateDefaultGUI(): + """Checks and creates if necessary a default GUI environment.""" + rc = HaveGoodGUI() + if not rc: + CreateDefaultGUI() + return rc diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/bitmap.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/bitmap.py new file mode 100644 index 0000000000000000000000000000000000000000..1501f72d899dcf3e85c0f94a93e63f12a617c763 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/bitmap.py @@ -0,0 +1,164 @@ +import os + +import win32api +import win32con +import win32ui +from pywin.mfc import docview, window + +from . import app + +bStretch = 1 + + +class BitmapDocument(docview.Document): + "A bitmap document. Holds the bitmap data itself." + + def __init__(self, template): + docview.Document.__init__(self, template) + self.bitmap = None + + def OnNewDocument(self): + # I can not create new bitmaps. + win32ui.MessageBox("Bitmaps can not be created.") + + def OnOpenDocument(self, filename): + self.bitmap = win32ui.CreateBitmap() + # init data members + f = open(filename, "rb") + try: + try: + self.bitmap.LoadBitmapFile(f) + except IOError: + win32ui.MessageBox("Could not load the bitmap from %s" % filename) + return 0 + finally: + f.close() + self.size = self.bitmap.GetSize() + return 1 + + def DeleteContents(self): + self.bitmap = None + + +class BitmapView(docview.ScrollView): + "A view of a bitmap. Obtains data from document." + + def __init__(self, doc): + docview.ScrollView.__init__(self, doc) + self.width = self.height = 0 + # set up message handlers + self.HookMessage(self.OnSize, win32con.WM_SIZE) + + def OnInitialUpdate(self): + doc = self.GetDocument() + if doc.bitmap: + bitmapSize = doc.bitmap.GetSize() + self.SetScrollSizes(win32con.MM_TEXT, bitmapSize) + + def OnSize(self, params): + lParam = params[3] + self.width = win32api.LOWORD(lParam) + self.height = win32api.HIWORD(lParam) + + def OnDraw(self, dc): + # set sizes used for "non stretch" mode. + doc = self.GetDocument() + if doc.bitmap is None: + return + bitmapSize = doc.bitmap.GetSize() + if bStretch: + # stretch BMP. + viewRect = (0, 0, self.width, self.height) + bitmapRect = (0, 0, bitmapSize[0], bitmapSize[1]) + doc.bitmap.Paint(dc, viewRect, bitmapRect) + else: + # non stretch. + doc.bitmap.Paint(dc) + + +class BitmapFrame(window.MDIChildWnd): + def OnCreateClient(self, createparams, context): + borderX = win32api.GetSystemMetrics(win32con.SM_CXFRAME) + borderY = win32api.GetSystemMetrics(win32con.SM_CYFRAME) + titleY = win32api.GetSystemMetrics(win32con.SM_CYCAPTION) # includes border + # try and maintain default window pos, else adjust if cant fit + # get the main client window dimensions. + mdiClient = win32ui.GetMainFrame().GetWindow(win32con.GW_CHILD) + clientWindowRect = mdiClient.ScreenToClient(mdiClient.GetWindowRect()) + clientWindowSize = ( + clientWindowRect[2] - clientWindowRect[0], + clientWindowRect[3] - clientWindowRect[1], + ) + left, top, right, bottom = mdiClient.ScreenToClient(self.GetWindowRect()) + # width, height=context.doc.size[0], context.doc.size[1] + # width = width+borderX*2 + # height= height+titleY+borderY*2-1 + # if (left+width)>clientWindowSize[0]: + # left = clientWindowSize[0] - width + # if left<0: + # left = 0 + # width = clientWindowSize[0] + # if (top+height)>clientWindowSize[1]: + # top = clientWindowSize[1] - height + # if top<0: + # top = 0 + # height = clientWindowSize[1] + # self.frame.MoveWindow((left, top, left+width, top+height),0) + window.MDIChildWnd.OnCreateClient(self, createparams, context) + return 1 + + +class BitmapTemplate(docview.DocTemplate): + def __init__(self): + docview.DocTemplate.__init__( + self, win32ui.IDR_PYTHONTYPE, BitmapDocument, BitmapFrame, BitmapView + ) + + def MatchDocType(self, fileName, fileType): + doc = self.FindOpenDocument(fileName) + if doc: + return doc + ext = os.path.splitext(fileName)[1].lower() + if ext == ".bmp": # removed due to PIL! or ext=='.ppm': + return win32ui.CDocTemplate_Confidence_yesAttemptNative + return win32ui.CDocTemplate_Confidence_maybeAttemptForeign + + +# return win32ui.CDocTemplate_Confidence_noAttempt + +# For debugging purposes, when this module may be reloaded many times. +try: + win32ui.GetApp().RemoveDocTemplate(bitmapTemplate) +except NameError: + pass + +bitmapTemplate = BitmapTemplate() +bitmapTemplate.SetDocStrings( + "\nBitmap\nBitmap\nBitmap (*.bmp)\n.bmp\nPythonBitmapFileType\nPython Bitmap File" +) +win32ui.GetApp().AddDocTemplate(bitmapTemplate) + +# This works, but just didnt make it through the code reorg. +# class PPMBitmap(Bitmap): +# def LoadBitmapFile(self, file ): +# magic=file.readline() +# if magic <> "P6\n": +# raise TypeError, "The file is not a PPM format file" +# rowcollist=string.split(file.readline()) +# cols=string.atoi(rowcollist[0]) +# rows=string.atoi(rowcollist[1]) +# file.readline() # whats this one? +# self.bitmap.LoadPPMFile(file,(cols,rows)) + + +def t(): + bitmapTemplate.OpenDocumentFile("d:\\winnt\\arcade.bmp") + # OpenBMPFile( 'd:\\winnt\\arcade.bmp') + + +def demo(): + import glob + + winDir = win32api.GetWindowsDirectory() + for fileName in glob.glob1(winDir, "*.bmp")[:2]: + bitmapTemplate.OpenDocumentFile(os.path.join(winDir, fileName)) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/cmdline.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/cmdline.py new file mode 100644 index 0000000000000000000000000000000000000000..dba31d1ad1e4983c8f199889630561a0178d6834 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/cmdline.py @@ -0,0 +1,56 @@ +# cmdline - command line utilities. +import string +import sys + +import win32ui + + +def ParseArgs(str): + import string + + ret = [] + pos = 0 + length = len(str) + while pos < length: + try: + while str[pos] in string.whitespace: + pos = pos + 1 + except IndexError: + break + if pos >= length: + break + if str[pos] == '"': + pos = pos + 1 + try: + endPos = str.index('"', pos) - 1 + nextPos = endPos + 2 + except ValueError: + endPos = length + nextPos = endPos + 1 + else: + endPos = pos + while endPos < length and not str[endPos] in string.whitespace: + endPos = endPos + 1 + nextPos = endPos + 1 + ret.append(str[pos : endPos + 1].strip()) + pos = nextPos + return ret + + +def FixArgFileName(fileName): + """Convert a filename on the commandline to something useful. + Given an automatic filename on the commandline, turn it a python module name, + with the path added to sys.path.""" + import os + + path, fname = os.path.split(fileName) + if len(path) == 0: + path = os.curdir + path = os.path.abspath(path) + # must check that the command line arg's path is in sys.path + for syspath in sys.path: + if os.path.abspath(syspath) == path: + break + else: + sys.path.append(path) + return os.path.splitext(fname)[0] diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/dbgcommands.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/dbgcommands.py new file mode 100644 index 0000000000000000000000000000000000000000..e295926c799320c80513af1a2986fc1fdb3154d0 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/dbgcommands.py @@ -0,0 +1,189 @@ +# Command Handlers for the debugger. + +# Not in the debugger package, as I always want these interfaces to be +# available, even if the debugger has not yet been (or can not be) +# imported +import warnings + +import win32ui +from pywin.scintilla.control import CScintillaEditInterface + +from . import scriptutils + +IdToBarNames = { + win32ui.IDC_DBG_STACK: ("Stack", 0), + win32ui.IDC_DBG_BREAKPOINTS: ("Breakpoints", 0), + win32ui.IDC_DBG_WATCH: ("Watch", 1), +} + + +class DebuggerCommandHandler: + def HookCommands(self): + commands = ( + (self.OnStep, None, win32ui.IDC_DBG_STEP), + (self.OnStepOut, self.OnUpdateOnlyBreak, win32ui.IDC_DBG_STEPOUT), + (self.OnStepOver, None, win32ui.IDC_DBG_STEPOVER), + (self.OnGo, None, win32ui.IDC_DBG_GO), + (self.OnClose, self.OnUpdateClose, win32ui.IDC_DBG_CLOSE), + (self.OnAdd, self.OnUpdateAddBreakpoints, win32ui.IDC_DBG_ADD), + (self.OnClearAll, self.OnUpdateClearAllBreakpoints, win32ui.IDC_DBG_CLEAR), + # (self.OnDebuggerToolbar, self.OnUpdateDebuggerToolbar, win32ui.ID_DEBUGGER_TOOLBAR), + ) + + frame = win32ui.GetMainFrame() + + for methHandler, methUpdate, id in commands: + frame.HookCommand(methHandler, id) + if not methUpdate is None: + frame.HookCommandUpdate(methUpdate, id) + + for id in list(IdToBarNames.keys()): + frame.HookCommand(self.OnDebuggerBar, id) + frame.HookCommandUpdate(self.OnUpdateDebuggerBar, id) + + def OnDebuggerToolbar(self, id, code): + if code == 0: + return not win32ui.GetMainFrame().OnBarCheck(id) + + def OnUpdateDebuggerToolbar(self, cmdui): + win32ui.GetMainFrame().OnUpdateControlBarMenu(cmdui) + cmdui.Enable(1) + + def _GetDebugger(self): + try: + import pywin.debugger + + return pywin.debugger.currentDebugger + except ImportError: + return None + + def _DoOrStart(self, doMethod, startFlag): + d = self._GetDebugger() + if d is not None and d.IsDebugging(): + method = getattr(d, doMethod) + method() + else: + scriptutils.RunScript( + defName=None, defArgs=None, bShowDialog=0, debuggingType=startFlag + ) + + def OnStep(self, msg, code): + self._DoOrStart("do_set_step", scriptutils.RS_DEBUGGER_STEP) + + def OnStepOver(self, msg, code): + self._DoOrStart("do_set_next", scriptutils.RS_DEBUGGER_STEP) + + def OnStepOut(self, msg, code): + d = self._GetDebugger() + if d is not None and d.IsDebugging(): + d.do_set_return() + + def OnGo(self, msg, code): + self._DoOrStart("do_set_continue", scriptutils.RS_DEBUGGER_GO) + + def OnClose(self, msg, code): + d = self._GetDebugger() + if d is not None: + if d.IsDebugging(): + d.set_quit() + else: + d.close() + + def OnUpdateClose(self, cmdui): + d = self._GetDebugger() + if d is not None and d.inited: + cmdui.Enable(1) + else: + cmdui.Enable(0) + + def OnAdd(self, msg, code): + doc, view = scriptutils.GetActiveEditorDocument() + if doc is None: + ## Don't do a messagebox, as this could be triggered from the app's + ## idle loop whenever the debug toolbar is visible, giving a never-ending + ## series of dialogs. This can happen when the OnUpdate handler + ## for the toolbar button IDC_DBG_ADD fails, since MFC falls back to + ## sending a normal command if the UI update command fails. + ## win32ui.MessageBox('There is no active window - no breakpoint can be added') + warnings.warn("There is no active window - no breakpoint can be added") + return None + pathName = doc.GetPathName() + lineNo = view.LineFromChar(view.GetSel()[0]) + 1 + # If I have a debugger, then tell it, otherwise just add a marker + d = self._GetDebugger() + if d is None: + import pywin.framework.editor.color.coloreditor + + doc.MarkerToggle( + lineNo, pywin.framework.editor.color.coloreditor.MARKER_BREAKPOINT + ) + else: + if d.get_break(pathName, lineNo): + win32ui.SetStatusText("Clearing breakpoint", 1) + rc = d.clear_break(pathName, lineNo) + else: + win32ui.SetStatusText("Setting breakpoint", 1) + rc = d.set_break(pathName, lineNo) + if rc: + win32ui.MessageBox(rc) + d.GUIRespondDebuggerData() + + def OnClearAll(self, msg, code): + win32ui.SetStatusText("Clearing all breakpoints") + d = self._GetDebugger() + if d is None: + import pywin.framework.editor + import pywin.framework.editor.color.coloreditor + + for doc in pywin.framework.editor.editorTemplate.GetDocumentList(): + doc.MarkerDeleteAll( + pywin.framework.editor.color.coloreditor.MARKER_BREAKPOINT + ) + else: + d.clear_all_breaks() + d.UpdateAllLineStates() + d.GUIRespondDebuggerData() + + def OnUpdateOnlyBreak(self, cmdui): + d = self._GetDebugger() + ok = d is not None and d.IsBreak() + cmdui.Enable(ok) + + def OnUpdateAddBreakpoints(self, cmdui): + doc, view = scriptutils.GetActiveEditorDocument() + if doc is None or not isinstance(view, CScintillaEditInterface): + enabled = 0 + else: + enabled = 1 + lineNo = view.LineFromChar(view.GetSel()[0]) + 1 + import pywin.framework.editor.color.coloreditor + + cmdui.SetCheck( + doc.MarkerAtLine( + lineNo, pywin.framework.editor.color.coloreditor.MARKER_BREAKPOINT + ) + != 0 + ) + cmdui.Enable(enabled) + + def OnUpdateClearAllBreakpoints(self, cmdui): + d = self._GetDebugger() + cmdui.Enable(d is None or len(d.breaks) != 0) + + def OnUpdateDebuggerBar(self, cmdui): + name, always = IdToBarNames.get(cmdui.m_nID) + enabled = always + d = self._GetDebugger() + if d is not None and d.IsDebugging() and name is not None: + enabled = 1 + bar = d.GetDebuggerBar(name) + cmdui.SetCheck(bar.IsWindowVisible()) + cmdui.Enable(enabled) + + def OnDebuggerBar(self, id, code): + name = IdToBarNames.get(id)[0] + d = self._GetDebugger() + if d is not None and name is not None: + bar = d.GetDebuggerBar(name) + newState = not bar.IsWindowVisible() + win32ui.GetMainFrame().ShowControlBar(bar, newState, 1) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/dlgappcore.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/dlgappcore.py new file mode 100644 index 0000000000000000000000000000000000000000..4b60cc1c0ae92ad601e7fc84962f6c29374a9694 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/dlgappcore.py @@ -0,0 +1,75 @@ +# dlgappcore. +# +# base classes for dialog based apps. + + +import win32api +import win32con +import win32ui +from pywin.mfc import dialog + +from . import app + +error = "Dialog Application Error" + + +class AppDialog(dialog.Dialog): + "The dialog box for the application" + + def __init__(self, id, dll=None): + self.iconId = win32ui.IDR_MAINFRAME + dialog.Dialog.__init__(self, id, dll) + + def OnInitDialog(self): + return dialog.Dialog.OnInitDialog(self) + + # Provide support for a dlg app using an icon + def OnPaint(self): + if not self.IsIconic(): + return self._obj_.OnPaint() + self.DefWindowProc(win32con.WM_ICONERASEBKGND, dc.GetHandleOutput(), 0) + left, top, right, bottom = self.GetClientRect() + left = (right - win32api.GetSystemMetrics(win32con.SM_CXICON)) >> 1 + top = (bottom - win32api.GetSystemMetrics(win32con.SM_CYICON)) >> 1 + hIcon = win32ui.GetApp().LoadIcon(self.iconId) + self.GetDC().DrawIcon((left, top), hIcon) + + # Only needed to provide a minimized icon (and this seems + # less important under win95/NT4 + def OnEraseBkgnd(self, dc): + if self.IsIconic(): + return 1 + else: + return self._obj_.OnEraseBkgnd(dc) + + def OnQueryDragIcon(self): + return win32ui.GetApp().LoadIcon(self.iconId) + + def PreDoModal(self): + pass + + +class DialogApp(app.CApp): + "An application class, for an app with main dialog box" + + def InitInstance(self): + # win32ui.SetProfileFileName('dlgapp.ini') + win32ui.LoadStdProfileSettings() + win32ui.EnableControlContainer() + win32ui.Enable3dControls() + self.dlg = self.frame = self.CreateDialog() + + if self.frame is None: + raise error("No dialog was created by CreateDialog()") + return + + self._obj_.InitDlgInstance(self.dlg) + self.PreDoModal() + self.dlg.PreDoModal() + self.dlg.DoModal() + + def CreateDialog(self): + pass + + def PreDoModal(self): + pass diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/ModuleBrowser.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/ModuleBrowser.py new file mode 100644 index 0000000000000000000000000000000000000000..7fd965327d1d7c128c293d20f4511ee3af6de9b7 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/ModuleBrowser.py @@ -0,0 +1,235 @@ +# ModuleBrowser.py - A view that provides a module browser for an editor document. +import pyclbr + +import afxres +import commctrl +import pywin.framework.scriptutils +import pywin.mfc.docview +import win32api +import win32con +import win32ui +from pywin.tools import browser, hierlist + + +class HierListCLBRModule(hierlist.HierListItem): + def __init__(self, modName, clbrdata): + self.modName = modName + self.clbrdata = clbrdata + + def GetText(self): + return self.modName + + def GetSubList(self): + ret = [] + for item in self.clbrdata.values(): + if ( + item.__class__ != pyclbr.Class + ): # ie, it is a pyclbr Function instance (only introduced post 1.5.2) + ret.append(HierListCLBRFunction(item)) + else: + ret.append(HierListCLBRClass(item)) + ret.sort() + return ret + + def IsExpandable(self): + return 1 + + +class HierListCLBRItem(hierlist.HierListItem): + def __init__(self, name, file, lineno, suffix=""): + self.name = str(name) + self.file = file + self.lineno = lineno + self.suffix = suffix + + def __lt__(self, other): + return self.name < other.name + + def __eq__(self, other): + return self.name == other.name + + def GetText(self): + return self.name + self.suffix + + def TakeDefaultAction(self): + if self.file: + pywin.framework.scriptutils.JumpToDocument( + self.file, self.lineno, bScrollToTop=1 + ) + else: + win32ui.SetStatusText("Can not locate the source code for this object.") + + def PerformItemSelected(self): + if self.file is None: + msg = "%s - source can not be located." % (self.name,) + else: + msg = "%s defined at line %d of %s" % (self.name, self.lineno, self.file) + win32ui.SetStatusText(msg) + + +class HierListCLBRClass(HierListCLBRItem): + def __init__(self, clbrclass, suffix=""): + try: + name = clbrclass.name + file = clbrclass.file + lineno = clbrclass.lineno + self.super = clbrclass.super + self.methods = clbrclass.methods + except AttributeError: + name = clbrclass + file = lineno = None + self.super = [] + self.methods = {} + HierListCLBRItem.__init__(self, name, file, lineno, suffix) + + def GetSubList(self): + r1 = [] + for c in self.super: + r1.append(HierListCLBRClass(c, " (Parent class)")) + r1.sort() + r2 = [] + for meth, lineno in self.methods.items(): + r2.append(HierListCLBRMethod(meth, self.file, lineno)) + r2.sort() + return r1 + r2 + + def IsExpandable(self): + return len(self.methods) + len(self.super) + + def GetBitmapColumn(self): + return 21 + + +class HierListCLBRFunction(HierListCLBRItem): + def __init__(self, clbrfunc, suffix=""): + name = clbrfunc.name + file = clbrfunc.file + lineno = clbrfunc.lineno + HierListCLBRItem.__init__(self, name, file, lineno, suffix) + + def GetBitmapColumn(self): + return 22 + + +class HierListCLBRMethod(HierListCLBRItem): + def GetBitmapColumn(self): + return 22 + + +class HierListCLBRErrorItem(hierlist.HierListItem): + def __init__(self, text): + self.text = text + + def GetText(self): + return self.text + + def GetSubList(self): + return [HierListCLBRErrorItem(self.text)] + + def IsExpandable(self): + return 0 + + +class HierListCLBRErrorRoot(HierListCLBRErrorItem): + def IsExpandable(self): + return 1 + + +class BrowserView(pywin.mfc.docview.TreeView): + def OnInitialUpdate(self): + self.list = None + rc = self._obj_.OnInitialUpdate() + self.HookMessage(self.OnSize, win32con.WM_SIZE) + self.bDirty = 0 + self.destroying = 0 + return rc + + def DestroyBrowser(self): + self.DestroyList() + + def OnActivateView(self, activate, av, dv): + # print "AV", self.bDirty, activate + if activate: + self.CheckRefreshList() + return self._obj_.OnActivateView(activate, av, dv) + + def _MakeRoot(self): + path = self.GetDocument().GetPathName() + if not path: + return HierListCLBRErrorRoot( + "Error: Can not browse a file until it is saved" + ) + else: + mod, path = pywin.framework.scriptutils.GetPackageModuleName(path) + if self.bDirty: + what = "Refreshing" + # Hack for pyclbr being too smart + try: + del pyclbr._modules[mod] + except (KeyError, AttributeError): + pass + else: + what = "Building" + win32ui.SetStatusText("%s class list - please wait..." % (what,), 1) + win32ui.DoWaitCursor(1) + try: + reader = pyclbr.readmodule_ex # new version post 1.5.2 + except AttributeError: + reader = pyclbr.readmodule + try: + data = reader(mod, [path]) + if data: + return HierListCLBRModule(mod, data) + else: + return HierListCLBRErrorRoot("No Python classes in module.") + + finally: + win32ui.DoWaitCursor(0) + win32ui.SetStatusText(win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE)) + + def DestroyList(self): + self.destroying = 1 + list = getattr( + self, "list", None + ) # If the document was not successfully opened, we may not have a list. + self.list = None + if list is not None: + list.HierTerm() + self.destroying = 0 + + def CheckMadeList(self): + if self.list is not None or self.destroying: + return + self.rootitem = root = self._MakeRoot() + self.list = list = hierlist.HierListWithItems(root, win32ui.IDB_BROWSER_HIER) + list.HierInit(self.GetParentFrame(), self) + list.SetStyle( + commctrl.TVS_HASLINES | commctrl.TVS_LINESATROOT | commctrl.TVS_HASBUTTONS + ) + + def CheckRefreshList(self): + if self.bDirty: + if self.list is None: + self.CheckMadeList() + else: + new_root = self._MakeRoot() + if self.rootitem.__class__ == new_root.__class__ == HierListCLBRModule: + self.rootitem.modName = new_root.modName + self.rootitem.clbrdata = new_root.clbrdata + self.list.Refresh() + else: + self.list.AcceptRoot(self._MakeRoot()) + self.bDirty = 0 + + def OnSize(self, params): + lparam = params[3] + w = win32api.LOWORD(lparam) + h = win32api.HIWORD(lparam) + if w != 0: + self.CheckMadeList() + elif w == 0: + self.DestroyList() + return 1 + + def _UpdateUIForState(self): + self.bDirty = 1 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ce13ece65c1a776077acf0a9155baeb9f57ed0ff --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/__init__.py @@ -0,0 +1,106 @@ +# __init__ for the Pythonwin editor package. +# +# We used to support optional editors - eg, color or non-color. +# +# This really isnt necessary with Scintilla, and scintilla +# is getting so deeply embedded that it was too much work. + +import sys + +import win32con +import win32ui + +defaultCharacterFormat = (-402653169, 0, 200, 0, 0, 0, 49, "Courier New") + +##def GetDefaultEditorModuleName(): +## import pywin +## # If someone has set pywin.editormodulename, then this is what we use +## try: +## prefModule = pywin.editormodulename +## except AttributeError: +## prefModule = win32ui.GetProfileVal("Editor","Module", "") +## return prefModule +## +##def WriteDefaultEditorModule(module): +## try: +## module = module.__name__ +## except: +## pass +## win32ui.WriteProfileVal("Editor", "Module", module) + + +def LoadDefaultEditor(): + pass + + +## prefModule = GetDefaultEditorModuleName() +## restorePrefModule = None +## mod = None +## if prefModule: +## try: +## mod = __import__(prefModule) +## except 'xx': +## msg = "Importing your preferred editor ('%s') failed.\n\nError %s: %s\n\nAn attempt will be made to load the default editor.\n\nWould you like this editor disabled in the future?" % (prefModule, sys.exc_info()[0], sys.exc_info()[1]) +## rc = win32ui.MessageBox(msg, "Error importing editor", win32con.MB_YESNO) +## if rc == win32con.IDNO: +## restorePrefModule = prefModule +## WriteDefaultEditorModule("") +## del rc +## +## try: +## # Try and load the default one - dont catch errors here. +## if mod is None: +## prefModule = "pywin.framework.editor.color.coloreditor" +## mod = __import__(prefModule) +## +## # Get at the real module. +## mod = sys.modules[prefModule] +## +## # Do a "from mod import *" +## globals().update(mod.__dict__) +## +## finally: +## # Restore the users default editor if it failed and they requested not to disable it. +## if restorePrefModule: +## WriteDefaultEditorModule(restorePrefModule) + + +def GetEditorOption(option, defaultValue, min=None, max=None): + rc = win32ui.GetProfileVal("Editor", option, defaultValue) + if min is not None and rc < min: + rc = defaultValue + if max is not None and rc > max: + rc = defaultValue + return rc + + +def SetEditorOption(option, newValue): + win32ui.WriteProfileVal("Editor", option, newValue) + + +def DeleteEditorOption(option): + try: + win32ui.WriteProfileVal("Editor", option, None) + except win32ui.error: + pass + + +# Load and save font tuples +def GetEditorFontOption(option, default=None): + if default is None: + default = defaultCharacterFormat + fmt = GetEditorOption(option, "") + if fmt == "": + return default + try: + return eval(fmt) + except: + print("WARNING: Invalid font setting in registry - setting ignored") + return default + + +def SetEditorFontOption(option, newValue): + SetEditorOption(option, str(newValue)) + + +from pywin.framework.editor.color.coloreditor import editorTemplate diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/color/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/color/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/color/coloreditor.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/color/coloreditor.py new file mode 100644 index 0000000000000000000000000000000000000000..4aacc0eab5b0fbc770d69a29b8c1b601cf30441b --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/color/coloreditor.py @@ -0,0 +1,664 @@ +# Color Editor originally by Neil Hodgson, but restructured by mh to integrate +# even tighter into Pythonwin. + +import pywin.scintilla.keycodes +import win32api +import win32con +import win32ui +from pywin.framework.editor import ( + GetEditorFontOption, + GetEditorOption, + SetEditorFontOption, + SetEditorOption, + defaultCharacterFormat, +) +from pywin.scintilla import bindings + +# from pywin.framework.editor import EditorPropertyPage + +MSG_CHECK_EXTERNAL_FILE = ( + win32con.WM_USER + 1999 +) ## WARNING: Duplicated in document.py and editor.py + +# Define a few common markers +MARKER_BOOKMARK = 0 +MARKER_BREAKPOINT = 1 +MARKER_CURRENT = 2 + +import pywin.scintilla.view +from pywin.debugger import dbgcon +from pywin.framework.editor.document import EditorDocumentBase +from pywin.scintilla import scintillacon # For the marker definitions +from pywin.scintilla.document import CScintillaDocument + + +class SyntEditDocument(EditorDocumentBase): + "A SyntEdit document." + + def OnDebuggerStateChange(self, state): + self._ApplyOptionalToViews("OnDebuggerStateChange", state) + + def HookViewNotifications(self, view): + EditorDocumentBase.HookViewNotifications(self, view) + view.SCISetUndoCollection(1) + + def FinalizeViewCreation(self, view): + EditorDocumentBase.FinalizeViewCreation(self, view) + if view == self.GetFirstView(): + self.GetDocTemplate().CheckIDLEMenus(view.idle) + + +SyntEditViewParent = pywin.scintilla.view.CScintillaView + + +class SyntEditView(SyntEditViewParent): + "A view of a SyntEdit. Obtains data from document." + + def __init__(self, doc): + SyntEditViewParent.__init__(self, doc) + self.bCheckingFile = 0 + + def OnInitialUpdate(self): + SyntEditViewParent.OnInitialUpdate(self) + + self.HookMessage(self.OnRClick, win32con.WM_RBUTTONDOWN) + + for id in ( + win32ui.ID_VIEW_FOLD_COLLAPSE, + win32ui.ID_VIEW_FOLD_COLLAPSE_ALL, + win32ui.ID_VIEW_FOLD_EXPAND, + win32ui.ID_VIEW_FOLD_EXPAND_ALL, + ): + self.HookCommand(self.OnCmdViewFold, id) + self.HookCommandUpdate(self.OnUpdateViewFold, id) + self.HookCommand(self.OnCmdViewFoldTopLevel, win32ui.ID_VIEW_FOLD_TOPLEVEL) + + # Define the markers + # self.SCIMarkerDeleteAll() + self.SCIMarkerDefineAll( + MARKER_BOOKMARK, + scintillacon.SC_MARK_ROUNDRECT, + win32api.RGB(0x0, 0x0, 0x0), + win32api.RGB(0, 0xFF, 0xFF), + ) + + self.SCIMarkerDefine(MARKER_CURRENT, scintillacon.SC_MARK_ARROW) + self.SCIMarkerSetBack(MARKER_CURRENT, win32api.RGB(0xFF, 0xFF, 0x00)) + + # Define the folding markers + if 1: # traditional markers + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDEROPEN, + scintillacon.SC_MARK_MINUS, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDER, + scintillacon.SC_MARK_PLUS, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDERSUB, + scintillacon.SC_MARK_EMPTY, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDERTAIL, + scintillacon.SC_MARK_EMPTY, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDEREND, + scintillacon.SC_MARK_EMPTY, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDEROPENMID, + scintillacon.SC_MARK_EMPTY, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDERMIDTAIL, + scintillacon.SC_MARK_EMPTY, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + else: # curved markers + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDEROPEN, + scintillacon.SC_MARK_CIRCLEMINUS, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDER, + scintillacon.SC_MARK_CIRCLEPLUS, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDERSUB, + scintillacon.SC_MARK_VLINE, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDERTAIL, + scintillacon.SC_MARK_LCORNERCURVE, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDEREND, + scintillacon.SC_MARK_CIRCLEPLUSCONNECTED, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDEROPENMID, + scintillacon.SC_MARK_CIRCLEMINUSCONNECTED, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + self.SCIMarkerDefineAll( + scintillacon.SC_MARKNUM_FOLDERMIDTAIL, + scintillacon.SC_MARK_TCORNERCURVE, + win32api.RGB(0xFF, 0xFF, 0xFF), + win32api.RGB(0, 0, 0), + ) + + self.SCIMarkerDefine(MARKER_BREAKPOINT, scintillacon.SC_MARK_CIRCLE) + # Marker background depends on debugger state + self.SCIMarkerSetFore(MARKER_BREAKPOINT, win32api.RGB(0x0, 0, 0)) + # Get the current debugger state. + try: + import pywin.debugger + + if pywin.debugger.currentDebugger is None: + state = dbgcon.DBGSTATE_NOT_DEBUGGING + else: + state = pywin.debugger.currentDebugger.debuggerState + except ImportError: + state = dbgcon.DBGSTATE_NOT_DEBUGGING + self.OnDebuggerStateChange(state) + + def _GetSubConfigNames(self): + return ["editor"] # Allow [Keys:Editor] sections to be specific to us + + def DoConfigChange(self): + SyntEditViewParent.DoConfigChange(self) + tabSize = GetEditorOption("Tab Size", 4, 2) + indentSize = GetEditorOption("Indent Size", 4, 2) + bUseTabs = GetEditorOption("Use Tabs", 0) + bSmartTabs = GetEditorOption("Smart Tabs", 1) + ext = self.idle.IDLEExtension("AutoIndent") # Required extension. + + self.SCISetViewWS(GetEditorOption("View Whitespace", 0)) + self.SCISetViewEOL(GetEditorOption("View EOL", 0)) + self.SCISetIndentationGuides(GetEditorOption("View Indentation Guides", 0)) + + if GetEditorOption("Right Edge Enabled", 0): + mode = scintillacon.EDGE_BACKGROUND + else: + mode = scintillacon.EDGE_NONE + self.SCISetEdgeMode(mode) + self.SCISetEdgeColumn(GetEditorOption("Right Edge Column", 75)) + self.SCISetEdgeColor( + GetEditorOption("Right Edge Color", win32api.RGB(0xEF, 0xEF, 0xEF)) + ) + + width = GetEditorOption("Marker Margin Width", 16) + self.SCISetMarginWidthN(1, width) + width = GetEditorOption("Fold Margin Width", 12) + self.SCISetMarginWidthN(2, width) + width = GetEditorOption("Line Number Margin Width", 0) + self.SCISetMarginWidthN(0, width) + self.bFolding = GetEditorOption("Enable Folding", 1) + fold_flags = 0 + self.SendScintilla( + scintillacon.SCI_SETMODEVENTMASK, scintillacon.SC_MOD_CHANGEFOLD + ) + if self.bFolding: + if GetEditorOption("Fold Lines", 1): + fold_flags = 16 + + self.SCISetProperty("fold", self.bFolding) + self.SCISetFoldFlags(fold_flags) + + tt_color = GetEditorOption("Tab Timmy Color", win32api.RGB(0xFF, 0, 0)) + self.SendScintilla(scintillacon.SCI_INDICSETFORE, 1, tt_color) + + tt_use = GetEditorOption("Use Tab Timmy", 1) + if tt_use: + self.SCISetProperty("tab.timmy.whinge.level", "1") + + # Auto-indent has very complicated behaviour. In a nutshell, the only + # way to get sensible behaviour from it is to ensure tabwidth != indentsize. + # Further, usetabs will only ever go from 1->0, never 0->1. + # This is _not_ the behaviour Pythonwin wants: + # * Tab width is arbitary, so should have no impact on smarts. + # * bUseTabs setting should reflect how new files are created, and + # if Smart Tabs disabled, existing files are edited + # * If "Smart Tabs" is enabled, bUseTabs should have no bearing + # for existing files (unless of course no context can be determined) + # + # So for smart tabs we configure the widget with completely dummy + # values (ensuring tabwidth != indentwidth), ask it to guess, then + # look at the values it has guessed, and re-configure + if bSmartTabs: + ext.config(usetabs=1, tabwidth=5, indentwidth=4) + ext.set_indentation_params(1) + if ext.indentwidth == 5: + # Either 5 literal spaces, or a single tab character. Assume a tab + usetabs = 1 + indentwidth = tabSize + else: + # Either Indented with spaces, and indent size has been guessed or + # an empty file (or no context found - tough!) + if self.GetTextLength() == 0: # emtpy + usetabs = bUseTabs + indentwidth = indentSize + else: # guessed. + indentwidth = ext.indentwidth + usetabs = 0 + # Tab size can never be guessed - set at user preference. + ext.config(usetabs=usetabs, indentwidth=indentwidth, tabwidth=tabSize) + else: + # Dont want smart-tabs - just set the options! + ext.config(usetabs=bUseTabs, tabwidth=tabSize, indentwidth=indentSize) + self.SCISetIndent(indentSize) + self.SCISetTabWidth(tabSize) + + def OnDebuggerStateChange(self, state): + if state == dbgcon.DBGSTATE_NOT_DEBUGGING: + # Indicate breakpoints arent really usable. + # Not quite white - useful when no marker margin, so set as background color. + self.SCIMarkerSetBack(MARKER_BREAKPOINT, win32api.RGB(0xEF, 0xEF, 0xEF)) + else: + # A light-red, so still readable when no marker margin. + self.SCIMarkerSetBack(MARKER_BREAKPOINT, win32api.RGB(0xFF, 0x80, 0x80)) + + def HookDocumentHandlers(self): + SyntEditViewParent.HookDocumentHandlers(self) + self.HookMessage(self.OnCheckExternalDocumentUpdated, MSG_CHECK_EXTERNAL_FILE) + + def HookHandlers(self): + SyntEditViewParent.HookHandlers(self) + self.HookMessage(self.OnSetFocus, win32con.WM_SETFOCUS) + + def _PrepareUserStateChange(self): + return self.GetSel(), self.GetFirstVisibleLine() + + def _EndUserStateChange(self, info): + scrollOff = info[1] - self.GetFirstVisibleLine() + if scrollOff: + self.LineScroll(scrollOff) + # Make sure we dont reset the cursor beyond the buffer. + max = self.GetTextLength() + newPos = min(info[0][0], max), min(info[0][1], max) + self.SetSel(newPos) + + ####################################### + # The Windows Message or Notify handlers. + ####################################### + def OnMarginClick(self, std, extra): + notify = self.SCIUnpackNotifyMessage(extra) + if notify.margin == 2: # Our fold margin + line_click = self.LineFromChar(notify.position) + # max_line = self.GetLineCount() + if self.SCIGetFoldLevel(line_click) & scintillacon.SC_FOLDLEVELHEADERFLAG: + # If a fold point. + self.SCIToggleFold(line_click) + return 1 + + def OnSetFocus(self, msg): + # Even though we use file change notifications, we should be very sure about it here. + self.OnCheckExternalDocumentUpdated(msg) + return 1 + + def OnCheckExternalDocumentUpdated(self, msg): + if self.bCheckingFile: + return + self.bCheckingFile = 1 + self.GetDocument().CheckExternalDocumentUpdated() + self.bCheckingFile = 0 + + def OnRClick(self, params): + menu = win32ui.CreatePopupMenu() + self.AppendMenu(menu, "&Locate module", "LocateModule") + self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) + self.AppendMenu(menu, "&Undo", "EditUndo") + self.AppendMenu(menu, "&Redo", "EditRedo") + self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) + self.AppendMenu(menu, "Cu&t", "EditCut") + self.AppendMenu(menu, "&Copy", "EditCopy") + self.AppendMenu(menu, "&Paste", "EditPaste") + self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) + self.AppendMenu(menu, "&Select all", "EditSelectAll") + self.AppendMenu( + menu, "View &Whitespace", "ViewWhitespace", checked=self.SCIGetViewWS() + ) + self.AppendMenu( + menu, "&Fixed Font", "ViewFixedFont", checked=self._GetColorizer().bUseFixed + ) + self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) + self.AppendMenu(menu, "&Goto line...", "GotoLine") + + submenu = win32ui.CreatePopupMenu() + newitems = self.idle.GetMenuItems("edit") + for text, event in newitems: + self.AppendMenu(submenu, text, event) + + flags = win32con.MF_STRING | win32con.MF_ENABLED | win32con.MF_POPUP + menu.AppendMenu(flags, submenu.GetHandle(), "&Source code") + + flags = ( + win32con.TPM_LEFTALIGN | win32con.TPM_LEFTBUTTON | win32con.TPM_RIGHTBUTTON + ) + menu.TrackPopupMenu(params[5], flags, self) + return 0 + + def OnCmdViewFold(self, cid, code): # Handle the menu command + if cid == win32ui.ID_VIEW_FOLD_EXPAND_ALL: + self.FoldExpandAllEvent(None) + elif cid == win32ui.ID_VIEW_FOLD_EXPAND: + self.FoldExpandEvent(None) + elif cid == win32ui.ID_VIEW_FOLD_COLLAPSE_ALL: + self.FoldCollapseAllEvent(None) + elif cid == win32ui.ID_VIEW_FOLD_COLLAPSE: + self.FoldCollapseEvent(None) + else: + print("Unknown collapse/expand ID") + + def OnUpdateViewFold(self, cmdui): # Update the tick on the UI. + if not self.bFolding: + cmdui.Enable(0) + return + id = cmdui.m_nID + if id in (win32ui.ID_VIEW_FOLD_EXPAND_ALL, win32ui.ID_VIEW_FOLD_COLLAPSE_ALL): + cmdui.Enable() + else: + enable = 0 + lineno = self.LineFromChar(self.GetSel()[0]) + foldable = ( + self.SCIGetFoldLevel(lineno) & scintillacon.SC_FOLDLEVELHEADERFLAG + ) + is_expanded = self.SCIGetFoldExpanded(lineno) + if id == win32ui.ID_VIEW_FOLD_EXPAND: + if foldable and not is_expanded: + enable = 1 + elif id == win32ui.ID_VIEW_FOLD_COLLAPSE: + if foldable and is_expanded: + enable = 1 + cmdui.Enable(enable) + + def OnCmdViewFoldTopLevel(self, cid, code): # Handle the menu command + self.FoldTopLevelEvent(None) + + ####################################### + # The Events + ####################################### + def ToggleBookmarkEvent(self, event, pos=-1): + """Toggle a bookmark at the specified or current position""" + if pos == -1: + pos, end = self.GetSel() + startLine = self.LineFromChar(pos) + self.GetDocument().MarkerToggle(startLine + 1, MARKER_BOOKMARK) + return 0 + + def GotoNextBookmarkEvent(self, event, fromPos=-1): + """Move to the next bookmark""" + if fromPos == -1: + fromPos, end = self.GetSel() + startLine = self.LineFromChar(fromPos) + 1 # Zero based line to start + nextLine = self.GetDocument().MarkerGetNext(startLine + 1, MARKER_BOOKMARK) - 1 + if nextLine < 0: + nextLine = self.GetDocument().MarkerGetNext(0, MARKER_BOOKMARK) - 1 + if nextLine < 0 or nextLine == startLine - 1: + win32api.MessageBeep() + else: + self.SCIEnsureVisible(nextLine) + self.SCIGotoLine(nextLine) + return 0 + + def TabKeyEvent(self, event): + """Insert an indent. If no selection, a single indent, otherwise a block indent""" + # Handle auto-complete first. + if self.SCIAutoCActive(): + self.SCIAutoCComplete() + return 0 + # Call the IDLE event. + return self.bindings.fire("<>", event) + + def EnterKeyEvent(self, event): + """Handle the enter key with special handling for auto-complete""" + # Handle auto-complete first. + if self.SCIAutoCActive(): + self.SCIAutoCComplete() + self.SCIAutoCCancel() + # Call the IDLE event. + return self.bindings.fire("<>", event) + + def ShowInteractiveWindowEvent(self, event): + import pywin.framework.interact + + pywin.framework.interact.ShowInteractiveWindow() + + def FoldTopLevelEvent(self, event=None): + if not self.bFolding: + return 1 + + win32ui.DoWaitCursor(1) + try: + self.Colorize() + maxLine = self.GetLineCount() + # Find the first line, and check out its state. + for lineSeek in range(maxLine): + if self.SCIGetFoldLevel(lineSeek) & scintillacon.SC_FOLDLEVELHEADERFLAG: + expanding = not self.SCIGetFoldExpanded(lineSeek) + break + else: + # no folds here! + return + for lineSeek in range(lineSeek, maxLine): + level = self.SCIGetFoldLevel(lineSeek) + level_no = ( + level + & scintillacon.SC_FOLDLEVELNUMBERMASK + - scintillacon.SC_FOLDLEVELBASE + ) + is_header = level & scintillacon.SC_FOLDLEVELHEADERFLAG + # print lineSeek, level_no, is_header + if level_no == 0 and is_header: + if (expanding and not self.SCIGetFoldExpanded(lineSeek)) or ( + not expanding and self.SCIGetFoldExpanded(lineSeek) + ): + self.SCIToggleFold(lineSeek) + finally: + win32ui.DoWaitCursor(-1) + + def FoldExpandSecondLevelEvent(self, event): + if not self.bFolding: + return 1 + win32ui.DoWaitCursor(1) + ## I think this is needed since Scintilla may not have + ## already formatted parts of file outside visible window. + self.Colorize() + levels = [scintillacon.SC_FOLDLEVELBASE] + ## Scintilla's level number is based on amount of whitespace indentation + for lineno in range(self.GetLineCount()): + level = self.SCIGetFoldLevel(lineno) + if not level & scintillacon.SC_FOLDLEVELHEADERFLAG: + continue + curr_level = level & scintillacon.SC_FOLDLEVELNUMBERMASK + if curr_level > levels[-1]: + levels.append(curr_level) + try: + level_ind = levels.index(curr_level) + except ValueError: + ## probably syntax error in source file, bail + break + levels = levels[: level_ind + 1] + if level_ind == 1 and not self.SCIGetFoldExpanded(lineno): + self.SCIToggleFold(lineno) + win32ui.DoWaitCursor(-1) + + def FoldCollapseSecondLevelEvent(self, event): + if not self.bFolding: + return 1 + win32ui.DoWaitCursor(1) + ## I think this is needed since Scintilla may not have + ## already formatted parts of file outside visible window. + self.Colorize() + levels = [scintillacon.SC_FOLDLEVELBASE] + ## Scintilla's level number is based on amount of whitespace indentation + for lineno in range(self.GetLineCount()): + level = self.SCIGetFoldLevel(lineno) + if not level & scintillacon.SC_FOLDLEVELHEADERFLAG: + continue + curr_level = level & scintillacon.SC_FOLDLEVELNUMBERMASK + if curr_level > levels[-1]: + levels.append(curr_level) + try: + level_ind = levels.index(curr_level) + except ValueError: + ## probably syntax error in source file, bail + break + levels = levels[: level_ind + 1] + if level_ind == 1 and self.SCIGetFoldExpanded(lineno): + self.SCIToggleFold(lineno) + win32ui.DoWaitCursor(-1) + + def FoldExpandEvent(self, event): + if not self.bFolding: + return 1 + win32ui.DoWaitCursor(1) + lineno = self.LineFromChar(self.GetSel()[0]) + if self.SCIGetFoldLevel( + lineno + ) & scintillacon.SC_FOLDLEVELHEADERFLAG and not self.SCIGetFoldExpanded(lineno): + self.SCIToggleFold(lineno) + win32ui.DoWaitCursor(-1) + + def FoldExpandAllEvent(self, event): + if not self.bFolding: + return 1 + win32ui.DoWaitCursor(1) + for lineno in range(0, self.GetLineCount()): + if self.SCIGetFoldLevel( + lineno + ) & scintillacon.SC_FOLDLEVELHEADERFLAG and not self.SCIGetFoldExpanded( + lineno + ): + self.SCIToggleFold(lineno) + win32ui.DoWaitCursor(-1) + + def FoldCollapseEvent(self, event): + if not self.bFolding: + return 1 + win32ui.DoWaitCursor(1) + lineno = self.LineFromChar(self.GetSel()[0]) + if self.SCIGetFoldLevel( + lineno + ) & scintillacon.SC_FOLDLEVELHEADERFLAG and self.SCIGetFoldExpanded(lineno): + self.SCIToggleFold(lineno) + win32ui.DoWaitCursor(-1) + + def FoldCollapseAllEvent(self, event): + if not self.bFolding: + return 1 + win32ui.DoWaitCursor(1) + self.Colorize() + for lineno in range(0, self.GetLineCount()): + if self.SCIGetFoldLevel( + lineno + ) & scintillacon.SC_FOLDLEVELHEADERFLAG and self.SCIGetFoldExpanded(lineno): + self.SCIToggleFold(lineno) + win32ui.DoWaitCursor(-1) + + +from pywin.framework.editor.frame import EditorFrame + + +class SplitterFrame(EditorFrame): + def OnCreate(self, cs): + self.HookCommand(self.OnWindowSplit, win32ui.ID_WINDOW_SPLIT) + return 1 + + def OnWindowSplit(self, id, code): + self.GetDlgItem(win32ui.AFX_IDW_PANE_FIRST).DoKeyboardSplit() + return 1 + + +from pywin.framework.editor.template import EditorTemplateBase + + +class SyntEditTemplate(EditorTemplateBase): + def __init__( + self, res=win32ui.IDR_TEXTTYPE, makeDoc=None, makeFrame=None, makeView=None + ): + if makeDoc is None: + makeDoc = SyntEditDocument + if makeView is None: + makeView = SyntEditView + if makeFrame is None: + makeFrame = SplitterFrame + self.bSetMenus = 0 + EditorTemplateBase.__init__(self, res, makeDoc, makeFrame, makeView) + + def CheckIDLEMenus(self, idle): + if self.bSetMenus: + return + self.bSetMenus = 1 + + submenu = win32ui.CreatePopupMenu() + newitems = idle.GetMenuItems("edit") + flags = win32con.MF_STRING | win32con.MF_ENABLED + for text, event in newitems: + id = bindings.event_to_commands.get(event) + if id is not None: + keyname = pywin.scintilla.view.configManager.get_key_binding( + event, ["editor"] + ) + if keyname is not None: + text = text + "\t" + keyname + submenu.AppendMenu(flags, id, text) + + mainMenu = self.GetSharedMenu() + editMenu = mainMenu.GetSubMenu(1) + editMenu.AppendMenu(win32con.MF_SEPARATOR, 0, "") + editMenu.AppendMenu( + win32con.MF_STRING | win32con.MF_POPUP | win32con.MF_ENABLED, + submenu.GetHandle(), + "&Source Code", + ) + + def _CreateDocTemplate(self, resourceId): + return win32ui.CreateDocTemplate(resourceId) + + def CreateWin32uiDocument(self): + return self.DoCreateDoc() + + def GetPythonPropertyPages(self): + """Returns a list of property pages""" + from pywin.scintilla import configui + + return EditorTemplateBase.GetPythonPropertyPages(self) + [ + configui.ScintillaFormatPropertyPage() + ] + + +# For debugging purposes, when this module may be reloaded many times. +try: + win32ui.GetApp().RemoveDocTemplate(editorTemplate) +except NameError: + pass + +editorTemplate = SyntEditTemplate() +win32ui.GetApp().AddDocTemplate(editorTemplate) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/configui.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/configui.py new file mode 100644 index 0000000000000000000000000000000000000000..903ad66c749e82452c43b98c88abc62616cfb2e2 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/configui.py @@ -0,0 +1,308 @@ +import pywin.scintilla.config +import win32api +import win32con +import win32ui +from pywin.framework.editor import ( + DeleteEditorOption, + GetEditorFontOption, + GetEditorOption, + SetEditorFontOption, + SetEditorOption, + defaultCharacterFormat, + editorTemplate, +) +from pywin.mfc import dialog + +from . import document + +# The standard 16 color VGA palette should always be possible +paletteVGA = ( + ("Black", 0, 0, 0), + ("Navy", 0, 0, 128), + ("Green", 0, 128, 0), + ("Cyan", 0, 128, 128), + ("Maroon", 128, 0, 0), + ("Purple", 128, 0, 128), + ("Olive", 128, 128, 0), + ("Gray", 128, 128, 128), + ("Silver", 192, 192, 192), + ("Blue", 0, 0, 255), + ("Lime", 0, 255, 0), + ("Aqua", 0, 255, 255), + ("Red", 255, 0, 0), + ("Fuchsia", 255, 0, 255), + ("Yellow", 255, 255, 0), + ("White", 255, 255, 255), +) + + +###################################################### +# +# Property Page for editor options +# +class EditorPropertyPage(dialog.PropertyPage): + def __init__(self): + dialog.PropertyPage.__init__(self, win32ui.IDD_PP_EDITOR) + self.autooptions = [] + self._AddEditorOption(win32ui.IDC_AUTO_RELOAD, "i", "Auto Reload", 1) + self._AddEditorOption( + win32ui.IDC_COMBO1, "i", "Backup Type", document.BAK_DOT_BAK_BAK_DIR + ) + self._AddEditorOption( + win32ui.IDC_AUTOCOMPLETE, "i", "Autocomplete Attributes", 1 + ) + self._AddEditorOption(win32ui.IDC_CALLTIPS, "i", "Show Call Tips", 1) + self._AddEditorOption( + win32ui.IDC_MARGIN_LINENUMBER, "i", "Line Number Margin Width", 0 + ) + self._AddEditorOption(win32ui.IDC_RADIO1, "i", "MarkersInMargin", None) + self._AddEditorOption( + win32ui.IDC_MARGIN_MARKER, "i", "Marker Margin Width", None + ) + self["Marker Margin Width"] = GetEditorOption("Marker Margin Width", 16) + + # Folding + self._AddEditorOption(win32ui.IDC_MARGIN_FOLD, "i", "Fold Margin Width", 12) + self._AddEditorOption(win32ui.IDC_FOLD_ENABLE, "i", "Enable Folding", 1) + self._AddEditorOption(win32ui.IDC_FOLD_ON_OPEN, "i", "Fold On Open", 0) + self._AddEditorOption(win32ui.IDC_FOLD_SHOW_LINES, "i", "Fold Lines", 1) + + # Right edge. + self._AddEditorOption( + win32ui.IDC_RIGHTEDGE_ENABLE, "i", "Right Edge Enabled", 0 + ) + self._AddEditorOption( + win32ui.IDC_RIGHTEDGE_COLUMN, "i", "Right Edge Column", 75 + ) + + # Source control, etc + self.AddDDX(win32ui.IDC_VSS_INTEGRATE, "bVSS") + self.AddDDX(win32ui.IDC_KEYBOARD_CONFIG, "Configs", "l") + self["Configs"] = pywin.scintilla.config.find_config_files() + + def _AddEditorOption(self, idd, typ, optionName, defaultVal): + self.AddDDX(idd, optionName, typ) + # some options are "derived" - ie, can be implied from others + # (eg, "view markers in background" is implied from "markerMarginWidth==0" + # So we don't actually store these values, but they do still get DDX support. + if defaultVal is not None: + self[optionName] = GetEditorOption(optionName, defaultVal) + self.autooptions.append((optionName, defaultVal)) + + def OnInitDialog(self): + for name, val in self.autooptions: + self[name] = GetEditorOption(name, val) + + # Note that these MUST be in the same order as the BAK constants. + cbo = self.GetDlgItem(win32ui.IDC_COMBO1) + cbo.AddString("None") + cbo.AddString(".BAK File") + cbo.AddString("TEMP dir") + cbo.AddString("Own dir") + + # Source Safe + bVSS = ( + GetEditorOption("Source Control Module", "") == "pywin.framework.editor.vss" + ) + self["bVSS"] = bVSS + + edit = self.GetDlgItem(win32ui.IDC_RIGHTEDGE_SAMPLE) + edit.SetWindowText("Sample Color") + + rc = dialog.PropertyPage.OnInitDialog(self) + + try: + self.GetDlgItem(win32ui.IDC_KEYBOARD_CONFIG).SelectString( + -1, GetEditorOption("Keyboard Config", "default") + ) + except win32ui.error: + import traceback + + traceback.print_exc() + pass + + self.HookCommand(self.OnButSimple, win32ui.IDC_FOLD_ENABLE) + self.HookCommand(self.OnButSimple, win32ui.IDC_RADIO1) + self.HookCommand(self.OnButSimple, win32ui.IDC_RADIO2) + self.HookCommand(self.OnButSimple, win32ui.IDC_RIGHTEDGE_ENABLE) + self.HookCommand(self.OnButEdgeColor, win32ui.IDC_RIGHTEDGE_DEFINE) + + butMarginEnabled = self["Marker Margin Width"] > 0 + self.GetDlgItem(win32ui.IDC_RADIO1).SetCheck(butMarginEnabled) + self.GetDlgItem(win32ui.IDC_RADIO2).SetCheck(not butMarginEnabled) + + self.edgeColor = self.initialEdgeColor = GetEditorOption( + "Right Edge Color", win32api.RGB(0xEF, 0xEF, 0xEF) + ) + for spinner_id in (win32ui.IDC_SPIN1, win32ui.IDC_SPIN2, win32ui.IDC_SPIN3): + spinner = self.GetDlgItem(spinner_id) + spinner.SetRange(0, 100) + self.UpdateUIForState() + + return rc + + def OnButSimple(self, id, code): + if code == win32con.BN_CLICKED: + self.UpdateUIForState() + + def OnButEdgeColor(self, id, code): + if code == win32con.BN_CLICKED: + d = win32ui.CreateColorDialog(self.edgeColor, 0, self) + # Ensure the current color is a custom color (as it may not be in the swatch) + # plus some other nice gray scales. + ccs = [self.edgeColor] + for c in range(0xEF, 0x4F, -0x10): + ccs.append(win32api.RGB(c, c, c)) + d.SetCustomColors(ccs) + if d.DoModal() == win32con.IDOK: + self.edgeColor = d.GetColor() + self.UpdateUIForState() + + def UpdateUIForState(self): + folding = self.GetDlgItem(win32ui.IDC_FOLD_ENABLE).GetCheck() + self.GetDlgItem(win32ui.IDC_FOLD_ON_OPEN).EnableWindow(folding) + self.GetDlgItem(win32ui.IDC_FOLD_SHOW_LINES).EnableWindow(folding) + + widthEnabled = self.GetDlgItem(win32ui.IDC_RADIO1).GetCheck() + self.GetDlgItem(win32ui.IDC_MARGIN_MARKER).EnableWindow(widthEnabled) + self.UpdateData() # Ensure self[] is up to date with the control data. + if widthEnabled and self["Marker Margin Width"] == 0: + self["Marker Margin Width"] = 16 + self.UpdateData(0) # Ensure control up to date with self[] + + # Right edge + edgeEnabled = self.GetDlgItem(win32ui.IDC_RIGHTEDGE_ENABLE).GetCheck() + self.GetDlgItem(win32ui.IDC_RIGHTEDGE_COLUMN).EnableWindow(edgeEnabled) + self.GetDlgItem(win32ui.IDC_RIGHTEDGE_SAMPLE).EnableWindow(edgeEnabled) + self.GetDlgItem(win32ui.IDC_RIGHTEDGE_DEFINE).EnableWindow(edgeEnabled) + + edit = self.GetDlgItem(win32ui.IDC_RIGHTEDGE_SAMPLE) + edit.SetBackgroundColor(0, self.edgeColor) + + def OnOK(self): + for name, defVal in self.autooptions: + SetEditorOption(name, self[name]) + # Margin width gets handled differently. + if self["MarkersInMargin"] == 0: + SetEditorOption("Marker Margin Width", self["Marker Margin Width"]) + else: + SetEditorOption("Marker Margin Width", 0) + if self.edgeColor != self.initialEdgeColor: + SetEditorOption("Right Edge Color", self.edgeColor) + if self["bVSS"]: + SetEditorOption("Source Control Module", "pywin.framework.editor.vss") + else: + if ( + GetEditorOption("Source Control Module", "") + == "pywin.framework.editor.vss" + ): + SetEditorOption("Source Control Module", "") + # Keyboard config + configname = self.GetDlgItem(win32ui.IDC_KEYBOARD_CONFIG).GetWindowText() + if configname: + if configname == "default": + DeleteEditorOption("Keyboard Config") + else: + SetEditorOption("Keyboard Config", configname) + + import pywin.scintilla.view + + pywin.scintilla.view.LoadConfiguration() + + # Now tell all views we have changed. + ## for doc in editorTemplate.GetDocumentList(): + ## for view in doc.GetAllViews(): + ## try: + ## fn = view.OnConfigChange + ## except AttributeError: + ## continue + ## fn() + return 1 + + +class EditorWhitespacePropertyPage(dialog.PropertyPage): + def __init__(self): + dialog.PropertyPage.__init__(self, win32ui.IDD_PP_TABS) + self.autooptions = [] + self._AddEditorOption(win32ui.IDC_TAB_SIZE, "i", "Tab Size", 4) + self._AddEditorOption(win32ui.IDC_INDENT_SIZE, "i", "Indent Size", 4) + self._AddEditorOption(win32ui.IDC_USE_SMART_TABS, "i", "Smart Tabs", 1) + self._AddEditorOption(win32ui.IDC_VIEW_WHITESPACE, "i", "View Whitespace", 0) + self._AddEditorOption(win32ui.IDC_VIEW_EOL, "i", "View EOL", 0) + self._AddEditorOption( + win32ui.IDC_VIEW_INDENTATIONGUIDES, "i", "View Indentation Guides", 0 + ) + + def _AddEditorOption(self, idd, typ, optionName, defaultVal): + self.AddDDX(idd, optionName, typ) + self[optionName] = GetEditorOption(optionName, defaultVal) + self.autooptions.append((optionName, defaultVal)) + + def OnInitDialog(self): + for name, val in self.autooptions: + self[name] = GetEditorOption(name, val) + + rc = dialog.PropertyPage.OnInitDialog(self) + + idc = win32ui.IDC_TABTIMMY_NONE + if GetEditorOption("Use Tab Timmy", 1): + idc = win32ui.IDC_TABTIMMY_IND + self.GetDlgItem(idc).SetCheck(1) + + idc = win32ui.IDC_RADIO1 + if GetEditorOption("Use Tabs", 0): + idc = win32ui.IDC_USE_TABS + self.GetDlgItem(idc).SetCheck(1) + + tt_color = GetEditorOption("Tab Timmy Color", win32api.RGB(0xFF, 0, 0)) + self.cbo = self.GetDlgItem(win32ui.IDC_COMBO1) + for c in paletteVGA: + self.cbo.AddString(c[0]) + sel = 0 + for c in paletteVGA: + if tt_color == win32api.RGB(c[1], c[2], c[3]): + break + sel = sel + 1 + else: + sel = -1 + self.cbo.SetCurSel(sel) + self.HookCommand(self.OnButSimple, win32ui.IDC_TABTIMMY_NONE) + self.HookCommand(self.OnButSimple, win32ui.IDC_TABTIMMY_IND) + self.HookCommand(self.OnButSimple, win32ui.IDC_TABTIMMY_BG) + # Set ranges for the spinners. + for spinner_id in [win32ui.IDC_SPIN1, win32ui.IDC_SPIN2]: + spinner = self.GetDlgItem(spinner_id) + spinner.SetRange(1, 16) + return rc + + def OnButSimple(self, id, code): + if code == win32con.BN_CLICKED: + self.UpdateUIForState() + + def UpdateUIForState(self): + timmy = self.GetDlgItem(win32ui.IDC_TABTIMMY_NONE).GetCheck() + self.GetDlgItem(win32ui.IDC_COMBO1).EnableWindow(not timmy) + + def OnOK(self): + for name, defVal in self.autooptions: + SetEditorOption(name, self[name]) + + SetEditorOption("Use Tabs", self.GetDlgItem(win32ui.IDC_USE_TABS).GetCheck()) + + SetEditorOption( + "Use Tab Timmy", self.GetDlgItem(win32ui.IDC_TABTIMMY_IND).GetCheck() + ) + c = paletteVGA[self.cbo.GetCurSel()] + SetEditorOption("Tab Timmy Color", win32api.RGB(c[1], c[2], c[3])) + + return 1 + + +def testpp(): + ps = dialog.PropertySheet("Editor Options") + ps.AddPage(EditorWhitespacePropertyPage()) + ps.DoModal() + + +if __name__ == "__main__": + testpp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/document.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/document.py new file mode 100644 index 0000000000000000000000000000000000000000..e66947b81cc8dd52ee6bbdda4d5ae63d5c13fe45 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/document.py @@ -0,0 +1,378 @@ +# We no longer support the old, non-colour editor! + +import os +import shutil +import traceback + +import win32api +import win32con +import win32ui +from pywin.framework.editor import GetEditorOption +from pywin.mfc import docview, object + +BAK_NONE = 0 +BAK_DOT_BAK = 1 +BAK_DOT_BAK_TEMP_DIR = 2 +BAK_DOT_BAK_BAK_DIR = 3 + +MSG_CHECK_EXTERNAL_FILE = ( + win32con.WM_USER + 1999 +) ## WARNING: Duplicated in editor.py and coloreditor.py + +import pywin.scintilla.document + +ParentEditorDocument = pywin.scintilla.document.CScintillaDocument + + +class EditorDocumentBase(ParentEditorDocument): + def __init__(self, template): + self.bAutoReload = GetEditorOption("Auto Reload", 1) + self.bDeclinedReload = 0 # Has the user declined to reload. + self.fileStat = None + self.bReportedFileNotFound = 0 + + # what sort of bak file should I create. + # default to write to %temp%/bak/filename.ext + self.bakFileType = GetEditorOption("Backup Type", BAK_DOT_BAK_BAK_DIR) + + self.watcherThread = FileWatchingThread(self) + self.watcherThread.CreateThread() + # Should I try and use VSS integration? + self.scModuleName = GetEditorOption("Source Control Module", "") + self.scModule = None # Loaded when first used. + ParentEditorDocument.__init__(self, template, template.CreateWin32uiDocument()) + + def OnCloseDocument(self): + self.watcherThread.SignalStop() + return self._obj_.OnCloseDocument() + + # def OnOpenDocument(self, name): + # rc = ParentEditorDocument.OnOpenDocument(self, name) + # self.GetFirstView()._SetLoadedText(self.text) + # self._DocumentStateChanged() + # return rc + + def OnSaveDocument(self, fileName): + win32ui.SetStatusText("Saving file...", 1) + # rename to bak if required. + dir, basename = os.path.split(fileName) + if self.bakFileType == BAK_DOT_BAK: + bakFileName = dir + "\\" + os.path.splitext(basename)[0] + ".bak" + elif self.bakFileType == BAK_DOT_BAK_TEMP_DIR: + bakFileName = ( + win32api.GetTempPath() + "\\" + os.path.splitext(basename)[0] + ".bak" + ) + elif self.bakFileType == BAK_DOT_BAK_BAK_DIR: + tempPath = os.path.join(win32api.GetTempPath(), "bak") + try: + os.mkdir(tempPath, 0) + except os.error: + pass + bakFileName = os.path.join(tempPath, basename) + try: + os.unlink(bakFileName) # raise NameError if no bakups wanted. + except (os.error, NameError): + pass + try: + # Do a copy as it might be on different volumes, + # and the file may be a hard-link, causing the link + # to follow the backup. + shutil.copy2(fileName, bakFileName) + except (os.error, NameError, IOError): + pass + try: + self.SaveFile(fileName) + except IOError as details: + win32ui.MessageBox("Error - could not save file\r\n\r\n%s" % details) + return 0 + except (UnicodeEncodeError, LookupError) as details: + rc = win32ui.MessageBox( + "Encoding failed: \r\n%s" % details + + "\r\nPlease add desired source encoding as first line of file, eg \r\n" + + "# -*- coding: mbcs -*-\r\n\r\n" + + "If you continue, the file will be saved as binary and will\r\n" + + "not be valid in the declared encoding.\r\n\r\n" + + "Save the file as binary with an invalid encoding?", + "File save failed", + win32con.MB_YESNO | win32con.MB_DEFBUTTON2, + ) + if rc == win32con.IDYES: + try: + self.SaveFile(fileName, encoding="latin-1") + except IOError as details: + win32ui.MessageBox( + "Error - could not save file\r\n\r\n%s" % details + ) + return 0 + else: + return 0 + self.SetModifiedFlag(0) # No longer dirty + self.bDeclinedReload = 0 # They probably want to know if it changes again! + win32ui.AddToRecentFileList(fileName) + self.SetPathName(fileName) + win32ui.SetStatusText("Ready") + self._DocumentStateChanged() + return 1 + + def FinalizeViewCreation(self, view): + ParentEditorDocument.FinalizeViewCreation(self, view) + if view == self.GetFirstView(): + self._DocumentStateChanged() + if view.bFolding and GetEditorOption("Fold On Open", 0): + view.FoldTopLevelEvent() + + def HookViewNotifications(self, view): + ParentEditorDocument.HookViewNotifications(self, view) + + # Support for reloading the document from disk - presumably after some + # external application has modified it (or possibly source control has + # checked it out. + def ReloadDocument(self): + """Reloads the document from disk. Assumes the file has + been saved and user has been asked if necessary - it just does it! + """ + win32ui.SetStatusText("Reloading document. Please wait...", 1) + self.SetModifiedFlag(0) + # Loop over all views, saving their state, then reload the document + views = self.GetAllViews() + states = [] + for view in views: + try: + info = view._PrepareUserStateChange() + except AttributeError: # Not our editor view? + info = None + states.append(info) + self.OnOpenDocument(self.GetPathName()) + for view, info in zip(views, states): + if info is not None: + view._EndUserStateChange(info) + self._DocumentStateChanged() + win32ui.SetStatusText("Document reloaded.") + + # Reloading the file + def CheckExternalDocumentUpdated(self): + if self.bDeclinedReload or not self.GetPathName(): + return + try: + newstat = os.stat(self.GetPathName()) + except os.error as exc: + if not self.bReportedFileNotFound: + print( + "The file '%s' is open for editing, but\nchecking it for changes caused the error: %s" + % (self.GetPathName(), exc.strerror) + ) + self.bReportedFileNotFound = 1 + return + if self.bReportedFileNotFound: + print( + "The file '%s' has re-appeared - continuing to watch for changes..." + % (self.GetPathName(),) + ) + self.bReportedFileNotFound = ( + 0 # Once found again we want to start complaining. + ) + changed = ( + (self.fileStat is None) + or self.fileStat[0] != newstat[0] + or self.fileStat[6] != newstat[6] + or self.fileStat[8] != newstat[8] + or self.fileStat[9] != newstat[9] + ) + if changed: + question = None + if self.IsModified(): + question = ( + "%s\r\n\r\nThis file has been modified outside of the source editor.\r\nDo you want to reload it and LOSE THE CHANGES in the source editor?" + % self.GetPathName() + ) + mbStyle = win32con.MB_YESNO | win32con.MB_DEFBUTTON2 # Default to "No" + else: + if not self.bAutoReload: + question = ( + "%s\r\n\r\nThis file has been modified outside of the source editor.\r\nDo you want to reload it?" + % self.GetPathName() + ) + mbStyle = win32con.MB_YESNO # Default to "Yes" + if question: + rc = win32ui.MessageBox(question, None, mbStyle) + if rc != win32con.IDYES: + self.bDeclinedReload = 1 + return + self.ReloadDocument() + + def _DocumentStateChanged(self): + """Called whenever the documents state (on disk etc) has been changed + by the editor (eg, as the result of a save operation) + """ + if self.GetPathName(): + try: + self.fileStat = os.stat(self.GetPathName()) + except os.error: + self.fileStat = None + else: + self.fileStat = None + self.watcherThread._DocumentStateChanged() + self._UpdateUIForState() + self._ApplyOptionalToViews("_UpdateUIForState") + self._ApplyOptionalToViews("SetReadOnly", self._IsReadOnly()) + self._ApplyOptionalToViews("SCISetSavePoint") + # Allow the debugger to reset us too. + import pywin.debugger + + if pywin.debugger.currentDebugger is not None: + pywin.debugger.currentDebugger.UpdateDocumentLineStates(self) + + # Read-only document support - make it obvious to the user + # that the file is read-only. + def _IsReadOnly(self): + return self.fileStat is not None and (self.fileStat[0] & 128) == 0 + + def _UpdateUIForState(self): + """Change the title to reflect the state of the document - + eg ReadOnly, Dirty, etc + """ + filename = self.GetPathName() + if not filename: + return # New file - nothing to do + try: + # This seems necessary so the internal state of the window becomes + # "visible". without it, it is still shown, but certain functions + # (such as updating the title) dont immediately work? + self.GetFirstView().ShowWindow(win32con.SW_SHOW) + title = win32ui.GetFileTitle(filename) + except win32ui.error: + title = filename + if self._IsReadOnly(): + title = title + " (read-only)" + self.SetTitle(title) + + def MakeDocumentWritable(self): + pretend_ss = 0 # Set to 1 to test this without source safe :-) + if not self.scModuleName and not pretend_ss: # No Source Control support. + win32ui.SetStatusText( + "Document is read-only, and no source-control system is configured" + ) + win32api.MessageBeep() + return 0 + + # We have source control support - check if the user wants to use it. + msg = "Would you like to check this file out?" + defButton = win32con.MB_YESNO + if self.IsModified(): + msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST" + defButton = win32con.MB_YESNO + if win32ui.MessageBox(msg, None, defButton) != win32con.IDYES: + return 0 + + if pretend_ss: + print("We are only pretending to check it out!") + win32api.SetFileAttributes( + self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL + ) + self.ReloadDocument() + return 1 + + # Now call on the module to do it. + if self.scModule is None: + try: + self.scModule = __import__(self.scModuleName) + for part in self.scModuleName.split(".")[1:]: + self.scModule = getattr(self.scModule, part) + except: + traceback.print_exc() + print("Error loading source control module.") + return 0 + + if self.scModule.CheckoutFile(self.GetPathName()): + self.ReloadDocument() + return 1 + return 0 + + def CheckMakeDocumentWritable(self): + if self._IsReadOnly(): + return self.MakeDocumentWritable() + return 1 + + def SaveModified(self): + # Called as the document is closed. If we are about + # to prompt for a save, bring the document to the foreground. + if self.IsModified(): + frame = self.GetFirstView().GetParentFrame() + try: + frame.MDIActivate() + frame.AutoRestore() + except: + print("Could not bring document to foreground") + return self._obj_.SaveModified() + + +# NOTE - I DONT use the standard threading module, +# as this waits for all threads to terminate at shutdown. +# When using the debugger, it is possible shutdown will +# occur without Pythonwin getting a complete shutdown, +# so we deadlock at the end - threading is waiting for +import pywin.mfc.thread +import win32event + + +class FileWatchingThread(pywin.mfc.thread.WinThread): + def __init__(self, doc): + self.doc = doc + self.adminEvent = win32event.CreateEvent(None, 0, 0, None) + self.stopEvent = win32event.CreateEvent(None, 0, 0, None) + self.watchEvent = None + pywin.mfc.thread.WinThread.__init__(self) + + def _DocumentStateChanged(self): + win32event.SetEvent(self.adminEvent) + + def RefreshEvent(self): + self.hwnd = self.doc.GetFirstView().GetSafeHwnd() + if self.watchEvent is not None: + win32api.FindCloseChangeNotification(self.watchEvent) + self.watchEvent = None + path = self.doc.GetPathName() + if path: + path = os.path.dirname(path) + if path: + filter = ( + win32con.FILE_NOTIFY_CHANGE_FILE_NAME + | win32con.FILE_NOTIFY_CHANGE_ATTRIBUTES + | win32con.FILE_NOTIFY_CHANGE_LAST_WRITE + ) + try: + self.watchEvent = win32api.FindFirstChangeNotification(path, 0, filter) + except win32api.error as exc: + print("Can not watch file", path, "for changes -", exc.strerror) + + def SignalStop(self): + win32event.SetEvent(self.stopEvent) + + def Run(self): + while 1: + handles = [self.stopEvent, self.adminEvent] + if self.watchEvent is not None: + handles.append(self.watchEvent) + rc = win32event.WaitForMultipleObjects(handles, 0, win32event.INFINITE) + if rc == win32event.WAIT_OBJECT_0: + break + elif rc == win32event.WAIT_OBJECT_0 + 1: + self.RefreshEvent() + else: + win32api.PostMessage(self.hwnd, MSG_CHECK_EXTERNAL_FILE, 0, 0) + try: + # If the directory has been removed underneath us, we get this error. + win32api.FindNextChangeNotification(self.watchEvent) + except win32api.error as exc: + print( + "Can not watch file", + self.doc.GetPathName(), + "for changes -", + exc.strerror, + ) + break + + # close a circular reference + self.doc = None + if self.watchEvent: + win32api.FindCloseChangeNotification(self.watchEvent) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/editor.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/editor.py new file mode 100644 index 0000000000000000000000000000000000000000..aa1f53857dc9670ee61aadcb72368f014f7c0326 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/editor.py @@ -0,0 +1,516 @@ +##################################################################### +# +# editor.py +# +# A general purpose text editor, built on top of the win32ui edit +# type, which is built on an MFC CEditView +# +# +# We now support reloading of externally modified documented +# (eg, presumably by some other process, such as source control or +# another editor. +# We also suport auto-loading of externally modified files. +# - if the current document has not been modified in this +# editor, but has been modified on disk, then the file +# can be automatically reloaded. +# +# Note that it will _always_ prompt you if the file in the editor has been modified. + + +import re + +import regex +import win32api +import win32con +import win32ui +from pywin.framework.editor import ( + GetEditorFontOption, + GetEditorOption, + SetEditorFontOption, + SetEditorOption, + defaultCharacterFormat, +) +from pywin.mfc import afxres, dialog, docview + +patImport = regex.symcomp("import \(.*\)") +patIndent = regex.compile("^\\([ \t]*[~ \t]\\)") + +ID_LOCATE_FILE = 0xE200 +ID_GOTO_LINE = 0xE2001 +MSG_CHECK_EXTERNAL_FILE = ( + win32con.WM_USER + 1999 +) ## WARNING: Duplicated in document.py and coloreditor.py + +# Key Codes that modify the bufffer when Ctrl or Alt are NOT pressed. +MODIFYING_VK_KEYS = [ + win32con.VK_BACK, + win32con.VK_TAB, + win32con.VK_RETURN, + win32con.VK_SPACE, + win32con.VK_DELETE, +] +for k in range(48, 91): + MODIFYING_VK_KEYS.append(k) + +# Key Codes that modify the bufffer when Ctrl is pressed. +MODIFYING_VK_KEYS_CTRL = [ + win32con.VK_BACK, + win32con.VK_RETURN, + win32con.VK_SPACE, + win32con.VK_DELETE, +] + +# Key Codes that modify the bufffer when Alt is pressed. +MODIFYING_VK_KEYS_ALT = [ + win32con.VK_BACK, + win32con.VK_RETURN, + win32con.VK_SPACE, + win32con.VK_DELETE, +] + + +# The editor itself starts here. +# Using the MFC Document/View model, we have an EditorDocument, which is responsible for +# managing the contents of the file, and a view which is responsible for rendering it. +# +# Due to a limitation in the Windows edit controls, we are limited to one view +# per document, although nothing in this code assumes this (I hope!) + +isRichText = 1 # We are using the Rich Text control. This has not been tested with value "0" for quite some time! + +# ParentEditorDocument=docview.Document +from .document import EditorDocumentBase + +ParentEditorDocument = EditorDocumentBase + + +class EditorDocument(ParentEditorDocument): + # + # File loading and saving operations + # + def OnOpenDocument(self, filename): + # + # handle Unix and PC text file format. + # + + # Get the "long name" of the file name, as it may have been translated + # to short names by the shell. + self.SetPathName(filename) # Must set this early! + # Now do the work! + self.BeginWaitCursor() + win32ui.SetStatusText("Loading file...", 1) + try: + f = open(filename, "rb") + except IOError: + win32ui.MessageBox( + filename + + "\nCan not find this file\nPlease verify that the correct path and file name are given" + ) + self.EndWaitCursor() + return 0 + raw = f.read() + f.close() + contents = self.TranslateLoadedData(raw) + rc = 0 + try: + self.GetFirstView().SetWindowText(contents) + rc = 1 + except TypeError: # Null byte in file. + win32ui.MessageBox("This file contains NULL bytes, and can not be edited") + rc = 0 + + self.EndWaitCursor() + self.SetModifiedFlag(0) # No longer dirty + self._DocumentStateChanged() + return rc + + def TranslateLoadedData(self, data): + """Given raw data read from a file, massage it suitable for the edit window""" + # if a CR in the first 250 chars, then perform the expensive translate + if data[:250].find("\r") == -1: + win32ui.SetStatusText( + "Translating from Unix file format - please wait...", 1 + ) + return re.sub("\r*\n", "\r\n", data) + else: + return data + + def SaveFile(self, fileName, encoding=None): + if isRichText: + view = self.GetFirstView() + view.SaveTextFile(fileName, encoding=encoding) + else: # Old style edit view window. + self.GetFirstView().SaveFile(fileName) + try: + # Make sure line cache has updated info about me! + import linecache + + linecache.checkcache() + except: + pass + + # + # Color state stuff + # + def SetAllLineColors(self, color=None): + for view in self.GetAllViews(): + view.SetAllLineColors(color) + + def SetLineColor(self, lineNo, color): + "Color a line of all views" + for view in self.GetAllViews(): + view.SetLineColor(lineNo, color) + + +# def StreamTextOut(self, data): ### This seems unreliable??? +# self.saveFileHandle.write(data) +# return 1 # keep em coming! + +# ParentEditorView=docview.EditView +ParentEditorView = docview.RichEditView + + +class EditorView(ParentEditorView): + def __init__(self, doc): + ParentEditorView.__init__(self, doc) + if isRichText: + self.SetWordWrap(win32ui.CRichEditView_WrapNone) + + self.addToMRU = 1 + self.HookHandlers() + self.bCheckingFile = 0 + + self.defCharFormat = GetEditorFontOption("Default Font", defaultCharacterFormat) + + # Smart tabs override everything else if context can be worked out. + self.bSmartTabs = GetEditorOption("Smart Tabs", 1) + + self.tabSize = GetEditorOption("Tab Size", 8) + self.indentSize = GetEditorOption("Indent Size", 8) + # If next indent is at a tab position, and useTabs is set, a tab will be inserted. + self.bUseTabs = GetEditorOption("Use Tabs", 1) + + def OnInitialUpdate(self): + rc = self._obj_.OnInitialUpdate() + self.SetDefaultCharFormat(self.defCharFormat) + return rc + + def CutCurLine(self): + curLine = self._obj_.LineFromChar() + nextLine = curLine + 1 + start = self._obj_.LineIndex(curLine) + end = self._obj_.LineIndex(nextLine) + if end == 0: # must be last line. + end = start + self.end.GetLineLength(curLine) + self._obj_.SetSel(start, end) + self._obj_.Cut() + + def _PrepareUserStateChange(self): + "Return selection, lineindex, etc info, so it can be restored" + self.SetRedraw(0) + return self.GetModify(), self.GetSel(), self.GetFirstVisibleLine() + + def _EndUserStateChange(self, info): + scrollOff = info[2] - self.GetFirstVisibleLine() + if scrollOff: + self.LineScroll(scrollOff) + self.SetSel(info[1]) + self.SetModify(info[0]) + self.SetRedraw(1) + self.InvalidateRect() + self.UpdateWindow() + + def _UpdateUIForState(self): + self.SetReadOnly(self.GetDocument()._IsReadOnly()) + + def SetAllLineColors(self, color=None): + if isRichText: + info = self._PrepareUserStateChange() + try: + if color is None: + color = self.defCharFormat[4] + self.SetSel(0, -1) + self.SetSelectionCharFormat((win32con.CFM_COLOR, 0, 0, 0, color)) + finally: + self._EndUserStateChange(info) + + def SetLineColor(self, lineNo, color): + "lineNo is the 1 based line number to set. If color is None, default color is used." + if isRichText: + info = self._PrepareUserStateChange() + try: + if color is None: + color = self.defCharFormat[4] + lineNo = lineNo - 1 + startIndex = self.LineIndex(lineNo) + if startIndex != -1: + self.SetSel(startIndex, self.LineIndex(lineNo + 1)) + self.SetSelectionCharFormat((win32con.CFM_COLOR, 0, 0, 0, color)) + finally: + self._EndUserStateChange(info) + + def Indent(self): + """Insert an indent to move the cursor to the next tab position. + + Honors the tab size and 'use tabs' settings. Assumes the cursor is already at the + position to be indented, and the selection is a single character (ie, not a block) + """ + start, end = self._obj_.GetSel() + startLine = self._obj_.LineFromChar(start) + line = self._obj_.GetLine(startLine) + realCol = start - self._obj_.LineIndex(startLine) + # Calulate the next tab stop. + # Expand existing tabs. + curCol = 0 + for ch in line[:realCol]: + if ch == "\t": + curCol = ((curCol / self.tabSize) + 1) * self.tabSize + else: + curCol = curCol + 1 + nextColumn = ((curCol / self.indentSize) + 1) * self.indentSize + # print "curCol is", curCol, "nextColumn is", nextColumn + ins = None + if self.bSmartTabs: + # Look for some context. + if realCol == 0: # Start of the line - see if the line above can tell us + lookLine = startLine - 1 + while lookLine >= 0: + check = self._obj_.GetLine(lookLine)[0:1] + if check in ("\t", " "): + ins = check + break + lookLine = lookLine - 1 + else: # See if the previous char can tell us + check = line[realCol - 1] + if check in ("\t", " "): + ins = check + + # Either smart tabs off, or not smart enough! + # Use the "old style" settings. + if ins is None: + if self.bUseTabs and nextColumn % self.tabSize == 0: + ins = "\t" + else: + ins = " " + + if ins == " ": + # Calc the number of spaces to take us to the next stop + ins = ins * (nextColumn - curCol) + + self._obj_.ReplaceSel(ins) + + def BlockDent(self, isIndent, startLine, endLine): + "Indent/Undent all lines specified" + if not self.GetDocument().CheckMakeDocumentWritable(): + return 0 + tabSize = self.tabSize # hard-code for now! + info = self._PrepareUserStateChange() + try: + for lineNo in range(startLine, endLine): + pos = self._obj_.LineIndex(lineNo) + self._obj_.SetSel(pos, pos) + if isIndent: + self.Indent() + else: + line = self._obj_.GetLine(lineNo) + try: + noToDel = 0 + if line[0] == "\t": + noToDel = 1 + elif line[0] == " ": + for noToDel in range(0, tabSize): + if line[noToDel] != " ": + break + else: + noToDel = tabSize + if noToDel: + self._obj_.SetSel(pos, pos + noToDel) + self._obj_.Clear() + except IndexError: + pass + finally: + self._EndUserStateChange(info) + self.GetDocument().SetModifiedFlag(1) # Now dirty + self._obj_.SetSel(self.LineIndex(startLine), self.LineIndex(endLine)) + + def GotoLine(self, lineNo=None): + try: + if lineNo is None: + lineNo = int(input("Enter Line Number")) + except (ValueError, KeyboardInterrupt): + return 0 + self.GetLineCount() # Seems to be needed when file first opened??? + charNo = self.LineIndex(lineNo - 1) + self.SetSel(charNo) + + def HookHandlers(self): # children can override, but should still call me! + # self.HookAllKeyStrokes(self.OnKey) + self.HookMessage(self.OnCheckExternalDocumentUpdated, MSG_CHECK_EXTERNAL_FILE) + self.HookMessage(self.OnRClick, win32con.WM_RBUTTONDOWN) + self.HookMessage(self.OnSetFocus, win32con.WM_SETFOCUS) + self.HookMessage(self.OnKeyDown, win32con.WM_KEYDOWN) + self.HookKeyStroke(self.OnKeyCtrlY, 25) # ^Y + self.HookKeyStroke(self.OnKeyCtrlG, 7) # ^G + self.HookKeyStroke(self.OnKeyTab, 9) # TAB + self.HookKeyStroke(self.OnKeyEnter, 13) # Enter + self.HookCommand(self.OnCmdLocateFile, ID_LOCATE_FILE) + self.HookCommand(self.OnCmdGotoLine, ID_GOTO_LINE) + self.HookCommand(self.OnEditPaste, afxres.ID_EDIT_PASTE) + self.HookCommand(self.OnEditCut, afxres.ID_EDIT_CUT) + + # Hook Handlers + def OnSetFocus(self, msg): + # Even though we use file change notifications, we should be very sure about it here. + self.OnCheckExternalDocumentUpdated(msg) + + def OnRClick(self, params): + menu = win32ui.CreatePopupMenu() + + # look for a module name + line = self._obj_.GetLine().strip() + flags = win32con.MF_STRING | win32con.MF_ENABLED + if patImport.match(line) == len(line): + menu.AppendMenu( + flags, ID_LOCATE_FILE, "&Locate %s.py" % patImport.group("name") + ) + menu.AppendMenu(win32con.MF_SEPARATOR) + menu.AppendMenu(flags, win32ui.ID_EDIT_UNDO, "&Undo") + menu.AppendMenu(win32con.MF_SEPARATOR) + menu.AppendMenu(flags, win32ui.ID_EDIT_CUT, "Cu&t") + menu.AppendMenu(flags, win32ui.ID_EDIT_COPY, "&Copy") + menu.AppendMenu(flags, win32ui.ID_EDIT_PASTE, "&Paste") + menu.AppendMenu(flags, win32con.MF_SEPARATOR) + menu.AppendMenu(flags, win32ui.ID_EDIT_SELECT_ALL, "&Select all") + menu.AppendMenu(flags, win32con.MF_SEPARATOR) + menu.AppendMenu(flags, ID_GOTO_LINE, "&Goto line...") + menu.TrackPopupMenu(params[5]) + return 0 + + def OnCmdGotoLine(self, cmd, code): + self.GotoLine() + return 0 + + def OnCmdLocateFile(self, cmd, code): + modName = patImport.group("name") + if not modName: + return 0 + import pywin.framework.scriptutils + + fileName = pywin.framework.scriptutils.LocatePythonFile(modName) + if fileName is None: + win32ui.SetStatusText("Can't locate module %s" % modName) + else: + win32ui.GetApp().OpenDocumentFile(fileName) + return 0 + + # Key handlers + def OnKeyEnter(self, key): + if not self.GetDocument().CheckMakeDocumentWritable(): + return 0 + curLine = self._obj_.GetLine() + self._obj_.ReplaceSel("\r\n") # insert the newline + # If the current line indicates the next should be indented, + # then copy the current indentation to this line. + res = patIndent.match(curLine, 0) + if res > 0 and curLine.strip(): + curIndent = patIndent.group(1) + self._obj_.ReplaceSel(curIndent) + return 0 # dont pass on + + def OnKeyCtrlY(self, key): + if not self.GetDocument().CheckMakeDocumentWritable(): + return 0 + self.CutCurLine() + return 0 # dont let him have it! + + def OnKeyCtrlG(self, key): + self.GotoLine() + return 0 # dont let him have it! + + def OnKeyTab(self, key): + if not self.GetDocument().CheckMakeDocumentWritable(): + return 0 + start, end = self._obj_.GetSel() + if start == end: # normal TAB key + self.Indent() + return 0 # we handled this. + + # Otherwise it is a block indent/dedent. + if start > end: + start, end = end, start # swap them. + startLine = self._obj_.LineFromChar(start) + endLine = self._obj_.LineFromChar(end) + + self.BlockDent(win32api.GetKeyState(win32con.VK_SHIFT) >= 0, startLine, endLine) + return 0 + + def OnEditPaste(self, id, code): + # Return 1 if we can make the file editable.(or it already is!) + return self.GetDocument().CheckMakeDocumentWritable() + + def OnEditCut(self, id, code): + # Return 1 if we can make the file editable.(or it already is!) + return self.GetDocument().CheckMakeDocumentWritable() + + def OnKeyDown(self, msg): + key = msg[2] + if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000: + modList = MODIFYING_VK_KEYS_CTRL + elif win32api.GetKeyState(win32con.VK_MENU) & 0x8000: + modList = MODIFYING_VK_KEYS_ALT + else: + modList = MODIFYING_VK_KEYS + + if key in modList: + # Return 1 if we can make the file editable.(or it already is!) + return self.GetDocument().CheckMakeDocumentWritable() + return 1 # Pass it on OK + + # def OnKey(self, key): + # return self.GetDocument().CheckMakeDocumentWritable() + + def OnCheckExternalDocumentUpdated(self, msg): + if self._obj_ is None or self.bCheckingFile: + return + self.bCheckingFile = 1 + self.GetDocument().CheckExternalDocumentUpdated() + self.bCheckingFile = 0 + + +from .template import EditorTemplateBase + + +class EditorTemplate(EditorTemplateBase): + def __init__( + self, res=win32ui.IDR_TEXTTYPE, makeDoc=None, makeFrame=None, makeView=None + ): + if makeDoc is None: + makeDoc = EditorDocument + if makeView is None: + makeView = EditorView + EditorTemplateBase.__init__(self, res, makeDoc, makeFrame, makeView) + + def _CreateDocTemplate(self, resourceId): + return win32ui.CreateRichEditDocTemplate(resourceId) + + def CreateWin32uiDocument(self): + return self.DoCreateRichEditDoc() + + +def Create(fileName=None, title=None, template=None): + return editorTemplate.OpenDocumentFile(fileName) + + +from pywin.framework.editor import GetDefaultEditorModuleName + +prefModule = GetDefaultEditorModuleName() +# Initialize only if this is the "default" editor. +if __name__ == prefModule: + # For debugging purposes, when this module may be reloaded many times. + try: + win32ui.GetApp().RemoveDocTemplate(editorTemplate) + except (NameError, win32ui.error): + pass + + editorTemplate = EditorTemplate() + win32ui.GetApp().AddDocTemplate(editorTemplate) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/frame.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/frame.py new file mode 100644 index 0000000000000000000000000000000000000000..e927d16e5fe0bde37c9aed3316f8c59bddfd989d --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/frame.py @@ -0,0 +1,74 @@ +# frame.py - The MDI frame window for an editor. +import pywin.framework.window +import win32con +import win32ui + +from . import ModuleBrowser + + +class EditorFrame(pywin.framework.window.MDIChildWnd): + def OnCreateClient(self, cp, context): + # Create the default view as specified by the template (ie, the editor view) + view = context.template.MakeView(context.doc) + # Create the browser view. + browserView = ModuleBrowser.BrowserView(context.doc) + view2 = context.template.MakeView(context.doc) + + splitter = win32ui.CreateSplitter() + style = win32con.WS_CHILD | win32con.WS_VISIBLE + splitter.CreateStatic(self, 1, 2, style, win32ui.AFX_IDW_PANE_FIRST) + sub_splitter = self.sub_splitter = win32ui.CreateSplitter() + sub_splitter.CreateStatic(splitter, 2, 1, style, win32ui.AFX_IDW_PANE_FIRST + 1) + + # Note we must add the default view first, so that doc.GetFirstView() returns the editor view. + sub_splitter.CreateView(view, 1, 0, (0, 0)) + splitter.CreateView(browserView, 0, 0, (0, 0)) + sub_splitter.CreateView(view2, 0, 0, (0, 0)) + + ## print "First view is", context.doc.GetFirstView() + ## print "Views are", view, view2, browserView + ## print "Parents are", view.GetParent(), view2.GetParent(), browserView.GetParent() + ## print "Splitter is", splitter + ## print "sub splitter is", sub_splitter + ## Old + ## splitter.CreateStatic (self, 1, 2) + ## splitter.CreateView(view, 0, 1, (0,0)) # size ignored. + ## splitter.CreateView (browserView, 0, 0, (0, 0)) + + # Restrict the size of the browser splitter (and we can avoid filling + # it until it is shown) + splitter.SetColumnInfo(0, 10, 20) + # And the active view is our default view (so it gets initial focus) + self.SetActiveView(view) + + def GetEditorView(self): + # In a multi-view (eg, splitter) environment, get + # an editor (ie, scintilla) view + # Look for the splitter opened the most! + if self.sub_splitter is None: + return self.GetDlgItem(win32ui.AFX_IDW_PANE_FIRST) + v1 = self.sub_splitter.GetPane(0, 0) + v2 = self.sub_splitter.GetPane(1, 0) + r1 = v1.GetWindowRect() + r2 = v2.GetWindowRect() + if r1[3] - r1[1] > r2[3] - r2[1]: + return v1 + return v2 + + def GetBrowserView(self): + # XXX - should fix this :-) + return self.GetActiveDocument().GetAllViews()[1] + + def OnClose(self): + doc = self.GetActiveDocument() + if not doc.SaveModified(): + ## Cancel button selected from Save dialog, do not actually close + ## print 'close cancelled' + return 0 + ## So the 'Save' dialog doesn't come up twice + doc._obj_.SetModifiedFlag(False) + + # Must force the module browser to close itself here (OnDestroy for the view itself is too late!) + self.sub_splitter = None # ensure no circles! + self.GetBrowserView().DestroyBrowser() + return self._obj_.OnClose() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/template.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/template.py new file mode 100644 index 0000000000000000000000000000000000000000..362a74a62d9486113de2ee4daa39046fc526c55d --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/template.py @@ -0,0 +1,60 @@ +import os + +import pywin.framework.window +import win32api +import win32ui +from pywin.mfc import docview + +from . import frame + +ParentEditorTemplate = docview.DocTemplate + + +class EditorTemplateBase(ParentEditorTemplate): + def __init__( + self, res=win32ui.IDR_TEXTTYPE, makeDoc=None, makeFrame=None, makeView=None + ): + if makeFrame is None: + makeFrame = frame.EditorFrame + ParentEditorTemplate.__init__(self, res, makeDoc, makeFrame, makeView) + + def _CreateDocTemplate(self, resourceId): + assert 0, "You must override this" + + def CreateWin32uiDocument(self): + assert 0, "You must override this" + + def GetFileExtensions(self): + return ".txt", ".py" + + def MatchDocType(self, fileName, fileType): + doc = self.FindOpenDocument(fileName) + if doc: + return doc + ext = os.path.splitext(fileName)[1].lower() + if ext in self.GetFileExtensions(): + return win32ui.CDocTemplate_Confidence_yesAttemptNative + return win32ui.CDocTemplate_Confidence_maybeAttemptForeign + + def InitialUpdateFrame(self, frame, doc, makeVisible=1): + self._obj_.InitialUpdateFrame(frame, doc, makeVisible) # call default handler. + doc._UpdateUIForState() + + def GetPythonPropertyPages(self): + """Returns a list of property pages""" + from . import configui + + return [configui.EditorPropertyPage(), configui.EditorWhitespacePropertyPage()] + + def OpenDocumentFile(self, filename, bMakeVisible=1): + if filename is not None: + try: + path = os.path.split(filename)[0] + # print "The editor is translating", `filename`,"to", + filename = win32api.FindFiles(filename)[0][8] + filename = os.path.join(path, filename) + # print `filename` + except (win32api.error, IndexError) as details: + pass + # print "Couldnt get the full filename!", details + return self._obj_.OpenDocumentFile(filename, bMakeVisible) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/vss.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/vss.py new file mode 100644 index 0000000000000000000000000000000000000000..718f83eea471ba6192eb1b547ec97c4213541aef --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/editor/vss.py @@ -0,0 +1,104 @@ +# vss.py -- Source Control using Microsoft VSS. + +# Provides routines for checking files out of VSS. +# +# Uses an INI file very similar to how VB integrates with VSS - even +# as far as using the same name. + +# The file must be named "Mssccprj.scc", and be in the format of +# an INI file. This file may be in a parent directory, in which +# case the project name will be built from what is specified in the +# ini file, plus the path from the INI file to the file itself. +# +# The INI file should have a [Python] section, and a +# Project=Project Name +# and optionally +# Database=?? + + +import os +import sys +import traceback + +import win32api +import win32ui + +g_iniName = "Mssccprj.scc" # Use the same INI name as VB! + +g_sourceSafe = None + + +def FindVssProjectInfo(fullfname): + """Looks up the file system for an INI file describing the project. + + Looking up the tree is for ni style packages. + + Returns (projectName, pathToFileName) where pathToFileName contains + the path from the ini file to the actual file. + """ + path, fnameonly = os.path.split(fullfname) + origPath = path + project = "" + retPaths = [fnameonly] + while not project: + iniName = os.path.join(path, g_iniName) + database = win32api.GetProfileVal("Python", "Database", "", iniName) + project = win32api.GetProfileVal("Python", "Project", "", iniName) + if project: + break + # No valid INI file in this directory - look up a level. + path, addpath = os.path.split(path) + if not addpath: # Root? + break + retPaths.insert(0, addpath) + if not project: + win32ui.MessageBox( + "%s\r\n\r\nThis directory is not configured for Python/VSS" % origPath + ) + return + return project, "/".join(retPaths), database + + +def CheckoutFile(fileName): + global g_sourceSafe + import pythoncom + + ok = 0 + # Assumes the fileName has a complete path, + # and that the INI file can be found in that path + # (or a parent path if a ni style package) + try: + import win32com.client + import win32com.client.gencache + + mod = win32com.client.gencache.EnsureModule( + "{783CD4E0-9D54-11CF-B8EE-00608CC9A71F}", 0, 5, 0 + ) + if mod is None: + win32ui.MessageBox( + "VSS does not appear to be installed. The TypeInfo can not be created" + ) + return ok + + rc = FindVssProjectInfo(fileName) + if rc is None: + return + project, vssFname, database = rc + if g_sourceSafe is None: + g_sourceSafe = win32com.client.Dispatch("SourceSafe") + # SS seems a bit wierd. It defaults the arguments as empty strings, but + # then complains when they are used - so we pass "Missing" + if not database: + database = pythoncom.Missing + g_sourceSafe.Open(database, pythoncom.Missing, pythoncom.Missing) + item = g_sourceSafe.VSSItem("$/%s/%s" % (project, vssFname)) + item.Checkout(None, fileName) + ok = 1 + except pythoncom.com_error as exc: + win32ui.MessageBox(exc.strerror, "Error checking out file") + except: + typ, val, tb = sys.exc_info() + traceback.print_exc() + win32ui.MessageBox("%s - %s" % (str(typ), str(val)), "Error checking out file") + tb = None # Cleanup a cycle + return ok diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/help.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/help.py new file mode 100644 index 0000000000000000000000000000000000000000..ab664b4d1a542810f834ee191aa2fdb04e973b69 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/help.py @@ -0,0 +1,173 @@ +# help.py - help utilities for PythonWin. +import os + +import regutil +import win32api +import win32con +import win32ui + +htmlhelp_handle = None + +html_help_command_translators = { + win32con.HELP_CONTENTS: 1, # HH_DISPLAY_TOC + win32con.HELP_CONTEXT: 15, # HH_HELP_CONTEXT + win32con.HELP_FINDER: 1, # HH_DISPLAY_TOC +} + + +def FinalizeHelp(): + global htmlhelp_handle + if htmlhelp_handle is not None: + import win32help + + try: + # frame = win32ui.GetMainFrame().GetSafeHwnd() + frame = 0 + win32help.HtmlHelp(frame, None, win32help.HH_UNINITIALIZE, htmlhelp_handle) + except win32help.error: + print("Failed to finalize htmlhelp!") + htmlhelp_handle = None + + +def OpenHelpFile(fileName, helpCmd=None, helpArg=None): + "Open a help file, given a full path" + # default help arg. + win32ui.DoWaitCursor(1) + try: + if helpCmd is None: + helpCmd = win32con.HELP_CONTENTS + ext = os.path.splitext(fileName)[1].lower() + if ext == ".hlp": + win32api.WinHelp( + win32ui.GetMainFrame().GetSafeHwnd(), fileName, helpCmd, helpArg + ) + # XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts + # so we disable it, forcing ShellExecute, which works fine (but + # doesn't close the help file when Pythonwin is closed. + # Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp, + # which may or may not be related. + elif 0 and ext == ".chm": + import win32help + + global htmlhelp_handle + helpCmd = html_help_command_translators.get(helpCmd, helpCmd) + # frame = win32ui.GetMainFrame().GetSafeHwnd() + frame = 0 # Dont want it overlapping ours! + if htmlhelp_handle is None: + htmlhelp_hwnd, htmlhelp_handle = win32help.HtmlHelp( + frame, None, win32help.HH_INITIALIZE + ) + win32help.HtmlHelp(frame, fileName, helpCmd, helpArg) + else: + # Hope that the extension is registered, and we know what to do! + win32api.ShellExecute(0, "open", fileName, None, "", win32con.SW_SHOW) + return fileName + finally: + win32ui.DoWaitCursor(-1) + + +def ListAllHelpFiles(): + ret = [] + ret = _ListAllHelpFilesInRoot(win32con.HKEY_LOCAL_MACHINE) + # Ensure we don't get dups. + for item in _ListAllHelpFilesInRoot(win32con.HKEY_CURRENT_USER): + if item not in ret: + ret.append(item) + return ret + + +def _ListAllHelpFilesInRoot(root): + """Returns a list of (helpDesc, helpFname) for all registered help files""" + import regutil + + retList = [] + try: + key = win32api.RegOpenKey( + root, regutil.BuildDefaultPythonKey() + "\\Help", 0, win32con.KEY_READ + ) + except win32api.error as exc: + import winerror + + if exc.winerror != winerror.ERROR_FILE_NOT_FOUND: + raise + return retList + try: + keyNo = 0 + while 1: + try: + helpDesc = win32api.RegEnumKey(key, keyNo) + helpFile = win32api.RegQueryValue(key, helpDesc) + retList.append((helpDesc, helpFile)) + keyNo = keyNo + 1 + except win32api.error as exc: + import winerror + + if exc.winerror != winerror.ERROR_NO_MORE_ITEMS: + raise + break + finally: + win32api.RegCloseKey(key) + return retList + + +def SelectAndRunHelpFile(): + from pywin.dialogs import list + + helpFiles = ListAllHelpFiles() + if len(helpFiles) == 1: + # only 1 help file registered - probably ours - no point asking + index = 0 + else: + index = list.SelectFromLists("Select Help file", helpFiles, ["Title"]) + if index is not None: + OpenHelpFile(helpFiles[index][1]) + + +helpIDMap = None + + +def SetHelpMenuOtherHelp(mainMenu): + """Modifies the main Help Menu to handle all registered help files. + mainMenu -- The main menu to modify - usually from docTemplate.GetSharedMenu() + """ + + # Load all help files from the registry. + global helpIDMap + if helpIDMap is None: + helpIDMap = {} + cmdID = win32ui.ID_HELP_OTHER + excludeList = ["Main Python Documentation", "Pythonwin Reference"] + firstList = ListAllHelpFiles() + # We actually want to not only exclude these entries, but + # their help file names (as many entries may share the same name) + excludeFnames = [] + for desc, fname in firstList: + if desc in excludeList: + excludeFnames.append(fname) + + helpDescs = [] + for desc, fname in firstList: + if fname not in excludeFnames: + helpIDMap[cmdID] = (desc, fname) + win32ui.GetMainFrame().HookCommand(HandleHelpOtherCommand, cmdID) + cmdID = cmdID + 1 + + helpMenu = mainMenu.GetSubMenu( + mainMenu.GetMenuItemCount() - 1 + ) # Help menu always last. + otherHelpMenuPos = 2 # cant search for ID, as sub-menu has no ID. + otherMenu = helpMenu.GetSubMenu(otherHelpMenuPos) + while otherMenu.GetMenuItemCount(): + otherMenu.DeleteMenu(0, win32con.MF_BYPOSITION) + + if helpIDMap: + for id, (desc, fname) in helpIDMap.items(): + otherMenu.AppendMenu(win32con.MF_ENABLED | win32con.MF_STRING, id, desc) + else: + helpMenu.EnableMenuItem( + otherHelpMenuPos, win32con.MF_BYPOSITION | win32con.MF_GRAYED + ) + + +def HandleHelpOtherCommand(cmd, code): + OpenHelpFile(helpIDMap[cmd][1]) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/interact.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/interact.py new file mode 100644 index 0000000000000000000000000000000000000000..5f0b87f2e16ad2ddd96ba878001fa542136992c1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/interact.py @@ -0,0 +1,985 @@ +################################################################## +## +## Interactive Shell Window +## + +import array +import code +import os +import string +import sys +import traceback + +import __main__ +import afxres +import pywin.framework.app +import pywin.scintilla.control +import pywin.scintilla.formatter +import pywin.scintilla.IDLEenvironment +import win32api +import win32clipboard +import win32con +import win32ui + +## sequential after ID_GOTO_LINE defined in editor.py +ID_EDIT_COPY_CODE = 0xE2002 +ID_EDIT_EXEC_CLIPBOARD = 0x2003 + +trace = pywin.scintilla.formatter.trace + +import re + +from . import winout + +# from IDLE. +_is_block_opener = re.compile(r":\s*(#.*)?$").search +_is_block_closer = re.compile( + r""" + \s* + ( return + | break + | continue + | raise + | pass + ) + \b +""", + re.VERBOSE, +).match + +tracebackHeader = "Traceback (".encode("ascii") + +sectionProfile = "Interactive Window" +valueFormatTitle = "FormatTitle" +valueFormatInput = "FormatInput" +valueFormatOutput = "FormatOutput" +valueFormatOutputError = "FormatOutputError" + +# These are defaults only. Values are read from the registry. +formatTitle = (-536870897, 0, 220, 0, 16711680, 184, 34, "Arial") +formatInput = (-402653169, 0, 200, 0, 0, 0, 49, "Courier New") +formatOutput = (-402653169, 0, 200, 0, 8421376, 0, 49, "Courier New") +formatOutputError = (-402653169, 0, 200, 0, 255, 0, 49, "Courier New") + +try: + sys.ps1 +except AttributeError: + sys.ps1 = ">>> " + sys.ps2 = "... " + + +def LoadPreference(preference, default=""): + return win32ui.GetProfileVal(sectionProfile, preference, default) + + +def SavePreference(prefName, prefValue): + win32ui.WriteProfileVal(sectionProfile, prefName, prefValue) + + +def GetPromptPrefix(line): + ps1 = sys.ps1 + if line[: len(ps1)] == ps1: + return ps1 + ps2 = sys.ps2 + if line[: len(ps2)] == ps2: + return ps2 + + +############################################################# +# +# Colorizer related code. +# +############################################################# +STYLE_INTERACTIVE_EOL = "Interactive EOL" +STYLE_INTERACTIVE_OUTPUT = "Interactive Output" +STYLE_INTERACTIVE_PROMPT = "Interactive Prompt" +STYLE_INTERACTIVE_BANNER = "Interactive Banner" +STYLE_INTERACTIVE_ERROR = "Interactive Error" +STYLE_INTERACTIVE_ERROR_FINALLINE = "Interactive Error (final line)" + +INTERACTIVE_STYLES = [ + STYLE_INTERACTIVE_EOL, + STYLE_INTERACTIVE_OUTPUT, + STYLE_INTERACTIVE_PROMPT, + STYLE_INTERACTIVE_BANNER, + STYLE_INTERACTIVE_ERROR, + STYLE_INTERACTIVE_ERROR_FINALLINE, +] + +FormatterParent = pywin.scintilla.formatter.PythonSourceFormatter + + +class InteractiveFormatter(FormatterParent): + def __init__(self, scintilla): + FormatterParent.__init__(self, scintilla) + self.bannerDisplayed = False + + def SetStyles(self): + FormatterParent.SetStyles(self) + Style = pywin.scintilla.formatter.Style + self.RegisterStyle(Style(STYLE_INTERACTIVE_EOL, STYLE_INTERACTIVE_PROMPT)) + self.RegisterStyle(Style(STYLE_INTERACTIVE_PROMPT, formatInput)) + self.RegisterStyle(Style(STYLE_INTERACTIVE_OUTPUT, formatOutput)) + self.RegisterStyle(Style(STYLE_INTERACTIVE_BANNER, formatTitle)) + self.RegisterStyle(Style(STYLE_INTERACTIVE_ERROR, formatOutputError)) + self.RegisterStyle( + Style(STYLE_INTERACTIVE_ERROR_FINALLINE, STYLE_INTERACTIVE_ERROR) + ) + + def LoadPreference(self, name, default): + rc = win32ui.GetProfileVal("Format", name, default) + if rc == default: + rc = win32ui.GetProfileVal(sectionProfile, name, default) + return rc + + def ColorizeInteractiveCode(self, cdoc, styleStart, stylePyStart): + lengthDoc = len(cdoc) + if lengthDoc == 0: + return + state = styleStart + # As per comments in Colorize(), we work with the raw utf8 + # bytes. To avoid too muych py3k pain, we treat each utf8 byte + # as a latin-1 unicode character - we only use it to compare + # against ascii chars anyway... + chNext = cdoc[0:1].decode("latin-1") + startSeg = 0 + i = 0 + lastState = state # debug only + while i < lengthDoc: + ch = chNext + chNext = cdoc[i + 1 : i + 2].decode("latin-1") + + # trace("ch=%r, i=%d, next=%r, state=%s" % (ch, i, chNext, state)) + if state == STYLE_INTERACTIVE_EOL: + if ch not in "\r\n": + self.ColorSeg(startSeg, i - 1, state) + startSeg = i + if ch in (sys.ps1[0], sys.ps2[0]): + state = STYLE_INTERACTIVE_PROMPT + elif cdoc[i : i + len(tracebackHeader)] == tracebackHeader: + state = STYLE_INTERACTIVE_ERROR + else: + state = STYLE_INTERACTIVE_OUTPUT + elif state == STYLE_INTERACTIVE_PROMPT: + if ch not in sys.ps1 + sys.ps2 + " ": + self.ColorSeg(startSeg, i - 1, state) + startSeg = i + if ch in "\r\n": + state = STYLE_INTERACTIVE_EOL + else: + state = stylePyStart # Start coloring Python code. + elif state in (STYLE_INTERACTIVE_OUTPUT,): + if ch in "\r\n": + self.ColorSeg(startSeg, i - 1, state) + startSeg = i + state = STYLE_INTERACTIVE_EOL + elif state == STYLE_INTERACTIVE_ERROR: + if ch in "\r\n" and chNext and chNext not in string.whitespace: + # Everything including me + self.ColorSeg(startSeg, i, state) + startSeg = i + 1 + state = STYLE_INTERACTIVE_ERROR_FINALLINE + elif i == 0 and ch not in string.whitespace: + # If we are coloring from the start of a line, + # we need this better check for the last line + # Color up to not including me + self.ColorSeg(startSeg, i - 1, state) + startSeg = i + state = STYLE_INTERACTIVE_ERROR_FINALLINE + elif state == STYLE_INTERACTIVE_ERROR_FINALLINE: + if ch in "\r\n": + self.ColorSeg(startSeg, i - 1, state) + startSeg = i + state = STYLE_INTERACTIVE_EOL + elif state == STYLE_INTERACTIVE_BANNER: + if ch in "\r\n" and (chNext == "" or chNext in ">["): + # Everything including me + self.ColorSeg(startSeg, i - 1, state) + startSeg = i + state = STYLE_INTERACTIVE_EOL + else: + # It is a PythonColorizer state - seek past the end of the line + # and ask the Python colorizer to color that. + end = startSeg + while end < lengthDoc and cdoc[end] not in "\r\n".encode("ascii"): + end = end + 1 + self.ColorizePythonCode(cdoc[:end], startSeg, state) + stylePyStart = self.GetStringStyle(end - 1) + if stylePyStart is None: + stylePyStart = pywin.scintilla.formatter.STYLE_DEFAULT + else: + stylePyStart = stylePyStart.name + startSeg = end + i = end - 1 # ready for increment. + chNext = cdoc[end : end + 1].decode("latin-1") + state = STYLE_INTERACTIVE_EOL + if lastState != state: + lastState = state + i = i + 1 + # and the rest + if startSeg < i: + self.ColorSeg(startSeg, i - 1, state) + + def Colorize(self, start=0, end=-1): + # scintilla's formatting is all done in terms of utf, so + # we work with utf8 bytes instead of unicode. This magically + # works as any extended chars found in the utf8 don't change + # the semantics. + stringVal = self.scintilla.GetTextRange(start, end, decode=False) + styleStart = None + stylePyStart = None + if start > 1: + # Likely we are being asked to color from the start of the line. + # We find the last formatted character on the previous line. + # If TQString, we continue it. Otherwise, we reset. + look = start - 1 + while look and self.scintilla.SCIGetCharAt(look) in "\n\r": + look = look - 1 + if look and look < start - 1: # Did we find a char before the \n\r sets? + strstyle = self.GetStringStyle(look) + quote_char = None + if strstyle is not None: + if strstyle.name == pywin.scintilla.formatter.STYLE_TQSSTRING: + quote_char = "'" + elif strstyle.name == pywin.scintilla.formatter.STYLE_TQDSTRING: + quote_char = '"' + if quote_char is not None: + # It is a TQS. If the TQS is not terminated, we + # carry the style through. + if look > 2: + look_str = ( + self.scintilla.SCIGetCharAt(look - 2) + + self.scintilla.SCIGetCharAt(look - 1) + + self.scintilla.SCIGetCharAt(look) + ) + if look_str != quote_char * 3: + stylePyStart = strstyle.name + if stylePyStart is None: + stylePyStart = pywin.scintilla.formatter.STYLE_DEFAULT + + if start > 0: + stylenum = self.scintilla.SCIGetStyleAt(start - 1) + styleStart = self.GetStyleByNum(stylenum).name + elif self.bannerDisplayed: + styleStart = STYLE_INTERACTIVE_EOL + else: + styleStart = STYLE_INTERACTIVE_BANNER + self.bannerDisplayed = True + self.scintilla.SCIStartStyling(start, 31) + self.style_buffer = array.array("b", (0,) * len(stringVal)) + self.ColorizeInteractiveCode(stringVal, styleStart, stylePyStart) + self.scintilla.SCISetStylingEx(self.style_buffer) + self.style_buffer = None + + +############################################################### +# +# This class handles the Python interactive interpreter. +# +# It uses a basic EditWindow, and does all the magic. +# This is triggered by the enter key hander attached by the +# start-up code. It determines if a command is to be executed +# or continued (ie, emit "... ") by snooping around the current +# line, looking for the prompts +# +class PythonwinInteractiveInterpreter(code.InteractiveInterpreter): + def __init__(self, locals=None, globals=None): + if locals is None: + locals = __main__.__dict__ + if globals is None: + globals = locals + self.globals = globals + code.InteractiveInterpreter.__init__(self, locals) + + def showsyntaxerror(self, filename=None): + sys.stderr.write( + tracebackHeader.decode("ascii") + ) # So the color syntaxer recognises it. + code.InteractiveInterpreter.showsyntaxerror(self, filename) + + def runcode(self, code): + try: + exec(code, self.globals, self.locals) + except SystemExit: + raise + except: + self.showtraceback() + + +class InteractiveCore: + def __init__(self, banner=None): + self.banner = banner + + # LoadFontPreferences() + def Init(self): + self.oldStdOut = self.oldStdErr = None + + # self.SetWordWrap(win32ui.CRichEditView_WrapNone) + self.interp = PythonwinInteractiveInterpreter() + + self.OutputGrab() # Release at cleanup. + + if self.GetTextLength() == 0: + if self.banner is None: + suffix = "" + if win32ui.debug: + suffix = ", debug build" + sys.stderr.write( + "PythonWin %s on %s%s.\n" % (sys.version, sys.platform, suffix) + ) + sys.stderr.write( + "Portions %s - see 'Help/About PythonWin' for further copyright information.\n" + % (win32ui.copyright,) + ) + else: + sys.stderr.write(banner) + rcfile = os.environ.get("PYTHONSTARTUP") + if rcfile: + import __main__ + + try: + exec( + compile( + open(rcfile, "rb").read(), rcfile, "exec", dont_inherit=True + ), + __main__.__dict__, + __main__.__dict__, + ) + except: + sys.stderr.write( + ">>> \nError executing PYTHONSTARTUP script %r\n" % (rcfile) + ) + traceback.print_exc(file=sys.stderr) + self.AppendToPrompt([]) + + def SetContext(self, globals, locals, name="Dbg"): + oldPrompt = sys.ps1 + if globals is None: + # Reset + sys.ps1 = ">>> " + sys.ps2 = "... " + locals = globals = __main__.__dict__ + else: + sys.ps1 = "[%s]>>> " % name + sys.ps2 = "[%s]... " % name + self.interp.locals = locals + self.interp.globals = globals + self.AppendToPrompt([], oldPrompt) + + def GetContext(self): + return self.interp.globals, self.interp.locals + + def DoGetLine(self, line=-1): + if line == -1: + line = self.LineFromChar() + line = self.GetLine(line) + while line and line[-1] in ("\r", "\n"): + line = line[:-1] + return line + + def AppendToPrompt(self, bufLines, oldPrompt=None): + "Take a command and stick it at the end of the buffer (with python prompts inserted if required)." + self.flush() + lastLineNo = self.GetLineCount() - 1 + line = self.DoGetLine(lastLineNo) + if oldPrompt and line == oldPrompt: + self.SetSel(self.GetTextLength() - len(oldPrompt), self.GetTextLength()) + self.ReplaceSel(sys.ps1) + elif line != str(sys.ps1): + if len(line) != 0: + self.write("\n") + self.write(sys.ps1) + self.flush() + self.idle.text.mark_set("iomark", "end-1c") + if not bufLines: + return + terms = (["\n" + sys.ps2] * (len(bufLines) - 1)) + [""] + for bufLine, term in zip(bufLines, terms): + if bufLine.strip(): + self.write(bufLine + term) + self.flush() + + def EnsureNoPrompt(self): + # Get ready to write some text NOT at a Python prompt. + self.flush() + lastLineNo = self.GetLineCount() - 1 + line = self.DoGetLine(lastLineNo) + if not line or line in (sys.ps1, sys.ps2): + self.SetSel(self.GetTextLength() - len(line), self.GetTextLength()) + self.ReplaceSel("") + else: + # Just add a new line. + self.write("\n") + + def _GetSubConfigNames(self): + return ["interactive"] # Allow [Keys:Interactive] sections to be specific + + def HookHandlers(self): + # Hook menu command (executed when a menu item with that ID is selected from a menu/toolbar + self.HookCommand(self.OnSelectBlock, win32ui.ID_EDIT_SELECT_BLOCK) + self.HookCommand(self.OnEditCopyCode, ID_EDIT_COPY_CODE) + self.HookCommand(self.OnEditExecClipboard, ID_EDIT_EXEC_CLIPBOARD) + mod = pywin.scintilla.IDLEenvironment.GetIDLEModule("IdleHistory") + if mod is not None: + self.history = mod.History(self.idle.text, "\n" + sys.ps2) + else: + self.history = None + # hack for now for event handling. + + # GetBlockBoundary takes a line number, and will return the + # start and and line numbers of the block, and a flag indicating if the + # block is a Python code block. + # If the line specified has a Python prompt, then the lines are parsed + # backwards and forwards, and the flag is true. + # If the line does not start with a prompt, the block is searched forward + # and backward until a prompt _is_ found, and all lines in between without + # prompts are returned, and the flag is false. + def GetBlockBoundary(self, lineNo): + line = self.DoGetLine(lineNo) + maxLineNo = self.GetLineCount() - 1 + prefix = GetPromptPrefix(line) + if prefix is None: # Non code block + flag = 0 + startLineNo = lineNo + while startLineNo > 0: + if GetPromptPrefix(self.DoGetLine(startLineNo - 1)) is not None: + break # there _is_ a prompt + startLineNo = startLineNo - 1 + endLineNo = lineNo + while endLineNo < maxLineNo: + if GetPromptPrefix(self.DoGetLine(endLineNo + 1)) is not None: + break # there _is_ a prompt + endLineNo = endLineNo + 1 + else: # Code block + flag = 1 + startLineNo = lineNo + while startLineNo > 0 and prefix != str(sys.ps1): + prefix = GetPromptPrefix(self.DoGetLine(startLineNo - 1)) + if prefix is None: + break + # there is no prompt. + startLineNo = startLineNo - 1 + endLineNo = lineNo + while endLineNo < maxLineNo: + prefix = GetPromptPrefix(self.DoGetLine(endLineNo + 1)) + if prefix is None: + break # there is no prompt + if prefix == str(sys.ps1): + break # this is another command + endLineNo = endLineNo + 1 + # continue until end of buffer, or no prompt + return (startLineNo, endLineNo, flag) + + def ExtractCommand(self, lines): + start, end = lines + retList = [] + while end >= start: + thisLine = self.DoGetLine(end) + promptLen = len(GetPromptPrefix(thisLine)) + retList = [thisLine[promptLen:]] + retList + end = end - 1 + return retList + + def OutputGrab(self): + # import win32traceutil; return + self.oldStdOut = sys.stdout + self.oldStdErr = sys.stderr + sys.stdout = self + sys.stderr = self + self.flush() + + def OutputRelease(self): + # a command may have overwritten these - only restore if not. + if self.oldStdOut is not None: + if sys.stdout == self: + sys.stdout = self.oldStdOut + if self.oldStdErr is not None: + if sys.stderr == self: + sys.stderr = self.oldStdErr + self.oldStdOut = None + self.oldStdErr = None + self.flush() + + ################################### + # + # Message/Command/Key Hooks. + # + # Enter key handler + # + def ProcessEnterEvent(self, event): + # If autocompletion has been triggered, complete and do not process event + if self.SCIAutoCActive(): + self.SCIAutoCComplete() + self.SCICancel() + return + + self.SCICancel() + # First, check for an error message + haveGrabbedOutput = 0 + if self.HandleSpecialLine(): + return 0 + + lineNo = self.LineFromChar() + start, end, isCode = self.GetBlockBoundary(lineNo) + # If we are not in a code block just go to the prompt (or create a new one) + if not isCode: + self.AppendToPrompt([]) + win32ui.SetStatusText(win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE)) + return + + lines = self.ExtractCommand((start, end)) + + # If we are in a code-block, but it isnt at the end of the buffer + # then copy it to the end ready for editing and subsequent execution + if end != self.GetLineCount() - 1: + win32ui.SetStatusText("Press ENTER to execute command") + self.AppendToPrompt(lines) + self.SetSel(-2) + return + + # If SHIFT held down, we want new code here and now! + bNeedIndent = ( + win32api.GetKeyState(win32con.VK_SHIFT) < 0 + or win32api.GetKeyState(win32con.VK_CONTROL) < 0 + ) + if bNeedIndent: + self.ReplaceSel("\n") + else: + self.SetSel(-2) + self.ReplaceSel("\n") + source = "\n".join(lines) + while source and source[-1] in "\t ": + source = source[:-1] + self.OutputGrab() # grab the output for the command exec. + try: + if self.interp.runsource( + source, "" + ): # Need more input! + bNeedIndent = 1 + else: + # If the last line isnt empty, append a newline + if self.history is not None: + self.history.history_store(source) + self.AppendToPrompt([]) + win32ui.SetStatusText( + win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE) + ) + # win32ui.SetStatusText('Successfully executed statement') + finally: + self.OutputRelease() + if bNeedIndent: + win32ui.SetStatusText("Ready to continue the command") + # Now attempt correct indentation (should use IDLE?) + curLine = self.DoGetLine(lineNo)[len(sys.ps2) :] + pos = 0 + indent = "" + while len(curLine) > pos and curLine[pos] in string.whitespace: + indent = indent + curLine[pos] + pos = pos + 1 + if _is_block_opener(curLine): + indent = indent + "\t" + elif _is_block_closer(curLine): + indent = indent[:-1] + # use ReplaceSel to ensure it goes at the cursor rather than end of buffer. + self.ReplaceSel(sys.ps2 + indent) + return 0 + + # ESC key handler + def ProcessEscEvent(self, event): + # Implement a cancel. + if self.SCIAutoCActive() or self.SCICallTipActive(): + self.SCICancel() + else: + win32ui.SetStatusText("Cancelled.") + self.AppendToPrompt(("",)) + return 0 + + def OnSelectBlock(self, command, code): + lineNo = self.LineFromChar() + start, end, isCode = self.GetBlockBoundary(lineNo) + startIndex = self.LineIndex(start) + endIndex = self.LineIndex(end + 1) - 2 # skip \r + \n + if endIndex < 0: # must be beyond end of buffer + endIndex = -2 # self.Length() + self.SetSel(startIndex, endIndex) + + def OnEditCopyCode(self, command, code): + """Sanitizes code from interactive window, removing prompts and output, + and inserts it in the clipboard.""" + code = self.GetSelText() + lines = code.splitlines() + out_lines = [] + for line in lines: + if line.startswith(sys.ps1): + line = line[len(sys.ps1) :] + out_lines.append(line) + elif line.startswith(sys.ps2): + line = line[len(sys.ps2) :] + out_lines.append(line) + out_code = os.linesep.join(out_lines) + win32clipboard.OpenClipboard() + try: + win32clipboard.SetClipboardData( + win32clipboard.CF_UNICODETEXT, str(out_code) + ) + finally: + win32clipboard.CloseClipboard() + + def OnEditExecClipboard(self, command, code): + """Executes python code directly from the clipboard.""" + win32clipboard.OpenClipboard() + try: + code = win32clipboard.GetClipboardData(win32clipboard.CF_UNICODETEXT) + finally: + win32clipboard.CloseClipboard() + + code = code.replace("\r\n", "\n") + "\n" + try: + o = compile(code, "", "exec") + exec(o, __main__.__dict__) + except: + traceback.print_exc() + + def GetRightMenuItems(self): + # Just override parents + ret = [] + flags = 0 + ret.append((flags, win32ui.ID_EDIT_UNDO, "&Undo")) + ret.append(win32con.MF_SEPARATOR) + ret.append((flags, win32ui.ID_EDIT_CUT, "Cu&t")) + ret.append((flags, win32ui.ID_EDIT_COPY, "&Copy")) + + start, end = self.GetSel() + if start != end: + ret.append((flags, ID_EDIT_COPY_CODE, "Copy code without prompts")) + if win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_UNICODETEXT): + ret.append( + (flags, ID_EDIT_EXEC_CLIPBOARD, "Execute python code from clipboard") + ) + + ret.append((flags, win32ui.ID_EDIT_PASTE, "&Paste")) + ret.append(win32con.MF_SEPARATOR) + ret.append((flags, win32ui.ID_EDIT_SELECT_ALL, "&Select all")) + ret.append((flags, win32ui.ID_EDIT_SELECT_BLOCK, "Select &block")) + ret.append((flags, win32ui.ID_VIEW_WHITESPACE, "View &Whitespace")) + return ret + + def MDINextEvent(self, event): + win32ui.GetMainFrame().MDINext(0) + + def MDIPrevEvent(self, event): + win32ui.GetMainFrame().MDINext(0) + + def WindowBackEvent(self, event): + parent = self.GetParentFrame() + if parent == win32ui.GetMainFrame(): + # It is docked. + try: + wnd, isactive = parent.MDIGetActive() + wnd.SetFocus() + except win32ui.error: + # No MDI window active! + pass + else: + # Normal Window + try: + lastActive = self.GetParentFrame().lastActive + # If the window is invalid, reset it. + if lastActive is not None and ( + lastActive._obj_ is None or lastActive.GetSafeHwnd() == 0 + ): + lastActive = self.GetParentFrame().lastActive = None + win32ui.SetStatusText("The last active Window has been closed.") + except AttributeError: + print("Can't find the last active window!") + lastActive = None + if lastActive is not None: + lastActive.MDIActivate() + + +class InteractiveView(InteractiveCore, winout.WindowOutputView): + def __init__(self, doc): + InteractiveCore.__init__(self) + winout.WindowOutputView.__init__(self, doc) + self.encoding = pywin.default_scintilla_encoding + + def _MakeColorizer(self): + return InteractiveFormatter(self) + + def OnInitialUpdate(self): + winout.WindowOutputView.OnInitialUpdate(self) + self.SetWordWrap() + self.Init() + + def HookHandlers(self): + winout.WindowOutputView.HookHandlers(self) + InteractiveCore.HookHandlers(self) + + +class CInteractivePython(winout.WindowOutput): + def __init__(self, makeDoc=None, makeFrame=None): + self.IsFinalDestroy = 0 + winout.WindowOutput.__init__( + self, + sectionProfile, + sectionProfile, + winout.flags.WQ_LINE, + 1, + None, + makeDoc, + makeFrame, + InteractiveView, + ) + self.Create() + + def OnViewDestroy(self, view): + if self.IsFinalDestroy: + view.OutputRelease() + winout.WindowOutput.OnViewDestroy(self, view) + + def Close(self): + self.IsFinalDestroy = 1 + winout.WindowOutput.Close(self) + + +class InteractiveFrame(winout.WindowOutputFrame): + def __init__(self): + self.lastActive = None + winout.WindowOutputFrame.__init__(self) + + def OnMDIActivate(self, bActive, wndActive, wndDeactive): + if bActive: + self.lastActive = wndDeactive + + +###################################################################### +## +## Dockable Window Support +## +###################################################################### +ID_DOCKED_INTERACTIVE_CONTROLBAR = 0xE802 + +DockedInteractiveViewParent = InteractiveView + + +class DockedInteractiveView(DockedInteractiveViewParent): + def HookHandlers(self): + DockedInteractiveViewParent.HookHandlers(self) + self.HookMessage(self.OnSetFocus, win32con.WM_SETFOCUS) + self.HookMessage(self.OnKillFocus, win32con.WM_KILLFOCUS) + + def OnSetFocus(self, msg): + self.GetParentFrame().SetActiveView(self) + return 1 + + def OnKillFocus(self, msg): + # If we are losing focus to another in this app, reset the main frame's active view. + hwnd = wparam = msg[2] + try: + wnd = win32ui.CreateWindowFromHandle(hwnd) + reset = wnd.GetTopLevelFrame() == self.GetTopLevelFrame() + except win32ui.error: + reset = 0 # Not my window + if reset: + self.GetParentFrame().SetActiveView(None) + return 1 + + def OnDestroy(self, msg): + newSize = self.GetWindowPlacement()[4] + pywin.framework.app.SaveWindowSize("Interactive Window", newSize, "docked") + try: + if self.GetParentFrame().GetActiveView == self: + self.GetParentFrame().SetActiveView(None) + except win32ui.error: + pass + try: + if win32ui.GetMainFrame().GetActiveView() == self: + win32ui.GetMainFrame().SetActiveView(None) + except win32ui.error: + pass + return DockedInteractiveViewParent.OnDestroy(self, msg) + + +class CDockedInteractivePython(CInteractivePython): + def __init__(self, dockbar): + self.bFirstCreated = 0 + self.dockbar = dockbar + CInteractivePython.__init__(self) + + def NeedRecreateWindow(self): + if self.bCreating: + return 0 + try: + frame = win32ui.GetMainFrame() + if frame.closing: + return 0 # Dieing! + except (win32ui.error, AttributeError): + return 0 # The app is dieing! + try: + cb = frame.GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) + return not cb.IsWindowVisible() + except win32ui.error: + return 1 # Control bar does not exist! + + def RecreateWindow(self): + try: + dockbar = win32ui.GetMainFrame().GetControlBar( + ID_DOCKED_INTERACTIVE_CONTROLBAR + ) + win32ui.GetMainFrame().ShowControlBar(dockbar, 1, 1) + except win32ui.error: + CreateDockedInteractiveWindow() + + def Create(self): + self.bCreating = 1 + doc = InteractiveDocument(None, self.DoCreateDoc()) + view = DockedInteractiveView(doc) + defRect = pywin.framework.app.LoadWindowSize("Interactive Window", "docked") + if defRect[2] - defRect[0] == 0: + defRect = 0, 0, 500, 200 + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_BORDER + id = 1050 # win32ui.AFX_IDW_PANE_FIRST + view.CreateWindow(self.dockbar, id, style, defRect) + view.OnInitialUpdate() + self.bFirstCreated = 1 + + self.currentView = doc.GetFirstView() + self.bCreating = 0 + if self.title: + doc.SetTitle(self.title) + + +# The factory we pass to the dockable window support. +def InteractiveViewCreator(parent): + global edit + edit = CDockedInteractivePython(parent) + return edit.currentView + + +def CreateDockedInteractiveWindow(): + # Later, the DockingBar should be capable of hosting multiple + # children. + from pywin.docking.DockingBar import DockingBar + + bar = DockingBar() + creator = InteractiveViewCreator + bar.CreateWindow( + win32ui.GetMainFrame(), + creator, + "Interactive Window", + ID_DOCKED_INTERACTIVE_CONTROLBAR, + ) + bar.SetBarStyle( + bar.GetBarStyle() + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + | afxres.CBRS_SIZE_DYNAMIC + ) + bar.EnableDocking(afxres.CBRS_ALIGN_ANY) + win32ui.GetMainFrame().DockControlBar(bar, afxres.AFX_IDW_DOCKBAR_BOTTOM) + + +###################################################################### +# +# The public interface to this module. +# +###################################################################### +# No extra functionality now, but maybe later, so +# publicize these names. +InteractiveDocument = winout.WindowOutputDocument + +# We remember our one and only interactive window in the "edit" variable. +edit = None + + +def CreateInteractiveWindowUserPreference(makeDoc=None, makeFrame=None): + """Create some sort of interactive window if the user's preference say we should.""" + bCreate = LoadPreference("Show at startup", 1) + if bCreate: + CreateInteractiveWindow(makeDoc, makeFrame) + + +def CreateInteractiveWindow(makeDoc=None, makeFrame=None): + """Create a standard or docked interactive window unconditionally""" + assert edit is None, "Creating second interactive window!" + bDocking = LoadPreference("Docking", 0) + if bDocking: + CreateDockedInteractiveWindow() + else: + CreateMDIInteractiveWindow(makeDoc, makeFrame) + assert edit is not None, "Created interactive window, but did not set the global!" + edit.currentView.SetFocus() + + +def CreateMDIInteractiveWindow(makeDoc=None, makeFrame=None): + """Create a standard (non-docked) interactive window unconditionally""" + global edit + if makeDoc is None: + makeDoc = InteractiveDocument + if makeFrame is None: + makeFrame = InteractiveFrame + edit = CInteractivePython(makeDoc=makeDoc, makeFrame=makeFrame) + + +def DestroyInteractiveWindow(): + """Destroy the interactive window. + This is different to Closing the window, + which may automatically re-appear. Once destroyed, it can never be recreated, + and a complete new instance must be created (which the various other helper + functions will then do after making this call + """ + global edit + if edit is not None and edit.currentView is not None: + if edit.currentView.GetParentFrame() == win32ui.GetMainFrame(): + # It is docked - do nothing now (this is only called at shutdown!) + pass + else: + # It is a standard window - call Close on the container. + edit.Close() + edit = None + + +def CloseInteractiveWindow(): + """Close the interactive window, allowing it to be re-created on demand.""" + global edit + if edit is not None and edit.currentView is not None: + if edit.currentView.GetParentFrame() == win32ui.GetMainFrame(): + # It is docked, just hide the dock bar. + frame = win32ui.GetMainFrame() + cb = frame.GetControlBar(ID_DOCKED_INTERACTIVE_CONTROLBAR) + frame.ShowControlBar(cb, 0, 1) + else: + # It is a standard window - destroy the frame/view, allowing the object itself to remain. + edit.currentView.GetParentFrame().DestroyWindow() + + +def ToggleInteractiveWindow(): + """If the interactive window is visible, hide it, otherwise show it.""" + if edit is None: + CreateInteractiveWindow() + else: + if edit.NeedRecreateWindow(): + edit.RecreateWindow() + else: + # Close it, allowing a reopen. + CloseInteractiveWindow() + + +def ShowInteractiveWindow(): + """Shows (or creates if necessary) an interactive window""" + if edit is None: + CreateInteractiveWindow() + else: + if edit.NeedRecreateWindow(): + edit.RecreateWindow() + else: + parent = edit.currentView.GetParentFrame() + if parent == win32ui.GetMainFrame(): # It is docked. + edit.currentView.SetFocus() + else: # It is a "normal" window + edit.currentView.GetParentFrame().AutoRestore() + win32ui.GetMainFrame().MDIActivate(edit.currentView.GetParentFrame()) + + +def IsInteractiveWindowVisible(): + return edit is not None and not edit.NeedRecreateWindow() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py new file mode 100644 index 0000000000000000000000000000000000000000..48461dbab079a2493a30cd25d5eee9527274ec7b --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py @@ -0,0 +1,555 @@ +# intpyapp.py - Interactive Python application class +# +import os +import sys +import traceback + +import __main__ +import commctrl +import win32api +import win32con +import win32ui +from pywin.mfc import afxres, dialog + +from . import app, dbgcommands + +lastLocateFileName = ".py" # used in the "File/Locate" dialog... + + +# todo - _SetupSharedMenu should be moved to a framework class. +def _SetupSharedMenu_(self): + sharedMenu = self.GetSharedMenu() + from pywin.framework import toolmenu + + toolmenu.SetToolsMenu(sharedMenu) + from pywin.framework import help + + help.SetHelpMenuOtherHelp(sharedMenu) + + +from pywin.mfc import docview + +docview.DocTemplate._SetupSharedMenu_ = _SetupSharedMenu_ + + +class MainFrame(app.MainFrame): + def OnCreate(self, createStruct): + self.closing = 0 + if app.MainFrame.OnCreate(self, createStruct) == -1: + return -1 + style = ( + win32con.WS_CHILD + | afxres.CBRS_SIZE_DYNAMIC + | afxres.CBRS_TOP + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + ) + + self.EnableDocking(afxres.CBRS_ALIGN_ANY) + + tb = win32ui.CreateToolBar(self, style | win32con.WS_VISIBLE) + tb.ModifyStyle(0, commctrl.TBSTYLE_FLAT) + tb.LoadToolBar(win32ui.IDR_MAINFRAME) + tb.EnableDocking(afxres.CBRS_ALIGN_ANY) + tb.SetWindowText("Standard") + self.DockControlBar(tb) + # Any other packages which use toolbars + from pywin.debugger.debugger import PrepareControlBars + + PrepareControlBars(self) + # Note "interact" also uses dockable windows, but they already happen + + # And a "Tools" menu on the main frame. + menu = self.GetMenu() + from . import toolmenu + + toolmenu.SetToolsMenu(menu, 2) + # And fix the "Help" menu on the main frame + from pywin.framework import help + + help.SetHelpMenuOtherHelp(menu) + + def OnClose(self): + try: + import pywin.debugger + + if ( + pywin.debugger.currentDebugger is not None + and pywin.debugger.currentDebugger.pumping + ): + try: + pywin.debugger.currentDebugger.close(1) + except: + traceback.print_exc() + return + except win32ui.error: + pass + self.closing = 1 + self.SaveBarState("ToolbarDefault") + self.SetActiveView(None) # Otherwise MFC's OnClose may _not_ prompt for save. + + from pywin.framework import help + + help.FinalizeHelp() + + self.DestroyControlBar(afxres.AFX_IDW_TOOLBAR) + self.DestroyControlBar(win32ui.ID_VIEW_TOOLBAR_DBG) + + return self._obj_.OnClose() + + def DestroyControlBar(self, id): + try: + bar = self.GetControlBar(id) + except win32ui.error: + return + bar.DestroyWindow() + + def OnCommand(self, wparam, lparam): + # By default, the current MDI child frame will process WM_COMMAND + # messages before any docked control bars - even if the control bar + # has focus. This is a problem for the interactive window when docked. + # Therefore, we detect the situation of a view having the main frame + # as its parent, and assume it must be a docked view (which it will in an MDI app) + try: + v = ( + self.GetActiveView() + ) # Raise an exception if none - good - then we want default handling + # Main frame _does_ have a current view (ie, a docking view) - see if it wants it. + if v.OnCommand(wparam, lparam): + return 1 + except (win32ui.error, AttributeError): + pass + return self._obj_.OnCommand(wparam, lparam) + + +class InteractivePythonApp(app.CApp): + # This works if necessary - just we dont need to override the Run method. + # def Run(self): + # return self._obj_.Run() + + def HookCommands(self): + app.CApp.HookCommands(self) + dbgcommands.DebuggerCommandHandler().HookCommands() + self.HookCommand(self.OnViewBrowse, win32ui.ID_VIEW_BROWSE) + self.HookCommand(self.OnFileImport, win32ui.ID_FILE_IMPORT) + self.HookCommand(self.OnFileCheck, win32ui.ID_FILE_CHECK) + self.HookCommandUpdate(self.OnUpdateFileCheck, win32ui.ID_FILE_CHECK) + self.HookCommand(self.OnFileRun, win32ui.ID_FILE_RUN) + self.HookCommand(self.OnFileLocate, win32ui.ID_FILE_LOCATE) + self.HookCommand(self.OnInteractiveWindow, win32ui.ID_VIEW_INTERACTIVE) + self.HookCommandUpdate( + self.OnUpdateInteractiveWindow, win32ui.ID_VIEW_INTERACTIVE + ) + self.HookCommand(self.OnViewOptions, win32ui.ID_VIEW_OPTIONS) + self.HookCommand(self.OnHelpIndex, afxres.ID_HELP_INDEX) + self.HookCommand(self.OnFileSaveAll, win32ui.ID_FILE_SAVE_ALL) + self.HookCommand(self.OnViewToolbarDbg, win32ui.ID_VIEW_TOOLBAR_DBG) + self.HookCommandUpdate(self.OnUpdateViewToolbarDbg, win32ui.ID_VIEW_TOOLBAR_DBG) + + def CreateMainFrame(self): + return MainFrame() + + def MakeExistingDDEConnection(self): + # Use DDE to connect to an existing instance + # Return None if no existing instance + try: + from . import intpydde + except ImportError: + # No dde support! + return None + conv = intpydde.CreateConversation(self.ddeServer) + try: + conv.ConnectTo("Pythonwin", "System") + return conv + except intpydde.error: + return None + + def InitDDE(self): + # Do all the magic DDE handling. + # Returns TRUE if we have pumped the arguments to our + # remote DDE app, and we should terminate. + try: + from . import intpydde + except ImportError: + self.ddeServer = None + intpydde = None + if intpydde is not None: + self.ddeServer = intpydde.DDEServer(self) + self.ddeServer.Create("Pythonwin", intpydde.CBF_FAIL_SELFCONNECTIONS) + try: + # If there is an existing instance, pump the arguments to it. + connection = self.MakeExistingDDEConnection() + if connection is not None: + connection.Exec("self.Activate()") + if self.ProcessArgs(sys.argv, connection) is None: + return 1 + except: + # It is too early to 'print' an exception - we + # don't have stdout setup yet! + win32ui.DisplayTraceback( + sys.exc_info(), " - error in DDE conversation with Pythonwin" + ) + return 1 + + def InitInstance(self): + # Allow "/nodde" and "/new" to optimize this! + if ( + "/nodde" not in sys.argv + and "/new" not in sys.argv + and "-nodde" not in sys.argv + and "-new" not in sys.argv + ): + if self.InitDDE(): + return 1 # A remote DDE client is doing it for us! + else: + self.ddeServer = None + + win32ui.SetRegistryKey( + "Python %s" % (sys.winver,) + ) # MFC automatically puts the main frame caption on! + app.CApp.InitInstance(self) + + # Create the taskbar icon + win32ui.CreateDebuggerThread() + + # Allow Pythonwin to host OCX controls. + win32ui.EnableControlContainer() + + # Display the interactive window if the user wants it. + from . import interact + + interact.CreateInteractiveWindowUserPreference() + + # Load the modules we use internally. + self.LoadSystemModules() + + # Load additional module the user may want. + self.LoadUserModules() + + # Load the ToolBar state near the end of the init process, as + # there may be Toolbar IDs created by the user or other modules. + # By now all these modules should be loaded, so all the toolbar IDs loaded. + try: + self.frame.LoadBarState("ToolbarDefault") + except win32ui.error: + # MFC sucks. It does essentially "GetDlgItem(x)->Something", so if the + # toolbar with ID x does not exist, MFC crashes! Pythonwin has a trap for this + # but I need to investigate more how to prevent it (AFAIK, ensuring all the + # toolbars are created by now _should_ stop it!) + pass + + # Finally process the command line arguments. + try: + self.ProcessArgs(sys.argv) + except: + # too early for printing anything. + win32ui.DisplayTraceback( + sys.exc_info(), " - error processing command line args" + ) + + def ExitInstance(self): + win32ui.DestroyDebuggerThread() + try: + from . import interact + + interact.DestroyInteractiveWindow() + except: + pass + if self.ddeServer is not None: + self.ddeServer.Shutdown() + self.ddeServer = None + return app.CApp.ExitInstance(self) + + def Activate(self): + # Bring to the foreground. Mainly used when another app starts up, it asks + # this one to activate itself, then it terminates. + frame = win32ui.GetMainFrame() + frame.SetForegroundWindow() + if frame.GetWindowPlacement()[1] == win32con.SW_SHOWMINIMIZED: + frame.ShowWindow(win32con.SW_RESTORE) + + def ProcessArgs(self, args, dde=None): + # If we are going to talk to a remote app via DDE, then + # activate it! + if ( + len(args) < 1 or not args[0] + ): # argv[0]=='' when started without args, just like Python.exe! + return + + i = 0 + while i < len(args): + argType = args[i] + i += 1 + if argType.startswith("-"): + # Support dash options. Slash options are misinterpreted by python init + # as path and not finding usually 'C:\\' ends up in sys.path[0] + argType = "/" + argType[1:] + if not argType.startswith("/"): + argType = win32ui.GetProfileVal( + "Python", "Default Arg Type", "/edit" + ).lower() + i -= 1 # arg is /edit's parameter + par = i < len(args) and args[i] or "MISSING" + if argType in ("/nodde", "/new", "-nodde", "-new"): + # Already handled + pass + elif argType.startswith("/goto:"): + gotoline = int(argType[len("/goto:") :]) + if dde: + dde.Exec( + "from pywin.framework import scriptutils\n" + "ed = scriptutils.GetActiveEditControl()\n" + "if ed: ed.SetSel(ed.LineIndex(%s - 1))" % gotoline + ) + else: + from . import scriptutils + + ed = scriptutils.GetActiveEditControl() + if ed: + ed.SetSel(ed.LineIndex(gotoline - 1)) + elif argType == "/edit": + # Load up the default application. + i += 1 + fname = win32api.GetFullPathName(par) + if not os.path.isfile(fname): + # if we don't catch this, OpenDocumentFile() (actually + # PyCDocument.SetPathName() in + # pywin.scintilla.document.CScintillaDocument.OnOpenDocument) + # segfaults Pythonwin on recent PY3 builds (b228) + win32ui.MessageBox( + "No such file: %s\n\nCommand Line: %s" + % (fname, win32api.GetCommandLine()), + "Open file for edit", + win32con.MB_ICONERROR, + ) + continue + if dde: + dde.Exec("win32ui.GetApp().OpenDocumentFile(%s)" % (repr(fname))) + else: + win32ui.GetApp().OpenDocumentFile(par) + elif argType == "/rundlg": + if dde: + dde.Exec( + "from pywin.framework import scriptutils;scriptutils.RunScript(%r, %r, 1)" + % (par, " ".join(args[i + 1 :])) + ) + else: + from . import scriptutils + + scriptutils.RunScript(par, " ".join(args[i + 1 :])) + return + elif argType == "/run": + if dde: + dde.Exec( + "from pywin.framework import scriptutils;scriptutils.RunScript(%r, %r, 0)" + % (par, " ".join(args[i + 1 :])) + ) + else: + from . import scriptutils + + scriptutils.RunScript(par, " ".join(args[i + 1 :]), 0) + return + elif argType == "/app": + raise RuntimeError( + "/app only supported for new instances of Pythonwin.exe" + ) + elif argType == "/dde": # Send arbitary command + if dde is not None: + dde.Exec(par) + else: + win32ui.MessageBox( + "The /dde command can only be used\r\nwhen Pythonwin is already running" + ) + i += 1 + else: + raise ValueError("Command line argument not recognised: %s" % argType) + + def LoadSystemModules(self): + self.DoLoadModules("pywin.framework.editor,pywin.framework.stdin") + + def LoadUserModules(self, moduleNames=None): + # Load the users modules. + if moduleNames is None: + default = "pywin.framework.sgrepmdi,pywin.framework.mdi_pychecker" + moduleNames = win32ui.GetProfileVal("Python", "Startup Modules", default) + self.DoLoadModules(moduleNames) + + def DoLoadModules(self, moduleNames): # ", sep string of module names. + if not moduleNames: + return + modules = moduleNames.split(",") + for module in modules: + try: + __import__(module) + except: # Catch em all, else the app itself dies! 'ImportError: + traceback.print_exc() + msg = 'Startup import of user module "%s" failed' % module + print(msg) + win32ui.MessageBox(msg) + + # + # DDE Callback + # + def OnDDECommand(self, command): + try: + exec(command + "\n") + except: + print("ERROR executing DDE command: ", command) + traceback.print_exc() + raise + + # + # General handlers + # + def OnViewBrowse(self, id, code): + "Called when ViewBrowse message is received" + from pywin.tools import browser + + obName = dialog.GetSimpleInput("Object", "__builtins__", "Browse Python Object") + if obName is None: + return + try: + browser.Browse(eval(obName, __main__.__dict__, __main__.__dict__)) + except NameError: + win32ui.MessageBox("This is no object with this name") + except AttributeError: + win32ui.MessageBox("The object has no attribute of that name") + except: + traceback.print_exc() + win32ui.MessageBox("This object can not be browsed") + + def OnFileImport(self, id, code): + "Called when a FileImport message is received. Import the current or specified file" + from . import scriptutils + + scriptutils.ImportFile() + + def OnFileCheck(self, id, code): + "Called when a FileCheck message is received. Check the current file." + from . import scriptutils + + scriptutils.CheckFile() + + def OnUpdateFileCheck(self, cmdui): + from . import scriptutils + + cmdui.Enable(scriptutils.GetActiveFileName(0) is not None) + + def OnFileRun(self, id, code): + "Called when a FileRun message is received." + from . import scriptutils + + showDlg = win32api.GetKeyState(win32con.VK_SHIFT) >= 0 + scriptutils.RunScript(None, None, showDlg) + + def OnFileLocate(self, id, code): + from . import scriptutils + + global lastLocateFileName # save the new version away for next time... + + name = dialog.GetSimpleInput( + "File name", lastLocateFileName, "Locate Python File" + ) + if name is None: # Cancelled. + return + lastLocateFileName = name + # if ".py" supplied, rip it off! + # should also check for .pys and .pyw + if lastLocateFileName[-3:].lower() == ".py": + lastLocateFileName = lastLocateFileName[:-3] + lastLocateFileName = lastLocateFileName.replace(".", "\\") + newName = scriptutils.LocatePythonFile(lastLocateFileName) + if newName is None: + win32ui.MessageBox("The file '%s' can not be located" % lastLocateFileName) + else: + win32ui.GetApp().OpenDocumentFile(newName) + + # Display all the "options" proprety pages we can find + def OnViewOptions(self, id, code): + win32ui.InitRichEdit() + sheet = dialog.PropertySheet("Pythonwin Options") + # Add property pages we know about that need manual work. + from pywin.dialogs import ideoptions + + sheet.AddPage(ideoptions.OptionsPropPage()) + + from . import toolmenu + + sheet.AddPage(toolmenu.ToolMenuPropPage()) + + # Get other dynamic pages from templates. + pages = [] + for template in self.GetDocTemplateList(): + try: + # Dont actually call the function with the exception handler. + getter = template.GetPythonPropertyPages + except AttributeError: + # Template does not provide property pages! + continue + pages = pages + getter() + + # Debugger template goes at the end + try: + from pywin.debugger import configui + except ImportError: + configui = None + if configui is not None: + pages.append(configui.DebuggerOptionsPropPage()) + # Now simply add the pages, and display the dialog. + for page in pages: + sheet.AddPage(page) + + if sheet.DoModal() == win32con.IDOK: + win32ui.SetStatusText("Applying configuration changes...", 1) + win32ui.DoWaitCursor(1) + # Tell every Window in our app that win.ini has changed! + win32ui.GetMainFrame().SendMessageToDescendants( + win32con.WM_WININICHANGE, 0, 0 + ) + win32ui.DoWaitCursor(0) + + def OnInteractiveWindow(self, id, code): + # toggle the existing state. + from . import interact + + interact.ToggleInteractiveWindow() + + def OnUpdateInteractiveWindow(self, cmdui): + try: + interact = sys.modules["pywin.framework.interact"] + state = interact.IsInteractiveWindowVisible() + except KeyError: # Interactive module hasnt ever been imported. + state = 0 + cmdui.Enable() + cmdui.SetCheck(state) + + def OnFileSaveAll(self, id, code): + # Only attempt to save editor documents. + from pywin.framework.editor import editorTemplate + + num = 0 + for doc in editorTemplate.GetDocumentList(): + if doc.IsModified() and doc.GetPathName(): + num = num = 1 + doc.OnSaveDocument(doc.GetPathName()) + win32ui.SetStatusText("%d documents saved" % num, 1) + + def OnViewToolbarDbg(self, id, code): + if code == 0: + return not win32ui.GetMainFrame().OnBarCheck(id) + + def OnUpdateViewToolbarDbg(self, cmdui): + win32ui.GetMainFrame().OnUpdateControlBarMenu(cmdui) + cmdui.Enable(1) + + def OnHelpIndex(self, id, code): + from . import help + + help.SelectAndRunHelpFile() + + +# As per the comments in app.py, this use is depreciated. +# app.AppBuilder = InteractivePythonApp + +# Now all we do is create the application +thisApp = InteractivePythonApp() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/intpydde.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/intpydde.py new file mode 100644 index 0000000000000000000000000000000000000000..1f869b0f68f9fbf20324a0eead3fbb2110e68eb2 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/intpydde.py @@ -0,0 +1,60 @@ +# DDE support for Pythonwin +# +# Seems to work fine (in the context that IE4 seems to have broken +# DDE on _all_ NT4 machines I have tried, but only when a "Command Prompt" window +# is open. Strange, but true. If you have problems with this, close all Command Prompts! + + +import sys +import traceback + +import win32api +import win32ui +from dde import * +from pywin.mfc import object + + +class DDESystemTopic(object.Object): + def __init__(self, app): + self.app = app + object.Object.__init__(self, CreateServerSystemTopic()) + + def Exec(self, data): + try: + # print "Executing", cmd + self.app.OnDDECommand(data) + except: + t, v, tb = sys.exc_info() + # The DDE Execution failed. + print("Error executing DDE command.") + traceback.print_exception(t, v, tb) + return 0 + + +class DDEServer(object.Object): + def __init__(self, app): + self.app = app + object.Object.__init__(self, CreateServer()) + self.topic = self.item = None + + def CreateSystemTopic(self): + return DDESystemTopic(self.app) + + def Shutdown(self): + self._obj_.Shutdown() + self._obj_.Destroy() + if self.topic is not None: + self.topic.Destroy() + self.topic = None + if self.item is not None: + self.item.Destroy() + self.item = None + + def OnCreate(self): + return 1 + + def Status(self, msg): + try: + win32ui.SetStatusText(msg) + except win32ui.error: + pass diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/mdi_pychecker.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/mdi_pychecker.py new file mode 100644 index 0000000000000000000000000000000000000000..c89f33b9b9622961fac5f2c8388408bad0310da1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/mdi_pychecker.py @@ -0,0 +1,849 @@ +###################################################################### +## +## The Pychecker MDI Plug-In UserModule for Pythonwin +## +## contributed by Robert Kiendl +## +## Style is similar to (and inherited) from the SGrepMDI UserModule +## +## Usage: +## +## Start Pychecker on current file: Menu/File/New../Pychecker. +## Use it: Jump to Pychecker warning source lines by double-click. +## Auto-add "#$pycheck_no" / "#$pycheck_no=specific-re-pattern" tags +## to source lines by context/right-mouse-click on warning lines. +## +## It requires pychecker installed and the pychecker.bat to be on +## the PATH. Example pychecker.bat: +## +## REM pychecker.bat +## C:\bin\python.exe C:\PYTHON23\Lib\site-packages\pychecker\checker.py %1 %2 %3 %4 %5 %6 %7 %8 %9 +## +## Adding it as default module in PythonWin: +## +## +++ ./intpyapp.py 2006-10-02 17:59:32.974161600 +0200 +## @@ -272,7 +282,7 @@ +## def LoadUserModules(self, moduleNames = None): +## # Load the users modules. +## if moduleNames is None: +## - default = "sgrepmdi" +## + default = "sgrepmdi,mdi_pychecker" +## moduleNames=win32ui.GetProfileVal('Python','Startup Modules',default) +## self.DoLoadModules(moduleNames) +## +###################################################################### + +import glob +import os +import re +import sys +import time + +import win32api +import win32con +import win32ui +from pywin.mfc import dialog, docview, window + +from . import scriptutils + + +def getsubdirs(d): + dlist = [] + flist = glob.glob(d + "\\*") + for f in flist: + if os.path.isdir(f): + dlist.append(f) + dlist = dlist + getsubdirs(f) + return dlist + + +class dirpath: + def __init__(self, str, recurse=0): + dp = str.split(";") + dirs = {} + for d in dp: + if os.path.isdir(d): + d = d.lower() + if d not in dirs: + dirs[d] = None + if recurse: + subdirs = getsubdirs(d) + for sd in subdirs: + sd = sd.lower() + if sd not in dirs: + dirs[sd] = None + elif os.path.isfile(d): + pass + else: + x = None + if d in os.environ: + x = dirpath(os.environ[d]) + elif d[:5] == "HKEY_": + keystr = d.split("\\") + try: + root = eval("win32con." + keystr[0]) + except: + win32ui.MessageBox( + "Can't interpret registry key name '%s'" % keystr[0] + ) + try: + subkey = "\\".join(keystr[1:]) + val = win32api.RegQueryValue(root, subkey) + if val: + x = dirpath(val) + else: + win32ui.MessageBox( + "Registry path '%s' did not return a path entry" % d + ) + except: + win32ui.MessageBox( + "Can't interpret registry key value: %s" % keystr[1:] + ) + else: + win32ui.MessageBox("Directory '%s' not found" % d) + if x: + for xd in x: + if xd not in dirs: + dirs[xd] = None + if recurse: + subdirs = getsubdirs(xd) + for sd in subdirs: + sd = sd.lower() + if sd not in dirs: + dirs[sd] = None + self.dirs = [] + for d in dirs.keys(): + self.dirs.append(d) + + def __getitem__(self, key): + return self.dirs[key] + + def __len__(self): + return len(self.dirs) + + def __setitem__(self, key, value): + self.dirs[key] = value + + def __delitem__(self, key): + del self.dirs[key] + + def __getslice__(self, lo, hi): + return self.dirs[lo:hi] + + def __setslice__(self, lo, hi, seq): + self.dirs[lo:hi] = seq + + def __delslice__(self, lo, hi): + del self.dirs[lo:hi] + + def __add__(self, other): + if type(other) == type(self) or type(other) == type([]): + return self.dirs + other.dirs + + def __radd__(self, other): + if type(other) == type(self) or type(other) == type([]): + return other.dirs + self.dirs + + +# Group(1) is the filename, group(2) is the lineno. +# regexGrepResult=regex.compile("^\\([a-zA-Z]:.*\\)(\\([0-9]+\\))") +# regexGrep=re.compile(r"^([a-zA-Z]:[^(]*)\((\d+)\)") +regexGrep = re.compile(r"^(..[^\(:]+)?[\(:](\d+)[\):]:?\s*(.*)") + +# these are the atom numbers defined by Windows for basic dialog controls + +BUTTON = 0x80 +EDIT = 0x81 +STATIC = 0x82 +LISTBOX = 0x83 +SCROLLBAR = 0x84 +COMBOBOX = 0x85 + + +class TheTemplate(docview.RichEditDocTemplate): + def __init__(self): + docview.RichEditDocTemplate.__init__( + self, win32ui.IDR_TEXTTYPE, TheDocument, TheFrame, TheView + ) + self.SetDocStrings( + "\nPychecker\nPychecker\nPychecker params (*.pychecker)\n.pychecker\n\n\n" + ) + win32ui.GetApp().AddDocTemplate(self) + self.docparams = None + + def MatchDocType(self, fileName, fileType): + doc = self.FindOpenDocument(fileName) + if doc: + return doc + ext = os.path.splitext(fileName)[1].lower() + if ext == ".pychecker": + return win32ui.CDocTemplate_Confidence_yesAttemptNative + return win32ui.CDocTemplate_Confidence_noAttempt + + def setParams(self, params): + self.docparams = params + + def readParams(self): + tmp = self.docparams + self.docparams = None + return tmp + + +class TheFrame(window.MDIChildWnd): + # The template and doc params will one day be removed. + def __init__(self, wnd=None): + window.MDIChildWnd.__init__(self, wnd) + + +class TheDocument(docview.RichEditDoc): + def __init__(self, template): + docview.RichEditDoc.__init__(self, template) + self.dirpattern = "" + self.filpattern = "" + self.greppattern = "" + self.casesensitive = 1 + self.recurse = 1 + self.verbose = 0 + + def OnOpenDocument(self, fnm): + # this bizarre stuff with params is so right clicking in a result window + # and starting a new grep can communicate the default parameters to the + # new grep. + try: + params = open(fnm, "r").read() + except: + params = None + self.setInitParams(params) + return self.OnNewDocument() + + def OnCloseDocument(self): + try: + win32ui.GetApp().DeleteIdleHandler(self.idleHandler) + except: + pass + return self._obj_.OnCloseDocument() + + def saveInitParams(self): + # Only save the flags, not the text boxes. + paramstr = "\t\t\t%d\t%d" % (self.casesensitive, self.recurse) + win32ui.WriteProfileVal("Pychecker", "Params", paramstr) + + def setInitParams(self, paramstr): + if paramstr is None: + paramstr = win32ui.GetProfileVal("Pychecker", "Params", "\t\t\t1\t0\t0") + params = paramstr.split("\t") + if len(params) < 3: + params = params + [""] * (3 - len(params)) + if len(params) < 6: + params = params + [0] * (6 - len(params)) + self.dirpattern = params[0] + self.filpattern = params[1] + self.greppattern = params[2] or "-#1000 --only" + self.casesensitive = int(params[3]) + self.recurse = int(params[4]) + self.verbose = int(params[5]) + # setup some reasonable defaults. + if not self.dirpattern: + try: + editor = win32ui.GetMainFrame().MDIGetActive()[0].GetEditorView() + self.dirpattern = os.path.abspath( + os.path.dirname(editor.GetDocument().GetPathName()) + ) + except (AttributeError, win32ui.error): + self.dirpattern = os.getcwd() + if not self.filpattern: + try: + editor = win32ui.GetMainFrame().MDIGetActive()[0].GetEditorView() + self.filpattern = editor.GetDocument().GetPathName() + except AttributeError: + self.filpattern = "*.py" + + def OnNewDocument(self): + if self.dirpattern == "": + self.setInitParams(greptemplate.readParams()) + d = TheDialog( + self.dirpattern, + self.filpattern, + self.greppattern, + self.casesensitive, + self.recurse, + self.verbose, + ) + if d.DoModal() == win32con.IDOK: + self.dirpattern = d["dirpattern"] + self.filpattern = d["filpattern"] + self.greppattern = d["greppattern"] + # self.casesensitive = d['casesensitive'] + # self.recurse = d['recursive'] + # self.verbose = d['verbose'] + self.doSearch() + self.saveInitParams() + return 1 + return 0 # cancelled - return zero to stop frame creation. + + def doSearch(self): + self.dp = dirpath(self.dirpattern, self.recurse) + self.SetTitle( + "Pychecker Run '%s' (options: %s)" % (self.filpattern, self.greppattern) + ) + # self.text = [] + self.GetFirstView().Append( + "#Pychecker Run in " + self.dirpattern + " %s\n" % time.asctime() + ) + if self.verbose: + self.GetFirstView().Append("# =" + repr(self.dp.dirs) + "\n") + self.GetFirstView().Append("# Files " + self.filpattern + "\n") + self.GetFirstView().Append("# Options " + self.greppattern + "\n") + self.fplist = self.filpattern.split(";") + self.GetFirstView().Append( + "# Running... ( double click on result lines in order to jump to the source code ) \n" + ) + win32ui.SetStatusText("Pychecker running. Please wait...", 0) + self.dpndx = self.fpndx = 0 + self.fndx = -1 + if not self.dp: + self.GetFirstView().Append( + "# ERROR: '%s' does not resolve to any search locations" + % self.dirpattern + ) + self.SetModifiedFlag(0) + else: + ##self.flist = glob.glob(self.dp[0]+'\\'+self.fplist[0]) + import operator + + self.flist = reduce(operator.add, list(map(glob.glob, self.fplist))) + # import pywin.debugger;pywin.debugger.set_trace() + self.startPycheckerRun() + + def idleHandler(self, handler, count): + import time + + time.sleep(0.001) + if self.result != None: + win32ui.GetApp().DeleteIdleHandler(self.idleHandler) + return 0 + return 1 # more + + def startPycheckerRun(self): + self.result = None + old = win32api.SetCursor(win32api.LoadCursor(0, win32con.IDC_APPSTARTING)) + win32ui.GetApp().AddIdleHandler(self.idleHandler) + import _thread + + _thread.start_new(self.threadPycheckerRun, ()) + ##win32api.SetCursor(old) + + def threadPycheckerRun(self): + result = "" + rc = -1 + try: + options = self.greppattern + files = " ".join(self.flist) + # Recently MarkH has failed to run pychecker without it having + # been explicitly installed - so we assume it is and locate it + # from its default location. + # Step1 - get python.exe + py = os.path.join(sys.prefix, "python.exe") + if not os.path.isfile(py): + if "64 bit" in sys.version: + py = os.path.join(sys.prefix, "PCBuild", "amd64", "python.exe") + else: + py = os.path.join(sys.prefix, "PCBuild", "python.exe") + try: + py = win32api.GetShortPathName(py) + except win32api.error: + py = "" + # Find checker.py + import sysconfig + + pychecker = os.path.join( + sysconfig.get_paths()["purelib"], "pychecker", "checker.py" + ) + if not os.path.isfile(py): + result = "Can't find python.exe!\n" + elif not os.path.isfile(pychecker): + result = ( + "Can't find checker.py - please install pychecker " + "(or run 'setup.py install' if you have the source version)\n" + ) + else: + cmd = '%s "%s" %s %s 2>&1' % (py, pychecker, options, files) + ##fin,fout,ferr=os.popen3(cmd) + ##result=ferr.read()+fout.read() + result = os.popen(cmd).read() + ##rc=f.close() + self.GetFirstView().Append(result) + finally: + self.result = result + print("== Pychecker run finished ==") + self.GetFirstView().Append("\n" + "== Pychecker run finished ==") + self.SetModifiedFlag(0) + + def _inactive_idleHandler(self, handler, count): + self.fndx = self.fndx + 1 + if self.fndx < len(self.flist): + f = self.flist[self.fndx] + if self.verbose: + self.GetFirstView().Append("# .." + f + "\n") + win32ui.SetStatusText("Searching " + f, 0) + lines = open(f, "r").readlines() + for i in range(len(lines)): + line = lines[i] + if self.pat.search(line) != None: + self.GetFirstView().Append(f + "(" + repr(i + 1) + ") " + line) + else: + self.fndx = -1 + self.fpndx = self.fpndx + 1 + if self.fpndx < len(self.fplist): + self.flist = glob.glob( + self.dp[self.dpndx] + "\\" + self.fplist[self.fpndx] + ) + else: + self.fpndx = 0 + self.dpndx = self.dpndx + 1 + if self.dpndx < len(self.dp): + self.flist = glob.glob( + self.dp[self.dpndx] + "\\" + self.fplist[self.fpndx] + ) + else: + win32ui.SetStatusText("Search complete.", 0) + self.SetModifiedFlag(0) # default to not modified. + try: + win32ui.GetApp().DeleteIdleHandler(self.idleHandler) + except: + pass + return 0 + return 1 + + def GetParams(self): + return ( + self.dirpattern + + "\t" + + self.filpattern + + "\t" + + self.greppattern + + "\t" + + repr(self.casesensitive) + + "\t" + + repr(self.recurse) + + "\t" + + repr(self.verbose) + ) + + def OnSaveDocument(self, filename): + # print 'OnSaveDocument() filename=',filename + savefile = open(filename, "wb") + txt = self.GetParams() + "\n" + # print 'writing',txt + savefile.write(txt) + savefile.close() + self.SetModifiedFlag(0) + return 1 + + +ID_OPEN_FILE = 0xE500 +ID_PYCHECKER = 0xE501 +ID_SAVERESULTS = 0x502 +ID_TRYAGAIN = 0x503 +ID_ADDCOMMENT = 0x504 +ID_ADDPYCHECKNO2 = 0x505 + + +class TheView(docview.RichEditView): + def __init__(self, doc): + docview.RichEditView.__init__(self, doc) + self.SetWordWrap(win32ui.CRichEditView_WrapNone) + self.HookHandlers() + + def OnInitialUpdate(self): + rc = self._obj_.OnInitialUpdate() + format = (-402653169, 0, 200, 0, 0, 0, 49, "Courier New") + self.SetDefaultCharFormat(format) + return rc + + def HookHandlers(self): + self.HookMessage(self.OnRClick, win32con.WM_RBUTTONDOWN) + self.HookCommand(self.OnCmdOpenFile, ID_OPEN_FILE) + self.HookCommand(self.OnCmdThe, ID_PYCHECKER) + self.HookCommand(self.OnCmdSave, ID_SAVERESULTS) + self.HookCommand(self.OnTryAgain, ID_TRYAGAIN) + self.HookCommand(self.OnAddComment, ID_ADDCOMMENT) + self.HookCommand(self.OnAddComment, ID_ADDPYCHECKNO2) + self.HookMessage(self.OnLDblClick, win32con.WM_LBUTTONDBLCLK) + + def OnLDblClick(self, params): + line = self.GetLine() + regexGrepResult = regexGrep.match(line) + if regexGrepResult: + fname = regexGrepResult.group(1) + line = int(regexGrepResult.group(2)) + scriptutils.JumpToDocument(fname, line) + return 0 # dont pass on + return 1 # pass it on by default. + + def OnRClick(self, params): + menu = win32ui.CreatePopupMenu() + flags = win32con.MF_STRING | win32con.MF_ENABLED + lineno = self._obj_.LineFromChar(-1) # selection or current line + line = self._obj_.GetLine(lineno) + regexGrepResult = regexGrep.match(line) + charstart, charend = self._obj_.GetSel() + if regexGrepResult: + self.fnm = regexGrepResult.group(1) + self.lnnum = int(regexGrepResult.group(2)) + menu.AppendMenu(flags, ID_OPEN_FILE, "&Open " + self.fnm) + menu.AppendMenu( + flags, ID_ADDCOMMENT, "&Add to source: Comment Tag/#$pycheck_no .." + ) + menu.AppendMenu( + flags, + ID_ADDPYCHECKNO2, + "&Add to source: Specific #$pycheck_no=%(errtext)s ..", + ) + menu.AppendMenu(win32con.MF_SEPARATOR) + menu.AppendMenu(flags, ID_TRYAGAIN, "&Try Again") + menu.AppendMenu(flags, win32ui.ID_EDIT_CUT, "Cu&t") + menu.AppendMenu(flags, win32ui.ID_EDIT_COPY, "&Copy") + menu.AppendMenu(flags, win32ui.ID_EDIT_PASTE, "&Paste") + menu.AppendMenu(flags, win32con.MF_SEPARATOR) + menu.AppendMenu(flags, win32ui.ID_EDIT_SELECT_ALL, "&Select all") + menu.AppendMenu(flags, win32con.MF_SEPARATOR) + menu.AppendMenu(flags, ID_SAVERESULTS, "Sa&ve results") + menu.TrackPopupMenu(params[5]) + return 0 + + def OnAddComment(self, cmd, code): + addspecific = cmd == ID_ADDPYCHECKNO2 + _ = list(self.GetSel()) + _.sort() + start, end = _ + line_start, line_end = self.LineFromChar(start), self.LineFromChar(end) + first = 1 + for i in range(line_start, line_end + 1): + line = self.GetLine(i) + m = regexGrep.match(line) + if m: + if first: + first = 0 + cmnt = dialog.GetSimpleInput( + "Add to %s lines" % (line_end - line_start + 1), + addspecific + and " #$pycheck_no=%(errtext)s" + or " #$pycheck_no", + ) + if not cmnt: + return 0 + ##import pywin.debugger;pywin.debugger.set_trace() + fname = m.group(1) + line = int(m.group(2)) + view = scriptutils.JumpToDocument(fname, line) + pos = view.LineIndex(line) - 1 + if view.GetTextRange(pos - 1, pos) in ("\r", "\n"): + pos -= 1 + view.SetSel(pos, pos) + errtext = m.group(3) + if start != end and line_start == line_end: + errtext = self.GetSelText() + errtext = repr(re.escape(errtext).replace("\ ", " ")) + view.ReplaceSel(addspecific and cmnt % locals() or cmnt) + return 0 + + def OnCmdOpenFile(self, cmd, code): + doc = win32ui.GetApp().OpenDocumentFile(self.fnm) + if doc: + vw = doc.GetFirstView() + # hope you have an editor that implements GotoLine()! + try: + vw.GotoLine(int(self.lnnum)) + except: + pass + return 0 + + def OnCmdThe(self, cmd, code): + curparamsstr = self.GetDocument().GetParams() + params = curparamsstr.split("\t") + params[2] = self.sel + greptemplate.setParams("\t".join(params)) + greptemplate.OpenDocumentFile() + return 0 + + def OnTryAgain(self, cmd, code): + greptemplate.setParams(self.GetDocument().GetParams()) + greptemplate.OpenDocumentFile() + return 0 + + def OnCmdSave(self, cmd, code): + flags = win32con.OFN_OVERWRITEPROMPT + dlg = win32ui.CreateFileDialog( + 0, None, None, flags, "Text Files (*.txt)|*.txt||", self + ) + dlg.SetOFNTitle("Save Results As") + if dlg.DoModal() == win32con.IDOK: + pn = dlg.GetPathName() + self._obj_.SaveFile(pn) + return 0 + + def Append(self, strng): + numlines = self.GetLineCount() + endpos = self.LineIndex(numlines - 1) + len(self.GetLine(numlines - 1)) + self.SetSel(endpos, endpos) + self.ReplaceSel(strng) + + +class TheDialog(dialog.Dialog): + def __init__(self, dp, fp, gp, cs, r, v): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + CS = win32con.WS_CHILD | win32con.WS_VISIBLE + tmp = [ + ["Pychecker Run", (0, 0, 210, 90), style, None, (8, "MS Sans Serif")], + ] + tmp.append([STATIC, "Files:", -1, (7, 7, 50, 9), CS]) + tmp.append( + [ + EDIT, + gp, + 103, + (52, 7, 144, 11), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append([STATIC, "Directories:", -1, (7, 20, 50, 9), CS]) + tmp.append( + [ + EDIT, + dp, + 102, + (52, 20, 128, 11), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append( + [ + BUTTON, + "...", + 110, + (182, 20, 16, 11), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append([STATIC, "Options:", -1, (7, 33, 50, 9), CS]) + tmp.append( + [ + EDIT, + fp, + 101, + (52, 33, 128, 11), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append( + [ + BUTTON, + "...", + 111, + (182, 33, 16, 11), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + # tmp.append([BUTTON,'Case sensitive', 104, (7, 45, 72, 9), CS | win32con.BS_AUTOCHECKBOX | win32con.BS_LEFTTEXT| win32con.WS_TABSTOP]) + # tmp.append([BUTTON,'Subdirectories', 105, (7, 56, 72, 9), CS | win32con.BS_AUTOCHECKBOX | win32con.BS_LEFTTEXT| win32con.WS_TABSTOP]) + # tmp.append([BUTTON,'Verbose', 106, (7, 67, 72, 9), CS | win32con.BS_AUTOCHECKBOX | win32con.BS_LEFTTEXT| win32con.WS_TABSTOP]) + tmp.append( + [ + BUTTON, + "OK", + win32con.IDOK, + (166, 53, 32, 12), + CS | win32con.BS_DEFPUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Cancel", + win32con.IDCANCEL, + (166, 67, 32, 12), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + dialog.Dialog.__init__(self, tmp) + self.AddDDX(101, "greppattern") + self.AddDDX(102, "dirpattern") + self.AddDDX(103, "filpattern") + # self.AddDDX(104,'casesensitive') + # self.AddDDX(105,'recursive') + # self.AddDDX(106,'verbose') + self._obj_.data["greppattern"] = gp + self._obj_.data["dirpattern"] = dp + self._obj_.data["filpattern"] = fp + # self._obj_.data['casesensitive'] = cs + # self._obj_.data['recursive'] = r + # self._obj_.data['verbose'] = v + self.HookCommand(self.OnMoreDirectories, 110) + self.HookCommand(self.OnMoreFiles, 111) + + def OnMoreDirectories(self, cmd, code): + self.getMore("Pychecker\\Directories", "dirpattern") + + def OnMoreFiles(self, cmd, code): + self.getMore("Pychecker\\File Types", "filpattern") + + def getMore(self, section, key): + self.UpdateData(1) + # get the items out of the ini file + ini = win32ui.GetProfileFileName() + secitems = win32api.GetProfileSection(section, ini) + items = [] + for secitem in secitems: + items.append(secitem.split("=")[1]) + dlg = TheParamsDialog(items) + if dlg.DoModal() == win32con.IDOK: + itemstr = ";".join(dlg.getItems()) + self._obj_.data[key] = itemstr + # update the ini file with dlg.getNew() + i = 0 + newitems = dlg.getNew() + if newitems: + items = items + newitems + for item in items: + win32api.WriteProfileVal(section, repr(i), item, ini) + i = i + 1 + self.UpdateData(0) + + def OnOK(self): + self.UpdateData(1) + for id, name in ( + (101, "greppattern"), + (102, "dirpattern"), + (103, "filpattern"), + ): + if not self[name]: + self.GetDlgItem(id).SetFocus() + win32api.MessageBeep() + win32ui.SetStatusText("Please enter a value") + return + self._obj_.OnOK() + + +class TheParamsDialog(dialog.Dialog): + def __init__(self, items): + self.items = items + self.newitems = [] + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + CS = win32con.WS_CHILD | win32con.WS_VISIBLE + tmp = [ + [ + "Pychecker Parameters", + (0, 0, 205, 100), + style, + None, + (8, "MS Sans Serif"), + ], + ] + tmp.append( + [ + LISTBOX, + "", + 107, + (7, 7, 150, 72), + CS + | win32con.LBS_MULTIPLESEL + | win32con.LBS_STANDARD + | win32con.LBS_HASSTRINGS + | win32con.WS_TABSTOP + | win32con.LBS_NOTIFY, + ] + ) + tmp.append( + [ + BUTTON, + "OK", + win32con.IDOK, + (167, 7, 32, 12), + CS | win32con.BS_DEFPUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Cancel", + win32con.IDCANCEL, + (167, 23, 32, 12), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append([STATIC, "New:", -1, (2, 83, 15, 12), CS]) + tmp.append( + [ + EDIT, + "", + 108, + (18, 83, 139, 12), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append( + [ + BUTTON, + "Add", + 109, + (167, 83, 32, 12), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + dialog.Dialog.__init__(self, tmp) + self.HookCommand(self.OnAddItem, 109) + self.HookCommand(self.OnListDoubleClick, 107) + + def OnInitDialog(self): + lb = self.GetDlgItem(107) + for item in self.items: + lb.AddString(item) + return self._obj_.OnInitDialog() + + def OnAddItem(self, cmd, code): + eb = self.GetDlgItem(108) + item = eb.GetLine(0) + self.newitems.append(item) + lb = self.GetDlgItem(107) + i = lb.AddString(item) + lb.SetSel(i, 1) + return 1 + + def OnListDoubleClick(self, cmd, code): + if code == win32con.LBN_DBLCLK: + self.OnOK() + return 1 + + def OnOK(self): + lb = self.GetDlgItem(107) + self.selections = lb.GetSelTextItems() + self._obj_.OnOK() + + def getItems(self): + return self.selections + + def getNew(self): + return self.newitems + + +try: + win32ui.GetApp().RemoveDocTemplate(greptemplate) +except NameError: + pass + +greptemplate = TheTemplate() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py new file mode 100644 index 0000000000000000000000000000000000000000..e5bc57c8ff90bcb235ddab50cc737f494fd46342 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py @@ -0,0 +1,688 @@ +""" +Various utilities for running/importing a script +""" +import bdb +import linecache +import os +import sys +import traceback + +import __main__ +import win32api +import win32con +import win32ui +from pywin.mfc import dialog +from pywin.mfc.docview import TreeView + +from .cmdline import ParseArgs + +RS_DEBUGGER_NONE = 0 # Dont run under the debugger. +RS_DEBUGGER_STEP = 1 # Start stepping under the debugger +RS_DEBUGGER_GO = 2 # Just run under the debugger, stopping only at break-points. +RS_DEBUGGER_PM = 3 # Dont run under debugger, but do post-mortem analysis on exception. + +debugging_options = """No debugging +Step-through in the debugger +Run in the debugger +Post-Mortem of unhandled exceptions""".split( + "\n" +) + +byte_cr = "\r".encode("ascii") +byte_lf = "\n".encode("ascii") +byte_crlf = "\r\n".encode("ascii") + + +# A dialog box for the "Run Script" command. +class DlgRunScript(dialog.Dialog): + "A class for the 'run script' dialog" + + def __init__(self, bHaveDebugger): + dialog.Dialog.__init__(self, win32ui.IDD_RUN_SCRIPT) + self.AddDDX(win32ui.IDC_EDIT1, "script") + self.AddDDX(win32ui.IDC_EDIT2, "args") + self.AddDDX(win32ui.IDC_COMBO1, "debuggingType", "i") + self.HookCommand(self.OnBrowse, win32ui.IDC_BUTTON2) + self.bHaveDebugger = bHaveDebugger + + def OnInitDialog(self): + rc = dialog.Dialog.OnInitDialog(self) + cbo = self.GetDlgItem(win32ui.IDC_COMBO1) + for o in debugging_options: + cbo.AddString(o) + cbo.SetCurSel(self["debuggingType"]) + if not self.bHaveDebugger: + cbo.EnableWindow(0) + + def OnBrowse(self, id, code): + if code != 0: # BN_CLICKED + return 1 + openFlags = win32con.OFN_OVERWRITEPROMPT | win32con.OFN_FILEMUSTEXIST + dlg = win32ui.CreateFileDialog( + 1, None, None, openFlags, "Python Scripts (*.py)|*.py||", self + ) + dlg.SetOFNTitle("Run Script") + if dlg.DoModal() != win32con.IDOK: + return 0 + self["script"] = dlg.GetPathName() + self.UpdateData(0) + return 0 + + +def GetDebugger(): + """Get the default Python debugger. Returns the debugger, or None. + + It is assumed the debugger has a standard "pdb" defined interface. + Currently always returns the 'pywin.debugger' debugger, or None + (pdb is _not_ returned as it is not effective in this GUI environment) + """ + try: + import pywin.debugger + + return pywin.debugger + except ImportError: + return None + + +def IsOnPythonPath(path): + "Given a path only, see if it is on the Pythonpath. Assumes path is a full path spec." + # must check that the command line arg's path is in sys.path + for syspath in sys.path: + try: + # Python 1.5 and later allows an empty sys.path entry. + if syspath and win32ui.FullPath(syspath) == path: + return 1 + except win32ui.error as details: + print( + "Warning: The sys.path entry '%s' is invalid\n%s" % (syspath, details) + ) + return 0 + + +def GetPackageModuleName(fileName): + """Given a filename, return (module name, new path). + eg - given "c:\a\b\c\my.py", return ("b.c.my",None) if "c:\a" is on sys.path. + If no package found, will return ("my", "c:\a\b\c") + """ + path, fname = os.path.split(fileName) + path = origPath = win32ui.FullPath(path) + fname = os.path.splitext(fname)[0] + modBits = [] + newPathReturn = None + if not IsOnPythonPath(path): + # Module not directly on the search path - see if under a package. + while len(path) > 3: # ie 'C:\' + path, modBit = os.path.split(path) + modBits.append(modBit) + # If on path, _and_ existing package of that name loaded. + if ( + IsOnPythonPath(path) + and modBit in sys.modules + and ( + os.path.exists(os.path.join(path, modBit, "__init__.py")) + or os.path.exists(os.path.join(path, modBit, "__init__.pyc")) + or os.path.exists(os.path.join(path, modBit, "__init__.pyo")) + ) + ): + modBits.reverse() + return ".".join(modBits) + "." + fname, newPathReturn + # Not found - look a level higher + else: + newPathReturn = origPath + + return fname, newPathReturn + + +def GetActiveView(): + """Gets the edit control (eg, EditView) with the focus, or None""" + try: + childFrame, bIsMaximised = win32ui.GetMainFrame().MDIGetActive() + return childFrame.GetActiveView() + except win32ui.error: + return None + + +def GetActiveEditControl(): + view = GetActiveView() + if view is None: + return None + if hasattr(view, "SCIAddText"): # Is it a scintilla control? + return view + try: + return view.GetRichEditCtrl() + except AttributeError: + pass + try: + return view.GetEditCtrl() + except AttributeError: + pass + + +def GetActiveEditorDocument(): + """Returns the active editor document and view, or (None,None) if no + active document or its not an editor document. + """ + view = GetActiveView() + if view is None or isinstance(view, TreeView): + return (None, None) + doc = view.GetDocument() + if hasattr(doc, "MarkerAdd"): # Is it an Editor document? + return doc, view + return (None, None) + + +def GetActiveFileName(bAutoSave=1): + """Gets the file name for the active frame, saving it if necessary. + + Returns None if it cant be found, or raises KeyboardInterrupt. + """ + pathName = None + active = GetActiveView() + if active is None: + return None + try: + doc = active.GetDocument() + pathName = doc.GetPathName() + + if bAutoSave and ( + len(pathName) > 0 + or doc.GetTitle()[:8] == "Untitled" + or doc.GetTitle()[:6] == "Script" + ): # if not a special purpose window + if doc.IsModified(): + try: + doc.OnSaveDocument(pathName) + pathName = doc.GetPathName() + + # clear the linecache buffer + linecache.clearcache() + + except win32ui.error: + raise KeyboardInterrupt + + except (win32ui.error, AttributeError): + pass + if not pathName: + return None + return pathName + + +lastScript = "" +lastArgs = "" +lastDebuggingType = RS_DEBUGGER_NONE + + +def RunScript(defName=None, defArgs=None, bShowDialog=1, debuggingType=None): + global lastScript, lastArgs, lastDebuggingType + _debugger_stop_frame_ = 1 # Magic variable so the debugger will hide me! + + # Get the debugger - may be None! + debugger = GetDebugger() + + if defName is None: + try: + pathName = GetActiveFileName() + except KeyboardInterrupt: + return # User cancelled save. + else: + pathName = defName + if not pathName: + pathName = lastScript + if defArgs is None: + args = "" + if pathName == lastScript: + args = lastArgs + else: + args = defArgs + if debuggingType is None: + debuggingType = lastDebuggingType + + if not pathName or bShowDialog: + dlg = DlgRunScript(debugger is not None) + dlg["script"] = pathName + dlg["args"] = args + dlg["debuggingType"] = debuggingType + if dlg.DoModal() != win32con.IDOK: + return + script = dlg["script"] + args = dlg["args"] + debuggingType = dlg["debuggingType"] + if not script: + return + if debuggingType == RS_DEBUGGER_GO and debugger is not None: + # This may surprise users - they select "Run under debugger", but + # it appears not to! Only warn when they pick from the dialog! + # First - ensure the debugger is activated to pickup any break-points + # set in the editor. + try: + # Create the debugger, but _dont_ init the debugger GUI. + rd = debugger._GetCurrentDebugger() + except AttributeError: + rd = None + if rd is not None and len(rd.breaks) == 0: + msg = "There are no active break-points.\r\n\r\nSelecting this debug option without any\r\nbreak-points is unlikely to have the desired effect\r\nas the debugger is unlikely to be invoked..\r\n\r\nWould you like to step-through in the debugger instead?" + rc = win32ui.MessageBox( + msg, + win32ui.LoadString(win32ui.IDR_DEBUGGER), + win32con.MB_YESNOCANCEL | win32con.MB_ICONINFORMATION, + ) + if rc == win32con.IDCANCEL: + return + if rc == win32con.IDYES: + debuggingType = RS_DEBUGGER_STEP + + lastDebuggingType = debuggingType + lastScript = script + lastArgs = args + else: + script = pathName + + # try and open the script. + if ( + len(os.path.splitext(script)[1]) == 0 + ): # check if no extension supplied, and give one. + script = script + ".py" + # If no path specified, try and locate the file + path, fnameonly = os.path.split(script) + if len(path) == 0: + try: + os.stat(fnameonly) # See if it is OK as is... + script = fnameonly + except os.error: + fullScript = LocatePythonFile(script) + if fullScript is None: + win32ui.MessageBox("The file '%s' can not be located" % script) + return + script = fullScript + else: + path = win32ui.FullPath(path) + if not IsOnPythonPath(path): + sys.path.append(path) + + # py3k fun: If we use text mode to open the file, we get \r\n + # translated so Python allows the syntax (good!), but we get back + # text already decoded from the default encoding (bad!) and Python + # ignores any encoding decls (bad!). If we use binary mode we get + # the raw bytes and Python looks at the encoding (good!) but \r\n + # chars stay in place so Python throws a syntax error (bad!). + # So: so the binary thing and manually normalize \r\n. + try: + f = open(script, "rb") + except IOError as exc: + win32ui.MessageBox( + "The file could not be opened - %s (%d)" % (exc.strerror, exc.errno) + ) + return + + # Get the source-code - as above, normalize \r\n + code = f.read().replace(byte_crlf, byte_lf).replace(byte_cr, byte_lf) + byte_lf + + # Remember and hack sys.argv for the script. + oldArgv = sys.argv + sys.argv = ParseArgs(args) + sys.argv.insert(0, script) + # sys.path[0] is the path of the script + oldPath0 = sys.path[0] + newPath0 = os.path.split(script)[0] + if not oldPath0: # if sys.path[0] is empty + sys.path[0] = newPath0 + insertedPath0 = 0 + else: + sys.path.insert(0, newPath0) + insertedPath0 = 1 + bWorked = 0 + win32ui.DoWaitCursor(1) + base = os.path.split(script)[1] + # Allow windows to repaint before starting. + win32ui.PumpWaitingMessages() + win32ui.SetStatusText("Running script %s..." % base, 1) + exitCode = 0 + from pywin.framework import interact + + # Check the debugger flags + if debugger is None and (debuggingType != RS_DEBUGGER_NONE): + win32ui.MessageBox( + "No debugger is installed. Debugging options have been ignored!" + ) + debuggingType = RS_DEBUGGER_NONE + + # Get a code object - ignore the debugger for this, as it is probably a syntax error + # at this point + try: + codeObject = compile(code, script, "exec") + except: + # Almost certainly a syntax error! + _HandlePythonFailure("run script", script) + # No code object which to run/debug. + return + __main__.__file__ = script + try: + if debuggingType == RS_DEBUGGER_STEP: + debugger.run(codeObject, __main__.__dict__, start_stepping=1) + elif debuggingType == RS_DEBUGGER_GO: + debugger.run(codeObject, __main__.__dict__, start_stepping=0) + else: + # Post mortem or no debugging + exec(codeObject, __main__.__dict__) + bWorked = 1 + except bdb.BdbQuit: + # Dont print tracebacks when the debugger quit, but do print a message. + print("Debugging session cancelled.") + exitCode = 1 + bWorked = 1 + except SystemExit as code: + exitCode = code + bWorked = 1 + except KeyboardInterrupt: + # Consider this successful, as we dont want the debugger. + # (but we do want a traceback!) + if interact.edit and interact.edit.currentView: + interact.edit.currentView.EnsureNoPrompt() + traceback.print_exc() + if interact.edit and interact.edit.currentView: + interact.edit.currentView.AppendToPrompt([]) + bWorked = 1 + except: + if interact.edit and interact.edit.currentView: + interact.edit.currentView.EnsureNoPrompt() + traceback.print_exc() + if interact.edit and interact.edit.currentView: + interact.edit.currentView.AppendToPrompt([]) + if debuggingType == RS_DEBUGGER_PM: + debugger.pm() + del __main__.__file__ + sys.argv = oldArgv + if insertedPath0: + del sys.path[0] + else: + sys.path[0] = oldPath0 + f.close() + if bWorked: + win32ui.SetStatusText("Script '%s' returned exit code %s" % (script, exitCode)) + else: + win32ui.SetStatusText("Exception raised while running script %s" % base) + try: + sys.stdout.flush() + except AttributeError: + pass + + win32ui.DoWaitCursor(0) + + +def ImportFile(): + """This code looks for the current window, and determines if it can be imported. If not, + it will prompt for a file name, and allow it to be imported.""" + try: + pathName = GetActiveFileName() + except KeyboardInterrupt: + pathName = None + + if pathName is not None: + if os.path.splitext(pathName)[1].lower() not in (".py", ".pyw", ".pyx"): + pathName = None + + if pathName is None: + openFlags = win32con.OFN_OVERWRITEPROMPT | win32con.OFN_FILEMUSTEXIST + dlg = win32ui.CreateFileDialog( + 1, None, None, openFlags, "Python Scripts (*.py;*.pyw)|*.py;*.pyw;*.pyx||" + ) + dlg.SetOFNTitle("Import Script") + if dlg.DoModal() != win32con.IDOK: + return 0 + + pathName = dlg.GetPathName() + + # If already imported, dont look for package + path, modName = os.path.split(pathName) + modName, modExt = os.path.splitext(modName) + newPath = None + # note that some packages (*cough* email *cough*) use "lazy importers" + # meaning sys.modules can change as a side-effect of looking at + # module.__file__ - so we must take a copy (ie, items() in py2k, + # list(items()) in py3k) + for key, mod in list(sys.modules.items()): + if getattr(mod, "__file__", None): + fname = mod.__file__ + base, ext = os.path.splitext(fname) + if ext.lower() in (".pyo", ".pyc"): + ext = ".py" + fname = base + ext + if win32ui.ComparePath(fname, pathName): + modName = key + break + else: # for not broken + modName, newPath = GetPackageModuleName(pathName) + if newPath: + sys.path.append(newPath) + + if modName in sys.modules: + bNeedReload = 1 + what = "reload" + else: + what = "import" + bNeedReload = 0 + + win32ui.SetStatusText(what.capitalize() + "ing module...", 1) + win32ui.DoWaitCursor(1) + # win32ui.GetMainFrame().BeginWaitCursor() + + try: + # always do an import, as it is cheap if it's already loaded. This ensures + # it is in our name space. + codeObj = compile("import " + modName, "", "exec") + except SyntaxError: + win32ui.SetStatusText('Invalid filename for import: "' + modName + '"') + return + try: + exec(codeObj, __main__.__dict__) + mod = sys.modules.get(modName) + if bNeedReload: + from importlib import reload + + mod = reload(sys.modules[modName]) + win32ui.SetStatusText( + "Successfully " + + what + + "ed module '" + + modName + + "': %s" % getattr(mod, "__file__", "") + ) + except: + _HandlePythonFailure(what) + win32ui.DoWaitCursor(0) + + +def CheckFile(): + """This code looks for the current window, and gets Python to check it + without actually executing any code (ie, by compiling only) + """ + try: + pathName = GetActiveFileName() + except KeyboardInterrupt: + return + + what = "check" + win32ui.SetStatusText(what.capitalize() + "ing module...", 1) + win32ui.DoWaitCursor(1) + try: + f = open(pathName) + except IOError as details: + print("Cant open file '%s' - %s" % (pathName, details)) + return + try: + code = f.read() + "\n" + finally: + f.close() + try: + codeObj = compile(code, pathName, "exec") + if RunTabNanny(pathName): + win32ui.SetStatusText( + "Python and the TabNanny successfully checked the file '" + + os.path.basename(pathName) + + "'" + ) + except SyntaxError: + _HandlePythonFailure(what, pathName) + except: + traceback.print_exc() + _HandlePythonFailure(what) + win32ui.DoWaitCursor(0) + + +def RunTabNanny(filename): + import io as io + + tabnanny = FindTabNanny() + if tabnanny is None: + win32ui.MessageBox("The TabNanny is not around, so the children can run amok!") + return + + # Capture the tab-nanny output + newout = io.StringIO() + old_out = sys.stderr, sys.stdout + sys.stderr = sys.stdout = newout + try: + tabnanny.check(filename) + finally: + # Restore output + sys.stderr, sys.stdout = old_out + data = newout.getvalue() + if data: + try: + lineno = data.split()[1] + lineno = int(lineno) + _JumpToPosition(filename, lineno) + try: # Try and display whitespace + GetActiveEditControl().SCISetViewWS(1) + except: + pass + win32ui.SetStatusText("The TabNanny found trouble at line %d" % lineno) + except (IndexError, TypeError, ValueError): + print("The tab nanny complained, but I cant see where!") + print(data) + return 0 + return 1 + + +def _JumpToPosition(fileName, lineno, col=1): + JumpToDocument(fileName, lineno, col) + + +def JumpToDocument(fileName, lineno=0, col=1, nChars=0, bScrollToTop=0): + # Jump to the position in a file. + # If lineno is <= 0, dont move the position - just open/restore. + # if nChars > 0, select that many characters. + # if bScrollToTop, the specified line will be moved to the top of the window + # (eg, bScrollToTop should be false when jumping to an error line to retain the + # context, but true when jumping to a method defn, where we want the full body. + # Return the view which is editing the file, or None on error. + doc = win32ui.GetApp().OpenDocumentFile(fileName) + if doc is None: + return None + frame = doc.GetFirstView().GetParentFrame() + try: + view = frame.GetEditorView() + if frame.GetActiveView() != view: + frame.SetActiveView(view) + frame.AutoRestore() + except AttributeError: # Not an editor frame?? + view = doc.GetFirstView() + if lineno > 0: + charNo = view.LineIndex(lineno - 1) + start = charNo + col - 1 + size = view.GetTextLength() + try: + view.EnsureCharsVisible(charNo) + except AttributeError: + print("Doesnt appear to be one of our views?") + view.SetSel(min(start, size), min(start + nChars, size)) + if bScrollToTop: + curTop = view.GetFirstVisibleLine() + nScroll = (lineno - 1) - curTop + view.LineScroll(nScroll, 0) + view.SetFocus() + return view + + +def _HandlePythonFailure(what, syntaxErrorPathName=None): + typ, details, tb = sys.exc_info() + if isinstance(details, SyntaxError): + try: + msg, (fileName, line, col, text) = details + if (not fileName or fileName == "") and syntaxErrorPathName: + fileName = syntaxErrorPathName + _JumpToPosition(fileName, line, col) + except (TypeError, ValueError): + msg = str(details) + win32ui.SetStatusText("Failed to " + what + " - syntax error - %s" % msg) + else: + traceback.print_exc() + win32ui.SetStatusText("Failed to " + what + " - " + str(details)) + tb = None # Clean up a cycle. + + +# Find the Python TabNanny in either the standard library or the Python Tools/Scripts directory. +def FindTabNanny(): + try: + return __import__("tabnanny") + except ImportError: + pass + # OK - not in the standard library - go looking. + filename = "tabnanny.py" + try: + path = win32api.RegQueryValue( + win32con.HKEY_LOCAL_MACHINE, + "SOFTWARE\\Python\\PythonCore\\%s\\InstallPath" % (sys.winver), + ) + except win32api.error: + print("WARNING - The Python registry does not have an 'InstallPath' setting") + print(" The file '%s' can not be located" % (filename)) + return None + fname = os.path.join(path, "Tools\\Scripts\\%s" % filename) + try: + os.stat(fname) + except os.error: + print( + "WARNING - The file '%s' can not be located in path '%s'" % (filename, path) + ) + return None + + tabnannyhome, tabnannybase = os.path.split(fname) + tabnannybase = os.path.splitext(tabnannybase)[0] + # Put tab nanny at the top of the path. + sys.path.insert(0, tabnannyhome) + try: + return __import__(tabnannybase) + finally: + # remove the tab-nanny from the path + del sys.path[0] + + +def LocatePythonFile(fileName, bBrowseIfDir=1): + "Given a file name, return a fully qualified file name, or None" + # first look for the exact file as specified + if not os.path.isfile(fileName): + # Go looking! + baseName = fileName + for path in sys.path: + fileName = os.path.abspath(os.path.join(path, baseName)) + if os.path.isdir(fileName): + if bBrowseIfDir: + d = win32ui.CreateFileDialog( + 1, "*.py", None, 0, "Python Files (*.py)|*.py|All files|*.*" + ) + d.SetOFNInitialDir(fileName) + rc = d.DoModal() + if rc == win32con.IDOK: + fileName = d.GetPathName() + break + else: + return None + else: + fileName = fileName + ".py" + if os.path.isfile(fileName): + break # Found it! + + else: # for not broken out of + return None + return win32ui.FullPath(fileName) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/sgrepmdi.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/sgrepmdi.py new file mode 100644 index 0000000000000000000000000000000000000000..b7d938bbb3e463959b97e48d6238259f0be82160 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/sgrepmdi.py @@ -0,0 +1,758 @@ +# SGrepMDI is by Gordon McMillan (gmcm@hypernet.com) +# It does basically what Find In Files does in MSVC with a couple enhancements. +# - It saves any directories in the app's ini file (if you want to get rid +# of them you'll have to edit the file) +# - "Directories" can be directories, +# - semicolon separated lists of "directories", +# - environment variables that evaluate to "directories", +# - registry path names that evaluate to "directories", +# - all of which is recursive, so you can mix them all up. +# - It is MDI, so you can 'nest' greps and return to earlier ones, +# (ie, have multiple results open at the same time) +# - Like FIF, double clicking a line opens an editor and takes you to the line. +# - You can highlight text, right click and start a new grep with the selected +# text as search pattern and same directories etc as before. +# - You can save grep parameters (so you don't lose your hardearned pattern) +# from File|Save +# - You can save grep results by right clicking in the result window. +# Hats off to Mark Hammond for providing an environment where I could cobble +# something like this together in a couple evenings! + +import glob +import os +import re + +import win32api +import win32con +import win32ui +from pywin.mfc import dialog, docview, window + +from . import scriptutils + + +def getsubdirs(d): + dlist = [] + flist = glob.glob(d + "\\*") + for f in flist: + if os.path.isdir(f): + dlist.append(f) + dlist = dlist + getsubdirs(f) + return dlist + + +class dirpath: + def __init__(self, str, recurse=0): + dp = str.split(";") + dirs = {} + for d in dp: + if os.path.isdir(d): + d = d.lower() + if d not in dirs: + dirs[d] = None + if recurse: + subdirs = getsubdirs(d) + for sd in subdirs: + sd = sd.lower() + if sd not in dirs: + dirs[sd] = None + elif os.path.isfile(d): + pass + else: + x = None + if d in os.environ: + x = dirpath(os.environ[d]) + elif d[:5] == "HKEY_": + keystr = d.split("\\") + try: + root = eval("win32con." + keystr[0]) + except: + win32ui.MessageBox( + "Can't interpret registry key name '%s'" % keystr[0] + ) + try: + subkey = "\\".join(keystr[1:]) + val = win32api.RegQueryValue(root, subkey) + if val: + x = dirpath(val) + else: + win32ui.MessageBox( + "Registry path '%s' did not return a path entry" % d + ) + except: + win32ui.MessageBox( + "Can't interpret registry key value: %s" % keystr[1:] + ) + else: + win32ui.MessageBox("Directory '%s' not found" % d) + if x: + for xd in x: + if xd not in dirs: + dirs[xd] = None + if recurse: + subdirs = getsubdirs(xd) + for sd in subdirs: + sd = sd.lower() + if sd not in dirs: + dirs[sd] = None + self.dirs = [] + for d in list(dirs.keys()): + self.dirs.append(d) + + def __getitem__(self, key): + return self.dirs[key] + + def __len__(self): + return len(self.dirs) + + def __setitem__(self, key, value): + self.dirs[key] = value + + def __delitem__(self, key): + del self.dirs[key] + + def __getslice__(self, lo, hi): + return self.dirs[lo:hi] + + def __setslice__(self, lo, hi, seq): + self.dirs[lo:hi] = seq + + def __delslice__(self, lo, hi): + del self.dirs[lo:hi] + + def __add__(self, other): + if type(other) == type(self) or type(other) == type([]): + return self.dirs + other.dirs + + def __radd__(self, other): + if type(other) == type(self) or type(other) == type([]): + return other.dirs + self.dirs + + +# Group(1) is the filename, group(2) is the lineno. +# regexGrepResult=regex.compile("^\\([a-zA-Z]:.*\\)(\\([0-9]+\\))") + +regexGrep = re.compile(r"^([a-zA-Z]:[^(]*)\(([0-9]+)\)") + +# these are the atom numbers defined by Windows for basic dialog controls + +BUTTON = 0x80 +EDIT = 0x81 +STATIC = 0x82 +LISTBOX = 0x83 +SCROLLBAR = 0x84 +COMBOBOX = 0x85 + + +class GrepTemplate(docview.RichEditDocTemplate): + def __init__(self): + docview.RichEditDocTemplate.__init__( + self, win32ui.IDR_TEXTTYPE, GrepDocument, GrepFrame, GrepView + ) + self.SetDocStrings("\nGrep\nGrep\nGrep params (*.grep)\n.grep\n\n\n") + win32ui.GetApp().AddDocTemplate(self) + self.docparams = None + + def MatchDocType(self, fileName, fileType): + doc = self.FindOpenDocument(fileName) + if doc: + return doc + ext = os.path.splitext(fileName)[1].lower() + if ext == ".grep": + return win32ui.CDocTemplate_Confidence_yesAttemptNative + return win32ui.CDocTemplate_Confidence_noAttempt + + def setParams(self, params): + self.docparams = params + + def readParams(self): + tmp = self.docparams + self.docparams = None + return tmp + + +class GrepFrame(window.MDIChildWnd): + # The template and doc params will one day be removed. + def __init__(self, wnd=None): + window.MDIChildWnd.__init__(self, wnd) + + +class GrepDocument(docview.RichEditDoc): + def __init__(self, template): + docview.RichEditDoc.__init__(self, template) + self.dirpattern = "" + self.filpattern = "" + self.greppattern = "" + self.casesensitive = 1 + self.recurse = 1 + self.verbose = 0 + + def OnOpenDocument(self, fnm): + # this bizarre stuff with params is so right clicking in a result window + # and starting a new grep can communicate the default parameters to the + # new grep. + try: + params = open(fnm, "r").read() + except: + params = None + self.setInitParams(params) + return self.OnNewDocument() + + def OnCloseDocument(self): + try: + win32ui.GetApp().DeleteIdleHandler(self.SearchFile) + except: + pass + return self._obj_.OnCloseDocument() + + def saveInitParams(self): + # Only save the flags, not the text boxes. + paramstr = "\t%s\t\t%d\t%d" % ( + self.filpattern, + self.casesensitive, + self.recurse, + ) + win32ui.WriteProfileVal("Grep", "Params", paramstr) + + def setInitParams(self, paramstr): + if paramstr is None: + paramstr = win32ui.GetProfileVal("Grep", "Params", "\t\t\t1\t0\t0") + params = paramstr.split("\t") + if len(params) < 3: + params = params + [""] * (3 - len(params)) + if len(params) < 6: + params = params + [0] * (6 - len(params)) + self.dirpattern = params[0] + self.filpattern = params[1] + self.greppattern = params[2] + self.casesensitive = int(params[3]) + self.recurse = int(params[4]) + self.verbose = int(params[5]) + # setup some reasonable defaults. + if not self.dirpattern: + try: + editor = win32ui.GetMainFrame().MDIGetActive()[0].GetEditorView() + self.dirpattern = os.path.abspath( + os.path.dirname(editor.GetDocument().GetPathName()) + ) + except (AttributeError, win32ui.error): + self.dirpattern = os.getcwd() + if not self.filpattern: + self.filpattern = "*.py" + + def OnNewDocument(self): + if self.dirpattern == "": + self.setInitParams(greptemplate.readParams()) + d = GrepDialog( + self.dirpattern, + self.filpattern, + self.greppattern, + self.casesensitive, + self.recurse, + self.verbose, + ) + if d.DoModal() == win32con.IDOK: + self.dirpattern = d["dirpattern"] + self.filpattern = d["filpattern"] + self.greppattern = d["greppattern"] + self.casesensitive = d["casesensitive"] + self.recurse = d["recursive"] + self.verbose = d["verbose"] + self.doSearch() + self.saveInitParams() + return 1 + return 0 # cancelled - return zero to stop frame creation. + + def doSearch(self): + self.dp = dirpath(self.dirpattern, self.recurse) + self.SetTitle("Grep for %s in %s" % (self.greppattern, self.filpattern)) + # self.text = [] + self.GetFirstView().Append("#Search " + self.dirpattern + "\n") + if self.verbose: + self.GetFirstView().Append("# =" + repr(self.dp.dirs) + "\n") + self.GetFirstView().Append("# Files " + self.filpattern + "\n") + self.GetFirstView().Append("# For " + self.greppattern + "\n") + self.fplist = self.filpattern.split(";") + if self.casesensitive: + self.pat = re.compile(self.greppattern) + else: + self.pat = re.compile(self.greppattern, re.IGNORECASE) + win32ui.SetStatusText("Searching. Please wait...", 0) + self.dpndx = self.fpndx = 0 + self.fndx = -1 + if not self.dp: + self.GetFirstView().Append( + "# ERROR: '%s' does not resolve to any search locations" + % self.dirpattern + ) + self.SetModifiedFlag(0) + else: + self.flist = glob.glob(self.dp[0] + "\\" + self.fplist[0]) + win32ui.GetApp().AddIdleHandler(self.SearchFile) + + def SearchFile(self, handler, count): + self.fndx = self.fndx + 1 + if self.fndx < len(self.flist): + f = self.flist[self.fndx] + if self.verbose: + self.GetFirstView().Append("# .." + f + "\n") + # Directories may match the file type pattern, and files may be removed + # while grep is running + if os.path.isfile(f): + win32ui.SetStatusText("Searching " + f, 0) + lines = open(f, "r").readlines() + for i in range(len(lines)): + line = lines[i] + if self.pat.search(line) != None: + self.GetFirstView().Append(f + "(" + repr(i + 1) + ") " + line) + else: + self.fndx = -1 + self.fpndx = self.fpndx + 1 + if self.fpndx < len(self.fplist): + self.flist = glob.glob( + self.dp[self.dpndx] + "\\" + self.fplist[self.fpndx] + ) + else: + self.fpndx = 0 + self.dpndx = self.dpndx + 1 + if self.dpndx < len(self.dp): + self.flist = glob.glob( + self.dp[self.dpndx] + "\\" + self.fplist[self.fpndx] + ) + else: + win32ui.SetStatusText("Search complete.", 0) + self.SetModifiedFlag(0) # default to not modified. + try: + win32ui.GetApp().DeleteIdleHandler(self.SearchFile) + except: + pass + return 0 + return 1 + + def GetParams(self): + return ( + self.dirpattern + + "\t" + + self.filpattern + + "\t" + + self.greppattern + + "\t" + + repr(self.casesensitive) + + "\t" + + repr(self.recurse) + + "\t" + + repr(self.verbose) + ) + + def OnSaveDocument(self, filename): + # print 'OnSaveDocument() filename=',filename + savefile = open(filename, "wb") + txt = self.GetParams() + "\n" + # print 'writing',txt + savefile.write(txt) + savefile.close() + self.SetModifiedFlag(0) + return 1 + + +ID_OPEN_FILE = 0xE400 +ID_GREP = 0xE401 +ID_SAVERESULTS = 0x402 +ID_TRYAGAIN = 0x403 + + +class GrepView(docview.RichEditView): + def __init__(self, doc): + docview.RichEditView.__init__(self, doc) + self.SetWordWrap(win32ui.CRichEditView_WrapNone) + self.HookHandlers() + + def OnInitialUpdate(self): + rc = self._obj_.OnInitialUpdate() + format = (-402653169, 0, 200, 0, 0, 0, 49, "Courier New") + self.SetDefaultCharFormat(format) + return rc + + def HookHandlers(self): + self.HookMessage(self.OnRClick, win32con.WM_RBUTTONDOWN) + self.HookCommand(self.OnCmdOpenFile, ID_OPEN_FILE) + self.HookCommand(self.OnCmdGrep, ID_GREP) + self.HookCommand(self.OnCmdSave, ID_SAVERESULTS) + self.HookCommand(self.OnTryAgain, ID_TRYAGAIN) + self.HookMessage(self.OnLDblClick, win32con.WM_LBUTTONDBLCLK) + + def OnLDblClick(self, params): + line = self.GetLine() + regexGrepResult = regexGrep.match(line) + if regexGrepResult: + fname = regexGrepResult.group(1) + line = int(regexGrepResult.group(2)) + scriptutils.JumpToDocument(fname, line) + return 0 # dont pass on + return 1 # pass it on by default. + + def OnRClick(self, params): + menu = win32ui.CreatePopupMenu() + flags = win32con.MF_STRING | win32con.MF_ENABLED + lineno = self._obj_.LineFromChar(-1) # selection or current line + line = self._obj_.GetLine(lineno) + regexGrepResult = regexGrep.match(line) + if regexGrepResult: + self.fnm = regexGrepResult.group(1) + self.lnnum = int(regexGrepResult.group(2)) + menu.AppendMenu(flags, ID_OPEN_FILE, "&Open " + self.fnm) + menu.AppendMenu(win32con.MF_SEPARATOR) + menu.AppendMenu(flags, ID_TRYAGAIN, "&Try Again") + charstart, charend = self._obj_.GetSel() + if charstart != charend: + linestart = self._obj_.LineIndex(lineno) + self.sel = line[charstart - linestart : charend - linestart] + menu.AppendMenu(flags, ID_GREP, "&Grep for " + self.sel) + menu.AppendMenu(win32con.MF_SEPARATOR) + menu.AppendMenu(flags, win32ui.ID_EDIT_CUT, "Cu&t") + menu.AppendMenu(flags, win32ui.ID_EDIT_COPY, "&Copy") + menu.AppendMenu(flags, win32ui.ID_EDIT_PASTE, "&Paste") + menu.AppendMenu(flags, win32con.MF_SEPARATOR) + menu.AppendMenu(flags, win32ui.ID_EDIT_SELECT_ALL, "&Select all") + menu.AppendMenu(flags, win32con.MF_SEPARATOR) + menu.AppendMenu(flags, ID_SAVERESULTS, "Sa&ve results") + menu.TrackPopupMenu(params[5]) + return 0 + + def OnCmdOpenFile(self, cmd, code): + doc = win32ui.GetApp().OpenDocumentFile(self.fnm) + if doc: + vw = doc.GetFirstView() + # hope you have an editor that implements GotoLine()! + try: + vw.GotoLine(int(self.lnnum)) + except: + pass + return 0 + + def OnCmdGrep(self, cmd, code): + if code != 0: + return 1 + curparamsstr = self.GetDocument().GetParams() + params = curparamsstr.split("\t") + params[2] = self.sel + greptemplate.setParams("\t".join(params)) + greptemplate.OpenDocumentFile() + return 0 + + def OnTryAgain(self, cmd, code): + if code != 0: + return 1 + greptemplate.setParams(self.GetDocument().GetParams()) + greptemplate.OpenDocumentFile() + return 0 + + def OnCmdSave(self, cmd, code): + if code != 0: + return 1 + flags = win32con.OFN_OVERWRITEPROMPT + dlg = win32ui.CreateFileDialog( + 0, None, None, flags, "Text Files (*.txt)|*.txt||", self + ) + dlg.SetOFNTitle("Save Results As") + if dlg.DoModal() == win32con.IDOK: + pn = dlg.GetPathName() + self._obj_.SaveTextFile(pn) + return 0 + + def Append(self, strng): + numlines = self.GetLineCount() + endpos = self.LineIndex(numlines - 1) + len(self.GetLine(numlines - 1)) + self.SetSel(endpos, endpos) + self.ReplaceSel(strng) + + +class GrepDialog(dialog.Dialog): + def __init__(self, dp, fp, gp, cs, r, v): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + CS = win32con.WS_CHILD | win32con.WS_VISIBLE + tmp = [ + ["Grep", (0, 0, 210, 90), style, None, (8, "MS Sans Serif")], + ] + tmp.append([STATIC, "Grep For:", -1, (7, 7, 50, 9), CS]) + tmp.append( + [ + EDIT, + gp, + 101, + (52, 7, 144, 11), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append([STATIC, "Directories:", -1, (7, 20, 50, 9), CS]) + tmp.append( + [ + EDIT, + dp, + 102, + (52, 20, 128, 11), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append( + [ + BUTTON, + "...", + 110, + (182, 20, 16, 11), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append([STATIC, "File types:", -1, (7, 33, 50, 9), CS]) + tmp.append( + [ + EDIT, + fp, + 103, + (52, 33, 128, 11), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append( + [ + BUTTON, + "...", + 111, + (182, 33, 16, 11), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Case sensitive", + 104, + (7, 45, 72, 9), + CS + | win32con.BS_AUTOCHECKBOX + | win32con.BS_LEFTTEXT + | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Subdirectories", + 105, + (7, 56, 72, 9), + CS + | win32con.BS_AUTOCHECKBOX + | win32con.BS_LEFTTEXT + | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Verbose", + 106, + (7, 67, 72, 9), + CS + | win32con.BS_AUTOCHECKBOX + | win32con.BS_LEFTTEXT + | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "OK", + win32con.IDOK, + (166, 53, 32, 12), + CS | win32con.BS_DEFPUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Cancel", + win32con.IDCANCEL, + (166, 67, 32, 12), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + dialog.Dialog.__init__(self, tmp) + self.AddDDX(101, "greppattern") + self.AddDDX(102, "dirpattern") + self.AddDDX(103, "filpattern") + self.AddDDX(104, "casesensitive") + self.AddDDX(105, "recursive") + self.AddDDX(106, "verbose") + self._obj_.data["greppattern"] = gp + self._obj_.data["dirpattern"] = dp + self._obj_.data["filpattern"] = fp + self._obj_.data["casesensitive"] = cs + self._obj_.data["recursive"] = r + self._obj_.data["verbose"] = v + self.HookCommand(self.OnMoreDirectories, 110) + self.HookCommand(self.OnMoreFiles, 111) + + def OnMoreDirectories(self, cmd, code): + if code != 0: + return 1 + self.getMore("Grep\\Directories", "dirpattern") + + def OnMoreFiles(self, cmd, code): + if code != 0: + return 1 + self.getMore("Grep\\File Types", "filpattern") + + def getMore(self, section, key): + self.UpdateData(1) + # get the items out of the ini file + ini = win32ui.GetProfileFileName() + secitems = win32api.GetProfileSection(section, ini) + items = [] + for secitem in secitems: + items.append(secitem.split("=")[1]) + dlg = GrepParamsDialog(items) + if dlg.DoModal() == win32con.IDOK: + itemstr = ";".join(dlg.getItems()) + self._obj_.data[key] = itemstr + # update the ini file with dlg.getNew() + i = 0 + newitems = dlg.getNew() + if newitems: + items = items + newitems + for item in items: + win32api.WriteProfileVal(section, repr(i), item, ini) + i = i + 1 + self.UpdateData(0) + + def OnOK(self): + self.UpdateData(1) + for id, name in ( + (101, "greppattern"), + (102, "dirpattern"), + (103, "filpattern"), + ): + if not self[name]: + self.GetDlgItem(id).SetFocus() + win32api.MessageBeep() + win32ui.SetStatusText("Please enter a value") + return + self._obj_.OnOK() + + +class GrepParamsDialog(dialog.Dialog): + def __init__(self, items): + self.items = items + self.newitems = [] + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + CS = win32con.WS_CHILD | win32con.WS_VISIBLE + tmp = [ + ["Grep Parameters", (0, 0, 205, 100), style, None, (8, "MS Sans Serif")], + ] + tmp.append( + [ + LISTBOX, + "", + 107, + (7, 7, 150, 72), + CS + | win32con.LBS_MULTIPLESEL + | win32con.LBS_STANDARD + | win32con.LBS_HASSTRINGS + | win32con.WS_TABSTOP + | win32con.LBS_NOTIFY, + ] + ) + tmp.append( + [ + BUTTON, + "OK", + win32con.IDOK, + (167, 7, 32, 12), + CS | win32con.BS_DEFPUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append( + [ + BUTTON, + "Cancel", + win32con.IDCANCEL, + (167, 23, 32, 12), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + tmp.append([STATIC, "New:", -1, (2, 83, 15, 12), CS]) + tmp.append( + [ + EDIT, + "", + 108, + (18, 83, 139, 12), + CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER, + ] + ) + tmp.append( + [ + BUTTON, + "Add", + 109, + (167, 83, 32, 12), + CS | win32con.BS_PUSHBUTTON | win32con.WS_TABSTOP, + ] + ) + dialog.Dialog.__init__(self, tmp) + self.HookCommand(self.OnAddItem, 109) + self.HookCommand(self.OnListDoubleClick, 107) + + def OnInitDialog(self): + lb = self.GetDlgItem(107) + for item in self.items: + lb.AddString(item) + return self._obj_.OnInitDialog() + + def OnAddItem(self, cmd, code): + if code != 0: + return 1 + eb = self.GetDlgItem(108) + item = eb.GetLine(0) + self.newitems.append(item) + lb = self.GetDlgItem(107) + i = lb.AddString(item) + lb.SetSel(i, 1) + return 1 + + def OnListDoubleClick(self, cmd, code): + if code == win32con.LBN_DBLCLK: + self.OnOK() + return 1 + + def OnOK(self): + lb = self.GetDlgItem(107) + self.selections = lb.GetSelTextItems() + self._obj_.OnOK() + + def getItems(self): + return self.selections + + def getNew(self): + return self.newitems + + +try: + win32ui.GetApp().RemoveDocTemplate(greptemplate) +except NameError: + pass + +greptemplate = GrepTemplate() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/startup.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/startup.py new file mode 100644 index 0000000000000000000000000000000000000000..4a7323225d7b3cbae8ee88a3e803da509b6f1f55 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/startup.py @@ -0,0 +1,80 @@ +# startup.py +# +"The main application startup code for PythonWin." + +# +# This does the basic command line handling. + +# Keep this as short as possible, cos error output is only redirected if +# this runs OK. Errors in imported modules are much better - the messages go somewhere (not any more :-) + +import os +import sys + +import win32api +import win32ui + +if not sys.argv: + # Initialize sys.argv from commandline. When sys.argv is empty list ( + # different from [''] meaning "no cmd line arguments" ), then C + # bootstrapping or another method of invocation failed to initialize + # sys.argv and it will be done here. ( This was a workaround for a bug in + # win32ui but is retained for other situations. ) + argv = win32api.CommandLineToArgv(win32api.GetCommandLine()) + sys.argv = argv[1:] + if os.getcwd() not in sys.path and "." not in sys.path: + sys.path.insert(0, os.getcwd()) + +# You may wish to redirect error output somewhere useful if you have startup errors. +# eg, 'import win32traceutil' will do this for you. +# import win32traceutil # Just uncomment this line to see error output! + +# An old class I used to use - generally only useful if Pythonwin is running under MSVC +# class DebugOutput: +# softspace=1 +# def write(self,message): +# win32ui.OutputDebug(message) +# sys.stderr=sys.stdout=DebugOutput() + +# To fix a problem with Pythonwin when started from the Pythonwin directory, +# we update the pywin path to ensure it is absolute. +# If it is indeed relative, it will be relative to our current directory. +# If its already absolute, then this will have no affect. +import pywin +import pywin.framework + +pywin.__path__[0] = win32ui.FullPath(pywin.__path__[0]) +pywin.framework.__path__[0] = win32ui.FullPath(pywin.framework.__path__[0]) + +# make a few wierd sys values. This is so later we can clobber sys.argv to trick +# scripts when running under a GUI environment. + +moduleName = "pywin.framework.intpyapp" +sys.appargvoffset = 0 +sys.appargv = sys.argv[:] +# Must check for /app param here. +if len(sys.argv) >= 2 and sys.argv[0].lower() in ("/app", "-app"): + from . import cmdline + + moduleName = cmdline.FixArgFileName(sys.argv[1]) + sys.appargvoffset = 2 + newargv = sys.argv[sys.appargvoffset :] + # newargv.insert(0, sys.argv[0]) + sys.argv = newargv + +# Import the application module. +__import__(moduleName) + +try: + win32ui.GetApp()._obj_ + # This worked - an app already exists - do nothing more +except (AttributeError, win32ui.error): + # This means either no app object exists at all, or the one + # that does exist does not have a Python class (ie, was created + # by the host .EXE). In this case, we do the "old style" init... + from . import app + + if app.AppBuilder is None: + raise TypeError("No application object has been registered") + + app.App = app.AppBuilder() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/stdin.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/stdin.py new file mode 100644 index 0000000000000000000000000000000000000000..2f3adcb6b5758b238cd9ea26ac10b6ebdae2fdae --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/stdin.py @@ -0,0 +1,176 @@ +# Copyright (c) 2000 David Abrahams. Permission to copy, use, modify, sell +# and distribute this software is granted provided this copyright +# notice appears in all copies. This software is provided "as is" without +# express or implied warranty, and with no claim as to its suitability for +# any purpose. +"""Provides a class Stdin which can be used to emulate the regular old +sys.stdin for the PythonWin interactive window. Right now it just pops +up a raw_input() dialog. With luck, someone will integrate it into the +actual PythonWin interactive window someday. + +WARNING: Importing this file automatically replaces sys.stdin with an +instance of Stdin (below). This is useful because you can just open +Stdin.py in PythonWin and hit the import button to get it set up right +if you don't feel like changing PythonWin's source. To put things back +the way they were, simply use this magic incantation: + import sys + sys.stdin = sys.stdin.real_file +""" +import sys + +try: + get_input_line = raw_input # py2x +except NameError: + get_input_line = input # py3k + + +class Stdin: + def __init__(self): + self.real_file = sys.stdin # NOTE: Likely to be None in py3k + self.buffer = "" + self.closed = False + + def __getattr__(self, name): + """Forward most functions to the real sys.stdin for absolute realism.""" + if self.real_file is None: + raise AttributeError(name) + return getattr(self.real_file, name) + + def isatty(self): + """Return 1 if the file is connected to a tty(-like) device, else 0.""" + return 1 + + def read(self, size=-1): + """Read at most size bytes from the file (less if the read + hits EOF or no more data is immediately available on a pipe, + tty or similar device). If the size argument is negative or + omitted, read all data until EOF is reached. The bytes are + returned as a string object. An empty string is returned when + EOF is encountered immediately. (For certain files, like ttys, + it makes sense to continue reading after an EOF is hit.)""" + result_size = self.__get_lines(size) + return self.__extract_from_buffer(result_size) + + def readline(self, size=-1): + """Read one entire line from the file. A trailing newline + character is kept in the string2.6 (but may be absent when a file ends + with an incomplete line). If the size argument is present and + non-negative, it is a maximum byte count (including the trailing + newline) and an incomplete line may be returned. An empty string is + returned when EOF is hit immediately. Note: unlike stdio's fgets(), + the returned string contains null characters ('\0') if they occurred + in the input. + """ + maximum_result_size = self.__get_lines(size, lambda buffer: "\n" in buffer) + + if "\n" in self.buffer[:maximum_result_size]: + result_size = self.buffer.find("\n", 0, maximum_result_size) + 1 + assert result_size > 0 + else: + result_size = maximum_result_size + + return self.__extract_from_buffer(result_size) + + def __extract_from_buffer(self, character_count): + """Remove the first character_count characters from the internal buffer and + return them. + """ + result = self.buffer[:character_count] + self.buffer = self.buffer[character_count:] + return result + + def __get_lines(self, desired_size, done_reading=lambda buffer: False): + """Keep adding lines to our internal buffer until done_reading(self.buffer) + is true or EOF has been reached or we have desired_size bytes in the buffer. + If desired_size < 0, we are never satisfied until we reach EOF. If done_reading + is not supplied, it is not consulted. + + If desired_size < 0, returns the length of the internal buffer. Otherwise, + returns desired_size. + """ + while not done_reading(self.buffer) and ( + desired_size < 0 or len(self.buffer) < desired_size + ): + try: + self.__get_line() + except ( + EOFError, + KeyboardInterrupt, + ): # deal with cancellation of get_input_line dialog + desired_size = len(self.buffer) # Be satisfied! + + if desired_size < 0: + return len(self.buffer) + else: + return desired_size + + def __get_line(self): + """Grab one line from get_input_line() and append it to the buffer.""" + line = get_input_line() + print(">>>", line) # echo input to console + self.buffer = self.buffer + line + "\n" + + def readlines(self, *sizehint): + """Read until EOF using readline() and return a list containing the lines + thus read. If the optional sizehint argument is present, instead of + reading up to EOF, whole lines totalling approximately sizehint bytes + (possibly after rounding up to an internal buffer size) are read. + """ + result = [] + total_read = 0 + while sizehint == () or total_read < sizehint[0]: + line = self.readline() + if line == "": + break + total_read = total_read + len(line) + result.append(line) + return result + + +if __name__ == "__main__": + test_input = r"""this is some test +input that I am hoping +~ +will be very instructive +and when I am done +I will have tested everything. +Twelve and twenty blackbirds +baked in a pie. Patty cake +patty cake so am I. +~ +Thirty-five niggling idiots! +Sell you soul to the devil, baby +""" + + def fake_raw_input(prompt=None): + """Replacement for raw_input() which pulls lines out of global test_input. + For testing only! + """ + global test_input + if "\n" not in test_input: + end_of_line_pos = len(test_input) + else: + end_of_line_pos = test_input.find("\n") + result = test_input[:end_of_line_pos] + test_input = test_input[end_of_line_pos + 1 :] + if len(result) == 0 or result[0] == "~": + raise EOFError() + return result + + get_input_line = fake_raw_input + + # Some completely inadequate tests, just to make sure the code's not totally broken + try: + x = Stdin() + print(x.read()) + print(x.readline()) + print(x.read(12)) + print(x.readline(47)) + print(x.readline(3)) + print(x.readlines()) + finally: + get_input_line = raw_input +else: + import sys + + sys.stdin = Stdin() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/toolmenu.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/toolmenu.py new file mode 100644 index 0000000000000000000000000000000000000000..3f739e09e8a26d97ecba2d2c7fb4cebc4bf72ff6 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/toolmenu.py @@ -0,0 +1,284 @@ +# toolmenu.py + +import sys + +import win32api +import win32con +import win32ui + +from . import app + +tools = {} +idPos = 100 + +# The default items should no tools menu exist in the INI file. +defaultToolMenuItems = [ + ("Browser", "win32ui.GetApp().OnViewBrowse(0,0)"), + ( + "Browse PythonPath", + "from pywin.tools import browseProjects;browseProjects.Browse()", + ), + ("Edit Python Path", "from pywin.tools import regedit;regedit.EditRegistry()"), + ("COM Makepy utility", "from win32com.client import makepy;makepy.main()"), + ( + "COM Browser", + "from win32com.client import combrowse;combrowse.main(modal=False)", + ), + ( + "Trace Collector Debugging tool", + "from pywin.tools import TraceCollector;TraceCollector.MakeOutputWindow()", + ), +] + + +def LoadToolMenuItems(): + # Load from the registry. + items = [] + lookNo = 1 + while 1: + menu = win32ui.GetProfileVal("Tools Menu\\%s" % lookNo, "", "") + if menu == "": + break + cmd = win32ui.GetProfileVal("Tools Menu\\%s" % lookNo, "Command", "") + items.append((menu, cmd)) + lookNo = lookNo + 1 + + if len(items) == 0: + items = defaultToolMenuItems + return items + + +def WriteToolMenuItems(items): + # Items is a list of (menu, command) + # Delete the entire registry tree. + try: + mainKey = win32ui.GetAppRegistryKey() + toolKey = win32api.RegOpenKey(mainKey, "Tools Menu") + except win32ui.error: + toolKey = None + if toolKey is not None: + while 1: + try: + subkey = win32api.RegEnumKey(toolKey, 0) + except win32api.error: + break + win32api.RegDeleteKey(toolKey, subkey) + # Keys are now removed - write the new ones. + # But first check if we have the defaults - and if so, dont write anything! + if items == defaultToolMenuItems: + return + itemNo = 1 + for menu, cmd in items: + win32ui.WriteProfileVal("Tools Menu\\%s" % itemNo, "", menu) + win32ui.WriteProfileVal("Tools Menu\\%s" % itemNo, "Command", cmd) + itemNo = itemNo + 1 + + +def SetToolsMenu(menu, menuPos=None): + global tools + global idPos + + # todo - check the menu does not already exist. + # Create the new menu + toolsMenu = win32ui.CreatePopupMenu() + + # Load from the ini file. + items = LoadToolMenuItems() + for menuString, cmd in items: + tools[idPos] = (menuString, cmd, menuString) + toolsMenu.AppendMenu( + win32con.MF_ENABLED | win32con.MF_STRING, idPos, menuString + ) + win32ui.GetMainFrame().HookCommand(HandleToolCommand, idPos) + idPos = idPos + 1 + + # Find the correct spot to insert the new tools menu. + if menuPos is None: + menuPos = menu.GetMenuItemCount() - 2 + if menuPos < 0: + menuPos = 0 + + menu.InsertMenu( + menuPos, + win32con.MF_BYPOSITION + | win32con.MF_ENABLED + | win32con.MF_STRING + | win32con.MF_POPUP, + toolsMenu.GetHandle(), + "&Tools", + ) + + +def HandleToolCommand(cmd, code): + import re + import traceback + + global tools + (menuString, pyCmd, desc) = tools[cmd] + win32ui.SetStatusText("Executing tool %s" % desc, 1) + pyCmd = re.sub("\\\\n", "\n", pyCmd) + win32ui.DoWaitCursor(1) + oldFlag = None + try: + oldFlag = sys.stdout.template.writeQueueing + sys.stdout.template.writeQueueing = 0 + except (NameError, AttributeError): + pass + + try: + exec("%s\n" % pyCmd) + worked = 1 + except SystemExit: + # The program raised a SystemExit - ignore it. + worked = 1 + except: + print("Failed to execute command:\n%s" % pyCmd) + traceback.print_exc() + worked = 0 + if oldFlag is not None: + sys.stdout.template.writeQueueing = oldFlag + win32ui.DoWaitCursor(0) + if worked: + text = "Completed successfully." + else: + text = "Error executing %s." % desc + win32ui.SetStatusText(text, 1) + + +# The property page for maintaing the items on the Tools menu. +import commctrl +from pywin.mfc import dialog + +if win32ui.UNICODE: + LVN_ENDLABELEDIT = commctrl.LVN_ENDLABELEDITW +else: + LVN_ENDLABELEDIT = commctrl.LVN_ENDLABELEDITA + + +class ToolMenuPropPage(dialog.PropertyPage): + def __init__(self): + self.bImChangingEditControls = 0 # Am I programatically changing the controls? + dialog.PropertyPage.__init__(self, win32ui.IDD_PP_TOOLMENU) + + def OnInitDialog(self): + self.editMenuCommand = self.GetDlgItem(win32ui.IDC_EDIT2) + self.butNew = self.GetDlgItem(win32ui.IDC_BUTTON3) + + # Now hook the change notification messages for the edit controls. + self.HookCommand(self.OnCommandEditControls, win32ui.IDC_EDIT1) + self.HookCommand(self.OnCommandEditControls, win32ui.IDC_EDIT2) + + self.HookNotify(self.OnNotifyListControl, commctrl.LVN_ITEMCHANGED) + self.HookNotify(self.OnNotifyListControlEndLabelEdit, commctrl.LVN_ENDLABELEDIT) + + # Hook the button clicks. + self.HookCommand(self.OnButtonNew, win32ui.IDC_BUTTON3) # New Item + self.HookCommand(self.OnButtonDelete, win32ui.IDC_BUTTON4) # Delete item + self.HookCommand(self.OnButtonMove, win32ui.IDC_BUTTON1) # Move up + self.HookCommand(self.OnButtonMove, win32ui.IDC_BUTTON2) # Move down + + # Setup the columns in the list control + lc = self.GetDlgItem(win32ui.IDC_LIST1) + rect = lc.GetWindowRect() + cx = rect[2] - rect[0] + colSize = cx / 2 - win32api.GetSystemMetrics(win32con.SM_CXBORDER) - 1 + + item = commctrl.LVCFMT_LEFT, colSize, "Menu Text" + lc.InsertColumn(0, item) + + item = commctrl.LVCFMT_LEFT, colSize, "Python Command" + lc.InsertColumn(1, item) + + # Insert the existing tools menu + itemNo = 0 + for desc, cmd in LoadToolMenuItems(): + lc.InsertItem(itemNo, desc) + lc.SetItemText(itemNo, 1, cmd) + itemNo = itemNo + 1 + + self.listControl = lc + return dialog.PropertyPage.OnInitDialog(self) + + def OnOK(self): + # Write the menu back to the registry. + items = [] + itemLook = 0 + while 1: + try: + text = self.listControl.GetItemText(itemLook, 0) + if not text: + break + items.append((text, self.listControl.GetItemText(itemLook, 1))) + except win32ui.error: + # no more items! + break + itemLook = itemLook + 1 + WriteToolMenuItems(items) + return self._obj_.OnOK() + + def OnCommandEditControls(self, id, cmd): + # print "OnEditControls", id, cmd + if cmd == win32con.EN_CHANGE and not self.bImChangingEditControls: + itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED) + newText = self.editMenuCommand.GetWindowText() + self.listControl.SetItemText(itemNo, 1, newText) + + return 0 + + def OnNotifyListControlEndLabelEdit(self, id, cmd): + newText = self.listControl.GetEditControl().GetWindowText() + itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED) + self.listControl.SetItemText(itemNo, 0, newText) + + def OnNotifyListControl(self, id, cmd): + # print id, cmd + try: + itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED) + except win32ui.error: # No selection! + return + + self.bImChangingEditControls = 1 + try: + item = self.listControl.GetItem(itemNo, 1) + self.editMenuCommand.SetWindowText(item[4]) + finally: + self.bImChangingEditControls = 0 + + return 0 # we have handled this! + + def OnButtonNew(self, id, cmd): + if cmd == win32con.BN_CLICKED: + newIndex = self.listControl.GetItemCount() + self.listControl.InsertItem(newIndex, "Click to edit the text") + self.listControl.EnsureVisible(newIndex, 0) + + def OnButtonMove(self, id, cmd): + if cmd == win32con.BN_CLICKED: + try: + itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED) + except win32ui.error: + return + menu = self.listControl.GetItemText(itemNo, 0) + cmd = self.listControl.GetItemText(itemNo, 1) + if id == win32ui.IDC_BUTTON1: + # Move up + if itemNo > 0: + self.listControl.DeleteItem(itemNo) + # reinsert it. + self.listControl.InsertItem(itemNo - 1, menu) + self.listControl.SetItemText(itemNo - 1, 1, cmd) + else: + # Move down. + if itemNo < self.listControl.GetItemCount() - 1: + self.listControl.DeleteItem(itemNo) + # reinsert it. + self.listControl.InsertItem(itemNo + 1, menu) + self.listControl.SetItemText(itemNo + 1, 1, cmd) + + def OnButtonDelete(self, id, cmd): + if cmd == win32con.BN_CLICKED: + try: + itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED) + except win32ui.error: # No selection! + return + self.listControl.DeleteItem(itemNo) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/window.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/window.py new file mode 100644 index 0000000000000000000000000000000000000000..58fd4d953404821d5bd0f114dec808b23f33c0bc --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/window.py @@ -0,0 +1,14 @@ +# Framework Window classes. + +# Most Pythonwin windows should use these classes rather than +# the raw MFC ones if they want Pythonwin specific functionality. +import pywin.mfc.window +import win32con + + +class MDIChildWnd(pywin.mfc.window.MDIChildWnd): + def AutoRestore(self): + "If the window is minimised or maximised, restore it." + p = self.GetWindowPlacement() + if p[1] == win32con.SW_MINIMIZE or p[1] == win32con.SW_SHOWMINIMIZED: + self.SetWindowPlacement(p[0], win32con.SW_RESTORE, p[2], p[3], p[4]) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/winout.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/winout.py new file mode 100644 index 0000000000000000000000000000000000000000..e78e959a9a232081539768f920624f3e6b7797ba --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/framework/winout.py @@ -0,0 +1,594 @@ +# winout.py +# +# generic "output window" +# +# This Window will detect itself closing, and recreate next time output is +# written to it. + +# This has the option of writing output at idle time (by hooking the +# idle message, and queueing output) or writing as each +# write is executed. +# Updating the window directly gives a jerky appearance as many writes +# take place between commands, and the windows scrolls, and updates etc +# Updating at idle-time may defer all output of a long process, giving the +# appearence nothing is happening. +# There is a compromise "line" mode, which will output whenever +# a complete line is available. + +# behaviour depends on self.writeQueueing + +# This module is thread safe - output can originate from any thread. If any thread +# other than the main thread attempts to print, it is always queued until next idle time + +import queue +import re + +import win32api +import win32con +import win32ui +from pywin.framework import app, window +from pywin.mfc import docview + +debug = lambda msg: None + +##debug=win32ui.OutputDebugString +##import win32trace;win32trace.InitWrite() # for debugging - delete me! +##debug = win32trace.write + + +class flags: + # queueing of output. + WQ_NONE = 0 + WQ_LINE = 1 + WQ_IDLE = 2 + + +# WindowOutputDocumentParent=docview.RichEditDoc +# WindowOutputDocumentParent=docview.Document +import pywin.scintilla.document +from pywin import default_scintilla_encoding +from pywin.scintilla import scintillacon + +WindowOutputDocumentParent = pywin.scintilla.document.CScintillaDocument + + +class WindowOutputDocument(WindowOutputDocumentParent): + def SaveModified(self): + return 1 # say it is OK to destroy my document + + def OnSaveDocument(self, fileName): + win32ui.SetStatusText("Saving file...", 1) + try: + self.SaveFile(fileName) + except IOError as details: + win32ui.MessageBox("Error - could not save file\r\n\r\n%s" % details) + return 0 + win32ui.SetStatusText("Ready") + return 1 + + +class WindowOutputFrame(window.MDIChildWnd): + def __init__(self, wnd=None): + window.MDIChildWnd.__init__(self, wnd) + self.HookMessage(self.OnSizeMove, win32con.WM_SIZE) + self.HookMessage(self.OnSizeMove, win32con.WM_MOVE) + + def LoadFrame(self, idResource, style, wndParent, context): + self.template = context.template + return self._obj_.LoadFrame(idResource, style, wndParent, context) + + def PreCreateWindow(self, cc): + cc = self._obj_.PreCreateWindow(cc) + if ( + self.template.defSize + and self.template.defSize[0] != self.template.defSize[1] + ): + rect = app.RectToCreateStructRect(self.template.defSize) + cc = cc[0], cc[1], cc[2], cc[3], rect, cc[5], cc[6], cc[7], cc[8] + return cc + + def OnSizeMove(self, msg): + # so recreate maintains position. + # Need to map coordinates from the + # frame windows first child. + mdiClient = self.GetParent() + self.template.defSize = mdiClient.ScreenToClient(self.GetWindowRect()) + + def OnDestroy(self, message): + self.template.OnFrameDestroy(self) + return 1 + + +class WindowOutputViewImpl: + def __init__(self): + self.patErrorMessage = re.compile('\W*File "(.*)", line ([0-9]+)') + self.template = self.GetDocument().GetDocTemplate() + + def HookHandlers(self): + # Hook for the right-click menu. + self.HookMessage(self.OnRClick, win32con.WM_RBUTTONDOWN) + + def OnDestroy(self, msg): + self.template.OnViewDestroy(self) + + def OnInitialUpdate(self): + self.RestoreKillBuffer() + self.SetSel(-2) # end of buffer + + def GetRightMenuItems(self): + ret = [] + flags = win32con.MF_STRING | win32con.MF_ENABLED + ret.append((flags, win32ui.ID_EDIT_COPY, "&Copy")) + ret.append((flags, win32ui.ID_EDIT_SELECT_ALL, "&Select all")) + return ret + + # + # Windows command handlers, virtuals, etc. + # + def OnRClick(self, params): + paramsList = self.GetRightMenuItems() + menu = win32ui.CreatePopupMenu() + for appendParams in paramsList: + if type(appendParams) != type(()): + appendParams = (appendParams,) + menu.AppendMenu(*appendParams) + menu.TrackPopupMenu(params[5]) # track at mouse position. + return 0 + + # as this is often used as an output window, exeptions will often + # be printed. Therefore, we support this functionality at this level. + # Returns TRUE if the current line is an error message line, and will + # jump to it. FALSE if no error (and no action taken) + def HandleSpecialLine(self): + from . import scriptutils + + line = self.GetLine() + if line[:11] == "com_error: ": + # An OLE Exception - pull apart the exception + # and try and locate a help file. + try: + import win32api + import win32con + + det = eval(line[line.find(":") + 1 :].strip()) + win32ui.SetStatusText("Opening help file on OLE error...") + from . import help + + help.OpenHelpFile(det[2][3], win32con.HELP_CONTEXT, det[2][4]) + return 1 + except win32api.error as details: + win32ui.SetStatusText( + "The help file could not be opened - %s" % details.strerror + ) + return 1 + except: + win32ui.SetStatusText( + "Line is a COM error, but no WinHelp details can be parsed" + ) + # Look for a Python traceback. + matchResult = self.patErrorMessage.match(line) + if matchResult is None: + # No match - try the previous line + lineNo = self.LineFromChar() + if lineNo > 0: + line = self.GetLine(lineNo - 1) + matchResult = self.patErrorMessage.match(line) + if matchResult is not None: + # we have an error line. + fileName = matchResult.group(1) + if fileName[0] == "<": + win32ui.SetStatusText("Can not load this file") + return 1 # still was an error message. + else: + lineNoString = matchResult.group(2) + # Attempt to locate the file (in case it is a relative spec) + fileNameSpec = fileName + fileName = scriptutils.LocatePythonFile(fileName) + if fileName is None: + # Dont force update, so it replaces the idle prompt. + win32ui.SetStatusText( + "Cant locate the file '%s'" % (fileNameSpec), 0 + ) + return 1 + + win32ui.SetStatusText( + "Jumping to line " + lineNoString + " of file " + fileName, 1 + ) + if not scriptutils.JumpToDocument(fileName, int(lineNoString)): + win32ui.SetStatusText("Could not open %s" % fileName) + return 1 # still was an error message. + return 1 + return 0 # not an error line + + def write(self, msg): + return self.template.write(msg) + + def writelines(self, lines): + for line in lines: + self.write(line) + + def flush(self): + self.template.flush() + + +class WindowOutputViewRTF(docview.RichEditView, WindowOutputViewImpl): + def __init__(self, doc): + docview.RichEditView.__init__(self, doc) + WindowOutputViewImpl.__init__(self) + + def OnInitialUpdate(self): + WindowOutputViewImpl.OnInitialUpdate(self) + return docview.RichEditView.OnInitialUpdate(self) + + def OnDestroy(self, msg): + WindowOutputViewImpl.OnDestroy(self, msg) + docview.RichEditView.OnDestroy(self, msg) + + def HookHandlers(self): + WindowOutputViewImpl.HookHandlers(self) + # Hook for finding and locating error messages + self.HookMessage(self.OnLDoubleClick, win32con.WM_LBUTTONDBLCLK) + + # docview.RichEditView.HookHandlers(self) + + def OnLDoubleClick(self, params): + if self.HandleSpecialLine(): + return 0 # dont pass on + return 1 # pass it on by default. + + def RestoreKillBuffer(self): + if len(self.template.killBuffer): + self.StreamIn(win32con.SF_RTF, self._StreamRTFIn) + self.template.killBuffer = [] + + def SaveKillBuffer(self): + self.StreamOut(win32con.SF_RTFNOOBJS, self._StreamRTFOut) + + def _StreamRTFOut(self, data): + self.template.killBuffer.append(data) + return 1 # keep em coming! + + def _StreamRTFIn(self, bytes): + try: + item = self.template.killBuffer[0] + self.template.killBuffer.remove(item) + if bytes < len(item): + print("Warning - output buffer not big enough!") + return item + except IndexError: + return None + + def dowrite(self, str): + self.SetSel(-2) + self.ReplaceSel(str) + + +import pywin.scintilla.view + + +class WindowOutputViewScintilla( + pywin.scintilla.view.CScintillaView, WindowOutputViewImpl +): + def __init__(self, doc): + pywin.scintilla.view.CScintillaView.__init__(self, doc) + WindowOutputViewImpl.__init__(self) + + def OnInitialUpdate(self): + pywin.scintilla.view.CScintillaView.OnInitialUpdate(self) + self.SCISetMarginWidth(3) + WindowOutputViewImpl.OnInitialUpdate(self) + + def OnDestroy(self, msg): + WindowOutputViewImpl.OnDestroy(self, msg) + pywin.scintilla.view.CScintillaView.OnDestroy(self, msg) + + def HookHandlers(self): + WindowOutputViewImpl.HookHandlers(self) + pywin.scintilla.view.CScintillaView.HookHandlers(self) + self.GetParent().HookNotify( + self.OnScintillaDoubleClick, scintillacon.SCN_DOUBLECLICK + ) + + ## self.HookMessage(self.OnLDoubleClick,win32con.WM_LBUTTONDBLCLK) + + def OnScintillaDoubleClick(self, std, extra): + self.HandleSpecialLine() + + ## def OnLDoubleClick(self,params): + ## return 0 # never dont pass on + + def RestoreKillBuffer(self): + assert len(self.template.killBuffer) in (0, 1), "Unexpected killbuffer contents" + if self.template.killBuffer: + self.SCIAddText(self.template.killBuffer[0]) + self.template.killBuffer = [] + + def SaveKillBuffer(self): + self.template.killBuffer = [self.GetTextRange(0, -1)] + + def dowrite(self, str): + end = self.GetTextLength() + atEnd = end == self.GetSel()[0] + self.SCIInsertText(str, end) + if atEnd: + self.SetSel(self.GetTextLength()) + + def SetWordWrap(self, bWrapOn=1): + if bWrapOn: + wrap_mode = scintillacon.SC_WRAP_WORD + else: + wrap_mode = scintillacon.SC_WRAP_NONE + self.SCISetWrapMode(wrap_mode) + + def _MakeColorizer(self): + return None # No colorizer for me! + + +WindowOutputView = WindowOutputViewScintilla + + +# The WindowOutput class is actually an MFC template. This is a conventient way of +# making sure that my state can exist beyond the life of the windows themselves. +# This is primarily to support the functionality of a WindowOutput window automatically +# being recreated if necessary when written to. +class WindowOutput(docview.DocTemplate): + """Looks like a general Output Window - text can be written by the 'write' method. + Will auto-create itself on first write, and also on next write after being closed""" + + softspace = 1 + + def __init__( + self, + title=None, + defSize=None, + queueing=flags.WQ_LINE, + bAutoRestore=1, + style=None, + makeDoc=None, + makeFrame=None, + makeView=None, + ): + """init the output window - + Params + title=None -- What is the title of the window + defSize=None -- What is the default size for the window - if this + is a string, the size will be loaded from the ini file. + queueing = flags.WQ_LINE -- When should output be written + bAutoRestore=1 -- Should a minimized window be restored. + style -- Style for Window, or None for default. + makeDoc, makeFrame, makeView -- Classes for frame, view and window respectively. + """ + if makeDoc is None: + makeDoc = WindowOutputDocument + if makeFrame is None: + makeFrame = WindowOutputFrame + if makeView is None: + makeView = WindowOutputViewScintilla + docview.DocTemplate.__init__( + self, win32ui.IDR_PYTHONTYPE, makeDoc, makeFrame, makeView + ) + self.SetDocStrings("\nOutput\n\nText Documents (*.txt)\n.txt\n\n\n") + win32ui.GetApp().AddDocTemplate(self) + self.writeQueueing = queueing + self.errorCantRecreate = 0 + self.killBuffer = [] + self.style = style + self.bAutoRestore = bAutoRestore + self.title = title + self.bCreating = 0 + self.interruptCount = 0 + if type(defSize) == type(""): # is a string - maintain size pos from ini file. + self.iniSizeSection = defSize + self.defSize = app.LoadWindowSize(defSize) + self.loadedSize = self.defSize + else: + self.iniSizeSection = None + self.defSize = defSize + self.currentView = None + self.outputQueue = queue.Queue(-1) + self.mainThreadId = win32api.GetCurrentThreadId() + self.idleHandlerSet = 0 + self.SetIdleHandler() + + def __del__(self): + self.Close() + + def Create(self, title=None, style=None): + self.bCreating = 1 + if title: + self.title = title + if style: + self.style = style + doc = self.OpenDocumentFile() + if doc is None: + return + self.currentView = doc.GetFirstView() + self.bCreating = 0 + if self.title: + doc.SetTitle(self.title) + + def Close(self): + self.RemoveIdleHandler() + try: + parent = self.currentView.GetParent() + except (AttributeError, win32ui.error): # Already closed + return + parent.DestroyWindow() + + def SetTitle(self, title): + self.title = title + if self.currentView: + self.currentView.GetDocument().SetTitle(self.title) + + def OnViewDestroy(self, view): + self.currentView.SaveKillBuffer() + self.currentView = None + + def OnFrameDestroy(self, frame): + if self.iniSizeSection: + # use GetWindowPlacement(), as it works even when min'd or max'd + newSize = frame.GetWindowPlacement()[4] + if self.loadedSize != newSize: + app.SaveWindowSize(self.iniSizeSection, newSize) + + def SetIdleHandler(self): + if not self.idleHandlerSet: + debug("Idle handler set\n") + win32ui.GetApp().AddIdleHandler(self.QueueIdleHandler) + self.idleHandlerSet = 1 + + def RemoveIdleHandler(self): + if self.idleHandlerSet: + debug("Idle handler reset\n") + if win32ui.GetApp().DeleteIdleHandler(self.QueueIdleHandler) == 0: + debug("Error deleting idle handler\n") + self.idleHandlerSet = 0 + + def RecreateWindow(self): + if self.errorCantRecreate: + debug("Error = not trying again") + return 0 + try: + # This will fail if app shutting down + win32ui.GetMainFrame().GetSafeHwnd() + self.Create() + return 1 + except (win32ui.error, AttributeError): + self.errorCantRecreate = 1 + debug("Winout can not recreate the Window!\n") + return 0 + + # this handles the idle message, and does the printing. + def QueueIdleHandler(self, handler, count): + try: + bEmpty = self.QueueFlush(20) + # If the queue is empty, then we are back to idle and restart interrupt logic. + if bEmpty: + self.interruptCount = 0 + except KeyboardInterrupt: + # First interrupt since idle we just pass on. + # later ones we dump the queue and give up. + self.interruptCount = self.interruptCount + 1 + if self.interruptCount > 1: + # Drop the queue quickly as the user is already annoyed :-) + self.outputQueue = queue.Queue(-1) + print("Interrupted.") + bEmpty = 1 + else: + raise # re-raise the error so the users exception filters up. + return not bEmpty # More to do if not empty. + + # Returns true if the Window needs to be recreated. + def NeedRecreateWindow(self): + try: + if self.currentView is not None and self.currentView.IsWindow(): + return 0 + except ( + win32ui.error, + AttributeError, + ): # Attribute error if the win32ui object has died. + pass + return 1 + + # Returns true if the Window is OK (either cos it was, or because it was recreated + def CheckRecreateWindow(self): + if self.bCreating: + return 1 + if not self.NeedRecreateWindow(): + return 1 + if self.bAutoRestore: + if self.RecreateWindow(): + return 1 + return 0 + + def QueueFlush(self, max=None): + # Returns true if the queue is empty after the flush + # debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize())) + if self.bCreating: + return 1 + items = [] + rc = 0 + while max is None or max > 0: + try: + item = self.outputQueue.get_nowait() + items.append(item) + except queue.Empty: + rc = 1 + break + if max is not None: + max = max - 1 + if len(items) != 0: + if not self.CheckRecreateWindow(): + debug(":Recreate failed!\n") + return 1 # In trouble - so say we have nothing to do. + win32ui.PumpWaitingMessages() # Pump paint messages + self.currentView.dowrite("".join(items)) + return rc + + def HandleOutput(self, message): + # debug("QueueOutput on thread %d, flags %d with '%s'...\n" % (win32api.GetCurrentThreadId(), self.writeQueueing, message )) + self.outputQueue.put(message) + if win32api.GetCurrentThreadId() != self.mainThreadId: + pass + # debug("not my thread - ignoring queue options!\n") + elif self.writeQueueing == flags.WQ_LINE: + pos = message.rfind("\n") + if pos >= 0: + # debug("Line queueing - forcing flush\n") + self.QueueFlush() + return + elif self.writeQueueing == flags.WQ_NONE: + # debug("WQ_NONE - flushing!\n") + self.QueueFlush() + return + # Let our idle handler get it - wake it up + try: + win32ui.GetMainFrame().PostMessage( + win32con.WM_USER + ) # Kick main thread off. + except win32ui.error: + # This can happen as the app is shutting down, so we send it to the C++ debugger + win32api.OutputDebugString(message) + + # delegate certain fns to my view. + def writelines(self, lines): + for line in lines: + self.write(line) + + def write(self, message): + self.HandleOutput(message) + + def flush(self): + self.QueueFlush() + + def HandleSpecialLine(self): + self.currentView.HandleSpecialLine() + + +def RTFWindowOutput(*args, **kw): + kw["makeView"] = WindowOutputViewRTF + return WindowOutput(*args, **kw) + + +def thread_test(o): + for i in range(5): + o.write("Hi from thread %d\n" % (win32api.GetCurrentThreadId())) + win32api.Sleep(100) + + +def test(): + w = WindowOutput(queueing=flags.WQ_IDLE) + w.write("First bit of text\n") + import _thread + + for i in range(5): + w.write("Hello from the main thread\n") + _thread.start_new(thread_test, (w,)) + for i in range(2): + w.write("Hello from the main thread\n") + win32api.Sleep(50) + return w + + +if __name__ == "__main__": + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/AutoExpand.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/AutoExpand.py new file mode 100644 index 0000000000000000000000000000000000000000..3b302ee93def3aa4e4029915612af4af9b81f995 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/AutoExpand.py @@ -0,0 +1,95 @@ +import re +import string + +###$ event <> +###$ win +###$ unix + + +class AutoExpand: + keydefs = { + "<>": [""], + } + + unix_keydefs = { + "<>": [""], + } + + menudefs = [ + ( + "edit", + [ + ("E_xpand word", "<>"), + ], + ), + ] + + wordchars = string.ascii_letters + string.digits + "_" + + def __init__(self, editwin): + self.text = editwin.text + self.text.wordlist = None # XXX what is this? + self.state = None + + def expand_word_event(self, event): + curinsert = self.text.index("insert") + curline = self.text.get("insert linestart", "insert lineend") + if not self.state: + words = self.getwords() + index = 0 + else: + words, index, insert, line = self.state + if insert != curinsert or line != curline: + words = self.getwords() + index = 0 + if not words: + self.text.bell() + return "break" + word = self.getprevword() + self.text.delete("insert - %d chars" % len(word), "insert") + newword = words[index] + index = (index + 1) % len(words) + if index == 0: + self.text.bell() # Warn we cycled around + self.text.insert("insert", newword) + curinsert = self.text.index("insert") + curline = self.text.get("insert linestart", "insert lineend") + self.state = words, index, curinsert, curline + return "break" + + def getwords(self): + word = self.getprevword() + if not word: + return [] + before = self.text.get("1.0", "insert wordstart") + wbefore = re.findall(r"\b" + word + r"\w+\b", before) + del before + after = self.text.get("insert wordend", "end") + wafter = re.findall(r"\b" + word + r"\w+\b", after) + del after + if not wbefore and not wafter: + return [] + words = [] + dict = {} + # search backwards through words before + wbefore.reverse() + for w in wbefore: + if dict.get(w): + continue + words.append(w) + dict[w] = w + # search onwards through words after + for w in wafter: + if dict.get(w): + continue + words.append(w) + dict[w] = w + words.append(word) + return words + + def getprevword(self): + line = self.text.get("insert linestart", "insert") + i = len(line) + while i > 0 and line[i - 1] in self.wordchars: + i = i - 1 + return line[i:] diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/AutoIndent.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/AutoIndent.py new file mode 100644 index 0000000000000000000000000000000000000000..c5adc5f8665d25320e0b49699cb5272be03c7abe --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/AutoIndent.py @@ -0,0 +1,547 @@ +import sys +import tokenize + +from pywin import default_scintilla_encoding + +from . import PyParse + +if sys.version_info < (3,): + # in py2k, tokenize() takes a 'token eater' callback, while + # generate_tokens is a generator that works with str objects. + token_generator = tokenize.generate_tokens +else: + # in py3k tokenize() is the generator working with 'byte' objects, and + # token_generator is the 'undocumented b/w compat' function that + # theoretically works with str objects - but actually seems to fail) + token_generator = tokenize.tokenize + + +class AutoIndent: + menudefs = [ + ( + "edit", + [ + None, + ("_Indent region", "<>"), + ("_Dedent region", "<>"), + ("Comment _out region", "<>"), + ("U_ncomment region", "<>"), + ("Tabify region", "<>"), + ("Untabify region", "<>"), + ("Toggle tabs", "<>"), + ("New indent width", "<>"), + ], + ), + ] + + keydefs = { + "<>": [""], + "<>": ["", ""], + "<>": [""], + } + + windows_keydefs = { + "<>": [""], + "<>": [""], + "<>": [""], + "<>": [""], + "<>": [""], + "<>": [""], + "<>": [""], + "<>": [""], + } + + unix_keydefs = { + "<>": [ + "", + "", + "", + ], + "<>": [ + "", + "", + "", + ], + "<>": ["", ""], + "<>": ["", ""], + "<>": ["", ""], + "<>": ["", ""], + "<>": [""], + "<>": [""], + } + + # usetabs true -> literal tab characters are used by indent and + # dedent cmds, possibly mixed with spaces if + # indentwidth is not a multiple of tabwidth + # false -> tab characters are converted to spaces by indent + # and dedent cmds, and ditto TAB keystrokes + # indentwidth is the number of characters per logical indent level. + # tabwidth is the display width of a literal tab character. + # CAUTION: telling Tk to use anything other than its default + # tab setting causes it to use an entirely different tabbing algorithm, + # treating tab stops as fixed distances from the left margin. + # Nobody expects this, so for now tabwidth should never be changed. + usetabs = 1 + indentwidth = 4 + tabwidth = 8 # for IDLE use, must remain 8 until Tk is fixed + + # If context_use_ps1 is true, parsing searches back for a ps1 line; + # else searches for a popular (if, def, ...) Python stmt. + context_use_ps1 = 0 + + # When searching backwards for a reliable place to begin parsing, + # first start num_context_lines[0] lines back, then + # num_context_lines[1] lines back if that didn't work, and so on. + # The last value should be huge (larger than the # of lines in a + # conceivable file). + # Making the initial values larger slows things down more often. + num_context_lines = 50, 500, 5000000 + + def __init__(self, editwin): + self.editwin = editwin + self.text = editwin.text + + def config(self, **options): + for key, value in options.items(): + if key == "usetabs": + self.usetabs = value + elif key == "indentwidth": + self.indentwidth = value + elif key == "tabwidth": + self.tabwidth = value + elif key == "context_use_ps1": + self.context_use_ps1 = value + else: + raise KeyError("bad option name: %s" % repr(key)) + + # If ispythonsource and guess are true, guess a good value for + # indentwidth based on file content (if possible), and if + # indentwidth != tabwidth set usetabs false. + # In any case, adjust the Text widget's view of what a tab + # character means. + + def set_indentation_params(self, ispythonsource, guess=1): + if guess and ispythonsource: + i = self.guess_indent() + if 2 <= i <= 8: + self.indentwidth = i + if self.indentwidth != self.tabwidth: + self.usetabs = 0 + + self.editwin.set_tabwidth(self.tabwidth) + + def smart_backspace_event(self, event): + text = self.text + first, last = self.editwin.get_selection_indices() + if first and last: + text.delete(first, last) + text.mark_set("insert", first) + return "break" + # Delete whitespace left, until hitting a real char or closest + # preceding virtual tab stop. + chars = text.get("insert linestart", "insert") + if chars == "": + if text.compare("insert", ">", "1.0"): + # easy: delete preceding newline + text.delete("insert-1c") + else: + text.bell() # at start of buffer + return "break" + if chars[-1] not in " \t": + # easy: delete preceding real char + text.delete("insert-1c") + return "break" + # Ick. It may require *inserting* spaces if we back up over a + # tab character! This is written to be clear, not fast. + have = len(chars.expandtabs(self.tabwidth)) + assert have > 0 + want = int((have - 1) / self.indentwidth) * self.indentwidth + ncharsdeleted = 0 + while 1: + chars = chars[:-1] + ncharsdeleted = ncharsdeleted + 1 + have = len(chars.expandtabs(self.tabwidth)) + if have <= want or chars[-1] not in " \t": + break + text.undo_block_start() + text.delete("insert-%dc" % ncharsdeleted, "insert") + if have < want: + text.insert("insert", " " * (want - have)) + text.undo_block_stop() + return "break" + + def smart_indent_event(self, event): + # if intraline selection: + # delete it + # elif multiline selection: + # do indent-region & return + # indent one level + text = self.text + first, last = self.editwin.get_selection_indices() + text.undo_block_start() + try: + if first and last: + if index2line(first) != index2line(last): + return self.indent_region_event(event) + text.delete(first, last) + text.mark_set("insert", first) + prefix = text.get("insert linestart", "insert") + raw, effective = classifyws(prefix, self.tabwidth) + if raw == len(prefix): + # only whitespace to the left + self.reindent_to(effective + self.indentwidth) + else: + if self.usetabs: + pad = "\t" + else: + effective = len(prefix.expandtabs(self.tabwidth)) + n = self.indentwidth + pad = " " * (n - effective % n) + text.insert("insert", pad) + text.see("insert") + return "break" + finally: + text.undo_block_stop() + + def newline_and_indent_event(self, event): + text = self.text + first, last = self.editwin.get_selection_indices() + text.undo_block_start() + try: + if first and last: + text.delete(first, last) + text.mark_set("insert", first) + line = text.get("insert linestart", "insert") + i, n = 0, len(line) + while i < n and line[i] in " \t": + i = i + 1 + if i == n: + # the cursor is in or at leading indentation; just inject + # an empty line at the start and strip space from current line + text.delete("insert - %d chars" % i, "insert") + text.insert("insert linestart", "\n") + return "break" + indent = line[:i] + # strip whitespace before insert point + i = 0 + while line and line[-1] in " \t": + line = line[:-1] + i = i + 1 + if i: + text.delete("insert - %d chars" % i, "insert") + # strip whitespace after insert point + while text.get("insert") in " \t": + text.delete("insert") + # start new line + text.insert("insert", "\n") + + # adjust indentation for continuations and block + # open/close first need to find the last stmt + lno = index2line(text.index("insert")) + y = PyParse.Parser(self.indentwidth, self.tabwidth) + for context in self.num_context_lines: + startat = max(lno - context, 1) + startatindex = repr(startat) + ".0" + rawtext = text.get(startatindex, "insert") + y.set_str(rawtext) + bod = y.find_good_parse_start( + self.context_use_ps1, self._build_char_in_string_func(startatindex) + ) + if bod is not None or startat == 1: + break + y.set_lo(bod or 0) + c = y.get_continuation_type() + if c != PyParse.C_NONE: + # The current stmt hasn't ended yet. + if c == PyParse.C_STRING: + # inside a string; just mimic the current indent + text.insert("insert", indent) + elif c == PyParse.C_BRACKET: + # line up with the first (if any) element of the + # last open bracket structure; else indent one + # level beyond the indent of the line with the + # last open bracket + self.reindent_to(y.compute_bracket_indent()) + elif c == PyParse.C_BACKSLASH: + # if more than one line in this stmt already, just + # mimic the current indent; else if initial line + # has a start on an assignment stmt, indent to + # beyond leftmost =; else to beyond first chunk of + # non-whitespace on initial line + if y.get_num_lines_in_stmt() > 1: + text.insert("insert", indent) + else: + self.reindent_to(y.compute_backslash_indent()) + else: + assert 0, "bogus continuation type " + repr(c) + return "break" + + # This line starts a brand new stmt; indent relative to + # indentation of initial line of closest preceding + # interesting stmt. + indent = y.get_base_indent_string() + text.insert("insert", indent) + if y.is_block_opener(): + self.smart_indent_event(event) + elif indent and y.is_block_closer(): + self.smart_backspace_event(event) + return "break" + finally: + text.see("insert") + text.undo_block_stop() + + auto_indent = newline_and_indent_event + + # Our editwin provides a is_char_in_string function that works + # with a Tk text index, but PyParse only knows about offsets into + # a string. This builds a function for PyParse that accepts an + # offset. + + def _build_char_in_string_func(self, startindex): + def inner(offset, _startindex=startindex, _icis=self.editwin.is_char_in_string): + return _icis(_startindex + "+%dc" % offset) + + return inner + + def indent_region_event(self, event): + head, tail, chars, lines = self.get_region() + for pos in range(len(lines)): + line = lines[pos] + if line: + raw, effective = classifyws(line, self.tabwidth) + effective = effective + self.indentwidth + lines[pos] = self._make_blanks(effective) + line[raw:] + self.set_region(head, tail, chars, lines) + return "break" + + def dedent_region_event(self, event): + head, tail, chars, lines = self.get_region() + for pos in range(len(lines)): + line = lines[pos] + if line: + raw, effective = classifyws(line, self.tabwidth) + effective = max(effective - self.indentwidth, 0) + lines[pos] = self._make_blanks(effective) + line[raw:] + self.set_region(head, tail, chars, lines) + return "break" + + def comment_region_event(self, event): + head, tail, chars, lines = self.get_region() + for pos in range(len(lines) - 1): + line = lines[pos] + lines[pos] = "##" + line + self.set_region(head, tail, chars, lines) + + def uncomment_region_event(self, event): + head, tail, chars, lines = self.get_region() + for pos in range(len(lines)): + line = lines[pos] + if not line: + continue + if line[:2] == "##": + line = line[2:] + elif line[:1] == "#": + line = line[1:] + lines[pos] = line + self.set_region(head, tail, chars, lines) + + def tabify_region_event(self, event): + head, tail, chars, lines = self.get_region() + tabwidth = self._asktabwidth() + for pos in range(len(lines)): + line = lines[pos] + if line: + raw, effective = classifyws(line, tabwidth) + ntabs, nspaces = divmod(effective, tabwidth) + lines[pos] = "\t" * ntabs + " " * nspaces + line[raw:] + self.set_region(head, tail, chars, lines) + + def untabify_region_event(self, event): + head, tail, chars, lines = self.get_region() + tabwidth = self._asktabwidth() + for pos in range(len(lines)): + lines[pos] = lines[pos].expandtabs(tabwidth) + self.set_region(head, tail, chars, lines) + + def toggle_tabs_event(self, event): + if self.editwin.askyesno( + "Toggle tabs", + "Turn tabs " + ("on", "off")[self.usetabs] + "?", + parent=self.text, + ): + self.usetabs = not self.usetabs + return "break" + + # XXX this isn't bound to anything -- see class tabwidth comments + def change_tabwidth_event(self, event): + new = self._asktabwidth() + if new != self.tabwidth: + self.tabwidth = new + self.set_indentation_params(0, guess=0) + return "break" + + def change_indentwidth_event(self, event): + new = self.editwin.askinteger( + "Indent width", + "New indent width (1-16)", + parent=self.text, + initialvalue=self.indentwidth, + minvalue=1, + maxvalue=16, + ) + if new and new != self.indentwidth: + self.indentwidth = new + return "break" + + def get_region(self): + text = self.text + first, last = self.editwin.get_selection_indices() + if first and last: + head = text.index(first + " linestart") + tail = text.index(last + "-1c lineend +1c") + else: + head = text.index("insert linestart") + tail = text.index("insert lineend +1c") + chars = text.get(head, tail) + lines = chars.split("\n") + return head, tail, chars, lines + + def set_region(self, head, tail, chars, lines): + text = self.text + newchars = "\n".join(lines) + if newchars == chars: + text.bell() + return + text.tag_remove("sel", "1.0", "end") + text.mark_set("insert", head) + text.undo_block_start() + text.delete(head, tail) + text.insert(head, newchars) + text.undo_block_stop() + text.tag_add("sel", head, "insert") + + # Make string that displays as n leading blanks. + + def _make_blanks(self, n): + if self.usetabs: + ntabs, nspaces = divmod(n, self.tabwidth) + return "\t" * ntabs + " " * nspaces + else: + return " " * n + + # Delete from beginning of line to insert point, then reinsert + # column logical (meaning use tabs if appropriate) spaces. + + def reindent_to(self, column): + text = self.text + text.undo_block_start() + if text.compare("insert linestart", "!=", "insert"): + text.delete("insert linestart", "insert") + if column: + text.insert("insert", self._make_blanks(column)) + text.undo_block_stop() + + def _asktabwidth(self): + return ( + self.editwin.askinteger( + "Tab width", + "Spaces per tab?", + parent=self.text, + initialvalue=self.tabwidth, + minvalue=1, + maxvalue=16, + ) + or self.tabwidth + ) + + # Guess indentwidth from text content. + # Return guessed indentwidth. This should not be believed unless + # it's in a reasonable range (e.g., it will be 0 if no indented + # blocks are found). + + def guess_indent(self): + opener, indented = IndentSearcher(self.text, self.tabwidth).run() + if opener and indented: + raw, indentsmall = classifyws(opener, self.tabwidth) + raw, indentlarge = classifyws(indented, self.tabwidth) + else: + indentsmall = indentlarge = 0 + return indentlarge - indentsmall + + +# "line.col" -> line, as an int +def index2line(index): + return int(float(index)) + + +# Look at the leading whitespace in s. +# Return pair (# of leading ws characters, +# effective # of leading blanks after expanding +# tabs to width tabwidth) + + +def classifyws(s, tabwidth): + raw = effective = 0 + for ch in s: + if ch == " ": + raw = raw + 1 + effective = effective + 1 + elif ch == "\t": + raw = raw + 1 + effective = (effective // tabwidth + 1) * tabwidth + else: + break + return raw, effective + + +class IndentSearcher: + # .run() chews over the Text widget, looking for a block opener + # and the stmt following it. Returns a pair, + # (line containing block opener, line containing stmt) + # Either or both may be None. + + def __init__(self, text, tabwidth): + self.text = text + self.tabwidth = tabwidth + self.i = self.finished = 0 + self.blkopenline = self.indentedline = None + + def readline(self): + if self.finished: + val = "" + else: + i = self.i = self.i + 1 + mark = repr(i) + ".0" + if self.text.compare(mark, ">=", "end"): + val = "" + else: + val = self.text.get(mark, mark + " lineend+1c") + # hrm - not sure this is correct in py3k - the source code may have + # an encoding declared, but the data will *always* be in + # default_scintilla_encoding - so if anyone looks at the encoding decl + # in the source they will be wrong. I think. Maybe. Or something... + return val.encode(default_scintilla_encoding) + + def run(self): + OPENERS = ("class", "def", "for", "if", "try", "while") + INDENT = tokenize.INDENT + NAME = tokenize.NAME + + save_tabsize = tokenize.tabsize + tokenize.tabsize = self.tabwidth + try: + try: + for typ, token, start, end, line in token_generator(self.readline): + if typ == NAME and token in OPENERS: + self.blkopenline = line + elif typ == INDENT and self.blkopenline: + self.indentedline = line + break + + except (tokenize.TokenError, IndentationError): + # since we cut off the tokenizer early, we can trigger + # spurious errors + pass + finally: + tokenize.tabsize = save_tabsize + return self.blkopenline, self.indentedline diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/CallTips.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/CallTips.py new file mode 100644 index 0000000000000000000000000000000000000000..cecc760a14b69e16e210bf7f6ac8fc45b60d746e --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/CallTips.py @@ -0,0 +1,219 @@ +# CallTips.py - An IDLE extension that provides "Call Tips" - ie, a floating window that +# displays parameter information as you open parens. + +import inspect +import string +import sys +import traceback + + +class CallTips: + menudefs = [] + + keydefs = { + "<>": [""], + "<>": [""], + "<>": [""], + "<>": ["", ""], + } + + windows_keydefs = {} + + unix_keydefs = {} + + def __init__(self, editwin): + self.editwin = editwin + self.text = editwin.text + self.calltip = None + if hasattr(self.text, "make_calltip_window"): + self._make_calltip_window = self.text.make_calltip_window + else: + self._make_calltip_window = self._make_tk_calltip_window + + def close(self): + self._make_calltip_window = None + + # Makes a Tk based calltip window. Used by IDLE, but not Pythonwin. + # See __init__ above for how this is used. + def _make_tk_calltip_window(self): + import CallTipWindow + + return CallTipWindow.CallTip(self.text) + + def _remove_calltip_window(self): + if self.calltip: + self.calltip.hidetip() + self.calltip = None + + def paren_open_event(self, event): + self._remove_calltip_window() + arg_text = get_arg_text(self.get_object_at_cursor()) + if arg_text: + self.calltip_start = self.text.index("insert") + self.calltip = self._make_calltip_window() + self.calltip.showtip(arg_text) + return "" # so the event is handled normally. + + def paren_close_event(self, event): + # Now just hides, but later we should check if other + # paren'd expressions remain open. + self._remove_calltip_window() + return "" # so the event is handled normally. + + def check_calltip_cancel_event(self, event): + if self.calltip: + # If we have moved before the start of the calltip, + # or off the calltip line, then cancel the tip. + # (Later need to be smarter about multi-line, etc) + if self.text.compare( + "insert", "<=", self.calltip_start + ) or self.text.compare("insert", ">", self.calltip_start + " lineend"): + self._remove_calltip_window() + return "" # so the event is handled normally. + + def calltip_cancel_event(self, event): + self._remove_calltip_window() + return "" # so the event is handled normally. + + def get_object_at_cursor( + self, + wordchars="._" + + string.ascii_uppercase + + string.ascii_lowercase + + string.digits, + ): + # XXX - This needs to be moved to a better place + # so the "." attribute lookup code can also use it. + text = self.text + chars = text.get("insert linestart", "insert") + i = len(chars) + while i and chars[i - 1] in wordchars: + i = i - 1 + word = chars[i:] + if word: + # How is this for a hack! + import __main__ + + namespace = sys.modules.copy() + namespace.update(__main__.__dict__) + try: + return eval(word, namespace) + except: + pass + return None # Can't find an object. + + +def _find_constructor(class_ob): + # Given a class object, return a function object used for the + # constructor (ie, __init__() ) or None if we can't find one. + try: + return class_ob.__init__ + except AttributeError: + for base in class_ob.__bases__: + rc = _find_constructor(base) + if rc is not None: + return rc + return None + + +def get_arg_text(ob): + # Get a string describing the arguments for the given object. + argText = "" + if ob is not None: + if inspect.isclass(ob): + # Look for the highest __init__ in the class chain. + fob = _find_constructor(ob) + if fob is None: + fob = lambda: None + else: + fob = ob + if inspect.isfunction(fob) or inspect.ismethod(fob): + try: + argText = str(inspect.signature(fob)) + except: + print("Failed to format the args") + traceback.print_exc() + # See if we can use the docstring + if hasattr(ob, "__doc__"): + doc = ob.__doc__ + try: + doc = doc.strip() + pos = doc.find("\n") + except AttributeError: + ## New style classes may have __doc__ slot without actually + ## having a string assigned to it + pass + else: + if pos < 0 or pos > 70: + pos = 70 + if argText: + argText = argText + "\n" + argText = argText + doc[:pos] + + return argText + + +################################################# +# +# Test code +# +if __name__ == "__main__": + + def t1(): + "()" + + def t2(a, b=None): + "(a, b=None)" + + def t3(a, *args): + "(a, *args)" + + def t4(*args): + "(*args)" + + def t5(a, *args): + "(a, *args)" + + def t6(a, b=None, *args, **kw): + "(a, b=None, *args, **kw)" + + class TC: + "(self, a=None, *b)" + + def __init__(self, a=None, *b): + "(self, a=None, *b)" + + def t1(self): + "(self)" + + def t2(self, a, b=None): + "(self, a, b=None)" + + def t3(self, a, *args): + "(self, a, *args)" + + def t4(self, *args): + "(self, *args)" + + def t5(self, a, *args): + "(self, a, *args)" + + def t6(self, a, b=None, *args, **kw): + "(self, a, b=None, *args, **kw)" + + def test(tests): + failed = [] + for t in tests: + expected = t.__doc__ + "\n" + t.__doc__ + if get_arg_text(t) != expected: + failed.append(t) + print( + "%s - expected %s, but got %s" + % (t, repr(expected), repr(get_arg_text(t))) + ) + print("%d of %d tests failed" % (len(failed), len(tests))) + + tc = TC() + tests = t1, t2, t3, t4, t5, t6, TC, tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6 + + test(tests) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/FormatParagraph.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/FormatParagraph.py new file mode 100644 index 0000000000000000000000000000000000000000..143c18ee32f98990e38b553fd234d93da5dd1fc9 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/FormatParagraph.py @@ -0,0 +1,166 @@ +# Extension to format a paragraph + +# Does basic, standard text formatting, and also understands Python +# comment blocks. Thus, for editing Python source code, this +# extension is really only suitable for reformatting these comment +# blocks or triple-quoted strings. + +# Known problems with comment reformatting: +# * If there is a selection marked, and the first line of the +# selection is not complete, the block will probably not be detected +# as comments, and will have the normal "text formatting" rules +# applied. +# * If a comment block has leading whitespace that mixes tabs and +# spaces, they will not be considered part of the same block. +# * Fancy comments, like this bulleted list, arent handled :-) + +import re + + +class FormatParagraph: + menudefs = [ + ( + "edit", + [ + ("Format Paragraph", "<>"), + ], + ) + ] + + keydefs = { + "<>": [""], + } + + unix_keydefs = { + "<>": [""], + } + + def __init__(self, editwin): + self.editwin = editwin + + def close(self): + self.editwin = None + + def format_paragraph_event(self, event): + text = self.editwin.text + first, last = self.editwin.get_selection_indices() + if first and last: + data = text.get(first, last) + comment_header = "" + else: + first, last, comment_header, data = find_paragraph( + text, text.index("insert") + ) + if comment_header: + # Reformat the comment lines - convert to text sans header. + lines = data.split("\n") + lines = map(lambda st, l=len(comment_header): st[l:], lines) + data = "\n".join(lines) + # Reformat to 70 chars or a 20 char width, whichever is greater. + format_width = max(70 - len(comment_header), 20) + newdata = reformat_paragraph(data, format_width) + # re-split and re-insert the comment header. + newdata = newdata.split("\n") + # If the block ends in a \n, we dont want the comment + # prefix inserted after it. (Im not sure it makes sense to + # reformat a comment block that isnt made of complete + # lines, but whatever!) Can't think of a clean soltution, + # so we hack away + block_suffix = "" + if not newdata[-1]: + block_suffix = "\n" + newdata = newdata[:-1] + builder = lambda item, prefix=comment_header: prefix + item + newdata = "\n".join([builder(d) for d in newdata]) + block_suffix + else: + # Just a normal text format + newdata = reformat_paragraph(data) + text.tag_remove("sel", "1.0", "end") + if newdata != data: + text.mark_set("insert", first) + text.undo_block_start() + text.delete(first, last) + text.insert(first, newdata) + text.undo_block_stop() + else: + text.mark_set("insert", last) + text.see("insert") + + +def find_paragraph(text, mark): + lineno, col = list(map(int, mark.split("."))) + line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) + while text.compare("%d.0" % lineno, "<", "end") and is_all_white(line): + lineno = lineno + 1 + line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) + first_lineno = lineno + comment_header = get_comment_header(line) + comment_header_len = len(comment_header) + while get_comment_header(line) == comment_header and not is_all_white( + line[comment_header_len:] + ): + lineno = lineno + 1 + line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) + last = "%d.0" % lineno + # Search back to beginning of paragraph + lineno = first_lineno - 1 + line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) + while ( + lineno > 0 + and get_comment_header(line) == comment_header + and not is_all_white(line[comment_header_len:]) + ): + lineno = lineno - 1 + line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) + first = "%d.0" % (lineno + 1) + return first, last, comment_header, text.get(first, last) + + +def reformat_paragraph(data, limit=70): + lines = data.split("\n") + i = 0 + n = len(lines) + while i < n and is_all_white(lines[i]): + i = i + 1 + if i >= n: + return data + indent1 = get_indent(lines[i]) + if i + 1 < n and not is_all_white(lines[i + 1]): + indent2 = get_indent(lines[i + 1]) + else: + indent2 = indent1 + new = lines[:i] + partial = indent1 + while i < n and not is_all_white(lines[i]): + # XXX Should take double space after period (etc.) into account + words = re.split("(\s+)", lines[i]) + for j in range(0, len(words), 2): + word = words[j] + if not word: + continue # Can happen when line ends in whitespace + if len((partial + word).expandtabs()) > limit and partial != indent1: + new.append(partial.rstrip()) + partial = indent2 + partial = partial + word + " " + if j + 1 < len(words) and words[j + 1] != " ": + partial = partial + " " + i = i + 1 + new.append(partial.rstrip()) + # XXX Should reformat remaining paragraphs as well + new.extend(lines[i:]) + return "\n".join(new) + + +def is_all_white(line): + return re.match(r"^\s*$", line) is not None + + +def get_indent(line): + return re.match(r"^(\s*)", line).group() + + +def get_comment_header(line): + m = re.match(r"^(\s*#*)", line) + if m is None: + return "" + return m.group(1) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/IdleHistory.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/IdleHistory.py new file mode 100644 index 0000000000000000000000000000000000000000..24e69240087a5c008d51ac9059ff40a6e95bc8d3 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/IdleHistory.py @@ -0,0 +1,87 @@ +class History: + def __init__(self, text, output_sep="\n"): + self.text = text + self.history = [] + self.history_prefix = None + self.history_pointer = None + self.output_sep = output_sep + text.bind("<>", self.history_prev) + text.bind("<>", self.history_next) + + def history_next(self, event): + self.history_do(0) + return "break" + + def history_prev(self, event): + self.history_do(1) + return "break" + + def _get_source(self, start, end): + # Get source code from start index to end index. Lines in the + # text control may be separated by sys.ps2 . + lines = self.text.get(start, end).split(self.output_sep) + return "\n".join(lines) + + def _put_source(self, where, source): + output = self.output_sep.join(source.split("\n")) + self.text.insert(where, output) + + def history_do(self, reverse): + nhist = len(self.history) + pointer = self.history_pointer + prefix = self.history_prefix + if pointer is not None and prefix is not None: + if ( + self.text.compare("insert", "!=", "end-1c") + or self._get_source("iomark", "end-1c") != self.history[pointer] + ): + pointer = prefix = None + if pointer is None or prefix is None: + prefix = self._get_source("iomark", "end-1c") + if reverse: + pointer = nhist + else: + pointer = -1 + nprefix = len(prefix) + while 1: + if reverse: + pointer = pointer - 1 + else: + pointer = pointer + 1 + if pointer < 0 or pointer >= nhist: + self.text.bell() + if self._get_source("iomark", "end-1c") != prefix: + self.text.delete("iomark", "end-1c") + self._put_source("iomark", prefix) + pointer = prefix = None + break + item = self.history[pointer] + if item[:nprefix] == prefix and len(item) > nprefix: + self.text.delete("iomark", "end-1c") + self._put_source("iomark", item) + break + self.text.mark_set("insert", "end-1c") + self.text.see("insert") + self.text.tag_remove("sel", "1.0", "end") + self.history_pointer = pointer + self.history_prefix = prefix + + def history_store(self, source): + source = source.strip() + if len(source) > 2: + # avoid duplicates + try: + self.history.remove(source) + except ValueError: + pass + self.history.append(source) + self.history_pointer = None + self.history_prefix = None + + def recall(self, s): + s = s.strip() + self.text.tag_remove("sel", "1.0", "end") + self.text.delete("iomark", "end-1c") + self.text.mark_set("insert", "end-1c") + self.text.insert("insert", s) + self.text.see("insert") diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/PyParse.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/PyParse.py new file mode 100644 index 0000000000000000000000000000000000000000..173336cadef2d57d5502555c9934b6b5dfbe5323 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/PyParse.py @@ -0,0 +1,591 @@ +import re +import string +import sys + +# Reason last stmt is continued (or C_NONE if it's not). +C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = list(range(4)) + +if 0: # for throwaway debugging output + + def dump(*stuff): + sys.__stdout__.write(" ".join(map(str, stuff)) + "\n") + + +# Find what looks like the start of a popular stmt. + +_synchre = re.compile( + r""" + ^ + [ \t]* + (?: if + | for + | while + | else + | def + | return + | assert + | break + | class + | continue + | elif + | try + | except + | raise + | import + ) + \b +""", + re.VERBOSE | re.MULTILINE, +).search + +# Match blank line or non-indenting comment line. + +_junkre = re.compile( + r""" + [ \t]* + (?: \# \S .* )? + \n +""", + re.VERBOSE, +).match + +# Match any flavor of string; the terminating quote is optional +# so that we're robust in the face of incomplete program text. + +_match_stringre = re.compile( + r""" + \""" [^"\\]* (?: + (?: \\. | "(?!"") ) + [^"\\]* + )* + (?: \""" )? + +| " [^"\\\n]* (?: \\. [^"\\\n]* )* "? + +| ''' [^'\\]* (?: + (?: \\. | '(?!'') ) + [^'\\]* + )* + (?: ''' )? + +| ' [^'\\\n]* (?: \\. [^'\\\n]* )* '? +""", + re.VERBOSE | re.DOTALL, +).match + +# Match a line that starts with something interesting; +# used to find the first item of a bracket structure. + +_itemre = re.compile( + r""" + [ \t]* + [^\s#\\] # if we match, m.end()-1 is the interesting char +""", + re.VERBOSE, +).match + +# Match start of stmts that should be followed by a dedent. + +_closere = re.compile( + r""" + \s* + (?: return + | break + | continue + | raise + | pass + ) + \b +""", + re.VERBOSE, +).match + +# Chew up non-special chars as quickly as possible. If match is +# successful, m.end() less 1 is the index of the last boring char +# matched. If match is unsuccessful, the string starts with an +# interesting char. + +_chew_ordinaryre = re.compile( + r""" + [^[\](){}#'"\\]+ +""", + re.VERBOSE, +).match + +# Build translation table to map uninteresting chars to "x", open +# brackets to "(", and close brackets to ")". + +_tran = ["x"] * 256 +for ch in "({[": + _tran[ord(ch)] = "(" +for ch in ")}]": + _tran[ord(ch)] = ")" +for ch in "\"'\\\n#": + _tran[ord(ch)] = ch +# We are called with unicode strings, and str.translate is one of the few +# py2k functions which can't 'do the right thing' - so take care to ensure +# _tran is full of unicode... +_tran = "".join(_tran) +del ch + + +class Parser: + def __init__(self, indentwidth, tabwidth): + self.indentwidth = indentwidth + self.tabwidth = tabwidth + + def set_str(self, str): + assert len(str) == 0 or str[-1] == "\n", "Oops - have str %r" % (str,) + self.str = str + self.study_level = 0 + + # Return index of a good place to begin parsing, as close to the + # end of the string as possible. This will be the start of some + # popular stmt like "if" or "def". Return None if none found: + # the caller should pass more prior context then, if possible, or + # if not (the entire program text up until the point of interest + # has already been tried) pass 0 to set_lo. + # + # This will be reliable iff given a reliable is_char_in_string + # function, meaning that when it says "no", it's absolutely + # guaranteed that the char is not in a string. + # + # Ack, hack: in the shell window this kills us, because there's + # no way to tell the differences between output, >>> etc and + # user input. Indeed, IDLE's first output line makes the rest + # look like it's in an unclosed paren!: + # Python 1.5.2 (#0, Apr 13 1999, ... + + def find_good_parse_start(self, use_ps1, is_char_in_string=None): + str, pos = self.str, None + if use_ps1: + # shell window + ps1 = "\n" + sys.ps1 + i = str.rfind(ps1) + if i >= 0: + pos = i + len(ps1) + # make it look like there's a newline instead + # of ps1 at the start -- hacking here once avoids + # repeated hackery later + self.str = str[: pos - 1] + "\n" + str[pos:] + return pos + + # File window -- real work. + if not is_char_in_string: + # no clue -- make the caller pass everything + return None + + # Peek back from the end for a good place to start, + # but don't try too often; pos will be left None, or + # bumped to a legitimate synch point. + limit = len(str) + for tries in range(5): + i = str.rfind(":\n", 0, limit) + if i < 0: + break + i = str.rfind("\n", 0, i) + 1 # start of colon line + m = _synchre(str, i, limit) + if m and not is_char_in_string(m.start()): + pos = m.start() + break + limit = i + if pos is None: + # Nothing looks like a block-opener, or stuff does + # but is_char_in_string keeps returning true; most likely + # we're in or near a giant string, the colorizer hasn't + # caught up enough to be helpful, or there simply *aren't* + # any interesting stmts. In any of these cases we're + # going to have to parse the whole thing to be sure, so + # give it one last try from the start, but stop wasting + # time here regardless of the outcome. + m = _synchre(str) + if m and not is_char_in_string(m.start()): + pos = m.start() + return pos + + # Peeking back worked; look forward until _synchre no longer + # matches. + i = pos + 1 + while 1: + m = _synchre(str, i) + if m: + s, i = m.span() + if not is_char_in_string(s): + pos = s + else: + break + return pos + + # Throw away the start of the string. Intended to be called with + # find_good_parse_start's result. + + def set_lo(self, lo): + assert lo == 0 or self.str[lo - 1] == "\n" + if lo > 0: + self.str = self.str[lo:] + + # As quickly as humanly possible , find the line numbers (0- + # based) of the non-continuation lines. + # Creates self.{goodlines, continuation}. + + def _study1(self): + if self.study_level >= 1: + return + self.study_level = 1 + + # Map all uninteresting characters to "x", all open brackets + # to "(", all close brackets to ")", then collapse runs of + # uninteresting characters. This can cut the number of chars + # by a factor of 10-40, and so greatly speed the following loop. + str = self.str + str = str.translate(_tran) + str = str.replace("xxxxxxxx", "x") + str = str.replace("xxxx", "x") + str = str.replace("xx", "x") + str = str.replace("xx", "x") + str = str.replace("\nx", "\n") + # note that replacing x\n with \n would be incorrect, because + # x may be preceded by a backslash + + # March over the squashed version of the program, accumulating + # the line numbers of non-continued stmts, and determining + # whether & why the last stmt is a continuation. + continuation = C_NONE + level = lno = 0 # level is nesting level; lno is line number + self.goodlines = goodlines = [0] + push_good = goodlines.append + i, n = 0, len(str) + while i < n: + ch = str[i] + i = i + 1 + + # cases are checked in decreasing order of frequency + if ch == "x": + continue + + if ch == "\n": + lno = lno + 1 + if level == 0: + push_good(lno) + # else we're in an unclosed bracket structure + continue + + if ch == "(": + level = level + 1 + continue + + if ch == ")": + if level: + level = level - 1 + # else the program is invalid, but we can't complain + continue + + if ch == '"' or ch == "'": + # consume the string + quote = ch + if str[i - 1 : i + 2] == quote * 3: + quote = quote * 3 + w = len(quote) - 1 + i = i + w + while i < n: + ch = str[i] + i = i + 1 + + if ch == "x": + continue + + if str[i - 1 : i + w] == quote: + i = i + w + break + + if ch == "\n": + lno = lno + 1 + if w == 0: + # unterminated single-quoted string + if level == 0: + push_good(lno) + break + continue + + if ch == "\\": + assert i < n + if str[i] == "\n": + lno = lno + 1 + i = i + 1 + continue + + # else comment char or paren inside string + + else: + # didn't break out of the loop, so we're still + # inside a string + continuation = C_STRING + continue # with outer loop + + if ch == "#": + # consume the comment + i = str.find("\n", i) + assert i >= 0 + continue + + assert ch == "\\" + assert i < n + if str[i] == "\n": + lno = lno + 1 + if i + 1 == n: + continuation = C_BACKSLASH + i = i + 1 + + # The last stmt may be continued for all 3 reasons. + # String continuation takes precedence over bracket + # continuation, which beats backslash continuation. + if continuation != C_STRING and level > 0: + continuation = C_BRACKET + self.continuation = continuation + + # Push the final line number as a sentinel value, regardless of + # whether it's continued. + assert (continuation == C_NONE) == (goodlines[-1] == lno) + if goodlines[-1] != lno: + push_good(lno) + + def get_continuation_type(self): + self._study1() + return self.continuation + + # study1 was sufficient to determine the continuation status, + # but doing more requires looking at every character. study2 + # does this for the last interesting statement in the block. + # Creates: + # self.stmt_start, stmt_end + # slice indices of last interesting stmt + # self.lastch + # last non-whitespace character before optional trailing + # comment + # self.lastopenbracketpos + # if continuation is C_BRACKET, index of last open bracket + + def _study2(self): + _ws = string.whitespace + if self.study_level >= 2: + return + self._study1() + self.study_level = 2 + + # Set p and q to slice indices of last interesting stmt. + str, goodlines = self.str, self.goodlines + i = len(goodlines) - 1 + p = len(str) # index of newest line + while i: + assert p + # p is the index of the stmt at line number goodlines[i]. + # Move p back to the stmt at line number goodlines[i-1]. + q = p + for nothing in range(goodlines[i - 1], goodlines[i]): + # tricky: sets p to 0 if no preceding newline + p = str.rfind("\n", 0, p - 1) + 1 + # The stmt str[p:q] isn't a continuation, but may be blank + # or a non-indenting comment line. + if _junkre(str, p): + i = i - 1 + else: + break + if i == 0: + # nothing but junk! + assert p == 0 + q = p + self.stmt_start, self.stmt_end = p, q + + # Analyze this stmt, to find the last open bracket (if any) + # and last interesting character (if any). + lastch = "" + stack = [] # stack of open bracket indices + push_stack = stack.append + while p < q: + # suck up all except ()[]{}'"#\\ + m = _chew_ordinaryre(str, p, q) + if m: + # we skipped at least one boring char + newp = m.end() + # back up over totally boring whitespace + i = newp - 1 # index of last boring char + while i >= p and str[i] in " \t\n": + i = i - 1 + if i >= p: + lastch = str[i] + p = newp + if p >= q: + break + + ch = str[p] + + if ch in "([{": + push_stack(p) + lastch = ch + p = p + 1 + continue + + if ch in ")]}": + if stack: + del stack[-1] + lastch = ch + p = p + 1 + continue + + if ch == '"' or ch == "'": + # consume string + # Note that study1 did this with a Python loop, but + # we use a regexp here; the reason is speed in both + # cases; the string may be huge, but study1 pre-squashed + # strings to a couple of characters per line. study1 + # also needed to keep track of newlines, and we don't + # have to. + lastch = ch + p = _match_stringre(str, p, q).end() + continue + + if ch == "#": + # consume comment and trailing newline + p = str.find("\n", p, q) + 1 + assert p > 0 + continue + + assert ch == "\\" + p = p + 1 # beyond backslash + assert p < q + if str[p] != "\n": + # the program is invalid, but can't complain + lastch = ch + str[p] + p = p + 1 # beyond escaped char + + # end while p < q: + + self.lastch = lastch + if stack: + self.lastopenbracketpos = stack[-1] + + # Assuming continuation is C_BRACKET, return the number + # of spaces the next line should be indented. + + def compute_bracket_indent(self): + self._study2() + assert self.continuation == C_BRACKET + j = self.lastopenbracketpos + str = self.str + n = len(str) + origi = i = str.rfind("\n", 0, j) + 1 + j = j + 1 # one beyond open bracket + # find first list item; set i to start of its line + while j < n: + m = _itemre(str, j) + if m: + j = m.end() - 1 # index of first interesting char + extra = 0 + break + else: + # this line is junk; advance to next line + i = j = str.find("\n", j) + 1 + else: + # nothing interesting follows the bracket; + # reproduce the bracket line's indentation + a level + j = i = origi + while str[j] in " \t": + j = j + 1 + extra = self.indentwidth + return len(str[i:j].expandtabs(self.tabwidth)) + extra + + # Return number of physical lines in last stmt (whether or not + # it's an interesting stmt! this is intended to be called when + # continuation is C_BACKSLASH). + + def get_num_lines_in_stmt(self): + self._study1() + goodlines = self.goodlines + return goodlines[-1] - goodlines[-2] + + # Assuming continuation is C_BACKSLASH, return the number of spaces + # the next line should be indented. Also assuming the new line is + # the first one following the initial line of the stmt. + + def compute_backslash_indent(self): + self._study2() + assert self.continuation == C_BACKSLASH + str = self.str + i = self.stmt_start + while str[i] in " \t": + i = i + 1 + startpos = i + + # See whether the initial line starts an assignment stmt; i.e., + # look for an = operator + endpos = str.find("\n", startpos) + 1 + found = level = 0 + while i < endpos: + ch = str[i] + if ch in "([{": + level = level + 1 + i = i + 1 + elif ch in ")]}": + if level: + level = level - 1 + i = i + 1 + elif ch == '"' or ch == "'": + i = _match_stringre(str, i, endpos).end() + elif ch == "#": + break + elif ( + level == 0 + and ch == "=" + and (i == 0 or str[i - 1] not in "=<>!") + and str[i + 1] != "=" + ): + found = 1 + break + else: + i = i + 1 + + if found: + # found a legit =, but it may be the last interesting + # thing on the line + i = i + 1 # move beyond the = + found = re.match(r"\s*\\", str[i:endpos]) is None + + if not found: + # oh well ... settle for moving beyond the first chunk + # of non-whitespace chars + i = startpos + while str[i] not in " \t\n": + i = i + 1 + + return len(str[self.stmt_start : i].expandtabs(self.tabwidth)) + 1 + + # Return the leading whitespace on the initial line of the last + # interesting stmt. + + def get_base_indent_string(self): + self._study2() + i, n = self.stmt_start, self.stmt_end + j = i + str = self.str + while j < n and str[j] in " \t": + j = j + 1 + return str[i:j] + + # Did the last interesting stmt open a block? + + def is_block_opener(self): + self._study2() + return self.lastch == ":" + + # Did the last interesting stmt close a block? + + def is_block_closer(self): + self._study2() + return _closere(self.str, self.stmt_start) is not None + + # index of last open bracket ({[, or None if none + lastopenbracketpos = None + + def get_last_open_bracket_pos(self): + self._study2() + return self.lastopenbracketpos diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b175d75542a65e75b46893ad90d35f27ac589ee0 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/idle/__init__.py @@ -0,0 +1 @@ +# This file denotes the directory as a Python package. diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/activex.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/activex.py new file mode 100644 index 0000000000000000000000000000000000000000..596bbef5e87137a5c2da9b9afbfa0331fbd9daa0 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/activex.py @@ -0,0 +1,86 @@ +"""Support for ActiveX control hosting in Pythonwin. +""" +import win32ui +import win32uiole + +from . import window + +# XXX - we are still "classic style" classes in py2x, so we need can't yet +# use 'type()' everywhere - revisit soon, as py2x will move to new-style too... +try: + from types import ClassType as new_type +except ImportError: + new_type = type # py3k + + +class Control(window.Wnd): + """An ActiveX control base class. A new class must be derived from both + this class and the Events class. See the demos for more details. + """ + + def __init__(self): + self.__dict__["_dispobj_"] = None + window.Wnd.__init__(self) + + def _GetControlCLSID(self): + return self.CLSID + + def _GetDispatchClass(self): + return self.default_interface + + def _GetEventMap(self): + return self.default_source._dispid_to_func_ + + def CreateControl(self, windowTitle, style, rect, parent, id, lic_string=None): + clsid = str(self._GetControlCLSID()) + self.__dict__["_obj_"] = win32ui.CreateControl( + clsid, windowTitle, style, rect, parent, id, None, False, lic_string + ) + klass = self._GetDispatchClass() + dispobj = klass(win32uiole.GetIDispatchForWindow(self._obj_)) + self.HookOleEvents() + self.__dict__["_dispobj_"] = dispobj + + def HookOleEvents(self): + dict = self._GetEventMap() + for dispid, methodName in dict.items(): + if hasattr(self, methodName): + self._obj_.HookOleEvent(getattr(self, methodName), dispid) + + def __getattr__(self, attr): + # Delegate attributes to the windows and the Dispatch object for this class + try: + return window.Wnd.__getattr__(self, attr) + except AttributeError: + pass + return getattr(self._dispobj_, attr) + + def __setattr__(self, attr, value): + if hasattr(self.__dict__, attr): + self.__dict__[attr] = value + return + try: + if self._dispobj_: + self._dispobj_.__setattr__(attr, value) + return + except AttributeError: + pass + self.__dict__[attr] = value + + +def MakeControlClass(controlClass, name=None): + """Given a CoClass in a generated .py file, this function will return a Class + object which can be used as an OCX control. + + This function is used when you do not want to handle any events from the OCX + control. If you need events, then you should derive a class from both the + activex.Control class and the CoClass + """ + if name is None: + name = controlClass.__name__ + return new_type("OCX" + name, (Control, controlClass), {}) + + +def MakeControlInstance(controlClass, name=None): + """As for MakeControlClass(), but returns an instance of the class.""" + return MakeControlClass(controlClass, name)() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/afxres.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/afxres.py new file mode 100644 index 0000000000000000000000000000000000000000..249211ff359e746a17995d28a2ead6c89bac4f64 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/afxres.py @@ -0,0 +1,501 @@ +# Generated by h2py from stdin +TCS_MULTILINE = 0x0200 +CBRS_ALIGN_LEFT = 0x1000 +CBRS_ALIGN_TOP = 0x2000 +CBRS_ALIGN_RIGHT = 0x4000 +CBRS_ALIGN_BOTTOM = 0x8000 +CBRS_ALIGN_ANY = 0xF000 +CBRS_BORDER_LEFT = 0x0100 +CBRS_BORDER_TOP = 0x0200 +CBRS_BORDER_RIGHT = 0x0400 +CBRS_BORDER_BOTTOM = 0x0800 +CBRS_BORDER_ANY = 0x0F00 +CBRS_TOOLTIPS = 0x0010 +CBRS_FLYBY = 0x0020 +CBRS_FLOAT_MULTI = 0x0040 +CBRS_BORDER_3D = 0x0080 +CBRS_HIDE_INPLACE = 0x0008 +CBRS_SIZE_DYNAMIC = 0x0004 +CBRS_SIZE_FIXED = 0x0002 +CBRS_FLOATING = 0x0001 +CBRS_GRIPPER = 0x00400000 +CBRS_ORIENT_HORZ = CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM +CBRS_ORIENT_VERT = CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT +CBRS_ORIENT_ANY = CBRS_ORIENT_HORZ | CBRS_ORIENT_VERT +CBRS_ALL = 0xFFFF +CBRS_NOALIGN = 0x00000000 +CBRS_LEFT = CBRS_ALIGN_LEFT | CBRS_BORDER_RIGHT +CBRS_TOP = CBRS_ALIGN_TOP | CBRS_BORDER_BOTTOM +CBRS_RIGHT = CBRS_ALIGN_RIGHT | CBRS_BORDER_LEFT +CBRS_BOTTOM = CBRS_ALIGN_BOTTOM | CBRS_BORDER_TOP +SBPS_NORMAL = 0x0000 +SBPS_NOBORDERS = 0x0100 +SBPS_POPOUT = 0x0200 +SBPS_OWNERDRAW = 0x1000 +SBPS_DISABLED = 0x04000000 +SBPS_STRETCH = 0x08000000 +ID_INDICATOR_EXT = 0xE700 +ID_INDICATOR_CAPS = 0xE701 +ID_INDICATOR_NUM = 0xE702 +ID_INDICATOR_SCRL = 0xE703 +ID_INDICATOR_OVR = 0xE704 +ID_INDICATOR_REC = 0xE705 +ID_INDICATOR_KANA = 0xE706 +ID_SEPARATOR = 0 +AFX_IDW_CONTROLBAR_FIRST = 0xE800 +AFX_IDW_CONTROLBAR_LAST = 0xE8FF +AFX_IDW_TOOLBAR = 0xE800 +AFX_IDW_STATUS_BAR = 0xE801 +AFX_IDW_PREVIEW_BAR = 0xE802 +AFX_IDW_RESIZE_BAR = 0xE803 +AFX_IDW_DOCKBAR_TOP = 0xE81B +AFX_IDW_DOCKBAR_LEFT = 0xE81C +AFX_IDW_DOCKBAR_RIGHT = 0xE81D +AFX_IDW_DOCKBAR_BOTTOM = 0xE81E +AFX_IDW_DOCKBAR_FLOAT = 0xE81F + + +def AFX_CONTROLBAR_MASK(nIDC): + return 1 << (nIDC - AFX_IDW_CONTROLBAR_FIRST) + + +AFX_IDW_PANE_FIRST = 0xE900 +AFX_IDW_PANE_LAST = 0xE9FF +AFX_IDW_HSCROLL_FIRST = 0xEA00 +AFX_IDW_VSCROLL_FIRST = 0xEA10 +AFX_IDW_SIZE_BOX = 0xEA20 +AFX_IDW_PANE_SAVE = 0xEA21 +AFX_IDS_APP_TITLE = 0xE000 +AFX_IDS_IDLEMESSAGE = 0xE001 +AFX_IDS_HELPMODEMESSAGE = 0xE002 +AFX_IDS_APP_TITLE_EMBEDDING = 0xE003 +AFX_IDS_COMPANY_NAME = 0xE004 +AFX_IDS_OBJ_TITLE_INPLACE = 0xE005 +ID_FILE_NEW = 0xE100 +ID_FILE_OPEN = 0xE101 +ID_FILE_CLOSE = 0xE102 +ID_FILE_SAVE = 0xE103 +ID_FILE_SAVE_AS = 0xE104 +ID_FILE_PAGE_SETUP = 0xE105 +ID_FILE_PRINT_SETUP = 0xE106 +ID_FILE_PRINT = 0xE107 +ID_FILE_PRINT_DIRECT = 0xE108 +ID_FILE_PRINT_PREVIEW = 0xE109 +ID_FILE_UPDATE = 0xE10A +ID_FILE_SAVE_COPY_AS = 0xE10B +ID_FILE_SEND_MAIL = 0xE10C +ID_FILE_MRU_FIRST = 0xE110 +ID_FILE_MRU_FILE1 = 0xE110 +ID_FILE_MRU_FILE2 = 0xE111 +ID_FILE_MRU_FILE3 = 0xE112 +ID_FILE_MRU_FILE4 = 0xE113 +ID_FILE_MRU_FILE5 = 0xE114 +ID_FILE_MRU_FILE6 = 0xE115 +ID_FILE_MRU_FILE7 = 0xE116 +ID_FILE_MRU_FILE8 = 0xE117 +ID_FILE_MRU_FILE9 = 0xE118 +ID_FILE_MRU_FILE10 = 0xE119 +ID_FILE_MRU_FILE11 = 0xE11A +ID_FILE_MRU_FILE12 = 0xE11B +ID_FILE_MRU_FILE13 = 0xE11C +ID_FILE_MRU_FILE14 = 0xE11D +ID_FILE_MRU_FILE15 = 0xE11E +ID_FILE_MRU_FILE16 = 0xE11F +ID_FILE_MRU_LAST = 0xE11F +ID_EDIT_CLEAR = 0xE120 +ID_EDIT_CLEAR_ALL = 0xE121 +ID_EDIT_COPY = 0xE122 +ID_EDIT_CUT = 0xE123 +ID_EDIT_FIND = 0xE124 +ID_EDIT_PASTE = 0xE125 +ID_EDIT_PASTE_LINK = 0xE126 +ID_EDIT_PASTE_SPECIAL = 0xE127 +ID_EDIT_REPEAT = 0xE128 +ID_EDIT_REPLACE = 0xE129 +ID_EDIT_SELECT_ALL = 0xE12A +ID_EDIT_UNDO = 0xE12B +ID_EDIT_REDO = 0xE12C +ID_WINDOW_NEW = 0xE130 +ID_WINDOW_ARRANGE = 0xE131 +ID_WINDOW_CASCADE = 0xE132 +ID_WINDOW_TILE_HORZ = 0xE133 +ID_WINDOW_TILE_VERT = 0xE134 +ID_WINDOW_SPLIT = 0xE135 +AFX_IDM_WINDOW_FIRST = 0xE130 +AFX_IDM_WINDOW_LAST = 0xE13F +AFX_IDM_FIRST_MDICHILD = 0xFF00 +ID_APP_ABOUT = 0xE140 +ID_APP_EXIT = 0xE141 +ID_HELP_INDEX = 0xE142 +ID_HELP_FINDER = 0xE143 +ID_HELP_USING = 0xE144 +ID_CONTEXT_HELP = 0xE145 +ID_HELP = 0xE146 +ID_DEFAULT_HELP = 0xE147 +ID_NEXT_PANE = 0xE150 +ID_PREV_PANE = 0xE151 +ID_FORMAT_FONT = 0xE160 +ID_OLE_INSERT_NEW = 0xE200 +ID_OLE_EDIT_LINKS = 0xE201 +ID_OLE_EDIT_CONVERT = 0xE202 +ID_OLE_EDIT_CHANGE_ICON = 0xE203 +ID_OLE_EDIT_PROPERTIES = 0xE204 +ID_OLE_VERB_FIRST = 0xE210 +ID_OLE_VERB_LAST = 0xE21F +AFX_ID_PREVIEW_CLOSE = 0xE300 +AFX_ID_PREVIEW_NUMPAGE = 0xE301 +AFX_ID_PREVIEW_NEXT = 0xE302 +AFX_ID_PREVIEW_PREV = 0xE303 +AFX_ID_PREVIEW_PRINT = 0xE304 +AFX_ID_PREVIEW_ZOOMIN = 0xE305 +AFX_ID_PREVIEW_ZOOMOUT = 0xE306 +ID_VIEW_TOOLBAR = 0xE800 +ID_VIEW_STATUS_BAR = 0xE801 +ID_RECORD_FIRST = 0xE900 +ID_RECORD_LAST = 0xE901 +ID_RECORD_NEXT = 0xE902 +ID_RECORD_PREV = 0xE903 +IDC_STATIC = -1 +AFX_IDS_SCFIRST = 0xEF00 +AFX_IDS_SCSIZE = 0xEF00 +AFX_IDS_SCMOVE = 0xEF01 +AFX_IDS_SCMINIMIZE = 0xEF02 +AFX_IDS_SCMAXIMIZE = 0xEF03 +AFX_IDS_SCNEXTWINDOW = 0xEF04 +AFX_IDS_SCPREVWINDOW = 0xEF05 +AFX_IDS_SCCLOSE = 0xEF06 +AFX_IDS_SCRESTORE = 0xEF12 +AFX_IDS_SCTASKLIST = 0xEF13 +AFX_IDS_MDICHILD = 0xEF1F +AFX_IDS_DESKACCESSORY = 0xEFDA +AFX_IDS_OPENFILE = 0xF000 +AFX_IDS_SAVEFILE = 0xF001 +AFX_IDS_ALLFILTER = 0xF002 +AFX_IDS_UNTITLED = 0xF003 +AFX_IDS_SAVEFILECOPY = 0xF004 +AFX_IDS_PREVIEW_CLOSE = 0xF005 +AFX_IDS_UNNAMED_FILE = 0xF006 +AFX_IDS_ABOUT = 0xF010 +AFX_IDS_HIDE = 0xF011 +AFX_IDP_NO_ERROR_AVAILABLE = 0xF020 +AFX_IDS_NOT_SUPPORTED_EXCEPTION = 0xF021 +AFX_IDS_RESOURCE_EXCEPTION = 0xF022 +AFX_IDS_MEMORY_EXCEPTION = 0xF023 +AFX_IDS_USER_EXCEPTION = 0xF024 +AFX_IDS_PRINTONPORT = 0xF040 +AFX_IDS_ONEPAGE = 0xF041 +AFX_IDS_TWOPAGE = 0xF042 +AFX_IDS_PRINTPAGENUM = 0xF043 +AFX_IDS_PREVIEWPAGEDESC = 0xF044 +AFX_IDS_PRINTDEFAULTEXT = 0xF045 +AFX_IDS_PRINTDEFAULT = 0xF046 +AFX_IDS_PRINTFILTER = 0xF047 +AFX_IDS_PRINTCAPTION = 0xF048 +AFX_IDS_PRINTTOFILE = 0xF049 +AFX_IDS_OBJECT_MENUITEM = 0xF080 +AFX_IDS_EDIT_VERB = 0xF081 +AFX_IDS_ACTIVATE_VERB = 0xF082 +AFX_IDS_CHANGE_LINK = 0xF083 +AFX_IDS_AUTO = 0xF084 +AFX_IDS_MANUAL = 0xF085 +AFX_IDS_FROZEN = 0xF086 +AFX_IDS_ALL_FILES = 0xF087 +AFX_IDS_SAVE_MENU = 0xF088 +AFX_IDS_UPDATE_MENU = 0xF089 +AFX_IDS_SAVE_AS_MENU = 0xF08A +AFX_IDS_SAVE_COPY_AS_MENU = 0xF08B +AFX_IDS_EXIT_MENU = 0xF08C +AFX_IDS_UPDATING_ITEMS = 0xF08D +AFX_IDS_METAFILE_FORMAT = 0xF08E +AFX_IDS_DIB_FORMAT = 0xF08F +AFX_IDS_BITMAP_FORMAT = 0xF090 +AFX_IDS_LINKSOURCE_FORMAT = 0xF091 +AFX_IDS_EMBED_FORMAT = 0xF092 +AFX_IDS_PASTELINKEDTYPE = 0xF094 +AFX_IDS_UNKNOWNTYPE = 0xF095 +AFX_IDS_RTF_FORMAT = 0xF096 +AFX_IDS_TEXT_FORMAT = 0xF097 +AFX_IDS_INVALID_CURRENCY = 0xF098 +AFX_IDS_INVALID_DATETIME = 0xF099 +AFX_IDS_INVALID_DATETIMESPAN = 0xF09A +AFX_IDP_INVALID_FILENAME = 0xF100 +AFX_IDP_FAILED_TO_OPEN_DOC = 0xF101 +AFX_IDP_FAILED_TO_SAVE_DOC = 0xF102 +AFX_IDP_ASK_TO_SAVE = 0xF103 +AFX_IDP_FAILED_TO_CREATE_DOC = 0xF104 +AFX_IDP_FILE_TOO_LARGE = 0xF105 +AFX_IDP_FAILED_TO_START_PRINT = 0xF106 +AFX_IDP_FAILED_TO_LAUNCH_HELP = 0xF107 +AFX_IDP_INTERNAL_FAILURE = 0xF108 +AFX_IDP_COMMAND_FAILURE = 0xF109 +AFX_IDP_FAILED_MEMORY_ALLOC = 0xF10A +AFX_IDP_PARSE_INT = 0xF110 +AFX_IDP_PARSE_REAL = 0xF111 +AFX_IDP_PARSE_INT_RANGE = 0xF112 +AFX_IDP_PARSE_REAL_RANGE = 0xF113 +AFX_IDP_PARSE_STRING_SIZE = 0xF114 +AFX_IDP_PARSE_RADIO_BUTTON = 0xF115 +AFX_IDP_PARSE_BYTE = 0xF116 +AFX_IDP_PARSE_UINT = 0xF117 +AFX_IDP_PARSE_DATETIME = 0xF118 +AFX_IDP_PARSE_CURRENCY = 0xF119 +AFX_IDP_FAILED_INVALID_FORMAT = 0xF120 +AFX_IDP_FAILED_INVALID_PATH = 0xF121 +AFX_IDP_FAILED_DISK_FULL = 0xF122 +AFX_IDP_FAILED_ACCESS_READ = 0xF123 +AFX_IDP_FAILED_ACCESS_WRITE = 0xF124 +AFX_IDP_FAILED_IO_ERROR_READ = 0xF125 +AFX_IDP_FAILED_IO_ERROR_WRITE = 0xF126 +AFX_IDP_STATIC_OBJECT = 0xF180 +AFX_IDP_FAILED_TO_CONNECT = 0xF181 +AFX_IDP_SERVER_BUSY = 0xF182 +AFX_IDP_BAD_VERB = 0xF183 +AFX_IDP_FAILED_TO_NOTIFY = 0xF185 +AFX_IDP_FAILED_TO_LAUNCH = 0xF186 +AFX_IDP_ASK_TO_UPDATE = 0xF187 +AFX_IDP_FAILED_TO_UPDATE = 0xF188 +AFX_IDP_FAILED_TO_REGISTER = 0xF189 +AFX_IDP_FAILED_TO_AUTO_REGISTER = 0xF18A +AFX_IDP_FAILED_TO_CONVERT = 0xF18B +AFX_IDP_GET_NOT_SUPPORTED = 0xF18C +AFX_IDP_SET_NOT_SUPPORTED = 0xF18D +AFX_IDP_ASK_TO_DISCARD = 0xF18E +AFX_IDP_FAILED_TO_CREATE = 0xF18F +AFX_IDP_FAILED_MAPI_LOAD = 0xF190 +AFX_IDP_INVALID_MAPI_DLL = 0xF191 +AFX_IDP_FAILED_MAPI_SEND = 0xF192 +AFX_IDP_FILE_NONE = 0xF1A0 +AFX_IDP_FILE_GENERIC = 0xF1A1 +AFX_IDP_FILE_NOT_FOUND = 0xF1A2 +AFX_IDP_FILE_BAD_PATH = 0xF1A3 +AFX_IDP_FILE_TOO_MANY_OPEN = 0xF1A4 +AFX_IDP_FILE_ACCESS_DENIED = 0xF1A5 +AFX_IDP_FILE_INVALID_FILE = 0xF1A6 +AFX_IDP_FILE_REMOVE_CURRENT = 0xF1A7 +AFX_IDP_FILE_DIR_FULL = 0xF1A8 +AFX_IDP_FILE_BAD_SEEK = 0xF1A9 +AFX_IDP_FILE_HARD_IO = 0xF1AA +AFX_IDP_FILE_SHARING = 0xF1AB +AFX_IDP_FILE_LOCKING = 0xF1AC +AFX_IDP_FILE_DISKFULL = 0xF1AD +AFX_IDP_FILE_EOF = 0xF1AE +AFX_IDP_ARCH_NONE = 0xF1B0 +AFX_IDP_ARCH_GENERIC = 0xF1B1 +AFX_IDP_ARCH_READONLY = 0xF1B2 +AFX_IDP_ARCH_ENDOFFILE = 0xF1B3 +AFX_IDP_ARCH_WRITEONLY = 0xF1B4 +AFX_IDP_ARCH_BADINDEX = 0xF1B5 +AFX_IDP_ARCH_BADCLASS = 0xF1B6 +AFX_IDP_ARCH_BADSCHEMA = 0xF1B7 +AFX_IDS_OCC_SCALEUNITS_PIXELS = 0xF1C0 +AFX_IDS_STATUS_FONT = 0xF230 +AFX_IDS_TOOLTIP_FONT = 0xF231 +AFX_IDS_UNICODE_FONT = 0xF232 +AFX_IDS_MINI_FONT = 0xF233 +AFX_IDP_SQL_FIRST = 0xF280 +AFX_IDP_SQL_CONNECT_FAIL = 0xF281 +AFX_IDP_SQL_RECORDSET_FORWARD_ONLY = 0xF282 +AFX_IDP_SQL_EMPTY_COLUMN_LIST = 0xF283 +AFX_IDP_SQL_FIELD_SCHEMA_MISMATCH = 0xF284 +AFX_IDP_SQL_ILLEGAL_MODE = 0xF285 +AFX_IDP_SQL_MULTIPLE_ROWS_AFFECTED = 0xF286 +AFX_IDP_SQL_NO_CURRENT_RECORD = 0xF287 +AFX_IDP_SQL_NO_ROWS_AFFECTED = 0xF288 +AFX_IDP_SQL_RECORDSET_READONLY = 0xF289 +AFX_IDP_SQL_SQL_NO_TOTAL = 0xF28A +AFX_IDP_SQL_ODBC_LOAD_FAILED = 0xF28B +AFX_IDP_SQL_DYNASET_NOT_SUPPORTED = 0xF28C +AFX_IDP_SQL_SNAPSHOT_NOT_SUPPORTED = 0xF28D +AFX_IDP_SQL_API_CONFORMANCE = 0xF28E +AFX_IDP_SQL_SQL_CONFORMANCE = 0xF28F +AFX_IDP_SQL_NO_DATA_FOUND = 0xF290 +AFX_IDP_SQL_ROW_UPDATE_NOT_SUPPORTED = 0xF291 +AFX_IDP_SQL_ODBC_V2_REQUIRED = 0xF292 +AFX_IDP_SQL_NO_POSITIONED_UPDATES = 0xF293 +AFX_IDP_SQL_LOCK_MODE_NOT_SUPPORTED = 0xF294 +AFX_IDP_SQL_DATA_TRUNCATED = 0xF295 +AFX_IDP_SQL_ROW_FETCH = 0xF296 +AFX_IDP_SQL_INCORRECT_ODBC = 0xF297 +AFX_IDP_SQL_UPDATE_DELETE_FAILED = 0xF298 +AFX_IDP_SQL_DYNAMIC_CURSOR_NOT_SUPPORTED = 0xF299 +AFX_IDP_DAO_FIRST = 0xF2A0 +AFX_IDP_DAO_ENGINE_INITIALIZATION = 0xF2A0 +AFX_IDP_DAO_DFX_BIND = 0xF2A1 +AFX_IDP_DAO_OBJECT_NOT_OPEN = 0xF2A2 +AFX_IDP_DAO_ROWTOOSHORT = 0xF2A3 +AFX_IDP_DAO_BADBINDINFO = 0xF2A4 +AFX_IDP_DAO_COLUMNUNAVAILABLE = 0xF2A5 +AFX_IDC_LISTBOX = 100 +AFX_IDC_CHANGE = 101 +AFX_IDC_PRINT_DOCNAME = 201 +AFX_IDC_PRINT_PRINTERNAME = 202 +AFX_IDC_PRINT_PORTNAME = 203 +AFX_IDC_PRINT_PAGENUM = 204 +ID_APPLY_NOW = 0x3021 +ID_WIZBACK = 0x3023 +ID_WIZNEXT = 0x3024 +ID_WIZFINISH = 0x3025 +AFX_IDC_TAB_CONTROL = 0x3020 +AFX_IDD_FILEOPEN = 28676 +AFX_IDD_FILESAVE = 28677 +AFX_IDD_FONT = 28678 +AFX_IDD_COLOR = 28679 +AFX_IDD_PRINT = 28680 +AFX_IDD_PRINTSETUP = 28681 +AFX_IDD_FIND = 28682 +AFX_IDD_REPLACE = 28683 +AFX_IDD_NEWTYPEDLG = 30721 +AFX_IDD_PRINTDLG = 30722 +AFX_IDD_PREVIEW_TOOLBAR = 30723 +AFX_IDD_PREVIEW_SHORTTOOLBAR = 30731 +AFX_IDD_INSERTOBJECT = 30724 +AFX_IDD_CHANGEICON = 30725 +AFX_IDD_CONVERT = 30726 +AFX_IDD_PASTESPECIAL = 30727 +AFX_IDD_EDITLINKS = 30728 +AFX_IDD_FILEBROWSE = 30729 +AFX_IDD_BUSY = 30730 +AFX_IDD_OBJECTPROPERTIES = 30732 +AFX_IDD_CHANGESOURCE = 30733 +AFX_IDC_CONTEXTHELP = 30977 +AFX_IDC_MAGNIFY = 30978 +AFX_IDC_SMALLARROWS = 30979 +AFX_IDC_HSPLITBAR = 30980 +AFX_IDC_VSPLITBAR = 30981 +AFX_IDC_NODROPCRSR = 30982 +AFX_IDC_TRACKNWSE = 30983 +AFX_IDC_TRACKNESW = 30984 +AFX_IDC_TRACKNS = 30985 +AFX_IDC_TRACKWE = 30986 +AFX_IDC_TRACK4WAY = 30987 +AFX_IDC_MOVE4WAY = 30988 +AFX_IDB_MINIFRAME_MENU = 30994 +AFX_IDB_CHECKLISTBOX_NT = 30995 +AFX_IDB_CHECKLISTBOX_95 = 30996 +AFX_IDR_PREVIEW_ACCEL = 30997 +AFX_IDI_STD_MDIFRAME = 31233 +AFX_IDI_STD_FRAME = 31234 +AFX_IDC_FONTPROP = 1000 +AFX_IDC_FONTNAMES = 1001 +AFX_IDC_FONTSTYLES = 1002 +AFX_IDC_FONTSIZES = 1003 +AFX_IDC_STRIKEOUT = 1004 +AFX_IDC_UNDERLINE = 1005 +AFX_IDC_SAMPLEBOX = 1006 +AFX_IDC_COLOR_BLACK = 1100 +AFX_IDC_COLOR_WHITE = 1101 +AFX_IDC_COLOR_RED = 1102 +AFX_IDC_COLOR_GREEN = 1103 +AFX_IDC_COLOR_BLUE = 1104 +AFX_IDC_COLOR_YELLOW = 1105 +AFX_IDC_COLOR_MAGENTA = 1106 +AFX_IDC_COLOR_CYAN = 1107 +AFX_IDC_COLOR_GRAY = 1108 +AFX_IDC_COLOR_LIGHTGRAY = 1109 +AFX_IDC_COLOR_DARKRED = 1110 +AFX_IDC_COLOR_DARKGREEN = 1111 +AFX_IDC_COLOR_DARKBLUE = 1112 +AFX_IDC_COLOR_LIGHTBROWN = 1113 +AFX_IDC_COLOR_DARKMAGENTA = 1114 +AFX_IDC_COLOR_DARKCYAN = 1115 +AFX_IDC_COLORPROP = 1116 +AFX_IDC_SYSTEMCOLORS = 1117 +AFX_IDC_PROPNAME = 1201 +AFX_IDC_PICTURE = 1202 +AFX_IDC_BROWSE = 1203 +AFX_IDC_CLEAR = 1204 +AFX_IDD_PROPPAGE_COLOR = 32257 +AFX_IDD_PROPPAGE_FONT = 32258 +AFX_IDD_PROPPAGE_PICTURE = 32259 +AFX_IDB_TRUETYPE = 32384 +AFX_IDS_PROPPAGE_UNKNOWN = 0xFE01 +AFX_IDS_COLOR_DESKTOP = 0xFE04 +AFX_IDS_COLOR_APPWORKSPACE = 0xFE05 +AFX_IDS_COLOR_WNDBACKGND = 0xFE06 +AFX_IDS_COLOR_WNDTEXT = 0xFE07 +AFX_IDS_COLOR_MENUBAR = 0xFE08 +AFX_IDS_COLOR_MENUTEXT = 0xFE09 +AFX_IDS_COLOR_ACTIVEBAR = 0xFE0A +AFX_IDS_COLOR_INACTIVEBAR = 0xFE0B +AFX_IDS_COLOR_ACTIVETEXT = 0xFE0C +AFX_IDS_COLOR_INACTIVETEXT = 0xFE0D +AFX_IDS_COLOR_ACTIVEBORDER = 0xFE0E +AFX_IDS_COLOR_INACTIVEBORDER = 0xFE0F +AFX_IDS_COLOR_WNDFRAME = 0xFE10 +AFX_IDS_COLOR_SCROLLBARS = 0xFE11 +AFX_IDS_COLOR_BTNFACE = 0xFE12 +AFX_IDS_COLOR_BTNSHADOW = 0xFE13 +AFX_IDS_COLOR_BTNTEXT = 0xFE14 +AFX_IDS_COLOR_BTNHIGHLIGHT = 0xFE15 +AFX_IDS_COLOR_DISABLEDTEXT = 0xFE16 +AFX_IDS_COLOR_HIGHLIGHT = 0xFE17 +AFX_IDS_COLOR_HIGHLIGHTTEXT = 0xFE18 +AFX_IDS_REGULAR = 0xFE19 +AFX_IDS_BOLD = 0xFE1A +AFX_IDS_ITALIC = 0xFE1B +AFX_IDS_BOLDITALIC = 0xFE1C +AFX_IDS_SAMPLETEXT = 0xFE1D +AFX_IDS_DISPLAYSTRING_FONT = 0xFE1E +AFX_IDS_DISPLAYSTRING_COLOR = 0xFE1F +AFX_IDS_DISPLAYSTRING_PICTURE = 0xFE20 +AFX_IDS_PICTUREFILTER = 0xFE21 +AFX_IDS_PICTYPE_UNKNOWN = 0xFE22 +AFX_IDS_PICTYPE_NONE = 0xFE23 +AFX_IDS_PICTYPE_BITMAP = 0xFE24 +AFX_IDS_PICTYPE_METAFILE = 0xFE25 +AFX_IDS_PICTYPE_ICON = 0xFE26 +AFX_IDS_COLOR_PPG = 0xFE28 +AFX_IDS_COLOR_PPG_CAPTION = 0xFE29 +AFX_IDS_FONT_PPG = 0xFE2A +AFX_IDS_FONT_PPG_CAPTION = 0xFE2B +AFX_IDS_PICTURE_PPG = 0xFE2C +AFX_IDS_PICTURE_PPG_CAPTION = 0xFE2D +AFX_IDS_PICTUREBROWSETITLE = 0xFE30 +AFX_IDS_BORDERSTYLE_0 = 0xFE31 +AFX_IDS_BORDERSTYLE_1 = 0xFE32 +AFX_IDS_VERB_EDIT = 0xFE40 +AFX_IDS_VERB_PROPERTIES = 0xFE41 +AFX_IDP_PICTURECANTOPEN = 0xFE83 +AFX_IDP_PICTURECANTLOAD = 0xFE84 +AFX_IDP_PICTURETOOLARGE = 0xFE85 +AFX_IDP_PICTUREREADFAILED = 0xFE86 +AFX_IDP_E_ILLEGALFUNCTIONCALL = 0xFEA0 +AFX_IDP_E_OVERFLOW = 0xFEA1 +AFX_IDP_E_OUTOFMEMORY = 0xFEA2 +AFX_IDP_E_DIVISIONBYZERO = 0xFEA3 +AFX_IDP_E_OUTOFSTRINGSPACE = 0xFEA4 +AFX_IDP_E_OUTOFSTACKSPACE = 0xFEA5 +AFX_IDP_E_BADFILENAMEORNUMBER = 0xFEA6 +AFX_IDP_E_FILENOTFOUND = 0xFEA7 +AFX_IDP_E_BADFILEMODE = 0xFEA8 +AFX_IDP_E_FILEALREADYOPEN = 0xFEA9 +AFX_IDP_E_DEVICEIOERROR = 0xFEAA +AFX_IDP_E_FILEALREADYEXISTS = 0xFEAB +AFX_IDP_E_BADRECORDLENGTH = 0xFEAC +AFX_IDP_E_DISKFULL = 0xFEAD +AFX_IDP_E_BADRECORDNUMBER = 0xFEAE +AFX_IDP_E_BADFILENAME = 0xFEAF +AFX_IDP_E_TOOMANYFILES = 0xFEB0 +AFX_IDP_E_DEVICEUNAVAILABLE = 0xFEB1 +AFX_IDP_E_PERMISSIONDENIED = 0xFEB2 +AFX_IDP_E_DISKNOTREADY = 0xFEB3 +AFX_IDP_E_PATHFILEACCESSERROR = 0xFEB4 +AFX_IDP_E_PATHNOTFOUND = 0xFEB5 +AFX_IDP_E_INVALIDPATTERNSTRING = 0xFEB6 +AFX_IDP_E_INVALIDUSEOFNULL = 0xFEB7 +AFX_IDP_E_INVALIDFILEFORMAT = 0xFEB8 +AFX_IDP_E_INVALIDPROPERTYVALUE = 0xFEB9 +AFX_IDP_E_INVALIDPROPERTYARRAYINDEX = 0xFEBA +AFX_IDP_E_SETNOTSUPPORTEDATRUNTIME = 0xFEBB +AFX_IDP_E_SETNOTSUPPORTED = 0xFEBC +AFX_IDP_E_NEEDPROPERTYARRAYINDEX = 0xFEBD +AFX_IDP_E_SETNOTPERMITTED = 0xFEBE +AFX_IDP_E_GETNOTSUPPORTEDATRUNTIME = 0xFEBF +AFX_IDP_E_GETNOTSUPPORTED = 0xFEC0 +AFX_IDP_E_PROPERTYNOTFOUND = 0xFEC1 +AFX_IDP_E_INVALIDCLIPBOARDFORMAT = 0xFEC2 +AFX_IDP_E_INVALIDPICTURE = 0xFEC3 +AFX_IDP_E_PRINTERERROR = 0xFEC4 +AFX_IDP_E_CANTSAVEFILETOTEMP = 0xFEC5 +AFX_IDP_E_SEARCHTEXTNOTFOUND = 0xFEC6 +AFX_IDP_E_REPLACEMENTSTOOLONG = 0xFEC7 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/dialog.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/dialog.py new file mode 100644 index 0000000000000000000000000000000000000000..25fe13635bced28e12fb931e7b03163ef454c009 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/dialog.py @@ -0,0 +1,278 @@ +""" \ +Base class for Dialogs. Also contains a few useful utility functions +""" +# dialog.py +# Python class for Dialog Boxes in PythonWin. + +import win32con +import win32ui + +# sob - 2to3 doesn't see this as a relative import :( +from pywin.mfc import window + + +def dllFromDll(dllid): + "given a 'dll' (maybe a dll, filename, etc), return a DLL object" + if dllid == None: + return None + elif type("") == type(dllid): + return win32ui.LoadLibrary(dllid) + else: + try: + dllid.GetFileName() + except AttributeError: + raise TypeError("DLL parameter must be None, a filename or a dll object") + return dllid + + +class Dialog(window.Wnd): + "Base class for a dialog" + + def __init__(self, id, dllid=None): + """id is the resource ID, or a template + dllid may be None, a dll object, or a string with a dll name""" + # must take a reference to the DLL until InitDialog. + self.dll = dllFromDll(dllid) + if type(id) == type([]): # a template + dlg = win32ui.CreateDialogIndirect(id) + else: + dlg = win32ui.CreateDialog(id, self.dll) + window.Wnd.__init__(self, dlg) + self.HookCommands() + self.bHaveInit = None + + def HookCommands(self): + pass + + def OnAttachedObjectDeath(self): + self.data = self._obj_.data + window.Wnd.OnAttachedObjectDeath(self) + + # provide virtuals. + def OnOK(self): + self._obj_.OnOK() + + def OnCancel(self): + self._obj_.OnCancel() + + def OnInitDialog(self): + self.bHaveInit = 1 + if self._obj_.data: + self._obj_.UpdateData(0) + return 1 # I did NOT set focus to a child window. + + def OnDestroy(self, msg): + self.dll = None # theoretically not needed if object destructs normally. + + # DDX support + def AddDDX(self, *args): + self._obj_.datalist.append(args) + + # Make a dialog object look like a dictionary for the DDX support + def __bool__(self): + return True + + def __len__(self): + return len(self.data) + + def __getitem__(self, key): + return self.data[key] + + def __setitem__(self, key, item): + self._obj_.data[key] = item # self.UpdateData(0) + + def keys(self): + return list(self.data.keys()) + + def items(self): + return list(self.data.items()) + + def values(self): + return list(self.data.values()) + + # XXX - needs py3k work! + def has_key(self, key): + return key in self.data + + +class PrintDialog(Dialog): + "Base class for a print dialog" + + def __init__( + self, + pInfo, + dlgID, + printSetupOnly=0, + flags=( + win32ui.PD_ALLPAGES + | win32ui.PD_USEDEVMODECOPIES + | win32ui.PD_NOPAGENUMS + | win32ui.PD_HIDEPRINTTOFILE + | win32ui.PD_NOSELECTION + ), + parent=None, + dllid=None, + ): + self.dll = dllFromDll(dllid) + if type(dlgID) == type([]): # a template + raise TypeError("dlgID parameter must be an integer resource ID") + dlg = win32ui.CreatePrintDialog(dlgID, printSetupOnly, flags, parent, self.dll) + window.Wnd.__init__(self, dlg) + self.HookCommands() + self.bHaveInit = None + self.pInfo = pInfo + # init values (if PrintSetup is called, values still available) + flags = pInfo.GetFlags() + self["toFile"] = flags & win32ui.PD_PRINTTOFILE != 0 + self["direct"] = pInfo.GetDirect() + self["preview"] = pInfo.GetPreview() + self["continuePrinting"] = pInfo.GetContinuePrinting() + self["curPage"] = pInfo.GetCurPage() + self["numPreviewPages"] = pInfo.GetNumPreviewPages() + self["userData"] = pInfo.GetUserData() + self["draw"] = pInfo.GetDraw() + self["pageDesc"] = pInfo.GetPageDesc() + self["minPage"] = pInfo.GetMinPage() + self["maxPage"] = pInfo.GetMaxPage() + self["offsetPage"] = pInfo.GetOffsetPage() + self["fromPage"] = pInfo.GetFromPage() + self["toPage"] = pInfo.GetToPage() + # these values updated after OnOK + self["copies"] = 0 + self["deviceName"] = "" + self["driverName"] = "" + self["printAll"] = 0 + self["printCollate"] = 0 + self["printRange"] = 0 + self["printSelection"] = 0 + + def OnInitDialog(self): + self.pInfo.CreatePrinterDC() # This also sets the hDC of the pInfo structure. + return self._obj_.OnInitDialog() + + def OnCancel(self): + del self.pInfo + + def OnOK(self): + """DoModal has finished. Can now access the users choices""" + self._obj_.OnOK() + pInfo = self.pInfo + # user values + flags = pInfo.GetFlags() + self["toFile"] = flags & win32ui.PD_PRINTTOFILE != 0 + self["direct"] = pInfo.GetDirect() + self["preview"] = pInfo.GetPreview() + self["continuePrinting"] = pInfo.GetContinuePrinting() + self["curPage"] = pInfo.GetCurPage() + self["numPreviewPages"] = pInfo.GetNumPreviewPages() + self["userData"] = pInfo.GetUserData() + self["draw"] = pInfo.GetDraw() + self["pageDesc"] = pInfo.GetPageDesc() + self["minPage"] = pInfo.GetMinPage() + self["maxPage"] = pInfo.GetMaxPage() + self["offsetPage"] = pInfo.GetOffsetPage() + self["fromPage"] = pInfo.GetFromPage() + self["toPage"] = pInfo.GetToPage() + self["copies"] = pInfo.GetCopies() + self["deviceName"] = pInfo.GetDeviceName() + self["driverName"] = pInfo.GetDriverName() + self["printAll"] = pInfo.PrintAll() + self["printCollate"] = pInfo.PrintCollate() + self["printRange"] = pInfo.PrintRange() + self["printSelection"] = pInfo.PrintSelection() + del self.pInfo + + +class PropertyPage(Dialog): + "Base class for a Property Page" + + def __init__(self, id, dllid=None, caption=0): + """id is the resource ID + dllid may be None, a dll object, or a string with a dll name""" + + self.dll = dllFromDll(dllid) + if self.dll: + oldRes = win32ui.SetResource(self.dll) + if type(id) == type([]): + dlg = win32ui.CreatePropertyPageIndirect(id) + else: + dlg = win32ui.CreatePropertyPage(id, caption) + if self.dll: + win32ui.SetResource(oldRes) + # dont call dialog init! + window.Wnd.__init__(self, dlg) + self.HookCommands() + + +class PropertySheet(window.Wnd): + def __init__(self, caption, dll=None, pageList=None): # parent=None, style,etc): + "Initialize a property sheet. pageList is a list of ID's" + # must take a reference to the DLL until InitDialog. + self.dll = dllFromDll(dll) + self.sheet = win32ui.CreatePropertySheet(caption) + window.Wnd.__init__(self, self.sheet) + if not pageList is None: + self.AddPage(pageList) + + def OnInitDialog(self): + return self._obj_.OnInitDialog() + + def DoModal(self): + if self.dll: + oldRes = win32ui.SetResource(self.dll) + rc = self.sheet.DoModal() + if self.dll: + win32ui.SetResource(oldRes) + return rc + + def AddPage(self, pages): + if self.dll: + oldRes = win32ui.SetResource(self.dll) + try: # try list style access + pages[0] + isSeq = 1 + except (TypeError, KeyError): + isSeq = 0 + if isSeq: + for page in pages: + self.DoAddSinglePage(page) + else: + self.DoAddSinglePage(pages) + if self.dll: + win32ui.SetResource(oldRes) + + def DoAddSinglePage(self, page): + "Page may be page, or int ID. Assumes DLL setup" + if type(page) == type(0): + self.sheet.AddPage(win32ui.CreatePropertyPage(page)) + else: + self.sheet.AddPage(page) + + +# define some app utility functions. +def GetSimpleInput(prompt, defValue="", title=None): + """displays a dialog, and returns a string, or None if cancelled. + args prompt, defValue='', title=main frames title""" + # uses a simple dialog to return a string object. + if title is None: + title = win32ui.GetMainFrame().GetWindowText() + # 2to3 insists on converting 'Dialog.__init__' to 'tkinter.dialog...' + DlgBaseClass = Dialog + + class DlgSimpleInput(DlgBaseClass): + def __init__(self, prompt, defValue, title): + self.title = title + DlgBaseClass.__init__(self, win32ui.IDD_SIMPLE_INPUT) + self.AddDDX(win32ui.IDC_EDIT1, "result") + self.AddDDX(win32ui.IDC_PROMPT1, "prompt") + self._obj_.data["result"] = defValue + self._obj_.data["prompt"] = prompt + + def OnInitDialog(self): + self.SetWindowText(self.title) + return DlgBaseClass.OnInitDialog(self) + + dlg = DlgSimpleInput(prompt, defValue, title) + if dlg.DoModal() != win32con.IDOK: + return None + return dlg["result"] diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/docview.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/docview.py new file mode 100644 index 0000000000000000000000000000000000000000..7da91b460d3545bfcd02ebbfdc063086a26f1890 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/docview.py @@ -0,0 +1,151 @@ +# document and view classes for MFC. +import win32ui + +from . import object, window + + +class View(window.Wnd): + def __init__(self, initobj): + window.Wnd.__init__(self, initobj) + + def OnInitialUpdate(self): + pass + + +# Simple control based views. +class CtrlView(View): + def __init__(self, doc, wndclass, style=0): + View.__init__(self, win32ui.CreateCtrlView(doc, wndclass, style)) + + +class EditView(CtrlView): + def __init__(self, doc): + View.__init__(self, win32ui.CreateEditView(doc)) + + +class RichEditView(CtrlView): + def __init__(self, doc): + View.__init__(self, win32ui.CreateRichEditView(doc)) + + +class ListView(CtrlView): + def __init__(self, doc): + View.__init__(self, win32ui.CreateListView(doc)) + + +class TreeView(CtrlView): + def __init__(self, doc): + View.__init__(self, win32ui.CreateTreeView(doc)) + + +# Other more advanced views. +class ScrollView(View): + def __init__(self, doc): + View.__init__(self, win32ui.CreateView(doc)) + + +class FormView(View): + def __init__(self, doc, id): + View.__init__(self, win32ui.CreateFormView(doc, id)) + + +class Document(object.CmdTarget): + def __init__(self, template, docobj=None): + if docobj is None: + docobj = template.DoCreateDoc() + object.CmdTarget.__init__(self, docobj) + + +class RichEditDoc(object.CmdTarget): + def __init__(self, template): + object.CmdTarget.__init__(self, template.DoCreateRichEditDoc()) + + +class CreateContext: + "A transient base class used as a CreateContext" + + def __init__(self, template, doc=None): + self.template = template + self.doc = doc + + def __del__(self): + self.close() + + def close(self): + self.doc = None + self.template = None + + +class DocTemplate(object.CmdTarget): + def __init__( + self, resourceId=None, MakeDocument=None, MakeFrame=None, MakeView=None + ): + if resourceId is None: + resourceId = win32ui.IDR_PYTHONTYPE + object.CmdTarget.__init__(self, self._CreateDocTemplate(resourceId)) + self.MakeDocument = MakeDocument + self.MakeFrame = MakeFrame + self.MakeView = MakeView + self._SetupSharedMenu_() + + def _SetupSharedMenu_(self): + pass # to be overridden by each "app" + + def _CreateDocTemplate(self, resourceId): + return win32ui.CreateDocTemplate(resourceId) + + def __del__(self): + object.CmdTarget.__del__(self) + + def CreateCreateContext(self, doc=None): + return CreateContext(self, doc) + + def CreateNewFrame(self, doc): + makeFrame = self.MakeFrame + if makeFrame is None: + makeFrame = window.MDIChildWnd + wnd = makeFrame() + context = self.CreateCreateContext(doc) + wnd.LoadFrame( + self.GetResourceID(), -1, None, context + ) # triggers OnCreateClient... + return wnd + + def CreateNewDocument(self): + makeDocument = self.MakeDocument + if makeDocument is None: + makeDocument = Document + return makeDocument(self) + + def CreateView(self, frame, context): + makeView = self.MakeView + if makeView is None: + makeView = EditView + view = makeView(context.doc) + view.CreateWindow(frame) + + +class RichEditDocTemplate(DocTemplate): + def __init__( + self, resourceId=None, MakeDocument=None, MakeFrame=None, MakeView=None + ): + if MakeView is None: + MakeView = RichEditView + if MakeDocument is None: + MakeDocument = RichEditDoc + DocTemplate.__init__(self, resourceId, MakeDocument, MakeFrame, MakeView) + + def _CreateDocTemplate(self, resourceId): + return win32ui.CreateRichEditDocTemplate(resourceId) + + +def t(): + class FormTemplate(DocTemplate): + def CreateView(self, frame, context): + makeView = self.MakeView + # view = FormView(context.doc, win32ui.IDD_PROPDEMO1) + view = ListView(context.doc) + view.CreateWindow(frame) + + t = FormTemplate() + return t.OpenDocumentFile(None) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/object.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/object.py new file mode 100644 index 0000000000000000000000000000000000000000..70138b6ee2ab05d3404a97bd0597750796dc4c6c --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/object.py @@ -0,0 +1,66 @@ +# MFC base classes. + +import win32ui + + +class Object: + def __init__(self, initObj=None): + self.__dict__["_obj_"] = initObj + # self._obj_ = initObj + if initObj is not None: + initObj.AttachObject(self) + + def __del__(self): + self.close() + + def __getattr__( + self, attr + ): # Make this object look like the underlying win32ui one. + # During cleanup __dict__ is not available, causing recursive death. + if not attr.startswith("__"): + try: + o = self.__dict__["_obj_"] + if o is not None: + return getattr(o, attr) + # Only raise this error for non "internal" names - + # Python may be calling __len__, __nonzero__, etc, so + # we dont want this exception + if attr[0] != "_" and attr[-1] != "_": + raise win32ui.error("The MFC object has died.") + except KeyError: + # No _obj_ at all - dont report MFC object died when there isnt one! + pass + raise AttributeError(attr) + + def OnAttachedObjectDeath(self): + # print "object", self.__class__.__name__, "dieing" + self._obj_ = None + + def close(self): + if "_obj_" in self.__dict__: + if self._obj_ is not None: + self._obj_.AttachObject(None) + self._obj_ = None + + +class CmdTarget(Object): + def __init__(self, initObj): + Object.__init__(self, initObj) + + def HookNotifyRange(self, handler, firstID, lastID): + oldhandlers = [] + for i in range(firstID, lastID + 1): + oldhandlers.append(self.HookNotify(handler, i)) + return oldhandlers + + def HookCommandRange(self, handler, firstID, lastID): + oldhandlers = [] + for i in range(firstID, lastID + 1): + oldhandlers.append(self.HookCommand(handler, i)) + return oldhandlers + + def HookCommandUpdateRange(self, handler, firstID, lastID): + oldhandlers = [] + for i in range(firstID, lastID + 1): + oldhandlers.append(self.HookCommandUpdate(handler, i)) + return oldhandlers diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/thread.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/thread.py new file mode 100644 index 0000000000000000000000000000000000000000..90a0a762cb4453db678c6e1060ccc7f9759d7b3c --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/thread.py @@ -0,0 +1,25 @@ +# Thread and application objects + +import win32ui + +from . import object + + +class WinThread(object.CmdTarget): + def __init__(self, initObj=None): + if initObj is None: + initObj = win32ui.CreateThread() + object.CmdTarget.__init__(self, initObj) + + def InitInstance(self): + pass # Default None/0 return indicates success for InitInstance() + + def ExitInstance(self): + pass + + +class WinApp(WinThread): + def __init__(self, initApp=None): + if initApp is None: + initApp = win32ui.GetApp() + WinThread.__init__(self, initApp) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/window.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/window.py new file mode 100644 index 0000000000000000000000000000000000000000..e52a7c1cfb19a3ee752f72d0e7495a34690e1d00 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/mfc/window.py @@ -0,0 +1,50 @@ +# The MFCish window classes. +import win32con +import win32ui + +from . import object + + +class Wnd(object.CmdTarget): + def __init__(self, initobj=None): + object.CmdTarget.__init__(self, initobj) + if self._obj_: + self._obj_.HookMessage(self.OnDestroy, win32con.WM_DESTROY) + + def OnDestroy(self, msg): + pass + + +# NOTE NOTE - This facility is currently disabled in Pythonwin!!!!! +# Note - to process all messages for your window, add the following method +# to a derived class. This code provides default message handling (ie, is +# identical, except presumably in speed, as if the method did not exist at +# all, so presumably will be modified to test for specific messages to be +# useful! +# def WindowProc(self, msg, wParam, lParam): +# rc, lResult = self._obj_.OnWndMsg(msg, wParam, lParam) +# if not rc: lResult = self._obj_.DefWindowProc(msg, wParam, lParam) +# return lResult + + +class FrameWnd(Wnd): + def __init__(self, wnd): + Wnd.__init__(self, wnd) + + +class MDIChildWnd(FrameWnd): + def __init__(self, wnd=None): + if wnd is None: + wnd = win32ui.CreateMDIChild() + FrameWnd.__init__(self, wnd) + + def OnCreateClient(self, cp, context): + if context is not None and context.template is not None: + context.template.CreateView(self, context) + + +class MDIFrameWnd(FrameWnd): + def __init__(self, wnd=None): + if wnd is None: + wnd = win32ui.CreateMDIFrame() + FrameWnd.__init__(self, wnd) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/IDLEenvironment.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/IDLEenvironment.py new file mode 100644 index 0000000000000000000000000000000000000000..b1db5093160c4df79ccac6314c27d14b16f235a4 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/IDLEenvironment.py @@ -0,0 +1,598 @@ +# Code that allows Pythonwin to pretend it is IDLE +# (at least as far as most IDLE extensions are concerned) + +import string +import sys + +import win32api +import win32con +import win32ui +from pywin import default_scintilla_encoding +from pywin.mfc.dialog import GetSimpleInput + +wordchars = string.ascii_uppercase + string.ascii_lowercase + string.digits + + +class TextError(Exception): # When a TclError would normally be raised. + pass + + +class EmptyRange(Exception): # Internally raised. + pass + + +def GetIDLEModule(module): + try: + # First get it from Pythonwin it is exists. + modname = "pywin.idle." + module + __import__(modname) + except ImportError as details: + msg = ( + "The IDLE extension '%s' can not be located.\r\n\r\n" + "Please correct the installation and restart the" + " application.\r\n\r\n%s" % (module, details) + ) + win32ui.MessageBox(msg) + return None + mod = sys.modules[modname] + mod.TclError = TextError # A hack that can go soon! + return mod + + +# A class that is injected into the IDLE auto-indent extension. +# It allows for decent performance when opening a new file, +# as auto-indent uses the tokenizer module to determine indents. +# The default AutoIndent readline method works OK, but it goes through +# this layer of Tk index indirection for every single line. For large files +# without indents (and even small files with indents :-) it was pretty slow! +def fast_readline(self): + if self.finished: + val = "" + else: + if "_scint_lines" not in self.__dict__: + # XXX - note - assumes this is only called once the file is loaded! + self._scint_lines = self.text.edit.GetTextRange().split("\n") + sl = self._scint_lines + i = self.i = self.i + 1 + if i >= len(sl): + val = "" + else: + val = sl[i] + "\n" + return val.encode(default_scintilla_encoding) + + +try: + GetIDLEModule("AutoIndent").IndentSearcher.readline = fast_readline +except AttributeError: # GetIDLEModule may return None + pass + + +# A class that attempts to emulate an IDLE editor window. +# Construct with a Pythonwin view. +class IDLEEditorWindow: + def __init__(self, edit): + self.edit = edit + self.text = TkText(edit) + self.extensions = {} + self.extension_menus = {} + + def close(self): + self.edit = self.text = None + self.extension_menus = None + try: + for ext in self.extensions.values(): + closer = getattr(ext, "close", None) + if closer is not None: + closer() + finally: + self.extensions = {} + + def IDLEExtension(self, extension): + ext = self.extensions.get(extension) + if ext is not None: + return ext + mod = GetIDLEModule(extension) + if mod is None: + return None + klass = getattr(mod, extension) + ext = self.extensions[extension] = klass(self) + # Find and bind all the events defined in the extension. + events = [item for item in dir(klass) if item[-6:] == "_event"] + for event in events: + name = "<<%s>>" % (event[:-6].replace("_", "-"),) + self.edit.bindings.bind(name, getattr(ext, event)) + return ext + + def GetMenuItems(self, menu_name): + # Get all menu items for the menu name (eg, "edit") + bindings = self.edit.bindings + ret = [] + for ext in self.extensions.values(): + menudefs = getattr(ext, "menudefs", []) + for name, items in menudefs: + if name == menu_name: + for text, event in [item for item in items if item is not None]: + text = text.replace("&", "&&") + text = text.replace("_", "&") + ret.append((text, event)) + return ret + + ###################################################################### + # The IDLE "Virtual UI" methods that are exposed to the IDLE extensions. + # + def askinteger( + self, caption, prompt, parent=None, initialvalue=0, minvalue=None, maxvalue=None + ): + while 1: + rc = GetSimpleInput(prompt, str(initialvalue), caption) + if rc is None: + return 0 # Correct "cancel" semantics? + err = None + try: + rc = int(rc) + except ValueError: + err = "Please enter an integer" + if not err and minvalue is not None and rc < minvalue: + err = "Please enter an integer greater then or equal to %s" % ( + minvalue, + ) + if not err and maxvalue is not None and rc > maxvalue: + err = "Please enter an integer less then or equal to %s" % (maxvalue,) + if err: + win32ui.MessageBox(err, caption, win32con.MB_OK) + continue + return rc + + def askyesno(self, caption, prompt, parent=None): + return win32ui.MessageBox(prompt, caption, win32con.MB_YESNO) == win32con.IDYES + + ###################################################################### + # The IDLE "Virtual Text Widget" methods that are exposed to the IDLE extensions. + # + + # Is character at text_index in a Python string? Return 0 for + # "guaranteed no", true for anything else. + def is_char_in_string(self, text_index): + # A helper for the code analyser - we need internal knowledge of + # the colorizer to get this information + # This assumes the colorizer has got to this point! + text_index = self.text._getoffset(text_index) + c = self.text.edit._GetColorizer() + if c and c.GetStringStyle(text_index) is None: + return 0 + return 1 + + # If a selection is defined in the text widget, return + # (start, end) as Tkinter text indices, otherwise return + # (None, None) + def get_selection_indices(self): + try: + first = self.text.index("sel.first") + last = self.text.index("sel.last") + return first, last + except TextError: + return None, None + + def set_tabwidth(self, width): + self.edit.SCISetTabWidth(width) + + def get_tabwidth(self): + return self.edit.GetTabWidth() + + +# A class providing the generic "Call Tips" interface +class CallTips: + def __init__(self, edit): + self.edit = edit + + def showtip(self, tip_text): + self.edit.SCICallTipShow(tip_text) + + def hidetip(self): + self.edit.SCICallTipCancel() + + +######################################## +# +# Helpers for the TkText emulation. +def TkOffsetToIndex(offset, edit): + lineoff = 0 + # May be 1 > actual end if we pretended there was a trailing '\n' + offset = min(offset, edit.GetTextLength()) + line = edit.LineFromChar(offset) + lineIndex = edit.LineIndex(line) + return "%d.%d" % (line + 1, offset - lineIndex) + + +def _NextTok(str, pos): + # Returns (token, endPos) + end = len(str) + if pos >= end: + return None, 0 + while pos < end and str[pos] in string.whitespace: + pos = pos + 1 + # Special case for +- + if str[pos] in "+-": + return str[pos], pos + 1 + # Digits also a special case. + endPos = pos + while endPos < end and str[endPos] in string.digits + ".": + endPos = endPos + 1 + if pos != endPos: + return str[pos:endPos], endPos + endPos = pos + while endPos < end and str[endPos] not in string.whitespace + string.digits + "+-": + endPos = endPos + 1 + if pos != endPos: + return str[pos:endPos], endPos + return None, 0 + + +def TkIndexToOffset(bm, edit, marks): + base, nextTokPos = _NextTok(bm, 0) + if base is None: + raise ValueError("Empty bookmark ID!") + if base.find(".") > 0: + try: + line, col = base.split(".", 2) + if col == "first" or col == "last": + # Tag name + if line != "sel": + raise ValueError("Tags arent here!") + sel = edit.GetSel() + if sel[0] == sel[1]: + raise EmptyRange + if col == "first": + pos = sel[0] + else: + pos = sel[1] + else: + # Lines are 1 based for tkinter + line = int(line) - 1 + if line > edit.GetLineCount(): + pos = edit.GetTextLength() + 1 + else: + pos = edit.LineIndex(line) + if pos == -1: + pos = edit.GetTextLength() + pos = pos + int(col) + except (ValueError, IndexError): + raise ValueError("Unexpected literal in '%s'" % base) + elif base == "insert": + pos = edit.GetSel()[0] + elif base == "end": + pos = edit.GetTextLength() + # Pretend there is a trailing '\n' if necessary + if pos and edit.SCIGetCharAt(pos - 1) != "\n": + pos = pos + 1 + else: + try: + pos = marks[base] + except KeyError: + raise ValueError("Unsupported base offset or undefined mark '%s'" % base) + + while 1: + word, nextTokPos = _NextTok(bm, nextTokPos) + if word is None: + break + if word in ("+", "-"): + num, nextTokPos = _NextTok(bm, nextTokPos) + if num is None: + raise ValueError("+/- operator needs 2 args") + what, nextTokPos = _NextTok(bm, nextTokPos) + if what is None: + raise ValueError("+/- operator needs 2 args") + if what[0] != "c": + raise ValueError("+/- only supports chars") + if word == "+": + pos = pos + int(num) + else: + pos = pos - int(num) + elif word == "wordstart": + while pos > 0 and edit.SCIGetCharAt(pos - 1) in wordchars: + pos = pos - 1 + elif word == "wordend": + end = edit.GetTextLength() + while pos < end and edit.SCIGetCharAt(pos) in wordchars: + pos = pos + 1 + elif word == "linestart": + while pos > 0 and edit.SCIGetCharAt(pos - 1) not in "\n\r": + pos = pos - 1 + elif word == "lineend": + end = edit.GetTextLength() + while pos < end and edit.SCIGetCharAt(pos) not in "\n\r": + pos = pos + 1 + else: + raise ValueError("Unsupported relative offset '%s'" % word) + return max(pos, 0) # Tkinter is tollerant of -ve indexes - we aren't + + +# A class that resembles an IDLE (ie, a Tk) text widget. +# Construct with an edit object (eg, an editor view) +class TkText: + def __init__(self, edit): + self.calltips = None + self.edit = edit + self.marks = {} + + ## def __getattr__(self, attr): + ## if attr=="tk": return self # So text.tk.call works. + ## if attr=="master": return None # ditto! + ## raise AttributeError, attr + ## def __getitem__(self, item): + ## if item=="tabs": + ## size = self.edit.GetTabWidth() + ## if size==8: return "" # Tk default + ## return size # correct semantics? + ## elif item=="font": # Used for measurements we dont need to do! + ## return "Dont know the font" + ## raise IndexError, "Invalid index '%s'" % item + def make_calltip_window(self): + if self.calltips is None: + self.calltips = CallTips(self.edit) + return self.calltips + + def _getoffset(self, index): + return TkIndexToOffset(index, self.edit, self.marks) + + def _getindex(self, off): + return TkOffsetToIndex(off, self.edit) + + def _fix_indexes(self, start, end): + # first some magic to handle skipping over utf8 extended chars. + while start > 0 and ord(self.edit.SCIGetCharAt(start)) & 0xC0 == 0x80: + start -= 1 + while ( + end < self.edit.GetTextLength() + and ord(self.edit.SCIGetCharAt(end)) & 0xC0 == 0x80 + ): + end += 1 + # now handling fixing \r\n->\n disparities... + if ( + start > 0 + and self.edit.SCIGetCharAt(start) == "\n" + and self.edit.SCIGetCharAt(start - 1) == "\r" + ): + start = start - 1 + if ( + end < self.edit.GetTextLength() + and self.edit.SCIGetCharAt(end - 1) == "\r" + and self.edit.SCIGetCharAt(end) == "\n" + ): + end = end + 1 + return start, end + + ## def get_tab_width(self): + ## return self.edit.GetTabWidth() + ## def call(self, *rest): + ## # Crap to support Tk measurement hacks for tab widths + ## if rest[0] != "font" or rest[1] != "measure": + ## raise ValueError, "Unsupport call type" + ## return len(rest[5]) + ## def configure(self, **kw): + ## for name, val in kw.items(): + ## if name=="tabs": + ## self.edit.SCISetTabWidth(int(val)) + ## else: + ## raise ValueError, "Unsupported configuration item %s" % kw + def bind(self, binding, handler): + self.edit.bindings.bind(binding, handler) + + def get(self, start, end=None): + try: + start = self._getoffset(start) + if end is None: + end = start + 1 + else: + end = self._getoffset(end) + except EmptyRange: + return "" + # Simple semantic checks to conform to the Tk text interface + if end <= start: + return "" + max = self.edit.GetTextLength() + checkEnd = 0 + if end > max: + end = max + checkEnd = 1 + start, end = self._fix_indexes(start, end) + ret = self.edit.GetTextRange(start, end) + # pretend a trailing '\n' exists if necessary. + if checkEnd and (not ret or ret[-1] != "\n"): + ret = ret + "\n" + return ret.replace("\r", "") + + def index(self, spec): + try: + return self._getindex(self._getoffset(spec)) + except EmptyRange: + return "" + + def insert(self, pos, text): + try: + pos = self._getoffset(pos) + except EmptyRange: + raise TextError("Empty range") + self.edit.SetSel((pos, pos)) + # IDLE only deals with "\n" - we will be nicer + + bits = text.split("\n") + self.edit.SCIAddText(bits[0]) + for bit in bits[1:]: + self.edit.SCINewline() + self.edit.SCIAddText(bit) + + def delete(self, start, end=None): + try: + start = self._getoffset(start) + if end is not None: + end = self._getoffset(end) + except EmptyRange: + raise TextError("Empty range") + # If end is specified and == start, then we must delete nothing. + if start == end: + return + # If end is not specified, delete one char + if end is None: + end = start + 1 + else: + # Tk says not to delete in this case, but our control would. + if end < start: + return + if start == self.edit.GetTextLength(): + return # Nothing to delete. + old = self.edit.GetSel()[0] # Lose a selection + # Hack for partial '\r\n' and UTF-8 char removal + start, end = self._fix_indexes(start, end) + self.edit.SetSel((start, end)) + self.edit.Clear() + if old >= start and old < end: + old = start + elif old >= end: + old = old - (end - start) + self.edit.SetSel(old) + + def bell(self): + win32api.MessageBeep() + + def see(self, pos): + # Most commands we use in Scintilla actually force the selection + # to be seen, making this unnecessary. + pass + + def mark_set(self, name, pos): + try: + pos = self._getoffset(pos) + except EmptyRange: + raise TextError("Empty range '%s'" % pos) + if name == "insert": + self.edit.SetSel(pos) + else: + self.marks[name] = pos + + def tag_add(self, name, start, end): + if name != "sel": + raise ValueError("Only sel tag is supported") + try: + start = self._getoffset(start) + end = self._getoffset(end) + except EmptyRange: + raise TextError("Empty range") + self.edit.SetSel(start, end) + + def tag_remove(self, name, start, end): + if name != "sel" or start != "1.0" or end != "end": + raise ValueError("Cant remove this tag") + # Turn the sel into a cursor + self.edit.SetSel(self.edit.GetSel()[0]) + + def compare(self, i1, op, i2): + try: + i1 = self._getoffset(i1) + except EmptyRange: + i1 = "" + try: + i2 = self._getoffset(i2) + except EmptyRange: + i2 = "" + return eval("%d%s%d" % (i1, op, i2)) + + def undo_block_start(self): + self.edit.SCIBeginUndoAction() + + def undo_block_stop(self): + self.edit.SCIEndUndoAction() + + +###################################################################### +# +# Test related code. +# +###################################################################### +def TestCheck(index, edit, expected=None): + rc = TkIndexToOffset(index, edit, {}) + if rc != expected: + print("ERROR: Index", index, ", expected", expected, "but got", rc) + + +def TestGet(fr, to, t, expected): + got = t.get(fr, to) + if got != expected: + print( + "ERROR: get(%s, %s) expected %s, but got %s" + % (repr(fr), repr(to), repr(expected), repr(got)) + ) + + +def test(): + import pywin.framework.editor + + d = pywin.framework.editor.editorTemplate.OpenDocumentFile(None) + e = d.GetFirstView() + t = TkText(e) + e.SCIAddText("hi there how\nare you today\r\nI hope you are well") + e.SetSel((4, 4)) + + skip = """ + TestCheck("insert", e, 4) + TestCheck("insert wordstart", e, 3) + TestCheck("insert wordend", e, 8) + TestCheck("insert linestart", e, 0) + TestCheck("insert lineend", e, 12) + TestCheck("insert + 4 chars", e, 8) + TestCheck("insert +4c", e, 8) + TestCheck("insert - 2 chars", e, 2) + TestCheck("insert -2c", e, 2) + TestCheck("insert-2c", e, 2) + TestCheck("insert-2 c", e, 2) + TestCheck("insert- 2c", e, 2) + TestCheck("1.1", e, 1) + TestCheck("1.0", e, 0) + TestCheck("2.0", e, 13) + try: + TestCheck("sel.first", e, 0) + print "*** sel.first worked with an empty selection" + except TextError: + pass + e.SetSel((4,5)) + TestCheck("sel.first- 2c", e, 2) + TestCheck("sel.last- 2c", e, 3) + """ + # Check EOL semantics + e.SetSel((4, 4)) + TestGet("insert lineend", "insert lineend +1c", t, "\n") + e.SetSel((20, 20)) + TestGet("insert lineend", "insert lineend +1c", t, "\n") + e.SetSel((35, 35)) + TestGet("insert lineend", "insert lineend +1c", t, "\n") + + +class IDLEWrapper: + def __init__(self, control): + self.text = control + + +def IDLETest(extension): + import os + import sys + + modname = "pywin.idle." + extension + __import__(modname) + mod = sys.modules[modname] + mod.TclError = TextError + klass = getattr(mod, extension) + + # Create a new Scintilla Window. + import pywin.framework.editor + + d = pywin.framework.editor.editorTemplate.OpenDocumentFile(None) + v = d.GetFirstView() + fname = os.path.splitext(__file__)[0] + ".py" + v.SCIAddText(open(fname).read()) + d.SetModifiedFlag(0) + r = klass(IDLEWrapper(TkText(v))) + return r + + +if __name__ == "__main__": + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0981b62284aa583d4750d3492b6ef892fa851d88 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/__init__.py @@ -0,0 +1 @@ +# package init. diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/bindings.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/bindings.py new file mode 100644 index 0000000000000000000000000000000000000000..785bd42a13a24ed36ed959998c93d47d3fa1ca1d --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/bindings.py @@ -0,0 +1,178 @@ +import traceback + +import win32api +import win32con +import win32ui + +from . import IDLEenvironment, keycodes + +HANDLER_ARGS_GUESS = 0 +HANDLER_ARGS_NATIVE = 1 +HANDLER_ARGS_IDLE = 2 +HANDLER_ARGS_EXTENSION = 3 + +next_id = 5000 + +event_to_commands = {} # dict of integer IDs to event names. +command_to_events = {} # dict of event names to int IDs + + +def assign_command_id(event, id=0): + global next_id + if id == 0: + id = event_to_commands.get(event, 0) + if id == 0: + id = next_id + next_id = next_id + 1 + # Only map the ones we allocated - specified ones are assumed to have a handler + command_to_events[id] = event + event_to_commands[event] = id + return id + + +class SendCommandHandler: + def __init__(self, cmd): + self.cmd = cmd + + def __call__(self, *args): + win32ui.GetMainFrame().SendMessage(win32con.WM_COMMAND, self.cmd) + + +class Binding: + def __init__(self, handler, handler_args_type): + self.handler = handler + self.handler_args_type = handler_args_type + + +class BindingsManager: + def __init__(self, parent_view): + self.parent_view = parent_view + self.bindings = {} # dict of Binding instances. + self.keymap = {} + + def prepare_configure(self): + self.keymap = {} + + def complete_configure(self): + for id in command_to_events.keys(): + self.parent_view.HookCommand(self._OnCommand, id) + + def close(self): + self.parent_view = self.bindings = self.keymap = None + + def report_error(self, problem): + try: + win32ui.SetStatusText(problem, 1) + except win32ui.error: + # No status bar! + print(problem) + + def update_keymap(self, keymap): + self.keymap.update(keymap) + + def bind(self, event, handler, handler_args_type=HANDLER_ARGS_GUESS, cid=0): + if handler is None: + handler = SendCommandHandler(cid) + self.bindings[event] = self._new_binding(handler, handler_args_type) + self.bind_command(event, cid) + + def bind_command(self, event, id=0): + "Binds an event to a Windows control/command ID" + id = assign_command_id(event, id) + return id + + def get_command_id(self, event): + id = event_to_commands.get(event) + if id is None: + # See if we even have an event of that name!? + if event not in self.bindings: + return None + id = self.bind_command(event) + return id + + def _OnCommand(self, id, code): + event = command_to_events.get(id) + if event is None: + self.report_error("No event associated with event ID %d" % id) + return 1 + return self.fire(event) + + def _new_binding(self, event, handler_args_type): + return Binding(event, handler_args_type) + + def _get_IDLE_handler(self, ext, handler): + try: + instance = self.parent_view.idle.IDLEExtension(ext) + name = handler.replace("-", "_") + "_event" + return getattr(instance, name) + except (ImportError, AttributeError): + msg = "Can not find event '%s' in IDLE extension '%s'" % (handler, ext) + self.report_error(msg) + return None + + def fire(self, event, event_param=None): + # Fire the specified event. Result is native Pythonwin result + # (ie, 1==pass one, 0 or None==handled) + + # First look up the event directly - if there, we are set. + binding = self.bindings.get(event) + if binding is None: + # If possible, find it! + # A native method name + handler = getattr(self.parent_view, event + "Event", None) + if handler is None: + # Can't decide if I should report an error?? + self.report_error("The event name '%s' can not be found." % event) + # Either way, just let the default handlers grab it. + return 1 + binding = self._new_binding(handler, HANDLER_ARGS_NATIVE) + # Cache it. + self.bindings[event] = binding + + handler_args_type = binding.handler_args_type + # Now actually fire it. + if handler_args_type == HANDLER_ARGS_GUESS: + # Can't be native, as natives are never added with "guess". + # Must be extension or IDLE. + if event[0] == "<": + handler_args_type = HANDLER_ARGS_IDLE + else: + handler_args_type = HANDLER_ARGS_EXTENSION + try: + if handler_args_type == HANDLER_ARGS_EXTENSION: + args = self.parent_view.idle, event_param + else: + args = (event_param,) + rc = binding.handler(*args) + if handler_args_type == HANDLER_ARGS_IDLE: + # Convert to our return code. + if rc in (None, "break"): + rc = 0 + else: + rc = 1 + except: + message = "Firing event '%s' failed." % event + print(message) + traceback.print_exc() + self.report_error(message) + rc = 1 # Let any default handlers have a go! + return rc + + def fire_key_event(self, msg): + key = msg[2] + keyState = 0 + if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000: + keyState = ( + keyState | win32con.RIGHT_CTRL_PRESSED | win32con.LEFT_CTRL_PRESSED + ) + if win32api.GetKeyState(win32con.VK_SHIFT) & 0x8000: + keyState = keyState | win32con.SHIFT_PRESSED + if win32api.GetKeyState(win32con.VK_MENU) & 0x8000: + keyState = keyState | win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED + keyinfo = key, keyState + # Special hacks for the dead-char key on non-US keyboards. + # (XXX - which do not work :-( + event = self.keymap.get(keyinfo) + if event is None: + return 1 + return self.fire(event, None) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/config.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/config.py new file mode 100644 index 0000000000000000000000000000000000000000..9a1b210e9c46c1a2ddaf4f20256cb802215fbfd1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/config.py @@ -0,0 +1,365 @@ +# config.py - deals with loading configuration information. + +# Loads config data from a .cfg file. Also caches the compiled +# data back into a .cfc file. + +# If you are wondering how to avoid needing .cfg files (eg, +# if you are freezing Pythonwin etc) I suggest you create a +# .py file, and put the config info in a docstring. Then +# pass a CStringIO file (rather than a filename) to the +# config manager. +import glob +import importlib.util +import marshal +import os +import stat +import sys +import traceback +import types + +import pywin +import win32api + +from . import keycodes + +debugging = 0 +if debugging: + import win32traceutil # Some trace statements fire before the interactive window is open. + + def trace(*args): + sys.stderr.write(" ".join(map(str, args)) + "\n") + +else: + trace = lambda *args: None + +compiled_config_version = 3 + + +def split_line(line, lineno): + comment_pos = line.find("#") + if comment_pos >= 0: + line = line[:comment_pos] + sep_pos = line.rfind("=") + if sep_pos == -1: + if line.strip(): + print("Warning: Line %d: %s is an invalid entry" % (lineno, repr(line))) + return None, None + return "", "" + return line[:sep_pos].strip(), line[sep_pos + 1 :].strip() + + +def get_section_header(line): + # Returns the section if the line is a section header, else None + if line[0] == "[": + end = line.find("]") + if end == -1: + end = len(line) + rc = line[1:end].lower() + try: + i = rc.index(":") + return rc[:i], rc[i + 1 :] + except ValueError: + return rc, "" + return None, None + + +def find_config_file(f): + return os.path.join(pywin.__path__[0], f + ".cfg") + + +def find_config_files(): + return [ + os.path.split(x)[1] + for x in [ + os.path.splitext(x)[0] + for x in glob.glob(os.path.join(pywin.__path__[0], "*.cfg")) + ] + ] + + +class ConfigManager: + def __init__(self, f): + self.filename = "unknown" + self.last_error = None + self.key_to_events = {} + b_close = False + if hasattr(f, "readline"): + fp = f + self.filename = "" + compiled_name = None + else: + try: + f = find_config_file(f) + src_stat = os.stat(f) + except os.error: + self.report_error("Config file '%s' not found" % f) + return + self.filename = f + self.basename = os.path.basename(f) + trace("Loading configuration", self.basename) + compiled_name = os.path.splitext(f)[0] + ".cfc" + try: + cf = open(compiled_name, "rb") + try: + ver = marshal.load(cf) + ok = compiled_config_version == ver + if ok: + kblayoutname = marshal.load(cf) + magic = marshal.load(cf) + size = marshal.load(cf) + mtime = marshal.load(cf) + if ( + magic == importlib.util.MAGIC_NUMBER + and win32api.GetKeyboardLayoutName() == kblayoutname + and src_stat[stat.ST_MTIME] == mtime + and src_stat[stat.ST_SIZE] == size + ): + self.cache = marshal.load(cf) + trace("Configuration loaded cached", compiled_name) + return # We are ready to roll! + finally: + cf.close() + except (os.error, IOError, EOFError): + pass + fp = open(f) + b_close = True + self.cache = {} + lineno = 1 + line = fp.readline() + while line: + # Skip to the next section (maybe already there!) + section, subsection = get_section_header(line) + while line and section is None: + line = fp.readline() + if not line: + break + lineno = lineno + 1 + section, subsection = get_section_header(line) + if not line: + break + + if section == "keys": + line, lineno = self._load_keys(subsection, fp, lineno) + elif section == "extensions": + line, lineno = self._load_extensions(subsection, fp, lineno) + elif section == "idle extensions": + line, lineno = self._load_idle_extensions(subsection, fp, lineno) + elif section == "general": + line, lineno = self._load_general(subsection, fp, lineno) + else: + self.report_error( + "Unrecognised section header '%s:%s'" % (section, subsection) + ) + line = fp.readline() + lineno = lineno + 1 + if b_close: + fp.close() + # Check critical data. + if not self.cache.get("keys"): + self.report_error("No keyboard definitions were loaded") + if not self.last_error and compiled_name: + try: + cf = open(compiled_name, "wb") + marshal.dump(compiled_config_version, cf) + marshal.dump(win32api.GetKeyboardLayoutName(), cf) + marshal.dump(importlib.util.MAGIC_NUMBER, cf) + marshal.dump(src_stat[stat.ST_SIZE], cf) + marshal.dump(src_stat[stat.ST_MTIME], cf) + marshal.dump(self.cache, cf) + cf.close() + except (IOError, EOFError): + pass # Ignore errors - may be read only. + + def configure(self, editor, subsections=None): + # Execute the extension code, and find any events. + # First, we "recursively" connect any we are based on. + if subsections is None: + subsections = [] + subsections = [""] + subsections + general = self.get_data("general") + if general: + parents = general.get("based on", []) + for parent in parents: + trace("Configuration based on", parent, "- loading.") + parent = self.__class__(parent) + parent.configure(editor, subsections) + if parent.last_error: + self.report_error(parent.last_error) + + bindings = editor.bindings + codeob = self.get_data("extension code") + if codeob is not None: + ns = {} + try: + exec(codeob, ns) + except: + traceback.print_exc() + self.report_error("Executing extension code failed") + ns = None + if ns: + num = 0 + for name, func in list(ns.items()): + if type(func) == types.FunctionType and name[:1] != "_": + bindings.bind(name, func) + num = num + 1 + trace("Configuration Extension code loaded", num, "events") + # Load the idle extensions + for subsection in subsections: + for ext in self.get_data("idle extensions", {}).get(subsection, []): + try: + editor.idle.IDLEExtension(ext) + trace("Loaded IDLE extension", ext) + except: + self.report_error("Can not load the IDLE extension '%s'" % ext) + + # Now bind up the key-map (remembering a reverse map + subsection_keymap = self.get_data("keys") + num_bound = 0 + for subsection in subsections: + keymap = subsection_keymap.get(subsection, {}) + bindings.update_keymap(keymap) + num_bound = num_bound + len(keymap) + trace("Configuration bound", num_bound, "keys") + + def get_key_binding(self, event, subsections=None): + if subsections is None: + subsections = [] + subsections = [""] + subsections + + subsection_keymap = self.get_data("keys") + for subsection in subsections: + map = self.key_to_events.get(subsection) + if map is None: # Build it + map = {} + keymap = subsection_keymap.get(subsection, {}) + for key_info, map_event in list(keymap.items()): + map[map_event] = key_info + self.key_to_events[subsection] = map + + info = map.get(event) + if info is not None: + return keycodes.make_key_name(info[0], info[1]) + return None + + def report_error(self, msg): + self.last_error = msg + print("Error in %s: %s" % (self.filename, msg)) + + def report_warning(self, msg): + print("Warning in %s: %s" % (self.filename, msg)) + + def _readline(self, fp, lineno, bStripComments=1): + line = fp.readline() + lineno = lineno + 1 + if line: + bBreak = ( + get_section_header(line)[0] is not None + ) # A new section is starting + if bStripComments and not bBreak: + pos = line.find("#") + if pos >= 0: + line = line[:pos] + "\n" + else: + bBreak = 1 + return line, lineno, bBreak + + def get_data(self, name, default=None): + return self.cache.get(name, default) + + def _save_data(self, name, data): + self.cache[name] = data + return data + + def _load_general(self, sub_section, fp, lineno): + map = {} + while 1: + line, lineno, bBreak = self._readline(fp, lineno) + if bBreak: + break + + key, val = split_line(line, lineno) + if not key: + continue + key = key.lower() + l = map.get(key, []) + l.append(val) + map[key] = l + self._save_data("general", map) + return line, lineno + + def _load_keys(self, sub_section, fp, lineno): + # Builds a nested dictionary of + # (scancode, flags) = event_name + main_map = self.get_data("keys", {}) + map = main_map.get(sub_section, {}) + while 1: + line, lineno, bBreak = self._readline(fp, lineno) + if bBreak: + break + + key, event = split_line(line, lineno) + if not event: + continue + sc, flag = keycodes.parse_key_name(key) + if sc is None: + self.report_warning("Line %d: Invalid key name '%s'" % (lineno, key)) + else: + map[sc, flag] = event + main_map[sub_section] = map + self._save_data("keys", main_map) + return line, lineno + + def _load_extensions(self, sub_section, fp, lineno): + start_lineno = lineno + lines = [] + while 1: + line, lineno, bBreak = self._readline(fp, lineno, 0) + if bBreak: + break + lines.append(line) + try: + c = compile( + "\n" * start_lineno + "".join(lines), # produces correct tracebacks + self.filename, + "exec", + ) + self._save_data("extension code", c) + except SyntaxError as details: + errlineno = details.lineno + start_lineno + # Should handle syntax errors better here, and offset the lineno. + self.report_error( + "Compiling extension code failed:\r\nFile: %s\r\nLine %d\r\n%s" + % (details.filename, errlineno, details.msg) + ) + return line, lineno + + def _load_idle_extensions(self, sub_section, fp, lineno): + extension_map = self.get_data("idle extensions") + if extension_map is None: + extension_map = {} + extensions = [] + while 1: + line, lineno, bBreak = self._readline(fp, lineno) + if bBreak: + break + line = line.strip() + if line: + extensions.append(line) + extension_map[sub_section] = extensions + self._save_data("idle extensions", extension_map) + return line, lineno + + +def test(): + import time + + start = time.clock() + f = "default" + cm = ConfigManager(f) + map = cm.get_data("keys") + took = time.clock() - start + print("Loaded %s items in %.4f secs" % (len(map), took)) + + +if __name__ == "__main__": + test() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/configui.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/configui.py new file mode 100644 index 0000000000000000000000000000000000000000..8b6157b60418967af59e7e9d5787149fdcdaa8cc --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/configui.py @@ -0,0 +1,292 @@ +import win32api +import win32con +import win32ui +from pywin.mfc import dialog + +# Used to indicate that style should use default color +from win32con import CLR_INVALID + +from . import scintillacon + +###################################################### +# Property Page for syntax formatting options + +# The standard 16 color VGA palette should always be possible +paletteVGA = ( + ("Black", win32api.RGB(0, 0, 0)), + ("Navy", win32api.RGB(0, 0, 128)), + ("Green", win32api.RGB(0, 128, 0)), + ("Cyan", win32api.RGB(0, 128, 128)), + ("Maroon", win32api.RGB(128, 0, 0)), + ("Purple", win32api.RGB(128, 0, 128)), + ("Olive", win32api.RGB(128, 128, 0)), + ("Gray", win32api.RGB(128, 128, 128)), + ("Silver", win32api.RGB(192, 192, 192)), + ("Blue", win32api.RGB(0, 0, 255)), + ("Lime", win32api.RGB(0, 255, 0)), + ("Aqua", win32api.RGB(0, 255, 255)), + ("Red", win32api.RGB(255, 0, 0)), + ("Fuchsia", win32api.RGB(255, 0, 255)), + ("Yellow", win32api.RGB(255, 255, 0)), + ("White", win32api.RGB(255, 255, 255)), + # and a few others will generally be possible. + ("DarkGrey", win32api.RGB(64, 64, 64)), + ("PurpleBlue", win32api.RGB(64, 64, 192)), + ("DarkGreen", win32api.RGB(0, 96, 0)), + ("DarkOlive", win32api.RGB(128, 128, 64)), + ("MediumBlue", win32api.RGB(0, 0, 192)), + ("DarkNavy", win32api.RGB(0, 0, 96)), + ("Magenta", win32api.RGB(96, 0, 96)), + ("OffWhite", win32api.RGB(255, 255, 220)), + ("LightPurple", win32api.RGB(220, 220, 255)), + ("", win32con.CLR_INVALID), +) + + +class ScintillaFormatPropertyPage(dialog.PropertyPage): + def __init__(self, scintillaClass=None, caption=0): + self.scintillaClass = scintillaClass + dialog.PropertyPage.__init__(self, win32ui.IDD_PP_FORMAT, caption=caption) + + def OnInitDialog(self): + try: + if self.scintillaClass is None: + from . import control + + sc = control.CScintillaEdit + else: + sc = self.scintillaClass + + self.scintilla = sc() + style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.ES_MULTILINE + # Convert the rect size + rect = self.MapDialogRect((5, 5, 120, 75)) + self.scintilla.CreateWindow(style, rect, self, 111) + self.HookNotify(self.OnBraceMatch, scintillacon.SCN_CHECKBRACE) + self.scintilla.HookKeyStroke(self.OnEsc, 27) + self.scintilla.SCISetViewWS(1) + self.pos_bstart = self.pos_bend = self.pos_bbad = 0 + + colorizer = self.scintilla._GetColorizer() + text = colorizer.GetSampleText() + items = text.split("|", 2) + pos = len(items[0]) + self.scintilla.SCIAddText("".join(items)) + self.scintilla.SetSel(pos, pos) + self.scintilla.ApplyFormattingStyles() + self.styles = self.scintilla._GetColorizer().styles + + self.cbo = self.GetDlgItem(win32ui.IDC_COMBO1) + for c in paletteVGA: + self.cbo.AddString(c[0]) + + self.cboBoldItalic = self.GetDlgItem(win32ui.IDC_COMBO2) + for item in ("Bold Italic", "Bold", "Italic", "Regular"): + self.cboBoldItalic.InsertString(0, item) + + self.butIsDefault = self.GetDlgItem(win32ui.IDC_CHECK1) + self.butIsDefaultBackground = self.GetDlgItem(win32ui.IDC_CHECK2) + self.listbox = self.GetDlgItem(win32ui.IDC_LIST1) + self.HookCommand(self.OnListCommand, win32ui.IDC_LIST1) + names = list(self.styles.keys()) + names.sort() + for name in names: + if self.styles[name].aliased is None: + self.listbox.AddString(name) + self.listbox.SetCurSel(0) + + idc = win32ui.IDC_RADIO1 + if not self.scintilla._GetColorizer().bUseFixed: + idc = win32ui.IDC_RADIO2 + self.GetDlgItem(idc).SetCheck(1) + self.UpdateUIForStyle(self.styles[names[0]]) + + self.scintilla.HookFormatter(self) + self.HookCommand(self.OnButDefaultFixedFont, win32ui.IDC_BUTTON1) + self.HookCommand(self.OnButDefaultPropFont, win32ui.IDC_BUTTON2) + self.HookCommand(self.OnButThisFont, win32ui.IDC_BUTTON3) + self.HookCommand(self.OnButUseDefaultFont, win32ui.IDC_CHECK1) + self.HookCommand(self.OnButThisBackground, win32ui.IDC_BUTTON4) + self.HookCommand(self.OnButUseDefaultBackground, win32ui.IDC_CHECK2) + self.HookCommand(self.OnStyleUIChanged, win32ui.IDC_COMBO1) + self.HookCommand(self.OnStyleUIChanged, win32ui.IDC_COMBO2) + self.HookCommand(self.OnButFixedOrDefault, win32ui.IDC_RADIO1) + self.HookCommand(self.OnButFixedOrDefault, win32ui.IDC_RADIO2) + except: + import traceback + + traceback.print_exc() + + def OnEsc(self, ch): + self.GetParent().EndDialog(win32con.IDCANCEL) + + def OnBraceMatch(self, std, extra): + import pywin.scintilla.view + + pywin.scintilla.view.DoBraceMatch(self.scintilla) + + def GetSelectedStyle(self): + return self.styles[self.listbox.GetText(self.listbox.GetCurSel())] + + def _DoButDefaultFont(self, extra_flags, attr): + baseFormat = getattr(self.scintilla._GetColorizer(), attr) + flags = ( + extra_flags + | win32con.CF_SCREENFONTS + | win32con.CF_EFFECTS + | win32con.CF_FORCEFONTEXIST + ) + d = win32ui.CreateFontDialog(baseFormat, flags, None, self) + if d.DoModal() == win32con.IDOK: + setattr(self.scintilla._GetColorizer(), attr, d.GetCharFormat()) + self.OnStyleUIChanged(0, win32con.BN_CLICKED) + + def OnButDefaultFixedFont(self, id, code): + if code == win32con.BN_CLICKED: + self._DoButDefaultFont(win32con.CF_FIXEDPITCHONLY, "baseFormatFixed") + return 1 + + def OnButDefaultPropFont(self, id, code): + if code == win32con.BN_CLICKED: + self._DoButDefaultFont(win32con.CF_SCALABLEONLY, "baseFormatProp") + return 1 + + def OnButFixedOrDefault(self, id, code): + if code == win32con.BN_CLICKED: + bUseFixed = id == win32ui.IDC_RADIO1 + self.GetDlgItem(win32ui.IDC_RADIO1).GetCheck() != 0 + self.scintilla._GetColorizer().bUseFixed = bUseFixed + self.scintilla.ApplyFormattingStyles(0) + return 1 + + def OnButThisFont(self, id, code): + if code == win32con.BN_CLICKED: + flags = ( + win32con.CF_SCREENFONTS + | win32con.CF_EFFECTS + | win32con.CF_FORCEFONTEXIST + ) + style = self.GetSelectedStyle() + # If the selected style is based on the default, we need to apply + # the default to it. + def_format = self.scintilla._GetColorizer().GetDefaultFormat() + format = style.GetCompleteFormat(def_format) + d = win32ui.CreateFontDialog(format, flags, None, self) + if d.DoModal() == win32con.IDOK: + style.format = d.GetCharFormat() + self.scintilla.ApplyFormattingStyles(0) + return 1 + + def OnButUseDefaultFont(self, id, code): + if code == win32con.BN_CLICKED: + isDef = self.butIsDefault.GetCheck() + self.GetDlgItem(win32ui.IDC_BUTTON3).EnableWindow(not isDef) + if isDef: # Being reset to the default font. + style = self.GetSelectedStyle() + style.ForceAgainstDefault() + self.UpdateUIForStyle(style) + self.scintilla.ApplyFormattingStyles(0) + else: + # User wants to override default - + # do nothing! + pass + + def OnButThisBackground(self, id, code): + if code == win32con.BN_CLICKED: + style = self.GetSelectedStyle() + bg = win32api.RGB(0xFF, 0xFF, 0xFF) + if style.background != CLR_INVALID: + bg = style.background + d = win32ui.CreateColorDialog(bg, 0, self) + if d.DoModal() == win32con.IDOK: + style.background = d.GetColor() + self.scintilla.ApplyFormattingStyles(0) + return 1 + + def OnButUseDefaultBackground(self, id, code): + if code == win32con.BN_CLICKED: + isDef = self.butIsDefaultBackground.GetCheck() + self.GetDlgItem(win32ui.IDC_BUTTON4).EnableWindow(not isDef) + if isDef: # Being reset to the default color + style = self.GetSelectedStyle() + style.background = style.default_background + self.UpdateUIForStyle(style) + self.scintilla.ApplyFormattingStyles(0) + else: + # User wants to override default - + # do nothing! + pass + + def OnListCommand(self, id, code): + if code == win32con.LBN_SELCHANGE: + style = self.GetSelectedStyle() + self.UpdateUIForStyle(style) + return 1 + + def UpdateUIForStyle(self, style): + format = style.format + sel = 0 + for c in paletteVGA: + if format[4] == c[1]: + # print "Style", style.name, "is", c[0] + break + sel = sel + 1 + else: + sel = -1 + self.cbo.SetCurSel(sel) + self.butIsDefault.SetCheck(style.IsBasedOnDefault()) + self.GetDlgItem(win32ui.IDC_BUTTON3).EnableWindow(not style.IsBasedOnDefault()) + + self.butIsDefaultBackground.SetCheck( + style.background == style.default_background + ) + self.GetDlgItem(win32ui.IDC_BUTTON4).EnableWindow( + style.background != style.default_background + ) + + bold = format[1] & win32con.CFE_BOLD != 0 + italic = format[1] & win32con.CFE_ITALIC != 0 + self.cboBoldItalic.SetCurSel(bold * 2 + italic) + + def OnStyleUIChanged(self, id, code): + if code in [win32con.BN_CLICKED, win32con.CBN_SELCHANGE]: + style = self.GetSelectedStyle() + self.ApplyUIFormatToStyle(style) + self.scintilla.ApplyFormattingStyles(0) + return 0 + return 1 + + def ApplyUIFormatToStyle(self, style): + format = style.format + color = paletteVGA[self.cbo.GetCurSel()] + effect = 0 + sel = self.cboBoldItalic.GetCurSel() + if sel == 0: + effect = 0 + elif sel == 1: + effect = win32con.CFE_ITALIC + elif sel == 2: + effect = win32con.CFE_BOLD + else: + effect = win32con.CFE_BOLD | win32con.CFE_ITALIC + maskFlags = ( + format[0] | win32con.CFM_COLOR | win32con.CFM_BOLD | win32con.CFM_ITALIC + ) + style.format = ( + maskFlags, + effect, + style.format[2], + style.format[3], + color[1], + ) + style.format[5:] + + def OnOK(self): + self.scintilla._GetColorizer().SavePreferences() + return 1 + + +def test(): + page = ColorEditorPropertyPage() + sheet = pywin.mfc.dialog.PropertySheet("Test") + sheet.AddPage(page) + sheet.CreateWindow() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/control.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/control.py new file mode 100644 index 0000000000000000000000000000000000000000..460b1686453a18dc52ed9bb2ae73820ef750f8d7 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/control.py @@ -0,0 +1,569 @@ +# An Python interface to the Scintilla control. +# +# Exposes Python classes that allow you to use Scintilla as +# a "standard" MFC edit control (eg, control.GetTextLength(), control.GetSel() +# plus many Scintilla specific features (eg control.SCIAddStyledText()) + +import array +import os +import struct + +import win32api +import win32con +import win32ui +from pywin import default_scintilla_encoding +from pywin.mfc import window + +from . import scintillacon + +# Load Scintilla.dll to get access to the control. +# We expect to find this in the same directory as win32ui.pyd +dllid = None +if win32ui.debug: # If running _d version of Pythonwin... + try: + dllid = win32api.LoadLibrary( + os.path.join(os.path.split(win32ui.__file__)[0], "Scintilla_d.DLL") + ) + except ( + win32api.error + ): # Not there - we dont _need_ a debug ver, so ignore this error. + pass +if dllid is None: + try: + dllid = win32api.LoadLibrary( + os.path.join(os.path.split(win32ui.__file__)[0], "Scintilla.DLL") + ) + except win32api.error: + pass +if dllid is None: + # Still not there - lets see if Windows can find it by searching? + dllid = win32api.LoadLibrary("Scintilla.DLL") + +# null_byte is str in py2k, bytes on py3k +null_byte = "\0".encode("ascii") + +## These are from Richedit.h - need to add to win32con or commctrl +EM_GETTEXTRANGE = 1099 +EM_EXLINEFROMCHAR = 1078 +EM_FINDTEXTEX = 1103 +EM_GETSELTEXT = 1086 +EM_EXSETSEL = win32con.WM_USER + 55 + + +class ScintillaNotification: + def __init__(self, **args): + self.__dict__.update(args) + + +class ScintillaControlInterface: + def SCIUnpackNotifyMessage(self, msg): + format = "iiiiPiiiPPiiii" + bytes = win32ui.GetBytes(msg, struct.calcsize(format)) + ( + position, + ch, + modifiers, + modificationType, + text_ptr, + length, + linesAdded, + msg, + wParam, + lParam, + line, + foldLevelNow, + foldLevelPrev, + margin, + ) = struct.unpack(format, bytes) + return ScintillaNotification( + position=position, + ch=ch, + modifiers=modifiers, + modificationType=modificationType, + text_ptr=text_ptr, + length=length, + linesAdded=linesAdded, + msg=msg, + wParam=wParam, + lParam=lParam, + line=line, + foldLevelNow=foldLevelNow, + foldLevelPrev=foldLevelPrev, + margin=margin, + ) + + def SCIAddText(self, text): + self.SendMessage( + scintillacon.SCI_ADDTEXT, text.encode(default_scintilla_encoding) + ) + + def SCIAddStyledText(self, text, style=None): + # If style is None, text is assumed to be a "native" Scintilla buffer. + # If style is specified, text is a normal string, and the style is + # assumed to apply to the entire string. + if style is not None: + text = list(map(lambda char, style=style: char + chr(style), text)) + text = "".join(text) + self.SendMessage( + scintillacon.SCI_ADDSTYLEDTEXT, text.encode(default_scintilla_encoding) + ) + + def SCIInsertText(self, text, pos=-1): + # SCIInsertText allows unicode or bytes - but if they are bytes, + # the caller must ensure it is encoded correctly. + if isinstance(text, str): + text = text.encode(default_scintilla_encoding) + self.SendScintilla(scintillacon.SCI_INSERTTEXT, pos, text + null_byte) + + def SCISetSavePoint(self): + self.SendScintilla(scintillacon.SCI_SETSAVEPOINT) + + def SCISetUndoCollection(self, collectFlag): + self.SendScintilla(scintillacon.SCI_SETUNDOCOLLECTION, collectFlag) + + def SCIBeginUndoAction(self): + self.SendScintilla(scintillacon.SCI_BEGINUNDOACTION) + + def SCIEndUndoAction(self): + self.SendScintilla(scintillacon.SCI_ENDUNDOACTION) + + def SCIGetCurrentPos(self): + return self.SendScintilla(scintillacon.SCI_GETCURRENTPOS) + + def SCIGetCharAt(self, pos): + # Must ensure char is unsigned! + return chr(self.SendScintilla(scintillacon.SCI_GETCHARAT, pos) & 0xFF) + + def SCIGotoLine(self, line): + self.SendScintilla(scintillacon.SCI_GOTOLINE, line) + + def SCIBraceMatch(self, pos, maxReStyle): + return self.SendScintilla(scintillacon.SCI_BRACEMATCH, pos, maxReStyle) + + def SCIBraceHighlight(self, pos, posOpposite): + return self.SendScintilla(scintillacon.SCI_BRACEHIGHLIGHT, pos, posOpposite) + + def SCIBraceBadHighlight(self, pos): + return self.SendScintilla(scintillacon.SCI_BRACEBADLIGHT, pos) + + #################################### + # Styling + # def SCIColourise(self, start=0, end=-1): + # NOTE - dependent on of we use builtin lexer, so handled below. + def SCIGetEndStyled(self): + return self.SendScintilla(scintillacon.SCI_GETENDSTYLED) + + def SCIStyleSetFore(self, num, v): + return self.SendScintilla(scintillacon.SCI_STYLESETFORE, num, v) + + def SCIStyleSetBack(self, num, v): + return self.SendScintilla(scintillacon.SCI_STYLESETBACK, num, v) + + def SCIStyleSetEOLFilled(self, num, v): + return self.SendScintilla(scintillacon.SCI_STYLESETEOLFILLED, num, v) + + def SCIStyleSetFont(self, num, name, characterset=0): + buff = (name + "\0").encode(default_scintilla_encoding) + self.SendScintilla(scintillacon.SCI_STYLESETFONT, num, buff) + self.SendScintilla(scintillacon.SCI_STYLESETCHARACTERSET, num, characterset) + + def SCIStyleSetBold(self, num, bBold): + self.SendScintilla(scintillacon.SCI_STYLESETBOLD, num, bBold) + + def SCIStyleSetItalic(self, num, bItalic): + self.SendScintilla(scintillacon.SCI_STYLESETITALIC, num, bItalic) + + def SCIStyleSetSize(self, num, size): + self.SendScintilla(scintillacon.SCI_STYLESETSIZE, num, size) + + def SCIGetViewWS(self): + return self.SendScintilla(scintillacon.SCI_GETVIEWWS) + + def SCISetViewWS(self, val): + self.SendScintilla(scintillacon.SCI_SETVIEWWS, not (val == 0)) + self.InvalidateRect() + + def SCISetIndentationGuides(self, val): + self.SendScintilla(scintillacon.SCI_SETINDENTATIONGUIDES, val) + + def SCIGetIndentationGuides(self): + return self.SendScintilla(scintillacon.SCI_GETINDENTATIONGUIDES) + + def SCISetIndent(self, val): + self.SendScintilla(scintillacon.SCI_SETINDENT, val) + + def SCIGetIndent(self, val): + return self.SendScintilla(scintillacon.SCI_GETINDENT) + + def SCIGetViewEOL(self): + return self.SendScintilla(scintillacon.SCI_GETVIEWEOL) + + def SCISetViewEOL(self, val): + self.SendScintilla(scintillacon.SCI_SETVIEWEOL, not (val == 0)) + self.InvalidateRect() + + def SCISetTabWidth(self, width): + self.SendScintilla(scintillacon.SCI_SETTABWIDTH, width, 0) + + def SCIStartStyling(self, pos, mask): + self.SendScintilla(scintillacon.SCI_STARTSTYLING, pos, mask) + + def SCISetStyling(self, pos, attr): + self.SendScintilla(scintillacon.SCI_SETSTYLING, pos, attr) + + def SCISetStylingEx(self, ray): # ray is an array. + address, length = ray.buffer_info() + self.SendScintilla(scintillacon.SCI_SETSTYLINGEX, length, address) + + def SCIGetStyleAt(self, pos): + return self.SendScintilla(scintillacon.SCI_GETSTYLEAT, pos) + + def SCISetMarginWidth(self, width): + self.SendScintilla(scintillacon.SCI_SETMARGINWIDTHN, 1, width) + + def SCISetMarginWidthN(self, n, width): + self.SendScintilla(scintillacon.SCI_SETMARGINWIDTHN, n, width) + + def SCISetFoldFlags(self, flags): + self.SendScintilla(scintillacon.SCI_SETFOLDFLAGS, flags) + + # Markers + def SCIMarkerDefineAll(self, markerNum, markerType, fore, back): + self.SCIMarkerDefine(markerNum, markerType) + self.SCIMarkerSetFore(markerNum, fore) + self.SCIMarkerSetBack(markerNum, back) + + def SCIMarkerDefine(self, markerNum, markerType): + self.SendScintilla(scintillacon.SCI_MARKERDEFINE, markerNum, markerType) + + def SCIMarkerSetFore(self, markerNum, fore): + self.SendScintilla(scintillacon.SCI_MARKERSETFORE, markerNum, fore) + + def SCIMarkerSetBack(self, markerNum, back): + self.SendScintilla(scintillacon.SCI_MARKERSETBACK, markerNum, back) + + def SCIMarkerAdd(self, lineNo, markerNum): + self.SendScintilla(scintillacon.SCI_MARKERADD, lineNo, markerNum) + + def SCIMarkerDelete(self, lineNo, markerNum): + self.SendScintilla(scintillacon.SCI_MARKERDELETE, lineNo, markerNum) + + def SCIMarkerDeleteAll(self, markerNum=-1): + self.SendScintilla(scintillacon.SCI_MARKERDELETEALL, markerNum) + + def SCIMarkerGet(self, lineNo): + return self.SendScintilla(scintillacon.SCI_MARKERGET, lineNo) + + def SCIMarkerNext(self, lineNo, markerNum): + return self.SendScintilla(scintillacon.SCI_MARKERNEXT, lineNo, markerNum) + + def SCICancel(self): + self.SendScintilla(scintillacon.SCI_CANCEL) + + # AutoComplete + def SCIAutoCShow(self, text): + if type(text) in [type([]), type(())]: + text = " ".join(text) + buff = (text + "\0").encode(default_scintilla_encoding) + return self.SendScintilla(scintillacon.SCI_AUTOCSHOW, 0, buff) + + def SCIAutoCCancel(self): + self.SendScintilla(scintillacon.SCI_AUTOCCANCEL) + + def SCIAutoCActive(self): + return self.SendScintilla(scintillacon.SCI_AUTOCACTIVE) + + def SCIAutoCComplete(self): + return self.SendScintilla(scintillacon.SCI_AUTOCCOMPLETE) + + def SCIAutoCStops(self, stops): + buff = (stops + "\0").encode(default_scintilla_encoding) + self.SendScintilla(scintillacon.SCI_AUTOCSTOPS, 0, buff) + + def SCIAutoCSetAutoHide(self, hide): + self.SendScintilla(scintillacon.SCI_AUTOCSETAUTOHIDE, hide) + + def SCIAutoCSetFillups(self, fillups): + self.SendScintilla(scintillacon.SCI_AUTOCSETFILLUPS, fillups) + + # Call tips + def SCICallTipShow(self, text, pos=-1): + if pos == -1: + pos = self.GetSel()[0] + buff = (text + "\0").encode(default_scintilla_encoding) + self.SendScintilla(scintillacon.SCI_CALLTIPSHOW, pos, buff) + + def SCICallTipCancel(self): + self.SendScintilla(scintillacon.SCI_CALLTIPCANCEL) + + def SCICallTipActive(self): + return self.SendScintilla(scintillacon.SCI_CALLTIPACTIVE) + + def SCICallTipPosStart(self): + return self.SendScintilla(scintillacon.SCI_CALLTIPPOSSTART) + + def SCINewline(self): + self.SendScintilla(scintillacon.SCI_NEWLINE) + + # Lexer etc + def SCISetKeywords(self, keywords, kw_list_no=0): + buff = (keywords + "\0").encode(default_scintilla_encoding) + self.SendScintilla(scintillacon.SCI_SETKEYWORDS, kw_list_no, buff) + + def SCISetProperty(self, name, value): + name_buff = array.array("b", (name + "\0").encode(default_scintilla_encoding)) + val_buff = array.array( + "b", (str(value) + "\0").encode(default_scintilla_encoding) + ) + address_name_buffer = name_buff.buffer_info()[0] + address_val_buffer = val_buff.buffer_info()[0] + self.SendScintilla( + scintillacon.SCI_SETPROPERTY, address_name_buffer, address_val_buffer + ) + + def SCISetStyleBits(self, nbits): + self.SendScintilla(scintillacon.SCI_SETSTYLEBITS, nbits) + + # Folding + def SCIGetFoldLevel(self, lineno): + return self.SendScintilla(scintillacon.SCI_GETFOLDLEVEL, lineno) + + def SCIToggleFold(self, lineno): + return self.SendScintilla(scintillacon.SCI_TOGGLEFOLD, lineno) + + def SCIEnsureVisible(self, lineno): + self.SendScintilla(scintillacon.SCI_ENSUREVISIBLE, lineno) + + def SCIGetFoldExpanded(self, lineno): + return self.SendScintilla(scintillacon.SCI_GETFOLDEXPANDED, lineno) + + # right edge + def SCISetEdgeColumn(self, edge): + self.SendScintilla(scintillacon.SCI_SETEDGECOLUMN, edge) + + def SCIGetEdgeColumn(self): + return self.SendScintilla(scintillacon.SCI_GETEDGECOLUMN) + + def SCISetEdgeMode(self, mode): + self.SendScintilla(scintillacon.SCI_SETEDGEMODE, mode) + + def SCIGetEdgeMode(self): + return self.SendScintilla(scintillacon.SCI_GETEDGEMODE) + + def SCISetEdgeColor(self, color): + self.SendScintilla(scintillacon.SCI_SETEDGECOLOUR, color) + + def SCIGetEdgeColor(self): + return self.SendScintilla(scintillacon.SCI_GETEDGECOLOR) + + # Multi-doc + def SCIGetDocPointer(self): + return self.SendScintilla(scintillacon.SCI_GETDOCPOINTER) + + def SCISetDocPointer(self, p): + return self.SendScintilla(scintillacon.SCI_SETDOCPOINTER, 0, p) + + def SCISetWrapMode(self, mode): + return self.SendScintilla(scintillacon.SCI_SETWRAPMODE, mode) + + def SCIGetWrapMode(self): + return self.SendScintilla(scintillacon.SCI_GETWRAPMODE) + + +class CScintillaEditInterface(ScintillaControlInterface): + def close(self): + self.colorizer = None + + def Clear(self): + self.SendScintilla(win32con.WM_CLEAR) + + def FindText(self, flags, range, findText): + """LPARAM for EM_FINDTEXTEX: + typedef struct _findtextex { + CHARRANGE chrg; + LPCTSTR lpstrText; + CHARRANGE chrgText;} FINDTEXTEX; + typedef struct _charrange { + LONG cpMin; + LONG cpMax;} CHARRANGE; + """ + findtextex_fmt = "llPll" + ## Scintilla does not handle unicode in EM_FINDTEXT msg (FINDTEXTEX struct) + txt_buff = (findText + "\0").encode(default_scintilla_encoding) + txt_array = array.array("b", txt_buff) + ft_buff = struct.pack( + findtextex_fmt, range[0], range[1], txt_array.buffer_info()[0], 0, 0 + ) + ft_array = array.array("b", ft_buff) + rc = self.SendScintilla(EM_FINDTEXTEX, flags, ft_array.buffer_info()[0]) + ftUnpacked = struct.unpack(findtextex_fmt, ft_array) + return rc, (ftUnpacked[3], ftUnpacked[4]) + + def GetSel(self): + currentPos = self.SendScintilla(scintillacon.SCI_GETCURRENTPOS) + anchorPos = self.SendScintilla(scintillacon.SCI_GETANCHOR) + if currentPos < anchorPos: + return (currentPos, anchorPos) + else: + return (anchorPos, currentPos) + return currentPos + + def GetSelText(self): + start, end = self.GetSel() + txtBuf = array.array("b", null_byte * (end - start + 1)) + addressTxtBuf = txtBuf.buffer_info()[0] + # EM_GETSELTEXT is documented as returning the number of chars + # not including the NULL, but scintilla includes the NULL. A + # quick glance at the scintilla impl doesn't make this + # obvious - the NULL is included in the 'selection' object + # and reflected in the length of that 'selection' object. + # I expect that is a bug in scintilla and may be fixed by now, + # but we just blindly assume that the last char is \0 and + # strip it. + self.SendScintilla(EM_GETSELTEXT, 0, addressTxtBuf) + return txtBuf.tobytes()[:-1].decode(default_scintilla_encoding) + + def SetSel(self, start=0, end=None): + if type(start) == type(()): + assert ( + end is None + ), "If you pass a point in the first param, the second must be None" + start, end = start + elif end is None: + end = start + if start < 0: + start = self.GetTextLength() + if end < 0: + end = self.GetTextLength() + assert start <= self.GetTextLength(), "The start postion is invalid (%d/%d)" % ( + start, + self.GetTextLength(), + ) + assert end <= self.GetTextLength(), "The end postion is invalid (%d/%d)" % ( + end, + self.GetTextLength(), + ) + cr = struct.pack("ll", start, end) + crBuff = array.array("b", cr) + addressCrBuff = crBuff.buffer_info()[0] + rc = self.SendScintilla(EM_EXSETSEL, 0, addressCrBuff) + + def GetLineCount(self): + return self.SendScintilla(win32con.EM_GETLINECOUNT) + + def LineFromChar(self, charPos=-1): + if charPos == -1: + charPos = self.GetSel()[0] + assert ( + charPos >= 0 and charPos <= self.GetTextLength() + ), "The charPos postion (%s) is invalid (max=%s)" % ( + charPos, + self.GetTextLength(), + ) + # return self.SendScintilla(EM_EXLINEFROMCHAR, charPos) + # EM_EXLINEFROMCHAR puts charPos in lParam, not wParam + return self.SendScintilla(EM_EXLINEFROMCHAR, 0, charPos) + + def LineIndex(self, line): + return self.SendScintilla(win32con.EM_LINEINDEX, line) + + def ScrollCaret(self): + return self.SendScintilla(win32con.EM_SCROLLCARET) + + def GetCurLineNumber(self): + return self.LineFromChar(self.SCIGetCurrentPos()) + + def GetTextLength(self): + return self.SendScintilla(scintillacon.SCI_GETTEXTLENGTH) + + def GetTextRange(self, start=0, end=-1, decode=True): + if end == -1: + end = self.SendScintilla(scintillacon.SCI_GETTEXTLENGTH) + assert end >= start, "Negative index requested (%d/%d)" % (start, end) + assert ( + start >= 0 and start <= self.GetTextLength() + ), "The start postion is invalid" + assert end >= 0 and end <= self.GetTextLength(), "The end postion is invalid" + initer = null_byte * (end - start + 1) + buff = array.array("b", initer) + addressBuffer = buff.buffer_info()[0] + tr = struct.pack("llP", start, end, addressBuffer) + trBuff = array.array("b", tr) + addressTrBuff = trBuff.buffer_info()[0] + num_bytes = self.SendScintilla(EM_GETTEXTRANGE, 0, addressTrBuff) + ret = buff.tobytes()[:num_bytes] + if decode: + ret = ret.decode(default_scintilla_encoding) + return ret + + def ReplaceSel(self, str): + buff = (str + "\0").encode(default_scintilla_encoding) + self.SendScintilla(scintillacon.SCI_REPLACESEL, 0, buff) + + def GetLine(self, line=-1): + if line == -1: + line = self.GetCurLineNumber() + start = self.LineIndex(line) + end = self.LineIndex(line + 1) + return self.GetTextRange(start, end) + + def SetReadOnly(self, flag=1): + return self.SendScintilla(win32con.EM_SETREADONLY, flag) + + def LineScroll(self, lines, cols=0): + return self.SendScintilla(win32con.EM_LINESCROLL, cols, lines) + + def GetFirstVisibleLine(self): + return self.SendScintilla(win32con.EM_GETFIRSTVISIBLELINE) + + def SetWordWrap(self, mode): + if mode != win32ui.CRichEditView_WrapNone: + raise ValueError("We dont support word-wrap (I dont think :-)") + + +class CScintillaColorEditInterface(CScintillaEditInterface): + ################################ + # Plug-in colorizer support + def _GetColorizer(self): + if not hasattr(self, "colorizer"): + self.colorizer = self._MakeColorizer() + return self.colorizer + + def _MakeColorizer(self): + # Give parent a chance to hook. + parent_func = getattr(self.GetParentFrame(), "_MakeColorizer", None) + if parent_func is not None: + return parent_func() + from . import formatter + + ## return formatter.PythonSourceFormatter(self) + return formatter.BuiltinPythonSourceFormatter(self) + + def Colorize(self, start=0, end=-1): + c = self._GetColorizer() + if c is not None: + c.Colorize(start, end) + + def ApplyFormattingStyles(self, bReload=1): + c = self._GetColorizer() + if c is not None: + c.ApplyFormattingStyles(bReload) + + # The Parent window will normally hook + def HookFormatter(self, parent=None): + c = self._GetColorizer() + if c is not None: # No need if we have no color! + c.HookFormatter(parent) + + +class CScintillaEdit(window.Wnd, CScintillaColorEditInterface): + def __init__(self, wnd=None): + if wnd is None: + wnd = win32ui.CreateWnd() + window.Wnd.__init__(self, wnd) + + def SendScintilla(self, msg, w=0, l=0): + return self.SendMessage(msg, w, l) + + def CreateWindow(self, style, rect, parent, id): + self._obj_.CreateWindow("Scintilla", "Scintilla", style, rect, parent, id, None) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/document.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/document.py new file mode 100644 index 0000000000000000000000000000000000000000..cddb442c113ae857216daa24cb5a56006a935f3c --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/document.py @@ -0,0 +1,312 @@ +import codecs +import re +import string + +import win32con +import win32ui +from pywin import default_scintilla_encoding +from pywin.mfc import docview + +from . import scintillacon + +crlf_bytes = "\r\n".encode("ascii") +lf_bytes = "\n".encode("ascii") + +# re from pep263 - but we use it both on bytes and strings. +re_encoding_bytes = re.compile("coding[:=]\s*([-\w.]+)".encode("ascii")) +re_encoding_text = re.compile("coding[:=]\s*([-\w.]+)") + +ParentScintillaDocument = docview.Document + + +class CScintillaDocument(ParentScintillaDocument): + "A SyntEdit document." + + def __init__(self, *args): + self.bom = None # the BOM, if any, read from the file. + # the encoding we detected from the source. Might have + # detected via the BOM or an encoding decl. Note that in + # the latter case (ie, while self.bom is None), it can't be + # trusted - the user may have edited the encoding decl between + # open and save. + self.source_encoding = None + ParentScintillaDocument.__init__(self, *args) + + def DeleteContents(self): + pass + + def OnOpenDocument(self, filename): + # init data members + # print "Opening", filename + self.SetPathName(filename) # Must set this early! + try: + # load the text as binary we can get smart + # about detecting any existing EOL conventions. + f = open(filename, "rb") + try: + self._LoadTextFromFile(f) + finally: + f.close() + except IOError: + rc = win32ui.MessageBox( + "Could not load the file from %s\n\nDo you want to create a new file?" + % filename, + "Pythonwin", + win32con.MB_YESNO | win32con.MB_ICONWARNING, + ) + if rc == win32con.IDNO: + return 0 + assert rc == win32con.IDYES, rc + try: + f = open(filename, "wb+") + try: + self._LoadTextFromFile(f) + finally: + f.close() + except IOError as e: + rc = win32ui.MessageBox("Cannot create the file %s" % filename) + return 1 + + def SaveFile(self, fileName, encoding=None): + view = self.GetFirstView() + ok = view.SaveTextFile(fileName, encoding=encoding) + if ok: + view.SCISetSavePoint() + return ok + + def ApplyFormattingStyles(self): + self._ApplyOptionalToViews("ApplyFormattingStyles") + + # ##################### + # File related functions + # Helper to transfer text from the MFC document to the control. + def _LoadTextFromFile(self, f): + # detect EOL mode - we don't support \r only - so find the + # first '\n' and guess based on the char before. + l = f.readline() + l2 = f.readline() + # If line ends with \r\n or has no line ending, use CRLF. + if l.endswith(crlf_bytes) or not l.endswith(lf_bytes): + eol_mode = scintillacon.SC_EOL_CRLF + else: + eol_mode = scintillacon.SC_EOL_LF + + # Detect the encoding - first look for a BOM, and if not found, + # look for a pep263 encoding declaration. + for bom, encoding in ( + (codecs.BOM_UTF8, "utf8"), + (codecs.BOM_UTF16_LE, "utf_16_le"), + (codecs.BOM_UTF16_BE, "utf_16_be"), + ): + if l.startswith(bom): + self.bom = bom + self.source_encoding = encoding + l = l[len(bom) :] # remove it. + break + else: + # no bom detected - look for pep263 encoding decl. + for look in (l, l2): + # Note we are looking at raw bytes here: so + # both the re itself uses bytes and the result + # is bytes - but we need the result as a string. + match = re_encoding_bytes.search(look) + if match is not None: + self.source_encoding = match.group(1).decode("ascii") + break + + # reading by lines would be too slow? Maybe we can use the + # incremental encoders? For now just stick with loading the + # entire file in memory. + text = l + l2 + f.read() + + # Translate from source encoding to UTF-8 bytes for Scintilla + source_encoding = self.source_encoding + # If we don't know an encoding, try utf-8 - if that fails we will + # fallback to latin-1 to treat it as bytes... + if source_encoding is None: + source_encoding = "utf-8" + # we could optimize this by avoiding utf8 to-ing and from-ing, + # but then we would lose the ability to handle invalid utf8 + # (and even then, the use of encoding aliases makes this tricky) + # To create an invalid utf8 file: + # >>> open(filename, "wb").write(codecs.BOM_UTF8+"bad \xa9har\r\n") + try: + dec = text.decode(source_encoding) + except UnicodeError: + print( + "WARNING: Failed to decode bytes from '%s' encoding - treating as latin1" + % source_encoding + ) + dec = text.decode("latin1") + except LookupError: + print( + "WARNING: Invalid encoding '%s' specified - treating as latin1" + % source_encoding + ) + dec = text.decode("latin1") + # and put it back as utf8 - this shouldn't fail. + text = dec.encode(default_scintilla_encoding) + + view = self.GetFirstView() + if view.IsWindow(): + # Turn off undo collection while loading + view.SendScintilla(scintillacon.SCI_SETUNDOCOLLECTION, 0, 0) + # Make sure the control isnt read-only + view.SetReadOnly(0) + view.SendScintilla(scintillacon.SCI_CLEARALL) + view.SendMessage(scintillacon.SCI_ADDTEXT, text) + view.SendScintilla(scintillacon.SCI_SETUNDOCOLLECTION, 1, 0) + view.SendScintilla(win32con.EM_EMPTYUNDOBUFFER, 0, 0) + # set EOL mode + view.SendScintilla(scintillacon.SCI_SETEOLMODE, eol_mode) + + def _SaveTextToFile(self, view, filename, encoding=None): + s = view.GetTextRange() # already decoded from scintilla's encoding + source_encoding = encoding + if source_encoding is None: + if self.bom: + source_encoding = self.source_encoding + else: + # no BOM - look for an encoding. + bits = re.split("[\r\n]+", s, 3) + for look in bits[:-1]: + match = re_encoding_text.search(look) + if match is not None: + source_encoding = match.group(1) + self.source_encoding = source_encoding + break + + if source_encoding is None: + source_encoding = "utf-8" + + ## encode data before opening file so script is not lost if encoding fails + file_contents = s.encode(source_encoding) + # Open in binary mode as scintilla itself ensures the + # line endings are already appropriate + f = open(filename, "wb") + try: + if self.bom: + f.write(self.bom) + f.write(file_contents) + finally: + f.close() + self.SetModifiedFlag(0) + + def FinalizeViewCreation(self, view): + pass + + def HookViewNotifications(self, view): + parent = view.GetParentFrame() + parent.HookNotify( + ViewNotifyDelegate(self, "OnBraceMatch"), scintillacon.SCN_CHECKBRACE + ) + parent.HookNotify( + ViewNotifyDelegate(self, "OnMarginClick"), scintillacon.SCN_MARGINCLICK + ) + parent.HookNotify( + ViewNotifyDelegate(self, "OnNeedShown"), scintillacon.SCN_NEEDSHOWN + ) + + parent.HookNotify( + DocumentNotifyDelegate(self, "OnSavePointReached"), + scintillacon.SCN_SAVEPOINTREACHED, + ) + parent.HookNotify( + DocumentNotifyDelegate(self, "OnSavePointLeft"), + scintillacon.SCN_SAVEPOINTLEFT, + ) + parent.HookNotify( + DocumentNotifyDelegate(self, "OnModifyAttemptRO"), + scintillacon.SCN_MODIFYATTEMPTRO, + ) + # Tell scintilla what characters should abort auto-complete. + view.SCIAutoCStops(string.whitespace + "()[]:;+-/*=\\?'!#@$%^&,<>\"'|") + + if view != self.GetFirstView(): + view.SCISetDocPointer(self.GetFirstView().SCIGetDocPointer()) + + def OnSavePointReached(self, std, extra): + self.SetModifiedFlag(0) + + def OnSavePointLeft(self, std, extra): + self.SetModifiedFlag(1) + + def OnModifyAttemptRO(self, std, extra): + self.MakeDocumentWritable() + + # All Marker functions are 1 based. + def MarkerAdd(self, lineNo, marker): + self.GetEditorView().SCIMarkerAdd(lineNo - 1, marker) + + def MarkerCheck(self, lineNo, marker): + v = self.GetEditorView() + lineNo = lineNo - 1 # Make 0 based + markerState = v.SCIMarkerGet(lineNo) + return markerState & (1 << marker) != 0 + + def MarkerToggle(self, lineNo, marker): + v = self.GetEditorView() + if self.MarkerCheck(lineNo, marker): + v.SCIMarkerDelete(lineNo - 1, marker) + else: + v.SCIMarkerAdd(lineNo - 1, marker) + + def MarkerDelete(self, lineNo, marker): + self.GetEditorView().SCIMarkerDelete(lineNo - 1, marker) + + def MarkerDeleteAll(self, marker): + self.GetEditorView().SCIMarkerDeleteAll(marker) + + def MarkerGetNext(self, lineNo, marker): + return self.GetEditorView().SCIMarkerNext(lineNo - 1, 1 << marker) + 1 + + def MarkerAtLine(self, lineNo, marker): + markerState = self.GetEditorView().SCIMarkerGet(lineNo - 1) + return markerState & (1 << marker) + + # Helper for reflecting functions to views. + def _ApplyToViews(self, funcName, *args): + for view in self.GetAllViews(): + func = getattr(view, funcName) + func(*args) + + def _ApplyOptionalToViews(self, funcName, *args): + for view in self.GetAllViews(): + func = getattr(view, funcName, None) + if func is not None: + func(*args) + + def GetEditorView(self): + # Find the first frame with a view, + # then ask it to give the editor view + # as it knows which one is "active" + try: + frame_gev = self.GetFirstView().GetParentFrame().GetEditorView + except AttributeError: + return self.GetFirstView() + return frame_gev() + + +# Delegate to the correct view, based on the control that sent it. +class ViewNotifyDelegate: + def __init__(self, doc, name): + self.doc = doc + self.name = name + + def __call__(self, std, extra): + (hwndFrom, idFrom, code) = std + for v in self.doc.GetAllViews(): + if v.GetSafeHwnd() == hwndFrom: + return getattr(v, self.name)(*(std, extra)) + + +# Delegate to the document, but only from a single view (as each view sends it seperately) +class DocumentNotifyDelegate: + def __init__(self, doc, name): + self.doc = doc + self.delegate = getattr(doc, name) + + def __call__(self, std, extra): + (hwndFrom, idFrom, code) = std + if hwndFrom == self.doc.GetEditorView().GetSafeHwnd(): + self.delegate(*(std, extra)) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/find.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/find.py new file mode 100644 index 0000000000000000000000000000000000000000..e1d21a5bceec6359e2d9023b5098e38346905f29 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/find.py @@ -0,0 +1,510 @@ +# find.py - Find and Replace +import afxres +import win32api +import win32con +import win32ui +from pywin.framework import scriptutils +from pywin.mfc import dialog + +FOUND_NOTHING = 0 +FOUND_NORMAL = 1 +FOUND_LOOPED_BACK = 2 +FOUND_NEXT_FILE = 3 + + +class SearchParams: + def __init__(self, other=None): + if other is None: + self.__dict__["findText"] = "" + self.__dict__["replaceText"] = "" + self.__dict__["matchCase"] = 0 + self.__dict__["matchWords"] = 0 + self.__dict__["acrossFiles"] = 0 + self.__dict__["remember"] = 1 + self.__dict__["sel"] = (-1, -1) + self.__dict__["keepDialogOpen"] = 0 + else: + self.__dict__.update(other.__dict__) + + # Helper so we cant misspell attributes :-) + def __setattr__(self, attr, val): + if not hasattr(self, attr): + raise AttributeError(attr) + self.__dict__[attr] = val + + +curDialog = None +lastSearch = defaultSearch = SearchParams() +searchHistory = [] + + +def ShowFindDialog(): + _ShowDialog(FindDialog) + + +def ShowReplaceDialog(): + _ShowDialog(ReplaceDialog) + + +def _ShowDialog(dlgClass): + global curDialog + if curDialog is not None: + if curDialog.__class__ != dlgClass: + curDialog.DestroyWindow() + curDialog = None + else: + curDialog.SetFocus() + if curDialog is None: + curDialog = dlgClass() + curDialog.CreateWindow() + + +def FindNext(): + params = SearchParams(lastSearch) + params.sel = (-1, -1) + if not params.findText: + ShowFindDialog() + else: + return _FindIt(None, params) + + +def _GetControl(control=None): + if control is None: + control = scriptutils.GetActiveEditControl() + return control + + +def _FindIt(control, searchParams): + global lastSearch, defaultSearch + control = _GetControl(control) + if control is None: + return FOUND_NOTHING + + # Move to the next char, so we find the next one. + flags = 0 + if searchParams.matchWords: + flags = flags | win32con.FR_WHOLEWORD + if searchParams.matchCase: + flags = flags | win32con.FR_MATCHCASE + if searchParams.sel == (-1, -1): + sel = control.GetSel() + # If the position is the same as we found last time, + # then we assume it is a "FindNext" + if sel == lastSearch.sel: + sel = sel[0] + 1, sel[0] + 1 + else: + sel = searchParams.sel + + if sel[0] == sel[1]: + sel = sel[0], control.GetTextLength() + + rc = FOUND_NOTHING + # (Old edit control will fail here!) + posFind, foundSel = control.FindText(flags, sel, searchParams.findText) + lastSearch = SearchParams(searchParams) + if posFind >= 0: + rc = FOUND_NORMAL + lineno = control.LineFromChar(posFind) + control.SCIEnsureVisible(lineno) + control.SetSel(foundSel) + control.SetFocus() + win32ui.SetStatusText(win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE)) + if rc == FOUND_NOTHING and lastSearch.acrossFiles: + # Loop around all documents. First find this document. + try: + try: + doc = control.GetDocument() + except AttributeError: + try: + doc = control.GetParent().GetDocument() + except AttributeError: + print("Cant find a document for the control!") + doc = None + if doc is not None: + template = doc.GetDocTemplate() + alldocs = template.GetDocumentList() + mypos = lookpos = alldocs.index(doc) + while 1: + lookpos = (lookpos + 1) % len(alldocs) + if lookpos == mypos: + break + view = alldocs[lookpos].GetFirstView() + posFind, foundSel = view.FindText( + flags, (0, view.GetTextLength()), searchParams.findText + ) + if posFind >= 0: + nChars = foundSel[1] - foundSel[0] + lineNo = view.LineFromChar(posFind) # zero based. + lineStart = view.LineIndex(lineNo) + colNo = posFind - lineStart # zero based. + scriptutils.JumpToDocument( + alldocs[lookpos].GetPathName(), + lineNo + 1, + colNo + 1, + nChars, + ) + rc = FOUND_NEXT_FILE + break + except win32ui.error: + pass + if rc == FOUND_NOTHING: + # Loop around this control - attempt to find from the start of the control. + posFind, foundSel = control.FindText( + flags, (0, sel[0] - 1), searchParams.findText + ) + if posFind >= 0: + control.SCIEnsureVisible(control.LineFromChar(foundSel[0])) + control.SetSel(foundSel) + control.SetFocus() + win32ui.SetStatusText("Not found! Searching from the top of the file.") + rc = FOUND_LOOPED_BACK + else: + lastSearch.sel = -1, -1 + win32ui.SetStatusText("Can not find '%s'" % searchParams.findText) + + if rc != FOUND_NOTHING: + lastSearch.sel = foundSel + + if lastSearch.remember: + defaultSearch = lastSearch + + # track search history + try: + ix = searchHistory.index(searchParams.findText) + except ValueError: + if len(searchHistory) > 50: + searchHistory[50:] = [] + else: + del searchHistory[ix] + searchHistory.insert(0, searchParams.findText) + + return rc + + +def _ReplaceIt(control): + control = _GetControl(control) + statusText = "Can not find '%s'." % lastSearch.findText + rc = FOUND_NOTHING + if control is not None and lastSearch.sel != (-1, -1): + control.ReplaceSel(lastSearch.replaceText) + rc = FindNext() + if rc != FOUND_NOTHING: + statusText = win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE) + win32ui.SetStatusText(statusText) + return rc + + +class FindReplaceDialog(dialog.Dialog): + def __init__(self): + dialog.Dialog.__init__(self, self._GetDialogTemplate()) + self.HookCommand(self.OnFindNext, 109) + + def OnInitDialog(self): + self.editFindText = self.GetDlgItem(102) + self.butMatchWords = self.GetDlgItem(105) + self.butMatchCase = self.GetDlgItem(107) + self.butKeepDialogOpen = self.GetDlgItem(115) + self.butAcrossFiles = self.GetDlgItem(116) + self.butRemember = self.GetDlgItem(117) + + self.editFindText.SetWindowText(defaultSearch.findText) + control = _GetControl() + # _GetControl only gets normal MDI windows; if the interactive + # window is docked and no document open, we get None. + if control: + # If we have a selection, default to that. + sel = control.GetSelText() + if len(sel) != 0: + self.editFindText.SetWindowText(sel) + if defaultSearch.remember: + defaultSearch.findText = sel + for hist in searchHistory: + self.editFindText.AddString(hist) + + if hasattr(self.editFindText, "SetEditSel"): + self.editFindText.SetEditSel(0, -1) + else: + self.editFindText.SetSel(0, -1) + self.butMatchWords.SetCheck(defaultSearch.matchWords) + self.butMatchCase.SetCheck(defaultSearch.matchCase) + self.butKeepDialogOpen.SetCheck(defaultSearch.keepDialogOpen) + self.butAcrossFiles.SetCheck(defaultSearch.acrossFiles) + self.butRemember.SetCheck(defaultSearch.remember) + return dialog.Dialog.OnInitDialog(self) + + def OnDestroy(self, msg): + global curDialog + curDialog = None + return dialog.Dialog.OnDestroy(self, msg) + + def DoFindNext(self): + params = SearchParams() + params.findText = self.editFindText.GetWindowText() + params.matchCase = self.butMatchCase.GetCheck() + params.matchWords = self.butMatchWords.GetCheck() + params.acrossFiles = self.butAcrossFiles.GetCheck() + params.remember = self.butRemember.GetCheck() + return _FindIt(None, params) + + def OnFindNext(self, id, code): + if code != 0: # BN_CLICKED + # 3d controls (python.exe + start_pythonwin.pyw) send + # other notification codes + return 1 # + if not self.editFindText.GetWindowText(): + win32api.MessageBeep() + return 1 + if self.DoFindNext() != FOUND_NOTHING: + if not self.butKeepDialogOpen.GetCheck(): + self.DestroyWindow() + + +class FindDialog(FindReplaceDialog): + def _GetDialogTemplate(self): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + visible = win32con.WS_CHILD | win32con.WS_VISIBLE + dt = [ + ["Find", (0, 2, 240, 75), style, None, (8, "MS Sans Serif")], + ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], + [ + "ComboBox", + "", + 102, + (50, 7, 120, 120), + visible + | win32con.WS_BORDER + | win32con.WS_TABSTOP + | win32con.WS_VSCROLL + | win32con.CBS_DROPDOWN + | win32con.CBS_AUTOHSCROLL, + ], + [ + "Button", + "Match &whole word only", + 105, + (5, 23, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "Match &case", + 107, + (5, 33, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "Keep &dialog open", + 115, + (5, 43, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "Across &open files", + 116, + (5, 52, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "&Remember as default search", + 117, + (5, 61, 150, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "&Find Next", + 109, + (185, 5, 50, 14), + visible | win32con.BS_DEFPUSHBUTTON | win32con.WS_TABSTOP, + ], + [ + "Button", + "Cancel", + win32con.IDCANCEL, + (185, 23, 50, 14), + visible | win32con.WS_TABSTOP, + ], + ] + return dt + + +class ReplaceDialog(FindReplaceDialog): + def _GetDialogTemplate(self): + style = ( + win32con.DS_MODALFRAME + | win32con.WS_POPUP + | win32con.WS_VISIBLE + | win32con.WS_CAPTION + | win32con.WS_SYSMENU + | win32con.DS_SETFONT + ) + visible = win32con.WS_CHILD | win32con.WS_VISIBLE + dt = [ + ["Replace", (0, 2, 240, 95), style, 0, (8, "MS Sans Serif")], + ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], + [ + "ComboBox", + "", + 102, + (60, 7, 110, 120), + visible + | win32con.WS_BORDER + | win32con.WS_TABSTOP + | win32con.WS_VSCROLL + | win32con.CBS_DROPDOWN + | win32con.CBS_AUTOHSCROLL, + ], + ["Static", "Re&place with:", 103, (5, 25, 50, 10), visible], + [ + "ComboBox", + "", + 104, + (60, 24, 110, 120), + visible + | win32con.WS_BORDER + | win32con.WS_TABSTOP + | win32con.WS_VSCROLL + | win32con.CBS_DROPDOWN + | win32con.CBS_AUTOHSCROLL, + ], + [ + "Button", + "Match &whole word only", + 105, + (5, 42, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "Match &case", + 107, + (5, 52, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "Keep &dialog open", + 115, + (5, 62, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "Across &open files", + 116, + (5, 72, 100, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "&Remember as default search", + 117, + (5, 81, 150, 10), + visible | win32con.BS_AUTOCHECKBOX | win32con.WS_TABSTOP, + ], + [ + "Button", + "&Find Next", + 109, + (185, 5, 50, 14), + visible | win32con.BS_DEFPUSHBUTTON | win32con.WS_TABSTOP, + ], + [ + "Button", + "&Replace", + 110, + (185, 23, 50, 14), + visible | win32con.WS_TABSTOP, + ], + [ + "Button", + "Replace &All", + 111, + (185, 41, 50, 14), + visible | win32con.WS_TABSTOP, + ], + [ + "Button", + "Cancel", + win32con.IDCANCEL, + (185, 59, 50, 14), + visible | win32con.WS_TABSTOP, + ], + ] + return dt + + def OnInitDialog(self): + rc = FindReplaceDialog.OnInitDialog(self) + self.HookCommand(self.OnReplace, 110) + self.HookCommand(self.OnReplaceAll, 111) + self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE) + self.editReplaceText = self.GetDlgItem(104) + self.editReplaceText.SetWindowText(lastSearch.replaceText) + if hasattr(self.editReplaceText, "SetEditSel"): + self.editReplaceText.SetEditSel(0, -1) + else: + self.editReplaceText.SetSel(0, -1) + self.butReplace = self.GetDlgItem(110) + self.butReplaceAll = self.GetDlgItem(111) + self.CheckButtonStates() + return rc # 0 when focus set + + def CheckButtonStates(self): + # We can do a "Replace" or "Replace All" if the current selection + # is the same as the search text. + ft = self.editFindText.GetWindowText() + control = _GetControl() + # bCanReplace = len(ft)>0 and control.GetSelText() == ft + bCanReplace = control is not None and lastSearch.sel == control.GetSel() + self.butReplace.EnableWindow(bCanReplace) + + # self.butReplaceAll.EnableWindow(bCanReplace) + + def OnActivate(self, msg): + wparam = msg[2] + fActive = win32api.LOWORD(wparam) + if fActive != win32con.WA_INACTIVE: + self.CheckButtonStates() + + def OnFindNext(self, id, code): + if code != 0: + return 1 + self.DoFindNext() + self.CheckButtonStates() + + def OnReplace(self, id, code): + if code != 0: + return 1 + lastSearch.replaceText = self.editReplaceText.GetWindowText() + _ReplaceIt(None) + + def OnReplaceAll(self, id, code): + if code != 0: + return 1 + control = _GetControl(None) + if control is not None: + control.SetSel(0) + num = 0 + if self.DoFindNext() == FOUND_NORMAL: + num = 1 + lastSearch.replaceText = self.editReplaceText.GetWindowText() + while _ReplaceIt(control) == FOUND_NORMAL: + num = num + 1 + + win32ui.SetStatusText("Replaced %d occurrences" % num) + if num > 0 and not self.butKeepDialogOpen.GetCheck(): + self.DestroyWindow() + + +if __name__ == "__main__": + ShowFindDialog() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/formatter.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/formatter.py new file mode 100644 index 0000000000000000000000000000000000000000..56100ccfcf52f6f8b7d7afa299e002a15756b887 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/formatter.py @@ -0,0 +1,695 @@ +# Does Python source formatting for Scintilla controls. +import array +import string + +import win32api +import win32con +import win32ui + +from . import scintillacon + +WM_KICKIDLE = 0x036A + +# Used to indicate that style should use default color +from win32con import CLR_INVALID + +debugging = 0 +if debugging: + # Output must go to another process else the result of + # the printing itself will trigger again trigger a trace. + + import win32trace + import win32traceutil + + def trace(*args): + win32trace.write(" ".join(map(str, args)) + "\n") + +else: + trace = lambda *args: None + + +class Style: + """Represents a single format""" + + def __init__(self, name, format, background=CLR_INVALID): + self.name = name # Name the format representes eg, "String", "Class" + # Default background for each style is only used when there are no + # saved settings (generally on first startup) + self.background = self.default_background = background + if type(format) == type(""): + self.aliased = format + self.format = None + else: + self.format = format + self.aliased = None + self.stylenum = None # Not yet registered. + + def IsBasedOnDefault(self): + return len(self.format) == 5 + + # If the currently extended font defintion matches the + # default format, restore the format to the "simple" format. + def NormalizeAgainstDefault(self, defaultFormat): + if self.IsBasedOnDefault(): + return 0 # No more to do, and not changed. + bIsDefault = ( + self.format[7] == defaultFormat[7] and self.format[2] == defaultFormat[2] + ) + if bIsDefault: + self.ForceAgainstDefault() + return bIsDefault + + def ForceAgainstDefault(self): + self.format = self.format[:5] + + def GetCompleteFormat(self, defaultFormat): + # Get the complete style after applying any relevant defaults. + if len(self.format) == 5: # It is a default one + fmt = self.format + defaultFormat[5:] + else: + fmt = self.format + flags = ( + win32con.CFM_BOLD + | win32con.CFM_CHARSET + | win32con.CFM_COLOR + | win32con.CFM_FACE + | win32con.CFM_ITALIC + | win32con.CFM_SIZE + ) + return (flags,) + fmt[1:] + + +# The Formatter interface +# used primarily when the actual formatting is done by Scintilla! +class FormatterBase: + def __init__(self, scintilla): + self.scintilla = scintilla + self.baseFormatFixed = (-402653169, 0, 200, 0, 0, 0, 49, "Courier New") + self.baseFormatProp = (-402653169, 0, 200, 0, 0, 0, 49, "Arial") + self.bUseFixed = 1 + self.styles = {} # Indexed by name + self.styles_by_id = {} # Indexed by allocated ID. + self.SetStyles() + + def HookFormatter(self, parent=None): + raise NotImplementedError() + + # Used by the IDLE extensions to quickly determine if a character is a string. + def GetStringStyle(self, pos): + try: + style = self.styles_by_id[self.scintilla.SCIGetStyleAt(pos)] + except KeyError: + # A style we dont know about - probably not even a .py file - can't be a string + return None + if style.name in self.string_style_names: + return style + return None + + def RegisterStyle(self, style, stylenum): + assert stylenum is not None, "We must have a style number" + assert style.stylenum is None, "Style has already been registered" + assert stylenum not in self.styles, "We are reusing a style number!" + style.stylenum = stylenum + self.styles[style.name] = style + self.styles_by_id[stylenum] = style + + def SetStyles(self): + raise NotImplementedError() + + def GetSampleText(self): + return "Sample Text for the Format Dialog" + + def GetDefaultFormat(self): + if self.bUseFixed: + return self.baseFormatFixed + return self.baseFormatProp + + # Update the control with the new style format. + def _ReformatStyle(self, style): + ## Selection (background only for now) + ## Passing False for WPARAM to SCI_SETSELBACK is documented as resetting to scintilla default, + ## but does not work - selection background is not visible at all. + ## Default value in SPECIAL_STYLES taken from scintilla source. + if style.name == STYLE_SELECTION: + clr = style.background + self.scintilla.SendScintilla(scintillacon.SCI_SETSELBACK, True, clr) + + ## Can't change font for selection, but could set color + ## However, the font color dropbox has no option for default, and thus would + ## always override syntax coloring + ## clr = style.format[4] + ## self.scintilla.SendScintilla(scintillacon.SCI_SETSELFORE, clr != CLR_INVALID, clr) + return + + assert style.stylenum is not None, "Unregistered style." + # print "Reformat style", style.name, style.stylenum + scintilla = self.scintilla + stylenum = style.stylenum + # Now we have the style number, indirect for the actual style. + if style.aliased is not None: + style = self.styles[style.aliased] + f = style.format + if style.IsBasedOnDefault(): + baseFormat = self.GetDefaultFormat() + else: + baseFormat = f + scintilla.SCIStyleSetFore(stylenum, f[4]) + scintilla.SCIStyleSetFont(stylenum, baseFormat[7], baseFormat[5]) + if f[1] & 1: + scintilla.SCIStyleSetBold(stylenum, 1) + else: + scintilla.SCIStyleSetBold(stylenum, 0) + if f[1] & 2: + scintilla.SCIStyleSetItalic(stylenum, 1) + else: + scintilla.SCIStyleSetItalic(stylenum, 0) + scintilla.SCIStyleSetSize(stylenum, int(baseFormat[2] / 20)) + scintilla.SCIStyleSetEOLFilled(stylenum, 1) # Only needed for unclosed strings. + + ## Default style background to whitespace background if set, + ## otherwise use system window color + bg = style.background + if bg == CLR_INVALID: + bg = self.styles[STYLE_DEFAULT].background + if bg == CLR_INVALID: + bg = win32api.GetSysColor(win32con.COLOR_WINDOW) + scintilla.SCIStyleSetBack(stylenum, bg) + + def GetStyleByNum(self, stylenum): + return self.styles_by_id[stylenum] + + def ApplyFormattingStyles(self, bReload=1): + if bReload: + self.LoadPreferences() + baseFormat = self.GetDefaultFormat() + defaultStyle = Style("default", baseFormat) + defaultStyle.stylenum = scintillacon.STYLE_DEFAULT + self._ReformatStyle(defaultStyle) + for style in list(self.styles.values()): + if style.aliased is None: + style.NormalizeAgainstDefault(baseFormat) + self._ReformatStyle(style) + self.scintilla.InvalidateRect() + + # Some functions for loading and saving preferences. By default + # an INI file (well, MFC maps this to the registry) is used. + def LoadPreferences(self): + self.baseFormatFixed = eval( + self.LoadPreference("Base Format Fixed", str(self.baseFormatFixed)) + ) + self.baseFormatProp = eval( + self.LoadPreference("Base Format Proportional", str(self.baseFormatProp)) + ) + self.bUseFixed = int(self.LoadPreference("Use Fixed", 1)) + + for style in list(self.styles.values()): + new = self.LoadPreference(style.name, str(style.format)) + try: + style.format = eval(new) + except: + print("Error loading style data for", style.name) + # Use "vanilla" background hardcoded in PYTHON_STYLES if no settings in registry + style.background = int( + self.LoadPreference( + style.name + " background", style.default_background + ) + ) + + def LoadPreference(self, name, default): + return win32ui.GetProfileVal("Format", name, default) + + def SavePreferences(self): + self.SavePreference("Base Format Fixed", str(self.baseFormatFixed)) + self.SavePreference("Base Format Proportional", str(self.baseFormatProp)) + self.SavePreference("Use Fixed", self.bUseFixed) + for style in list(self.styles.values()): + if style.aliased is None: + self.SavePreference(style.name, str(style.format)) + bg_name = style.name + " background" + self.SavePreference(bg_name, style.background) + + def SavePreference(self, name, value): + win32ui.WriteProfileVal("Format", name, value) + + +# An abstract formatter +# For all formatters we actually implement here. +# (as opposed to those formatters built in to Scintilla) +class Formatter(FormatterBase): + def __init__(self, scintilla): + self.bCompleteWhileIdle = 0 + self.bHaveIdleHandler = 0 # Dont currently have an idle handle + self.nextstylenum = 0 + FormatterBase.__init__(self, scintilla) + + def HookFormatter(self, parent=None): + if parent is None: + parent = self.scintilla.GetParent() # was GetParentFrame()!? + parent.HookNotify(self.OnStyleNeeded, scintillacon.SCN_STYLENEEDED) + + def OnStyleNeeded(self, std, extra): + notify = self.scintilla.SCIUnpackNotifyMessage(extra) + endStyledChar = self.scintilla.SendScintilla(scintillacon.SCI_GETENDSTYLED) + lineEndStyled = self.scintilla.LineFromChar(endStyledChar) + endStyled = self.scintilla.LineIndex(lineEndStyled) + # print "enPosPaint %d endStyledChar %d lineEndStyled %d endStyled %d" % (endPosPaint, endStyledChar, lineEndStyled, endStyled) + self.Colorize(endStyled, notify.position) + + def ColorSeg(self, start, end, styleName): + end = end + 1 + # assert end-start>=0, "Can't have negative styling" + stylenum = self.styles[styleName].stylenum + while start < end: + self.style_buffer[start] = stylenum + start = start + 1 + # self.scintilla.SCISetStyling(end - start + 1, stylenum) + + def RegisterStyle(self, style, stylenum=None): + if stylenum is None: + stylenum = self.nextstylenum + self.nextstylenum = self.nextstylenum + 1 + FormatterBase.RegisterStyle(self, style, stylenum) + + def ColorizeString(self, str, charStart, styleStart): + raise RuntimeError("You must override this method") + + def Colorize(self, start=0, end=-1): + scintilla = self.scintilla + # scintilla's formatting is all done in terms of utf, so + # we work with utf8 bytes instead of unicode. This magically + # works as any extended chars found in the utf8 don't change + # the semantics. + stringVal = scintilla.GetTextRange(start, end, decode=False) + if start > 0: + stylenum = scintilla.SCIGetStyleAt(start - 1) + styleStart = self.GetStyleByNum(stylenum).name + else: + styleStart = None + # trace("Coloring", start, end, end-start, len(stringVal), styleStart, self.scintilla.SCIGetCharAt(start)) + scintilla.SCIStartStyling(start, 31) + self.style_buffer = array.array("b", (0,) * len(stringVal)) + self.ColorizeString(stringVal, styleStart) + scintilla.SCISetStylingEx(self.style_buffer) + self.style_buffer = None + # trace("After styling, end styled is", self.scintilla.SCIGetEndStyled()) + if ( + self.bCompleteWhileIdle + and not self.bHaveIdleHandler + and end != -1 + and end < scintilla.GetTextLength() + ): + self.bHaveIdleHandler = 1 + win32ui.GetApp().AddIdleHandler(self.DoMoreColoring) + # Kicking idle makes the app seem slower when initially repainting! + + # win32ui.GetMainFrame().PostMessage(WM_KICKIDLE, 0, 0) + + def DoMoreColoring(self, handler, count): + try: + scintilla = self.scintilla + endStyled = scintilla.SCIGetEndStyled() + lineStartStyled = scintilla.LineFromChar(endStyled) + start = scintilla.LineIndex(lineStartStyled) + end = scintilla.LineIndex(lineStartStyled + 1) + textlen = scintilla.GetTextLength() + if end < 0: + end = textlen + + finished = end >= textlen + self.Colorize(start, end) + except (win32ui.error, AttributeError): + # Window may have closed before we finished - no big deal! + finished = 1 + + if finished: + self.bHaveIdleHandler = 0 + win32ui.GetApp().DeleteIdleHandler(handler) + return not finished + + +# A Formatter that knows how to format Python source +from keyword import iskeyword, kwlist + +wordstarts = "_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +wordchars = "._0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" +operators = "%^&*()-+=|{}[]:;<>,/?!.~" + +STYLE_DEFAULT = "Whitespace" +STYLE_COMMENT = "Comment" +STYLE_COMMENT_BLOCK = "Comment Blocks" +STYLE_NUMBER = "Number" +STYLE_STRING = "String" +STYLE_SQSTRING = "SQ String" +STYLE_TQSSTRING = "TQS String" +STYLE_TQDSTRING = "TQD String" +STYLE_KEYWORD = "Keyword" +STYLE_CLASS = "Class" +STYLE_METHOD = "Method" +STYLE_OPERATOR = "Operator" +STYLE_IDENTIFIER = "Identifier" +STYLE_BRACE = "Brace/Paren - matching" +STYLE_BRACEBAD = "Brace/Paren - unmatched" +STYLE_STRINGEOL = "String with no terminator" +STYLE_LINENUMBER = "Line numbers" +STYLE_INDENTGUIDE = "Indent guide" +STYLE_SELECTION = "Selection" + +STRING_STYLES = [ + STYLE_STRING, + STYLE_SQSTRING, + STYLE_TQSSTRING, + STYLE_TQDSTRING, + STYLE_STRINGEOL, +] + +# These styles can have any ID - they are not special to scintilla itself. +# However, if we use the built-in lexer, then we must use its style numbers +# so in that case, they _are_ special. +# (name, format, background, scintilla id) +PYTHON_STYLES = [ + (STYLE_DEFAULT, (0, 0, 200, 0, 0x808080), CLR_INVALID, scintillacon.SCE_P_DEFAULT), + ( + STYLE_COMMENT, + (0, 2, 200, 0, 0x008000), + CLR_INVALID, + scintillacon.SCE_P_COMMENTLINE, + ), + ( + STYLE_COMMENT_BLOCK, + (0, 2, 200, 0, 0x808080), + CLR_INVALID, + scintillacon.SCE_P_COMMENTBLOCK, + ), + (STYLE_NUMBER, (0, 0, 200, 0, 0x808000), CLR_INVALID, scintillacon.SCE_P_NUMBER), + (STYLE_STRING, (0, 0, 200, 0, 0x008080), CLR_INVALID, scintillacon.SCE_P_STRING), + (STYLE_SQSTRING, STYLE_STRING, CLR_INVALID, scintillacon.SCE_P_CHARACTER), + (STYLE_TQSSTRING, STYLE_STRING, CLR_INVALID, scintillacon.SCE_P_TRIPLE), + (STYLE_TQDSTRING, STYLE_STRING, CLR_INVALID, scintillacon.SCE_P_TRIPLEDOUBLE), + (STYLE_STRINGEOL, (0, 0, 200, 0, 0x000000), 0x008080, scintillacon.SCE_P_STRINGEOL), + (STYLE_KEYWORD, (0, 1, 200, 0, 0x800000), CLR_INVALID, scintillacon.SCE_P_WORD), + (STYLE_CLASS, (0, 1, 200, 0, 0xFF0000), CLR_INVALID, scintillacon.SCE_P_CLASSNAME), + (STYLE_METHOD, (0, 1, 200, 0, 0x808000), CLR_INVALID, scintillacon.SCE_P_DEFNAME), + ( + STYLE_OPERATOR, + (0, 0, 200, 0, 0x000000), + CLR_INVALID, + scintillacon.SCE_P_OPERATOR, + ), + ( + STYLE_IDENTIFIER, + (0, 0, 200, 0, 0x000000), + CLR_INVALID, + scintillacon.SCE_P_IDENTIFIER, + ), +] + +# These styles _always_ have this specific style number, regardless of +# internal or external formatter. +SPECIAL_STYLES = [ + (STYLE_BRACE, (0, 0, 200, 0, 0x000000), 0xFFFF80, scintillacon.STYLE_BRACELIGHT), + (STYLE_BRACEBAD, (0, 0, 200, 0, 0x000000), 0x8EA5F2, scintillacon.STYLE_BRACEBAD), + ( + STYLE_LINENUMBER, + (0, 0, 200, 0, 0x000000), + win32api.GetSysColor(win32con.COLOR_3DFACE), + scintillacon.STYLE_LINENUMBER, + ), + ( + STYLE_INDENTGUIDE, + (0, 0, 200, 0, 0x000000), + CLR_INVALID, + scintillacon.STYLE_INDENTGUIDE, + ), + ## Not actually a style; requires special handling to send appropriate messages to scintilla + ( + STYLE_SELECTION, + (0, 0, 200, 0, CLR_INVALID), + win32api.RGB(0xC0, 0xC0, 0xC0), + 999999, + ), +] + +PythonSampleCode = """\ +# Some Python +class Sample(Super): + def Fn(self): +\tself.v = 1024 +dest = 'dest.html' +x = func(a + 1)|) +s = "I forget... +## A large +## comment block""" + + +class PythonSourceFormatter(Formatter): + string_style_names = STRING_STYLES + + def GetSampleText(self): + return PythonSampleCode + + def LoadStyles(self): + pass + + def SetStyles(self): + for name, format, bg, ignore in PYTHON_STYLES: + self.RegisterStyle(Style(name, format, bg)) + for name, format, bg, sc_id in SPECIAL_STYLES: + self.RegisterStyle(Style(name, format, bg), sc_id) + + def ClassifyWord(self, cdoc, start, end, prevWord): + word = cdoc[start : end + 1].decode("latin-1") + attr = STYLE_IDENTIFIER + if prevWord == "class": + attr = STYLE_CLASS + elif prevWord == "def": + attr = STYLE_METHOD + elif word[0] in string.digits: + attr = STYLE_NUMBER + elif iskeyword(word): + attr = STYLE_KEYWORD + self.ColorSeg(start, end, attr) + return word + + def ColorizeString(self, str, styleStart): + if styleStart is None: + styleStart = STYLE_DEFAULT + return self.ColorizePythonCode(str, 0, styleStart) + + def ColorizePythonCode(self, cdoc, charStart, styleStart): + # Straight translation of C++, should do better + lengthDoc = len(cdoc) + if lengthDoc <= charStart: + return + prevWord = "" + state = styleStart + chPrev = chPrev2 = chPrev3 = " " + chNext2 = chNext = cdoc[charStart : charStart + 1].decode("latin-1") + startSeg = i = charStart + while i < lengthDoc: + ch = chNext + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1 : i + 2].decode("latin-1") + chNext2 = " " + if i + 2 < lengthDoc: + chNext2 = cdoc[i + 2 : i + 3].decode("latin-1") + if state == STYLE_DEFAULT: + if ch in wordstarts: + self.ColorSeg(startSeg, i - 1, STYLE_DEFAULT) + state = STYLE_KEYWORD + startSeg = i + elif ch == "#": + self.ColorSeg(startSeg, i - 1, STYLE_DEFAULT) + if chNext == "#": + state = STYLE_COMMENT_BLOCK + else: + state = STYLE_COMMENT + startSeg = i + elif ch == '"': + self.ColorSeg(startSeg, i - 1, STYLE_DEFAULT) + startSeg = i + state = STYLE_COMMENT + if chNext == '"' and chNext2 == '"': + i = i + 2 + state = STYLE_TQDSTRING + ch = " " + chPrev = " " + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1] + else: + state = STYLE_STRING + elif ch == "'": + self.ColorSeg(startSeg, i - 1, STYLE_DEFAULT) + startSeg = i + state = STYLE_COMMENT + if chNext == "'" and chNext2 == "'": + i = i + 2 + state = STYLE_TQSSTRING + ch = " " + chPrev = " " + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1] + else: + state = STYLE_SQSTRING + elif ch in operators: + self.ColorSeg(startSeg, i - 1, STYLE_DEFAULT) + self.ColorSeg(i, i, STYLE_OPERATOR) + startSeg = i + 1 + elif state == STYLE_KEYWORD: + if ch not in wordchars: + prevWord = self.ClassifyWord(cdoc, startSeg, i - 1, prevWord) + state = STYLE_DEFAULT + startSeg = i + if ch == "#": + if chNext == "#": + state = STYLE_COMMENT_BLOCK + else: + state = STYLE_COMMENT + elif ch == '"': + if chNext == '"' and chNext2 == '"': + i = i + 2 + state = STYLE_TQDSTRING + ch = " " + chPrev = " " + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1] + else: + state = STYLE_STRING + elif ch == "'": + if chNext == "'" and chNext2 == "'": + i = i + 2 + state = STYLE_TQSSTRING + ch = " " + chPrev = " " + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1] + else: + state = STYLE_SQSTRING + elif ch in operators: + self.ColorSeg(startSeg, i, STYLE_OPERATOR) + startSeg = i + 1 + elif state == STYLE_COMMENT or state == STYLE_COMMENT_BLOCK: + if ch == "\r" or ch == "\n": + self.ColorSeg(startSeg, i - 1, state) + state = STYLE_DEFAULT + startSeg = i + elif state == STYLE_STRING: + if ch == "\\": + if chNext == '"' or chNext == "'" or chNext == "\\": + i = i + 1 + ch = chNext + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1] + elif ch == '"': + self.ColorSeg(startSeg, i, STYLE_STRING) + state = STYLE_DEFAULT + startSeg = i + 1 + elif state == STYLE_SQSTRING: + if ch == "\\": + if chNext == '"' or chNext == "'" or chNext == "\\": + i = i + 1 + ch = chNext + chNext = " " + if i + 1 < lengthDoc: + chNext = cdoc[i + 1] + elif ch == "'": + self.ColorSeg(startSeg, i, STYLE_SQSTRING) + state = STYLE_DEFAULT + startSeg = i + 1 + elif state == STYLE_TQSSTRING: + if ch == "'" and chPrev == "'" and chPrev2 == "'" and chPrev3 != "\\": + self.ColorSeg(startSeg, i, STYLE_TQSSTRING) + state = STYLE_DEFAULT + startSeg = i + 1 + elif ( + state == STYLE_TQDSTRING + and ch == '"' + and chPrev == '"' + and chPrev2 == '"' + and chPrev3 != "\\" + ): + self.ColorSeg(startSeg, i, STYLE_TQDSTRING) + state = STYLE_DEFAULT + startSeg = i + 1 + chPrev3 = chPrev2 + chPrev2 = chPrev + chPrev = ch + i = i + 1 + if startSeg < lengthDoc: + if state == STYLE_KEYWORD: + self.ClassifyWord(cdoc, startSeg, lengthDoc - 1, prevWord) + else: + self.ColorSeg(startSeg, lengthDoc - 1, state) + + +# These taken from the SciTE properties file. +source_formatter_extensions = [ + (".py .pys .pyw".split(), scintillacon.SCLEX_PYTHON), + (".html .htm .asp .shtml".split(), scintillacon.SCLEX_HTML), + ( + "c .cc .cpp .cxx .h .hh .hpp .hxx .idl .odl .php3 .phtml .inc .js".split(), + scintillacon.SCLEX_CPP, + ), + (".vbs .frm .ctl .cls".split(), scintillacon.SCLEX_VB), + (".pl .pm .cgi .pod".split(), scintillacon.SCLEX_PERL), + (".sql .spec .body .sps .spb .sf .sp".split(), scintillacon.SCLEX_SQL), + (".tex .sty".split(), scintillacon.SCLEX_LATEX), + (".xml .xul".split(), scintillacon.SCLEX_XML), + (".err".split(), scintillacon.SCLEX_ERRORLIST), + (".mak".split(), scintillacon.SCLEX_MAKEFILE), + (".bat .cmd".split(), scintillacon.SCLEX_BATCH), +] + + +class BuiltinSourceFormatter(FormatterBase): + # A class that represents a formatter built-in to Scintilla + def __init__(self, scintilla, ext): + self.ext = ext + FormatterBase.__init__(self, scintilla) + + def Colorize(self, start=0, end=-1): + self.scintilla.SendScintilla(scintillacon.SCI_COLOURISE, start, end) + + def RegisterStyle(self, style, stylenum=None): + assert style.stylenum is None, "Style has already been registered" + if stylenum is None: + stylenum = self.nextstylenum + self.nextstylenum = self.nextstylenum + 1 + assert self.styles.get(stylenum) is None, "We are reusing a style number!" + style.stylenum = stylenum + self.styles[style.name] = style + self.styles_by_id[stylenum] = style + + def HookFormatter(self, parent=None): + sc = self.scintilla + for exts, formatter in source_formatter_extensions: + if self.ext in exts: + formatter_use = formatter + break + else: + formatter_use = scintillacon.SCLEX_PYTHON + sc.SendScintilla(scintillacon.SCI_SETLEXER, formatter_use) + keywords = " ".join(kwlist) + sc.SCISetKeywords(keywords) + + +class BuiltinPythonSourceFormatter(BuiltinSourceFormatter): + sci_lexer_name = scintillacon.SCLEX_PYTHON + string_style_names = STRING_STYLES + + def __init__(self, sc, ext=".py"): + BuiltinSourceFormatter.__init__(self, sc, ext) + + def SetStyles(self): + for name, format, bg, sc_id in PYTHON_STYLES: + self.RegisterStyle(Style(name, format, bg), sc_id) + for name, format, bg, sc_id in SPECIAL_STYLES: + self.RegisterStyle(Style(name, format, bg), sc_id) + + def GetSampleText(self): + return PythonSampleCode diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/keycodes.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/keycodes.py new file mode 100644 index 0000000000000000000000000000000000000000..badcef3e70544fd9bd3bfdb6e0e627d318592573 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/keycodes.py @@ -0,0 +1,190 @@ +import win32api +import win32con +import win32ui + +MAPVK_VK_TO_CHAR = 2 + +key_name_to_vk = {} +key_code_to_name = {} + +_better_names = { + "escape": "esc", + "return": "enter", + "back": "pgup", + "next": "pgdn", +} + + +def _fillvkmap(): + # Pull the VK_names from win32con + names = [entry for entry in win32con.__dict__ if entry.startswith("VK_")] + for name in names: + code = getattr(win32con, name) + n = name[3:].lower() + key_name_to_vk[n] = code + if n in _better_names: + n = _better_names[n] + key_name_to_vk[n] = code + key_code_to_name[code] = n + + +_fillvkmap() + + +def get_vk(chardesc): + if len(chardesc) == 1: + # it is a character. + info = win32api.VkKeyScan(chardesc) + if info == -1: + # Note: returning None, None causes an error when keyboard layout is non-English, see the report below + # https://stackoverflow.com/questions/45138084/pythonwin-occasionally-gives-an-error-on-opening + return 0, 0 + vk = win32api.LOBYTE(info) + state = win32api.HIBYTE(info) + modifiers = 0 + if state & 0x1: + modifiers |= win32con.SHIFT_PRESSED + if state & 0x2: + modifiers |= win32con.LEFT_CTRL_PRESSED | win32con.RIGHT_CTRL_PRESSED + if state & 0x4: + modifiers |= win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED + return vk, modifiers + # must be a 'key name' + return key_name_to_vk.get(chardesc.lower()), 0 + + +modifiers = { + "alt": win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED, + "lalt": win32con.LEFT_ALT_PRESSED, + "ralt": win32con.RIGHT_ALT_PRESSED, + "ctrl": win32con.LEFT_CTRL_PRESSED | win32con.RIGHT_CTRL_PRESSED, + "ctl": win32con.LEFT_CTRL_PRESSED | win32con.RIGHT_CTRL_PRESSED, + "control": win32con.LEFT_CTRL_PRESSED | win32con.RIGHT_CTRL_PRESSED, + "lctrl": win32con.LEFT_CTRL_PRESSED, + "lctl": win32con.LEFT_CTRL_PRESSED, + "rctrl": win32con.RIGHT_CTRL_PRESSED, + "rctl": win32con.RIGHT_CTRL_PRESSED, + "shift": win32con.SHIFT_PRESSED, + "key": 0, # ignore key tag. +} + + +def parse_key_name(name): + name = name + "-" # Add a sentinal + start = pos = 0 + max = len(name) + toks = [] + while pos < max: + if name[pos] in "+-": + tok = name[start:pos] + # use the ascii lower() version of tok, so ascii chars require + # an explicit shift modifier - ie 'Ctrl+G' should be treated as + # 'ctrl+g' - 'ctrl+shift+g' would be needed if desired. + # This is mainly to avoid changing all the old keystroke defs + toks.append(tok.lower()) + pos += 1 # skip the sep + start = pos + pos += 1 + flags = 0 + # do the modifiers + for tok in toks[:-1]: + mod = modifiers.get(tok.lower()) + if mod is not None: + flags |= mod + # the key name + vk, this_flags = get_vk(toks[-1]) + return vk, flags | this_flags + + +_checks = [ + [ # Shift + ("Shift", win32con.SHIFT_PRESSED), + ], + [ # Ctrl key + ("Ctrl", win32con.LEFT_CTRL_PRESSED | win32con.RIGHT_CTRL_PRESSED), + ("LCtrl", win32con.LEFT_CTRL_PRESSED), + ("RCtrl", win32con.RIGHT_CTRL_PRESSED), + ], + [ # Alt key + ("Alt", win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED), + ("LAlt", win32con.LEFT_ALT_PRESSED), + ("RAlt", win32con.RIGHT_ALT_PRESSED), + ], +] + + +def make_key_name(vk, flags): + # Check alt keys. + flags_done = 0 + parts = [] + for moddata in _checks: + for name, checkflag in moddata: + if flags & checkflag: + parts.append(name) + flags_done = flags_done & checkflag + break + if flags_done & flags: + parts.append(hex(flags & ~flags_done)) + # Now the key name. + if vk is None: + parts.append("") + else: + try: + parts.append(key_code_to_name[vk]) + except KeyError: + # Not in our virtual key map - ask Windows what character this + # key corresponds to. + scancode = win32api.MapVirtualKey(vk, MAPVK_VK_TO_CHAR) + parts.append(chr(scancode)) + sep = "+" + if sep in parts: + sep = "-" + return sep.join([p.capitalize() for p in parts]) + + +def _psc(char): + sc, mods = get_vk(char) + print("Char %s -> %d -> %s" % (repr(char), sc, key_code_to_name.get(sc))) + + +def test1(): + for ch in """aA0/?[{}];:'"`~_-+=\\|,<.>/?""": + _psc(ch) + for code in ["Home", "End", "Left", "Right", "Up", "Down", "Menu", "Next"]: + _psc(code) + + +def _pkn(n): + vk, flags = parse_key_name(n) + print("%s -> %s,%s -> %s" % (n, vk, flags, make_key_name(vk, flags))) + + +def test2(): + _pkn("ctrl+alt-shift+x") + _pkn("ctrl-home") + _pkn("Shift-+") + _pkn("Shift--") + _pkn("Shift+-") + _pkn("Shift++") + _pkn("LShift-+") + _pkn("ctl+home") + _pkn("ctl+enter") + _pkn("alt+return") + _pkn("Alt+/") + _pkn("Alt+BadKeyName") + _pkn("A") # an ascii char - should be seen as 'a' + _pkn("a") + _pkn("Shift-A") + _pkn("Shift-a") + _pkn("a") + _pkn("(") + _pkn("Ctrl+(") + _pkn("Ctrl+Shift-8") + _pkn("Ctrl+*") + _pkn("{") + _pkn("!") + _pkn(".") + + +if __name__ == "__main__": + test2() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/scintillacon.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/scintillacon.py new file mode 100644 index 0000000000000000000000000000000000000000..e7657dc77098655ab885dd68239b2ba3c3513f49 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/scintillacon.py @@ -0,0 +1,2001 @@ +# Generated by h2py from Include\scintilla.h + + +# Included from BaseTsd.h +def HandleToUlong(h): + return HandleToULong(h) + + +def UlongToHandle(ul): + return ULongToHandle(ul) + + +def UlongToPtr(ul): + return ULongToPtr(ul) + + +def UintToPtr(ui): + return UIntToPtr(ui) + + +INVALID_POSITION = -1 +SCI_START = 2000 +SCI_OPTIONAL_START = 3000 +SCI_LEXER_START = 4000 +SCI_ADDTEXT = 2001 +SCI_ADDSTYLEDTEXT = 2002 +SCI_INSERTTEXT = 2003 +SCI_CLEARALL = 2004 +SCI_CLEARDOCUMENTSTYLE = 2005 +SCI_GETLENGTH = 2006 +SCI_GETCHARAT = 2007 +SCI_GETCURRENTPOS = 2008 +SCI_GETANCHOR = 2009 +SCI_GETSTYLEAT = 2010 +SCI_REDO = 2011 +SCI_SETUNDOCOLLECTION = 2012 +SCI_SELECTALL = 2013 +SCI_SETSAVEPOINT = 2014 +SCI_GETSTYLEDTEXT = 2015 +SCI_CANREDO = 2016 +SCI_MARKERLINEFROMHANDLE = 2017 +SCI_MARKERDELETEHANDLE = 2018 +SCI_GETUNDOCOLLECTION = 2019 +SCWS_INVISIBLE = 0 +SCWS_VISIBLEALWAYS = 1 +SCWS_VISIBLEAFTERINDENT = 2 +SCI_GETVIEWWS = 2020 +SCI_SETVIEWWS = 2021 +SCI_POSITIONFROMPOINT = 2022 +SCI_POSITIONFROMPOINTCLOSE = 2023 +SCI_GOTOLINE = 2024 +SCI_GOTOPOS = 2025 +SCI_SETANCHOR = 2026 +SCI_GETCURLINE = 2027 +SCI_GETENDSTYLED = 2028 +SC_EOL_CRLF = 0 +SC_EOL_CR = 1 +SC_EOL_LF = 2 +SCI_CONVERTEOLS = 2029 +SCI_GETEOLMODE = 2030 +SCI_SETEOLMODE = 2031 +SCI_STARTSTYLING = 2032 +SCI_SETSTYLING = 2033 +SCI_GETBUFFEREDDRAW = 2034 +SCI_SETBUFFEREDDRAW = 2035 +SCI_SETTABWIDTH = 2036 +SCI_GETTABWIDTH = 2121 +SC_CP_UTF8 = 65001 +SC_CP_DBCS = 1 +SCI_SETCODEPAGE = 2037 +SCI_SETUSEPALETTE = 2039 +MARKER_MAX = 31 +SC_MARK_CIRCLE = 0 +SC_MARK_ROUNDRECT = 1 +SC_MARK_ARROW = 2 +SC_MARK_SMALLRECT = 3 +SC_MARK_SHORTARROW = 4 +SC_MARK_EMPTY = 5 +SC_MARK_ARROWDOWN = 6 +SC_MARK_MINUS = 7 +SC_MARK_PLUS = 8 +SC_MARK_VLINE = 9 +SC_MARK_LCORNER = 10 +SC_MARK_TCORNER = 11 +SC_MARK_BOXPLUS = 12 +SC_MARK_BOXPLUSCONNECTED = 13 +SC_MARK_BOXMINUS = 14 +SC_MARK_BOXMINUSCONNECTED = 15 +SC_MARK_LCORNERCURVE = 16 +SC_MARK_TCORNERCURVE = 17 +SC_MARK_CIRCLEPLUS = 18 +SC_MARK_CIRCLEPLUSCONNECTED = 19 +SC_MARK_CIRCLEMINUS = 20 +SC_MARK_CIRCLEMINUSCONNECTED = 21 +SC_MARK_BACKGROUND = 22 +SC_MARK_DOTDOTDOT = 23 +SC_MARK_ARROWS = 24 +SC_MARK_PIXMAP = 25 +SC_MARK_FULLRECT = 26 +SC_MARK_LEFTRECT = 27 +SC_MARK_CHARACTER = 10000 +SC_MARKNUM_FOLDEREND = 25 +SC_MARKNUM_FOLDEROPENMID = 26 +SC_MARKNUM_FOLDERMIDTAIL = 27 +SC_MARKNUM_FOLDERTAIL = 28 +SC_MARKNUM_FOLDERSUB = 29 +SC_MARKNUM_FOLDER = 30 +SC_MARKNUM_FOLDEROPEN = 31 +SC_MASK_FOLDERS = -33554432 +SCI_MARKERDEFINE = 2040 +SCI_MARKERSETFORE = 2041 +SCI_MARKERSETBACK = 2042 +SCI_MARKERADD = 2043 +SCI_MARKERDELETE = 2044 +SCI_MARKERDELETEALL = 2045 +SCI_MARKERGET = 2046 +SCI_MARKERNEXT = 2047 +SCI_MARKERPREVIOUS = 2048 +SCI_MARKERDEFINEPIXMAP = 2049 +SCI_MARKERADDSET = 2466 +SCI_MARKERSETALPHA = 2476 +SC_MARGIN_SYMBOL = 0 +SC_MARGIN_NUMBER = 1 +SC_MARGIN_BACK = 2 +SC_MARGIN_FORE = 3 +SCI_SETMARGINTYPEN = 2240 +SCI_GETMARGINTYPEN = 2241 +SCI_SETMARGINWIDTHN = 2242 +SCI_GETMARGINWIDTHN = 2243 +SCI_SETMARGINMASKN = 2244 +SCI_GETMARGINMASKN = 2245 +SCI_SETMARGINSENSITIVEN = 2246 +SCI_GETMARGINSENSITIVEN = 2247 +STYLE_DEFAULT = 32 +STYLE_LINENUMBER = 33 +STYLE_BRACELIGHT = 34 +STYLE_BRACEBAD = 35 +STYLE_CONTROLCHAR = 36 +STYLE_INDENTGUIDE = 37 +STYLE_CALLTIP = 38 +STYLE_LASTPREDEFINED = 39 +STYLE_MAX = 255 +SC_CHARSET_ANSI = 0 +SC_CHARSET_DEFAULT = 1 +SC_CHARSET_BALTIC = 186 +SC_CHARSET_CHINESEBIG5 = 136 +SC_CHARSET_EASTEUROPE = 238 +SC_CHARSET_GB2312 = 134 +SC_CHARSET_GREEK = 161 +SC_CHARSET_HANGUL = 129 +SC_CHARSET_MAC = 77 +SC_CHARSET_OEM = 255 +SC_CHARSET_RUSSIAN = 204 +SC_CHARSET_CYRILLIC = 1251 +SC_CHARSET_SHIFTJIS = 128 +SC_CHARSET_SYMBOL = 2 +SC_CHARSET_TURKISH = 162 +SC_CHARSET_JOHAB = 130 +SC_CHARSET_HEBREW = 177 +SC_CHARSET_ARABIC = 178 +SC_CHARSET_VIETNAMESE = 163 +SC_CHARSET_THAI = 222 +SC_CHARSET_8859_15 = 1000 +SCI_STYLECLEARALL = 2050 +SCI_STYLESETFORE = 2051 +SCI_STYLESETBACK = 2052 +SCI_STYLESETBOLD = 2053 +SCI_STYLESETITALIC = 2054 +SCI_STYLESETSIZE = 2055 +SCI_STYLESETFONT = 2056 +SCI_STYLESETEOLFILLED = 2057 +SCI_STYLERESETDEFAULT = 2058 +SCI_STYLESETUNDERLINE = 2059 +SC_CASE_MIXED = 0 +SC_CASE_UPPER = 1 +SC_CASE_LOWER = 2 +SCI_STYLEGETFORE = 2481 +SCI_STYLEGETBACK = 2482 +SCI_STYLEGETBOLD = 2483 +SCI_STYLEGETITALIC = 2484 +SCI_STYLEGETSIZE = 2485 +SCI_STYLEGETFONT = 2486 +SCI_STYLEGETEOLFILLED = 2487 +SCI_STYLEGETUNDERLINE = 2488 +SCI_STYLEGETCASE = 2489 +SCI_STYLEGETCHARACTERSET = 2490 +SCI_STYLEGETVISIBLE = 2491 +SCI_STYLEGETCHANGEABLE = 2492 +SCI_STYLEGETHOTSPOT = 2493 +SCI_STYLESETCASE = 2060 +SCI_STYLESETCHARACTERSET = 2066 +SCI_STYLESETHOTSPOT = 2409 +SCI_SETSELFORE = 2067 +SCI_SETSELBACK = 2068 +SCI_GETSELALPHA = 2477 +SCI_SETSELALPHA = 2478 +SCI_GETSELEOLFILLED = 2479 +SCI_SETSELEOLFILLED = 2480 +SCI_SETCARETFORE = 2069 +SCI_ASSIGNCMDKEY = 2070 +SCI_CLEARCMDKEY = 2071 +SCI_CLEARALLCMDKEYS = 2072 +SCI_SETSTYLINGEX = 2073 +SCI_STYLESETVISIBLE = 2074 +SCI_GETCARETPERIOD = 2075 +SCI_SETCARETPERIOD = 2076 +SCI_SETWORDCHARS = 2077 +SCI_BEGINUNDOACTION = 2078 +SCI_ENDUNDOACTION = 2079 +INDIC_PLAIN = 0 +INDIC_SQUIGGLE = 1 +INDIC_TT = 2 +INDIC_DIAGONAL = 3 +INDIC_STRIKE = 4 +INDIC_HIDDEN = 5 +INDIC_BOX = 6 +INDIC_ROUNDBOX = 7 +INDIC_MAX = 31 +INDIC_CONTAINER = 8 +INDIC0_MASK = 0x20 +INDIC1_MASK = 0x40 +INDIC2_MASK = 0x80 +INDICS_MASK = 0xE0 +SCI_INDICSETSTYLE = 2080 +SCI_INDICGETSTYLE = 2081 +SCI_INDICSETFORE = 2082 +SCI_INDICGETFORE = 2083 +SCI_INDICSETUNDER = 2510 +SCI_INDICGETUNDER = 2511 +SCI_SETWHITESPACEFORE = 2084 +SCI_SETWHITESPACEBACK = 2085 +SCI_SETSTYLEBITS = 2090 +SCI_GETSTYLEBITS = 2091 +SCI_SETLINESTATE = 2092 +SCI_GETLINESTATE = 2093 +SCI_GETMAXLINESTATE = 2094 +SCI_GETCARETLINEVISIBLE = 2095 +SCI_SETCARETLINEVISIBLE = 2096 +SCI_GETCARETLINEBACK = 2097 +SCI_SETCARETLINEBACK = 2098 +SCI_STYLESETCHANGEABLE = 2099 +SCI_AUTOCSHOW = 2100 +SCI_AUTOCCANCEL = 2101 +SCI_AUTOCACTIVE = 2102 +SCI_AUTOCPOSSTART = 2103 +SCI_AUTOCCOMPLETE = 2104 +SCI_AUTOCSTOPS = 2105 +SCI_AUTOCSETSEPARATOR = 2106 +SCI_AUTOCGETSEPARATOR = 2107 +SCI_AUTOCSELECT = 2108 +SCI_AUTOCSETCANCELATSTART = 2110 +SCI_AUTOCGETCANCELATSTART = 2111 +SCI_AUTOCSETFILLUPS = 2112 +SCI_AUTOCSETCHOOSESINGLE = 2113 +SCI_AUTOCGETCHOOSESINGLE = 2114 +SCI_AUTOCSETIGNORECASE = 2115 +SCI_AUTOCGETIGNORECASE = 2116 +SCI_USERLISTSHOW = 2117 +SCI_AUTOCSETAUTOHIDE = 2118 +SCI_AUTOCGETAUTOHIDE = 2119 +SCI_AUTOCSETDROPRESTOFWORD = 2270 +SCI_AUTOCGETDROPRESTOFWORD = 2271 +SCI_REGISTERIMAGE = 2405 +SCI_CLEARREGISTEREDIMAGES = 2408 +SCI_AUTOCGETTYPESEPARATOR = 2285 +SCI_AUTOCSETTYPESEPARATOR = 2286 +SCI_AUTOCSETMAXWIDTH = 2208 +SCI_AUTOCGETMAXWIDTH = 2209 +SCI_AUTOCSETMAXHEIGHT = 2210 +SCI_AUTOCGETMAXHEIGHT = 2211 +SCI_SETINDENT = 2122 +SCI_GETINDENT = 2123 +SCI_SETUSETABS = 2124 +SCI_GETUSETABS = 2125 +SCI_SETLINEINDENTATION = 2126 +SCI_GETLINEINDENTATION = 2127 +SCI_GETLINEINDENTPOSITION = 2128 +SCI_GETCOLUMN = 2129 +SCI_SETHSCROLLBAR = 2130 +SCI_GETHSCROLLBAR = 2131 +SC_IV_NONE = 0 +SC_IV_REAL = 1 +SC_IV_LOOKFORWARD = 2 +SC_IV_LOOKBOTH = 3 +SCI_SETINDENTATIONGUIDES = 2132 +SCI_GETINDENTATIONGUIDES = 2133 +SCI_SETHIGHLIGHTGUIDE = 2134 +SCI_GETHIGHLIGHTGUIDE = 2135 +SCI_GETLINEENDPOSITION = 2136 +SCI_GETCODEPAGE = 2137 +SCI_GETCARETFORE = 2138 +SCI_GETUSEPALETTE = 2139 +SCI_GETREADONLY = 2140 +SCI_SETCURRENTPOS = 2141 +SCI_SETSELECTIONSTART = 2142 +SCI_GETSELECTIONSTART = 2143 +SCI_SETSELECTIONEND = 2144 +SCI_GETSELECTIONEND = 2145 +SCI_SETPRINTMAGNIFICATION = 2146 +SCI_GETPRINTMAGNIFICATION = 2147 +SC_PRINT_NORMAL = 0 +SC_PRINT_INVERTLIGHT = 1 +SC_PRINT_BLACKONWHITE = 2 +SC_PRINT_COLOURONWHITE = 3 +SC_PRINT_COLOURONWHITEDEFAULTBG = 4 +SCI_SETPRINTCOLOURMODE = 2148 +SCI_GETPRINTCOLOURMODE = 2149 +SCFIND_WHOLEWORD = 2 +SCFIND_MATCHCASE = 4 +SCFIND_WORDSTART = 0x00100000 +SCFIND_REGEXP = 0x00200000 +SCFIND_POSIX = 0x00400000 +SCI_FINDTEXT = 2150 +SCI_FORMATRANGE = 2151 +SCI_GETFIRSTVISIBLELINE = 2152 +SCI_GETLINE = 2153 +SCI_GETLINECOUNT = 2154 +SCI_SETMARGINLEFT = 2155 +SCI_GETMARGINLEFT = 2156 +SCI_SETMARGINRIGHT = 2157 +SCI_GETMARGINRIGHT = 2158 +SCI_GETMODIFY = 2159 +SCI_SETSEL = 2160 +SCI_GETSELTEXT = 2161 +SCI_GETTEXTRANGE = 2162 +SCI_HIDESELECTION = 2163 +SCI_POINTXFROMPOSITION = 2164 +SCI_POINTYFROMPOSITION = 2165 +SCI_LINEFROMPOSITION = 2166 +SCI_POSITIONFROMLINE = 2167 +SCI_LINESCROLL = 2168 +SCI_SCROLLCARET = 2169 +SCI_REPLACESEL = 2170 +SCI_SETREADONLY = 2171 +SCI_NULL = 2172 +SCI_CANPASTE = 2173 +SCI_CANUNDO = 2174 +SCI_EMPTYUNDOBUFFER = 2175 +SCI_UNDO = 2176 +SCI_CUT = 2177 +SCI_COPY = 2178 +SCI_PASTE = 2179 +SCI_CLEAR = 2180 +SCI_SETTEXT = 2181 +SCI_GETTEXT = 2182 +SCI_GETTEXTLENGTH = 2183 +SCI_GETDIRECTFUNCTION = 2184 +SCI_GETDIRECTPOINTER = 2185 +SCI_SETOVERTYPE = 2186 +SCI_GETOVERTYPE = 2187 +SCI_SETCARETWIDTH = 2188 +SCI_GETCARETWIDTH = 2189 +SCI_SETTARGETSTART = 2190 +SCI_GETTARGETSTART = 2191 +SCI_SETTARGETEND = 2192 +SCI_GETTARGETEND = 2193 +SCI_REPLACETARGET = 2194 +SCI_REPLACETARGETRE = 2195 +SCI_SEARCHINTARGET = 2197 +SCI_SETSEARCHFLAGS = 2198 +SCI_GETSEARCHFLAGS = 2199 +SCI_CALLTIPSHOW = 2200 +SCI_CALLTIPCANCEL = 2201 +SCI_CALLTIPACTIVE = 2202 +SCI_CALLTIPPOSSTART = 2203 +SCI_CALLTIPSETHLT = 2204 +SCI_CALLTIPSETBACK = 2205 +SCI_CALLTIPSETFORE = 2206 +SCI_CALLTIPSETFOREHLT = 2207 +SCI_CALLTIPUSESTYLE = 2212 +SCI_VISIBLEFROMDOCLINE = 2220 +SCI_DOCLINEFROMVISIBLE = 2221 +SCI_WRAPCOUNT = 2235 +SC_FOLDLEVELBASE = 0x400 +SC_FOLDLEVELWHITEFLAG = 0x1000 +SC_FOLDLEVELHEADERFLAG = 0x2000 +SC_FOLDLEVELBOXHEADERFLAG = 0x4000 +SC_FOLDLEVELBOXFOOTERFLAG = 0x8000 +SC_FOLDLEVELCONTRACTED = 0x10000 +SC_FOLDLEVELUNINDENT = 0x20000 +SC_FOLDLEVELNUMBERMASK = 0x0FFF +SCI_SETFOLDLEVEL = 2222 +SCI_GETFOLDLEVEL = 2223 +SCI_GETLASTCHILD = 2224 +SCI_GETFOLDPARENT = 2225 +SCI_SHOWLINES = 2226 +SCI_HIDELINES = 2227 +SCI_GETLINEVISIBLE = 2228 +SCI_SETFOLDEXPANDED = 2229 +SCI_GETFOLDEXPANDED = 2230 +SCI_TOGGLEFOLD = 2231 +SCI_ENSUREVISIBLE = 2232 +SC_FOLDFLAG_LINEBEFORE_EXPANDED = 0x0002 +SC_FOLDFLAG_LINEBEFORE_CONTRACTED = 0x0004 +SC_FOLDFLAG_LINEAFTER_EXPANDED = 0x0008 +SC_FOLDFLAG_LINEAFTER_CONTRACTED = 0x0010 +SC_FOLDFLAG_LEVELNUMBERS = 0x0040 +SC_FOLDFLAG_BOX = 0x0001 +SCI_SETFOLDFLAGS = 2233 +SCI_ENSUREVISIBLEENFORCEPOLICY = 2234 +SCI_SETTABINDENTS = 2260 +SCI_GETTABINDENTS = 2261 +SCI_SETBACKSPACEUNINDENTS = 2262 +SCI_GETBACKSPACEUNINDENTS = 2263 +SC_TIME_FOREVER = 10000000 +SCI_SETMOUSEDWELLTIME = 2264 +SCI_GETMOUSEDWELLTIME = 2265 +SCI_WORDSTARTPOSITION = 2266 +SCI_WORDENDPOSITION = 2267 +SC_WRAP_NONE = 0 +SC_WRAP_WORD = 1 +SC_WRAP_CHAR = 2 +SCI_SETWRAPMODE = 2268 +SCI_GETWRAPMODE = 2269 +SC_WRAPVISUALFLAG_NONE = 0x0000 +SC_WRAPVISUALFLAG_END = 0x0001 +SC_WRAPVISUALFLAG_START = 0x0002 +SCI_SETWRAPVISUALFLAGS = 2460 +SCI_GETWRAPVISUALFLAGS = 2461 +SC_WRAPVISUALFLAGLOC_DEFAULT = 0x0000 +SC_WRAPVISUALFLAGLOC_END_BY_TEXT = 0x0001 +SC_WRAPVISUALFLAGLOC_START_BY_TEXT = 0x0002 +SCI_SETWRAPVISUALFLAGSLOCATION = 2462 +SCI_GETWRAPVISUALFLAGSLOCATION = 2463 +SCI_SETWRAPSTARTINDENT = 2464 +SCI_GETWRAPSTARTINDENT = 2465 +SC_CACHE_NONE = 0 +SC_CACHE_CARET = 1 +SC_CACHE_PAGE = 2 +SC_CACHE_DOCUMENT = 3 +SCI_SETLAYOUTCACHE = 2272 +SCI_GETLAYOUTCACHE = 2273 +SCI_SETSCROLLWIDTH = 2274 +SCI_GETSCROLLWIDTH = 2275 +SCI_SETSCROLLWIDTHTRACKING = 2516 +SCI_GETSCROLLWIDTHTRACKING = 2517 +SCI_TEXTWIDTH = 2276 +SCI_SETENDATLASTLINE = 2277 +SCI_GETENDATLASTLINE = 2278 +SCI_TEXTHEIGHT = 2279 +SCI_SETVSCROLLBAR = 2280 +SCI_GETVSCROLLBAR = 2281 +SCI_APPENDTEXT = 2282 +SCI_GETTWOPHASEDRAW = 2283 +SCI_SETTWOPHASEDRAW = 2284 +SCI_TARGETFROMSELECTION = 2287 +SCI_LINESJOIN = 2288 +SCI_LINESSPLIT = 2289 +SCI_SETFOLDMARGINCOLOUR = 2290 +SCI_SETFOLDMARGINHICOLOUR = 2291 +SCI_LINEDOWN = 2300 +SCI_LINEDOWNEXTEND = 2301 +SCI_LINEUP = 2302 +SCI_LINEUPEXTEND = 2303 +SCI_CHARLEFT = 2304 +SCI_CHARLEFTEXTEND = 2305 +SCI_CHARRIGHT = 2306 +SCI_CHARRIGHTEXTEND = 2307 +SCI_WORDLEFT = 2308 +SCI_WORDLEFTEXTEND = 2309 +SCI_WORDRIGHT = 2310 +SCI_WORDRIGHTEXTEND = 2311 +SCI_HOME = 2312 +SCI_HOMEEXTEND = 2313 +SCI_LINEEND = 2314 +SCI_LINEENDEXTEND = 2315 +SCI_DOCUMENTSTART = 2316 +SCI_DOCUMENTSTARTEXTEND = 2317 +SCI_DOCUMENTEND = 2318 +SCI_DOCUMENTENDEXTEND = 2319 +SCI_PAGEUP = 2320 +SCI_PAGEUPEXTEND = 2321 +SCI_PAGEDOWN = 2322 +SCI_PAGEDOWNEXTEND = 2323 +SCI_EDITTOGGLEOVERTYPE = 2324 +SCI_CANCEL = 2325 +SCI_DELETEBACK = 2326 +SCI_TAB = 2327 +SCI_BACKTAB = 2328 +SCI_NEWLINE = 2329 +SCI_FORMFEED = 2330 +SCI_VCHOME = 2331 +SCI_VCHOMEEXTEND = 2332 +SCI_ZOOMIN = 2333 +SCI_ZOOMOUT = 2334 +SCI_DELWORDLEFT = 2335 +SCI_DELWORDRIGHT = 2336 +SCI_DELWORDRIGHTEND = 2518 +SCI_LINECUT = 2337 +SCI_LINEDELETE = 2338 +SCI_LINETRANSPOSE = 2339 +SCI_LINEDUPLICATE = 2404 +SCI_LOWERCASE = 2340 +SCI_UPPERCASE = 2341 +SCI_LINESCROLLDOWN = 2342 +SCI_LINESCROLLUP = 2343 +SCI_DELETEBACKNOTLINE = 2344 +SCI_HOMEDISPLAY = 2345 +SCI_HOMEDISPLAYEXTEND = 2346 +SCI_LINEENDDISPLAY = 2347 +SCI_LINEENDDISPLAYEXTEND = 2348 +SCI_HOMEWRAP = 2349 +SCI_HOMEWRAPEXTEND = 2450 +SCI_LINEENDWRAP = 2451 +SCI_LINEENDWRAPEXTEND = 2452 +SCI_VCHOMEWRAP = 2453 +SCI_VCHOMEWRAPEXTEND = 2454 +SCI_LINECOPY = 2455 +SCI_MOVECARETINSIDEVIEW = 2401 +SCI_LINELENGTH = 2350 +SCI_BRACEHIGHLIGHT = 2351 +SCI_BRACEBADLIGHT = 2352 +SCI_BRACEMATCH = 2353 +SCI_GETVIEWEOL = 2355 +SCI_SETVIEWEOL = 2356 +SCI_GETDOCPOINTER = 2357 +SCI_SETDOCPOINTER = 2358 +SCI_SETMODEVENTMASK = 2359 +EDGE_NONE = 0 +EDGE_LINE = 1 +EDGE_BACKGROUND = 2 +SCI_GETEDGECOLUMN = 2360 +SCI_SETEDGECOLUMN = 2361 +SCI_GETEDGEMODE = 2362 +SCI_SETEDGEMODE = 2363 +SCI_GETEDGECOLOUR = 2364 +SCI_SETEDGECOLOUR = 2365 +SCI_SEARCHANCHOR = 2366 +SCI_SEARCHNEXT = 2367 +SCI_SEARCHPREV = 2368 +SCI_LINESONSCREEN = 2370 +SCI_USEPOPUP = 2371 +SCI_SELECTIONISRECTANGLE = 2372 +SCI_SETZOOM = 2373 +SCI_GETZOOM = 2374 +SCI_CREATEDOCUMENT = 2375 +SCI_ADDREFDOCUMENT = 2376 +SCI_RELEASEDOCUMENT = 2377 +SCI_GETMODEVENTMASK = 2378 +SCI_SETFOCUS = 2380 +SCI_GETFOCUS = 2381 +SCI_SETSTATUS = 2382 +SCI_GETSTATUS = 2383 +SCI_SETMOUSEDOWNCAPTURES = 2384 +SCI_GETMOUSEDOWNCAPTURES = 2385 +SC_CURSORNORMAL = -1 +SC_CURSORWAIT = 4 +SCI_SETCURSOR = 2386 +SCI_GETCURSOR = 2387 +SCI_SETCONTROLCHARSYMBOL = 2388 +SCI_GETCONTROLCHARSYMBOL = 2389 +SCI_WORDPARTLEFT = 2390 +SCI_WORDPARTLEFTEXTEND = 2391 +SCI_WORDPARTRIGHT = 2392 +SCI_WORDPARTRIGHTEXTEND = 2393 +VISIBLE_SLOP = 0x01 +VISIBLE_STRICT = 0x04 +SCI_SETVISIBLEPOLICY = 2394 +SCI_DELLINELEFT = 2395 +SCI_DELLINERIGHT = 2396 +SCI_SETXOFFSET = 2397 +SCI_GETXOFFSET = 2398 +SCI_CHOOSECARETX = 2399 +SCI_GRABFOCUS = 2400 +CARET_SLOP = 0x01 +CARET_STRICT = 0x04 +CARET_JUMPS = 0x10 +CARET_EVEN = 0x08 +SCI_SETXCARETPOLICY = 2402 +SCI_SETYCARETPOLICY = 2403 +SCI_SETPRINTWRAPMODE = 2406 +SCI_GETPRINTWRAPMODE = 2407 +SCI_SETHOTSPOTACTIVEFORE = 2410 +SCI_GETHOTSPOTACTIVEFORE = 2494 +SCI_SETHOTSPOTACTIVEBACK = 2411 +SCI_GETHOTSPOTACTIVEBACK = 2495 +SCI_SETHOTSPOTACTIVEUNDERLINE = 2412 +SCI_GETHOTSPOTACTIVEUNDERLINE = 2496 +SCI_SETHOTSPOTSINGLELINE = 2421 +SCI_GETHOTSPOTSINGLELINE = 2497 +SCI_PARADOWN = 2413 +SCI_PARADOWNEXTEND = 2414 +SCI_PARAUP = 2415 +SCI_PARAUPEXTEND = 2416 +SCI_POSITIONBEFORE = 2417 +SCI_POSITIONAFTER = 2418 +SCI_COPYRANGE = 2419 +SCI_COPYTEXT = 2420 +SC_SEL_STREAM = 0 +SC_SEL_RECTANGLE = 1 +SC_SEL_LINES = 2 +SCI_SETSELECTIONMODE = 2422 +SCI_GETSELECTIONMODE = 2423 +SCI_GETLINESELSTARTPOSITION = 2424 +SCI_GETLINESELENDPOSITION = 2425 +SCI_LINEDOWNRECTEXTEND = 2426 +SCI_LINEUPRECTEXTEND = 2427 +SCI_CHARLEFTRECTEXTEND = 2428 +SCI_CHARRIGHTRECTEXTEND = 2429 +SCI_HOMERECTEXTEND = 2430 +SCI_VCHOMERECTEXTEND = 2431 +SCI_LINEENDRECTEXTEND = 2432 +SCI_PAGEUPRECTEXTEND = 2433 +SCI_PAGEDOWNRECTEXTEND = 2434 +SCI_STUTTEREDPAGEUP = 2435 +SCI_STUTTEREDPAGEUPEXTEND = 2436 +SCI_STUTTEREDPAGEDOWN = 2437 +SCI_STUTTEREDPAGEDOWNEXTEND = 2438 +SCI_WORDLEFTEND = 2439 +SCI_WORDLEFTENDEXTEND = 2440 +SCI_WORDRIGHTEND = 2441 +SCI_WORDRIGHTENDEXTEND = 2442 +SCI_SETWHITESPACECHARS = 2443 +SCI_SETCHARSDEFAULT = 2444 +SCI_AUTOCGETCURRENT = 2445 +SCI_ALLOCATE = 2446 +SCI_TARGETASUTF8 = 2447 +SCI_SETLENGTHFORENCODE = 2448 +SCI_ENCODEDFROMUTF8 = 2449 +SCI_FINDCOLUMN = 2456 +SCI_GETCARETSTICKY = 2457 +SCI_SETCARETSTICKY = 2458 +SCI_TOGGLECARETSTICKY = 2459 +SCI_SETPASTECONVERTENDINGS = 2467 +SCI_GETPASTECONVERTENDINGS = 2468 +SCI_SELECTIONDUPLICATE = 2469 +SC_ALPHA_TRANSPARENT = 0 +SC_ALPHA_OPAQUE = 255 +SC_ALPHA_NOALPHA = 256 +SCI_SETCARETLINEBACKALPHA = 2470 +SCI_GETCARETLINEBACKALPHA = 2471 +CARETSTYLE_INVISIBLE = 0 +CARETSTYLE_LINE = 1 +CARETSTYLE_BLOCK = 2 +SCI_SETCARETSTYLE = 2512 +SCI_GETCARETSTYLE = 2513 +SCI_SETINDICATORCURRENT = 2500 +SCI_GETINDICATORCURRENT = 2501 +SCI_SETINDICATORVALUE = 2502 +SCI_GETINDICATORVALUE = 2503 +SCI_INDICATORFILLRANGE = 2504 +SCI_INDICATORCLEARRANGE = 2505 +SCI_INDICATORALLONFOR = 2506 +SCI_INDICATORVALUEAT = 2507 +SCI_INDICATORSTART = 2508 +SCI_INDICATOREND = 2509 +SCI_SETPOSITIONCACHE = 2514 +SCI_GETPOSITIONCACHE = 2515 +SCI_COPYALLOWLINE = 2519 +SCI_GETCHARACTERPOINTER = 2520 +SCI_SETKEYSUNICODE = 2521 +SCI_GETKEYSUNICODE = 2522 +SCI_STARTRECORD = 3001 +SCI_STOPRECORD = 3002 +SCI_SETLEXER = 4001 +SCI_GETLEXER = 4002 +SCI_COLOURISE = 4003 +SCI_SETPROPERTY = 4004 +KEYWORDSET_MAX = 8 +SCI_SETKEYWORDS = 4005 +SCI_SETLEXERLANGUAGE = 4006 +SCI_LOADLEXERLIBRARY = 4007 +SCI_GETPROPERTY = 4008 +SCI_GETPROPERTYEXPANDED = 4009 +SCI_GETPROPERTYINT = 4010 +SCI_GETSTYLEBITSNEEDED = 4011 +SC_MOD_INSERTTEXT = 0x1 +SC_MOD_DELETETEXT = 0x2 +SC_MOD_CHANGESTYLE = 0x4 +SC_MOD_CHANGEFOLD = 0x8 +SC_PERFORMED_USER = 0x10 +SC_PERFORMED_UNDO = 0x20 +SC_PERFORMED_REDO = 0x40 +SC_MULTISTEPUNDOREDO = 0x80 +SC_LASTSTEPINUNDOREDO = 0x100 +SC_MOD_CHANGEMARKER = 0x200 +SC_MOD_BEFOREINSERT = 0x400 +SC_MOD_BEFOREDELETE = 0x800 +SC_MULTILINEUNDOREDO = 0x1000 +SC_STARTACTION = 0x2000 +SC_MOD_CHANGEINDICATOR = 0x4000 +SC_MOD_CHANGELINESTATE = 0x8000 +SC_MODEVENTMASKALL = 0xFFFF +SCEN_CHANGE = 768 +SCEN_SETFOCUS = 512 +SCEN_KILLFOCUS = 256 +SCK_DOWN = 300 +SCK_UP = 301 +SCK_LEFT = 302 +SCK_RIGHT = 303 +SCK_HOME = 304 +SCK_END = 305 +SCK_PRIOR = 306 +SCK_NEXT = 307 +SCK_DELETE = 308 +SCK_INSERT = 309 +SCK_ESCAPE = 7 +SCK_BACK = 8 +SCK_TAB = 9 +SCK_RETURN = 13 +SCK_ADD = 310 +SCK_SUBTRACT = 311 +SCK_DIVIDE = 312 +SCK_WIN = 313 +SCK_RWIN = 314 +SCK_MENU = 315 +SCMOD_NORM = 0 +SCMOD_SHIFT = 1 +SCMOD_CTRL = 2 +SCMOD_ALT = 4 +SCN_STYLENEEDED = 2000 +SCN_CHARADDED = 2001 +SCN_SAVEPOINTREACHED = 2002 +SCN_SAVEPOINTLEFT = 2003 +SCN_MODIFYATTEMPTRO = 2004 +SCN_KEY = 2005 +SCN_DOUBLECLICK = 2006 +SCN_UPDATEUI = 2007 +SCN_MODIFIED = 2008 +SCN_MACRORECORD = 2009 +SCN_MARGINCLICK = 2010 +SCN_NEEDSHOWN = 2011 +SCN_PAINTED = 2013 +SCN_USERLISTSELECTION = 2014 +SCN_URIDROPPED = 2015 +SCN_DWELLSTART = 2016 +SCN_DWELLEND = 2017 +SCN_ZOOM = 2018 +SCN_HOTSPOTCLICK = 2019 +SCN_HOTSPOTDOUBLECLICK = 2020 +SCN_CALLTIPCLICK = 2021 +SCN_AUTOCSELECTION = 2022 +SCN_INDICATORCLICK = 2023 +SCN_INDICATORRELEASE = 2024 +SCN_AUTOCCANCELLED = 2025 +SCI_SETCARETPOLICY = 2369 +CARET_CENTER = 0x02 +CARET_XEVEN = 0x08 +CARET_XJUMPS = 0x10 +SCN_POSCHANGED = 2012 +SCN_CHECKBRACE = 2007 +# Generated by h2py from Include\scilexer.h +SCLEX_CONTAINER = 0 +SCLEX_NULL = 1 +SCLEX_PYTHON = 2 +SCLEX_CPP = 3 +SCLEX_HTML = 4 +SCLEX_XML = 5 +SCLEX_PERL = 6 +SCLEX_SQL = 7 +SCLEX_VB = 8 +SCLEX_PROPERTIES = 9 +SCLEX_ERRORLIST = 10 +SCLEX_MAKEFILE = 11 +SCLEX_BATCH = 12 +SCLEX_XCODE = 13 +SCLEX_LATEX = 14 +SCLEX_LUA = 15 +SCLEX_DIFF = 16 +SCLEX_CONF = 17 +SCLEX_PASCAL = 18 +SCLEX_AVE = 19 +SCLEX_ADA = 20 +SCLEX_LISP = 21 +SCLEX_RUBY = 22 +SCLEX_EIFFEL = 23 +SCLEX_EIFFELKW = 24 +SCLEX_TCL = 25 +SCLEX_NNCRONTAB = 26 +SCLEX_BULLANT = 27 +SCLEX_VBSCRIPT = 28 +SCLEX_BAAN = 31 +SCLEX_MATLAB = 32 +SCLEX_SCRIPTOL = 33 +SCLEX_ASM = 34 +SCLEX_CPPNOCASE = 35 +SCLEX_FORTRAN = 36 +SCLEX_F77 = 37 +SCLEX_CSS = 38 +SCLEX_POV = 39 +SCLEX_LOUT = 40 +SCLEX_ESCRIPT = 41 +SCLEX_PS = 42 +SCLEX_NSIS = 43 +SCLEX_MMIXAL = 44 +SCLEX_CLW = 45 +SCLEX_CLWNOCASE = 46 +SCLEX_LOT = 47 +SCLEX_YAML = 48 +SCLEX_TEX = 49 +SCLEX_METAPOST = 50 +SCLEX_POWERBASIC = 51 +SCLEX_FORTH = 52 +SCLEX_ERLANG = 53 +SCLEX_OCTAVE = 54 +SCLEX_MSSQL = 55 +SCLEX_VERILOG = 56 +SCLEX_KIX = 57 +SCLEX_GUI4CLI = 58 +SCLEX_SPECMAN = 59 +SCLEX_AU3 = 60 +SCLEX_APDL = 61 +SCLEX_BASH = 62 +SCLEX_ASN1 = 63 +SCLEX_VHDL = 64 +SCLEX_CAML = 65 +SCLEX_BLITZBASIC = 66 +SCLEX_PUREBASIC = 67 +SCLEX_HASKELL = 68 +SCLEX_PHPSCRIPT = 69 +SCLEX_TADS3 = 70 +SCLEX_REBOL = 71 +SCLEX_SMALLTALK = 72 +SCLEX_FLAGSHIP = 73 +SCLEX_CSOUND = 74 +SCLEX_FREEBASIC = 75 +SCLEX_INNOSETUP = 76 +SCLEX_OPAL = 77 +SCLEX_SPICE = 78 +SCLEX_D = 79 +SCLEX_CMAKE = 80 +SCLEX_GAP = 81 +SCLEX_PLM = 82 +SCLEX_PROGRESS = 83 +SCLEX_ABAQUS = 84 +SCLEX_ASYMPTOTE = 85 +SCLEX_R = 86 +SCLEX_MAGIK = 87 +SCLEX_POWERSHELL = 88 +SCLEX_MYSQL = 89 +SCLEX_PO = 90 +SCLEX_AUTOMATIC = 1000 +SCE_P_DEFAULT = 0 +SCE_P_COMMENTLINE = 1 +SCE_P_NUMBER = 2 +SCE_P_STRING = 3 +SCE_P_CHARACTER = 4 +SCE_P_WORD = 5 +SCE_P_TRIPLE = 6 +SCE_P_TRIPLEDOUBLE = 7 +SCE_P_CLASSNAME = 8 +SCE_P_DEFNAME = 9 +SCE_P_OPERATOR = 10 +SCE_P_IDENTIFIER = 11 +SCE_P_COMMENTBLOCK = 12 +SCE_P_STRINGEOL = 13 +SCE_P_WORD2 = 14 +SCE_P_DECORATOR = 15 +SCE_C_DEFAULT = 0 +SCE_C_COMMENT = 1 +SCE_C_COMMENTLINE = 2 +SCE_C_COMMENTDOC = 3 +SCE_C_NUMBER = 4 +SCE_C_WORD = 5 +SCE_C_STRING = 6 +SCE_C_CHARACTER = 7 +SCE_C_UUID = 8 +SCE_C_PREPROCESSOR = 9 +SCE_C_OPERATOR = 10 +SCE_C_IDENTIFIER = 11 +SCE_C_STRINGEOL = 12 +SCE_C_VERBATIM = 13 +SCE_C_REGEX = 14 +SCE_C_COMMENTLINEDOC = 15 +SCE_C_WORD2 = 16 +SCE_C_COMMENTDOCKEYWORD = 17 +SCE_C_COMMENTDOCKEYWORDERROR = 18 +SCE_C_GLOBALCLASS = 19 +SCE_D_DEFAULT = 0 +SCE_D_COMMENT = 1 +SCE_D_COMMENTLINE = 2 +SCE_D_COMMENTDOC = 3 +SCE_D_COMMENTNESTED = 4 +SCE_D_NUMBER = 5 +SCE_D_WORD = 6 +SCE_D_WORD2 = 7 +SCE_D_WORD3 = 8 +SCE_D_TYPEDEF = 9 +SCE_D_STRING = 10 +SCE_D_STRINGEOL = 11 +SCE_D_CHARACTER = 12 +SCE_D_OPERATOR = 13 +SCE_D_IDENTIFIER = 14 +SCE_D_COMMENTLINEDOC = 15 +SCE_D_COMMENTDOCKEYWORD = 16 +SCE_D_COMMENTDOCKEYWORDERROR = 17 +SCE_TCL_DEFAULT = 0 +SCE_TCL_COMMENT = 1 +SCE_TCL_COMMENTLINE = 2 +SCE_TCL_NUMBER = 3 +SCE_TCL_WORD_IN_QUOTE = 4 +SCE_TCL_IN_QUOTE = 5 +SCE_TCL_OPERATOR = 6 +SCE_TCL_IDENTIFIER = 7 +SCE_TCL_SUBSTITUTION = 8 +SCE_TCL_SUB_BRACE = 9 +SCE_TCL_MODIFIER = 10 +SCE_TCL_EXPAND = 11 +SCE_TCL_WORD = 12 +SCE_TCL_WORD2 = 13 +SCE_TCL_WORD3 = 14 +SCE_TCL_WORD4 = 15 +SCE_TCL_WORD5 = 16 +SCE_TCL_WORD6 = 17 +SCE_TCL_WORD7 = 18 +SCE_TCL_WORD8 = 19 +SCE_TCL_COMMENT_BOX = 20 +SCE_TCL_BLOCK_COMMENT = 21 +SCE_H_DEFAULT = 0 +SCE_H_TAG = 1 +SCE_H_TAGUNKNOWN = 2 +SCE_H_ATTRIBUTE = 3 +SCE_H_ATTRIBUTEUNKNOWN = 4 +SCE_H_NUMBER = 5 +SCE_H_DOUBLESTRING = 6 +SCE_H_SINGLESTRING = 7 +SCE_H_OTHER = 8 +SCE_H_COMMENT = 9 +SCE_H_ENTITY = 10 +SCE_H_TAGEND = 11 +SCE_H_XMLSTART = 12 +SCE_H_XMLEND = 13 +SCE_H_SCRIPT = 14 +SCE_H_ASP = 15 +SCE_H_ASPAT = 16 +SCE_H_CDATA = 17 +SCE_H_QUESTION = 18 +SCE_H_VALUE = 19 +SCE_H_XCCOMMENT = 20 +SCE_H_SGML_DEFAULT = 21 +SCE_H_SGML_COMMAND = 22 +SCE_H_SGML_1ST_PARAM = 23 +SCE_H_SGML_DOUBLESTRING = 24 +SCE_H_SGML_SIMPLESTRING = 25 +SCE_H_SGML_ERROR = 26 +SCE_H_SGML_SPECIAL = 27 +SCE_H_SGML_ENTITY = 28 +SCE_H_SGML_COMMENT = 29 +SCE_H_SGML_1ST_PARAM_COMMENT = 30 +SCE_H_SGML_BLOCK_DEFAULT = 31 +SCE_HJ_START = 40 +SCE_HJ_DEFAULT = 41 +SCE_HJ_COMMENT = 42 +SCE_HJ_COMMENTLINE = 43 +SCE_HJ_COMMENTDOC = 44 +SCE_HJ_NUMBER = 45 +SCE_HJ_WORD = 46 +SCE_HJ_KEYWORD = 47 +SCE_HJ_DOUBLESTRING = 48 +SCE_HJ_SINGLESTRING = 49 +SCE_HJ_SYMBOLS = 50 +SCE_HJ_STRINGEOL = 51 +SCE_HJ_REGEX = 52 +SCE_HJA_START = 55 +SCE_HJA_DEFAULT = 56 +SCE_HJA_COMMENT = 57 +SCE_HJA_COMMENTLINE = 58 +SCE_HJA_COMMENTDOC = 59 +SCE_HJA_NUMBER = 60 +SCE_HJA_WORD = 61 +SCE_HJA_KEYWORD = 62 +SCE_HJA_DOUBLESTRING = 63 +SCE_HJA_SINGLESTRING = 64 +SCE_HJA_SYMBOLS = 65 +SCE_HJA_STRINGEOL = 66 +SCE_HJA_REGEX = 67 +SCE_HB_START = 70 +SCE_HB_DEFAULT = 71 +SCE_HB_COMMENTLINE = 72 +SCE_HB_NUMBER = 73 +SCE_HB_WORD = 74 +SCE_HB_STRING = 75 +SCE_HB_IDENTIFIER = 76 +SCE_HB_STRINGEOL = 77 +SCE_HBA_START = 80 +SCE_HBA_DEFAULT = 81 +SCE_HBA_COMMENTLINE = 82 +SCE_HBA_NUMBER = 83 +SCE_HBA_WORD = 84 +SCE_HBA_STRING = 85 +SCE_HBA_IDENTIFIER = 86 +SCE_HBA_STRINGEOL = 87 +SCE_HP_START = 90 +SCE_HP_DEFAULT = 91 +SCE_HP_COMMENTLINE = 92 +SCE_HP_NUMBER = 93 +SCE_HP_STRING = 94 +SCE_HP_CHARACTER = 95 +SCE_HP_WORD = 96 +SCE_HP_TRIPLE = 97 +SCE_HP_TRIPLEDOUBLE = 98 +SCE_HP_CLASSNAME = 99 +SCE_HP_DEFNAME = 100 +SCE_HP_OPERATOR = 101 +SCE_HP_IDENTIFIER = 102 +SCE_HPHP_COMPLEX_VARIABLE = 104 +SCE_HPA_START = 105 +SCE_HPA_DEFAULT = 106 +SCE_HPA_COMMENTLINE = 107 +SCE_HPA_NUMBER = 108 +SCE_HPA_STRING = 109 +SCE_HPA_CHARACTER = 110 +SCE_HPA_WORD = 111 +SCE_HPA_TRIPLE = 112 +SCE_HPA_TRIPLEDOUBLE = 113 +SCE_HPA_CLASSNAME = 114 +SCE_HPA_DEFNAME = 115 +SCE_HPA_OPERATOR = 116 +SCE_HPA_IDENTIFIER = 117 +SCE_HPHP_DEFAULT = 118 +SCE_HPHP_HSTRING = 119 +SCE_HPHP_SIMPLESTRING = 120 +SCE_HPHP_WORD = 121 +SCE_HPHP_NUMBER = 122 +SCE_HPHP_VARIABLE = 123 +SCE_HPHP_COMMENT = 124 +SCE_HPHP_COMMENTLINE = 125 +SCE_HPHP_HSTRING_VARIABLE = 126 +SCE_HPHP_OPERATOR = 127 +SCE_PL_DEFAULT = 0 +SCE_PL_ERROR = 1 +SCE_PL_COMMENTLINE = 2 +SCE_PL_POD = 3 +SCE_PL_NUMBER = 4 +SCE_PL_WORD = 5 +SCE_PL_STRING = 6 +SCE_PL_CHARACTER = 7 +SCE_PL_PUNCTUATION = 8 +SCE_PL_PREPROCESSOR = 9 +SCE_PL_OPERATOR = 10 +SCE_PL_IDENTIFIER = 11 +SCE_PL_SCALAR = 12 +SCE_PL_ARRAY = 13 +SCE_PL_HASH = 14 +SCE_PL_SYMBOLTABLE = 15 +SCE_PL_VARIABLE_INDEXER = 16 +SCE_PL_REGEX = 17 +SCE_PL_REGSUBST = 18 +SCE_PL_LONGQUOTE = 19 +SCE_PL_BACKTICKS = 20 +SCE_PL_DATASECTION = 21 +SCE_PL_HERE_DELIM = 22 +SCE_PL_HERE_Q = 23 +SCE_PL_HERE_QQ = 24 +SCE_PL_HERE_QX = 25 +SCE_PL_STRING_Q = 26 +SCE_PL_STRING_QQ = 27 +SCE_PL_STRING_QX = 28 +SCE_PL_STRING_QR = 29 +SCE_PL_STRING_QW = 30 +SCE_PL_POD_VERB = 31 +SCE_PL_SUB_PROTOTYPE = 40 +SCE_PL_FORMAT_IDENT = 41 +SCE_PL_FORMAT = 42 +SCE_RB_DEFAULT = 0 +SCE_RB_ERROR = 1 +SCE_RB_COMMENTLINE = 2 +SCE_RB_POD = 3 +SCE_RB_NUMBER = 4 +SCE_RB_WORD = 5 +SCE_RB_STRING = 6 +SCE_RB_CHARACTER = 7 +SCE_RB_CLASSNAME = 8 +SCE_RB_DEFNAME = 9 +SCE_RB_OPERATOR = 10 +SCE_RB_IDENTIFIER = 11 +SCE_RB_REGEX = 12 +SCE_RB_GLOBAL = 13 +SCE_RB_SYMBOL = 14 +SCE_RB_MODULE_NAME = 15 +SCE_RB_INSTANCE_VAR = 16 +SCE_RB_CLASS_VAR = 17 +SCE_RB_BACKTICKS = 18 +SCE_RB_DATASECTION = 19 +SCE_RB_HERE_DELIM = 20 +SCE_RB_HERE_Q = 21 +SCE_RB_HERE_QQ = 22 +SCE_RB_HERE_QX = 23 +SCE_RB_STRING_Q = 24 +SCE_RB_STRING_QQ = 25 +SCE_RB_STRING_QX = 26 +SCE_RB_STRING_QR = 27 +SCE_RB_STRING_QW = 28 +SCE_RB_WORD_DEMOTED = 29 +SCE_RB_STDIN = 30 +SCE_RB_STDOUT = 31 +SCE_RB_STDERR = 40 +SCE_RB_UPPER_BOUND = 41 +SCE_B_DEFAULT = 0 +SCE_B_COMMENT = 1 +SCE_B_NUMBER = 2 +SCE_B_KEYWORD = 3 +SCE_B_STRING = 4 +SCE_B_PREPROCESSOR = 5 +SCE_B_OPERATOR = 6 +SCE_B_IDENTIFIER = 7 +SCE_B_DATE = 8 +SCE_B_STRINGEOL = 9 +SCE_B_KEYWORD2 = 10 +SCE_B_KEYWORD3 = 11 +SCE_B_KEYWORD4 = 12 +SCE_B_CONSTANT = 13 +SCE_B_ASM = 14 +SCE_B_LABEL = 15 +SCE_B_ERROR = 16 +SCE_B_HEXNUMBER = 17 +SCE_B_BINNUMBER = 18 +SCE_PROPS_DEFAULT = 0 +SCE_PROPS_COMMENT = 1 +SCE_PROPS_SECTION = 2 +SCE_PROPS_ASSIGNMENT = 3 +SCE_PROPS_DEFVAL = 4 +SCE_PROPS_KEY = 5 +SCE_L_DEFAULT = 0 +SCE_L_COMMAND = 1 +SCE_L_TAG = 2 +SCE_L_MATH = 3 +SCE_L_COMMENT = 4 +SCE_LUA_DEFAULT = 0 +SCE_LUA_COMMENT = 1 +SCE_LUA_COMMENTLINE = 2 +SCE_LUA_COMMENTDOC = 3 +SCE_LUA_NUMBER = 4 +SCE_LUA_WORD = 5 +SCE_LUA_STRING = 6 +SCE_LUA_CHARACTER = 7 +SCE_LUA_LITERALSTRING = 8 +SCE_LUA_PREPROCESSOR = 9 +SCE_LUA_OPERATOR = 10 +SCE_LUA_IDENTIFIER = 11 +SCE_LUA_STRINGEOL = 12 +SCE_LUA_WORD2 = 13 +SCE_LUA_WORD3 = 14 +SCE_LUA_WORD4 = 15 +SCE_LUA_WORD5 = 16 +SCE_LUA_WORD6 = 17 +SCE_LUA_WORD7 = 18 +SCE_LUA_WORD8 = 19 +SCE_ERR_DEFAULT = 0 +SCE_ERR_PYTHON = 1 +SCE_ERR_GCC = 2 +SCE_ERR_MS = 3 +SCE_ERR_CMD = 4 +SCE_ERR_BORLAND = 5 +SCE_ERR_PERL = 6 +SCE_ERR_NET = 7 +SCE_ERR_LUA = 8 +SCE_ERR_CTAG = 9 +SCE_ERR_DIFF_CHANGED = 10 +SCE_ERR_DIFF_ADDITION = 11 +SCE_ERR_DIFF_DELETION = 12 +SCE_ERR_DIFF_MESSAGE = 13 +SCE_ERR_PHP = 14 +SCE_ERR_ELF = 15 +SCE_ERR_IFC = 16 +SCE_ERR_IFORT = 17 +SCE_ERR_ABSF = 18 +SCE_ERR_TIDY = 19 +SCE_ERR_JAVA_STACK = 20 +SCE_ERR_VALUE = 21 +SCE_BAT_DEFAULT = 0 +SCE_BAT_COMMENT = 1 +SCE_BAT_WORD = 2 +SCE_BAT_LABEL = 3 +SCE_BAT_HIDE = 4 +SCE_BAT_COMMAND = 5 +SCE_BAT_IDENTIFIER = 6 +SCE_BAT_OPERATOR = 7 +SCE_MAKE_DEFAULT = 0 +SCE_MAKE_COMMENT = 1 +SCE_MAKE_PREPROCESSOR = 2 +SCE_MAKE_IDENTIFIER = 3 +SCE_MAKE_OPERATOR = 4 +SCE_MAKE_TARGET = 5 +SCE_MAKE_IDEOL = 9 +SCE_DIFF_DEFAULT = 0 +SCE_DIFF_COMMENT = 1 +SCE_DIFF_COMMAND = 2 +SCE_DIFF_HEADER = 3 +SCE_DIFF_POSITION = 4 +SCE_DIFF_DELETED = 5 +SCE_DIFF_ADDED = 6 +SCE_DIFF_CHANGED = 7 +SCE_CONF_DEFAULT = 0 +SCE_CONF_COMMENT = 1 +SCE_CONF_NUMBER = 2 +SCE_CONF_IDENTIFIER = 3 +SCE_CONF_EXTENSION = 4 +SCE_CONF_PARAMETER = 5 +SCE_CONF_STRING = 6 +SCE_CONF_OPERATOR = 7 +SCE_CONF_IP = 8 +SCE_CONF_DIRECTIVE = 9 +SCE_AVE_DEFAULT = 0 +SCE_AVE_COMMENT = 1 +SCE_AVE_NUMBER = 2 +SCE_AVE_WORD = 3 +SCE_AVE_STRING = 6 +SCE_AVE_ENUM = 7 +SCE_AVE_STRINGEOL = 8 +SCE_AVE_IDENTIFIER = 9 +SCE_AVE_OPERATOR = 10 +SCE_AVE_WORD1 = 11 +SCE_AVE_WORD2 = 12 +SCE_AVE_WORD3 = 13 +SCE_AVE_WORD4 = 14 +SCE_AVE_WORD5 = 15 +SCE_AVE_WORD6 = 16 +SCE_ADA_DEFAULT = 0 +SCE_ADA_WORD = 1 +SCE_ADA_IDENTIFIER = 2 +SCE_ADA_NUMBER = 3 +SCE_ADA_DELIMITER = 4 +SCE_ADA_CHARACTER = 5 +SCE_ADA_CHARACTEREOL = 6 +SCE_ADA_STRING = 7 +SCE_ADA_STRINGEOL = 8 +SCE_ADA_LABEL = 9 +SCE_ADA_COMMENTLINE = 10 +SCE_ADA_ILLEGAL = 11 +SCE_BAAN_DEFAULT = 0 +SCE_BAAN_COMMENT = 1 +SCE_BAAN_COMMENTDOC = 2 +SCE_BAAN_NUMBER = 3 +SCE_BAAN_WORD = 4 +SCE_BAAN_STRING = 5 +SCE_BAAN_PREPROCESSOR = 6 +SCE_BAAN_OPERATOR = 7 +SCE_BAAN_IDENTIFIER = 8 +SCE_BAAN_STRINGEOL = 9 +SCE_BAAN_WORD2 = 10 +SCE_LISP_DEFAULT = 0 +SCE_LISP_COMMENT = 1 +SCE_LISP_NUMBER = 2 +SCE_LISP_KEYWORD = 3 +SCE_LISP_KEYWORD_KW = 4 +SCE_LISP_SYMBOL = 5 +SCE_LISP_STRING = 6 +SCE_LISP_STRINGEOL = 8 +SCE_LISP_IDENTIFIER = 9 +SCE_LISP_OPERATOR = 10 +SCE_LISP_SPECIAL = 11 +SCE_LISP_MULTI_COMMENT = 12 +SCE_EIFFEL_DEFAULT = 0 +SCE_EIFFEL_COMMENTLINE = 1 +SCE_EIFFEL_NUMBER = 2 +SCE_EIFFEL_WORD = 3 +SCE_EIFFEL_STRING = 4 +SCE_EIFFEL_CHARACTER = 5 +SCE_EIFFEL_OPERATOR = 6 +SCE_EIFFEL_IDENTIFIER = 7 +SCE_EIFFEL_STRINGEOL = 8 +SCE_NNCRONTAB_DEFAULT = 0 +SCE_NNCRONTAB_COMMENT = 1 +SCE_NNCRONTAB_TASK = 2 +SCE_NNCRONTAB_SECTION = 3 +SCE_NNCRONTAB_KEYWORD = 4 +SCE_NNCRONTAB_MODIFIER = 5 +SCE_NNCRONTAB_ASTERISK = 6 +SCE_NNCRONTAB_NUMBER = 7 +SCE_NNCRONTAB_STRING = 8 +SCE_NNCRONTAB_ENVIRONMENT = 9 +SCE_NNCRONTAB_IDENTIFIER = 10 +SCE_FORTH_DEFAULT = 0 +SCE_FORTH_COMMENT = 1 +SCE_FORTH_COMMENT_ML = 2 +SCE_FORTH_IDENTIFIER = 3 +SCE_FORTH_CONTROL = 4 +SCE_FORTH_KEYWORD = 5 +SCE_FORTH_DEFWORD = 6 +SCE_FORTH_PREWORD1 = 7 +SCE_FORTH_PREWORD2 = 8 +SCE_FORTH_NUMBER = 9 +SCE_FORTH_STRING = 10 +SCE_FORTH_LOCALE = 11 +SCE_MATLAB_DEFAULT = 0 +SCE_MATLAB_COMMENT = 1 +SCE_MATLAB_COMMAND = 2 +SCE_MATLAB_NUMBER = 3 +SCE_MATLAB_KEYWORD = 4 +SCE_MATLAB_STRING = 5 +SCE_MATLAB_OPERATOR = 6 +SCE_MATLAB_IDENTIFIER = 7 +SCE_MATLAB_DOUBLEQUOTESTRING = 8 +SCE_SCRIPTOL_DEFAULT = 0 +SCE_SCRIPTOL_WHITE = 1 +SCE_SCRIPTOL_COMMENTLINE = 2 +SCE_SCRIPTOL_PERSISTENT = 3 +SCE_SCRIPTOL_CSTYLE = 4 +SCE_SCRIPTOL_COMMENTBLOCK = 5 +SCE_SCRIPTOL_NUMBER = 6 +SCE_SCRIPTOL_STRING = 7 +SCE_SCRIPTOL_CHARACTER = 8 +SCE_SCRIPTOL_STRINGEOL = 9 +SCE_SCRIPTOL_KEYWORD = 10 +SCE_SCRIPTOL_OPERATOR = 11 +SCE_SCRIPTOL_IDENTIFIER = 12 +SCE_SCRIPTOL_TRIPLE = 13 +SCE_SCRIPTOL_CLASSNAME = 14 +SCE_SCRIPTOL_PREPROCESSOR = 15 +SCE_ASM_DEFAULT = 0 +SCE_ASM_COMMENT = 1 +SCE_ASM_NUMBER = 2 +SCE_ASM_STRING = 3 +SCE_ASM_OPERATOR = 4 +SCE_ASM_IDENTIFIER = 5 +SCE_ASM_CPUINSTRUCTION = 6 +SCE_ASM_MATHINSTRUCTION = 7 +SCE_ASM_REGISTER = 8 +SCE_ASM_DIRECTIVE = 9 +SCE_ASM_DIRECTIVEOPERAND = 10 +SCE_ASM_COMMENTBLOCK = 11 +SCE_ASM_CHARACTER = 12 +SCE_ASM_STRINGEOL = 13 +SCE_ASM_EXTINSTRUCTION = 14 +SCE_F_DEFAULT = 0 +SCE_F_COMMENT = 1 +SCE_F_NUMBER = 2 +SCE_F_STRING1 = 3 +SCE_F_STRING2 = 4 +SCE_F_STRINGEOL = 5 +SCE_F_OPERATOR = 6 +SCE_F_IDENTIFIER = 7 +SCE_F_WORD = 8 +SCE_F_WORD2 = 9 +SCE_F_WORD3 = 10 +SCE_F_PREPROCESSOR = 11 +SCE_F_OPERATOR2 = 12 +SCE_F_LABEL = 13 +SCE_F_CONTINUATION = 14 +SCE_CSS_DEFAULT = 0 +SCE_CSS_TAG = 1 +SCE_CSS_CLASS = 2 +SCE_CSS_PSEUDOCLASS = 3 +SCE_CSS_UNKNOWN_PSEUDOCLASS = 4 +SCE_CSS_OPERATOR = 5 +SCE_CSS_IDENTIFIER = 6 +SCE_CSS_UNKNOWN_IDENTIFIER = 7 +SCE_CSS_VALUE = 8 +SCE_CSS_COMMENT = 9 +SCE_CSS_ID = 10 +SCE_CSS_IMPORTANT = 11 +SCE_CSS_DIRECTIVE = 12 +SCE_CSS_DOUBLESTRING = 13 +SCE_CSS_SINGLESTRING = 14 +SCE_CSS_IDENTIFIER2 = 15 +SCE_CSS_ATTRIBUTE = 16 +SCE_CSS_IDENTIFIER3 = 17 +SCE_CSS_PSEUDOELEMENT = 18 +SCE_CSS_EXTENDED_IDENTIFIER = 19 +SCE_CSS_EXTENDED_PSEUDOCLASS = 20 +SCE_CSS_EXTENDED_PSEUDOELEMENT = 21 +SCE_POV_DEFAULT = 0 +SCE_POV_COMMENT = 1 +SCE_POV_COMMENTLINE = 2 +SCE_POV_NUMBER = 3 +SCE_POV_OPERATOR = 4 +SCE_POV_IDENTIFIER = 5 +SCE_POV_STRING = 6 +SCE_POV_STRINGEOL = 7 +SCE_POV_DIRECTIVE = 8 +SCE_POV_BADDIRECTIVE = 9 +SCE_POV_WORD2 = 10 +SCE_POV_WORD3 = 11 +SCE_POV_WORD4 = 12 +SCE_POV_WORD5 = 13 +SCE_POV_WORD6 = 14 +SCE_POV_WORD7 = 15 +SCE_POV_WORD8 = 16 +SCE_LOUT_DEFAULT = 0 +SCE_LOUT_COMMENT = 1 +SCE_LOUT_NUMBER = 2 +SCE_LOUT_WORD = 3 +SCE_LOUT_WORD2 = 4 +SCE_LOUT_WORD3 = 5 +SCE_LOUT_WORD4 = 6 +SCE_LOUT_STRING = 7 +SCE_LOUT_OPERATOR = 8 +SCE_LOUT_IDENTIFIER = 9 +SCE_LOUT_STRINGEOL = 10 +SCE_ESCRIPT_DEFAULT = 0 +SCE_ESCRIPT_COMMENT = 1 +SCE_ESCRIPT_COMMENTLINE = 2 +SCE_ESCRIPT_COMMENTDOC = 3 +SCE_ESCRIPT_NUMBER = 4 +SCE_ESCRIPT_WORD = 5 +SCE_ESCRIPT_STRING = 6 +SCE_ESCRIPT_OPERATOR = 7 +SCE_ESCRIPT_IDENTIFIER = 8 +SCE_ESCRIPT_BRACE = 9 +SCE_ESCRIPT_WORD2 = 10 +SCE_ESCRIPT_WORD3 = 11 +SCE_PS_DEFAULT = 0 +SCE_PS_COMMENT = 1 +SCE_PS_DSC_COMMENT = 2 +SCE_PS_DSC_VALUE = 3 +SCE_PS_NUMBER = 4 +SCE_PS_NAME = 5 +SCE_PS_KEYWORD = 6 +SCE_PS_LITERAL = 7 +SCE_PS_IMMEVAL = 8 +SCE_PS_PAREN_ARRAY = 9 +SCE_PS_PAREN_DICT = 10 +SCE_PS_PAREN_PROC = 11 +SCE_PS_TEXT = 12 +SCE_PS_HEXSTRING = 13 +SCE_PS_BASE85STRING = 14 +SCE_PS_BADSTRINGCHAR = 15 +SCE_NSIS_DEFAULT = 0 +SCE_NSIS_COMMENT = 1 +SCE_NSIS_STRINGDQ = 2 +SCE_NSIS_STRINGLQ = 3 +SCE_NSIS_STRINGRQ = 4 +SCE_NSIS_FUNCTION = 5 +SCE_NSIS_VARIABLE = 6 +SCE_NSIS_LABEL = 7 +SCE_NSIS_USERDEFINED = 8 +SCE_NSIS_SECTIONDEF = 9 +SCE_NSIS_SUBSECTIONDEF = 10 +SCE_NSIS_IFDEFINEDEF = 11 +SCE_NSIS_MACRODEF = 12 +SCE_NSIS_STRINGVAR = 13 +SCE_NSIS_NUMBER = 14 +SCE_NSIS_SECTIONGROUP = 15 +SCE_NSIS_PAGEEX = 16 +SCE_NSIS_FUNCTIONDEF = 17 +SCE_NSIS_COMMENTBOX = 18 +SCE_MMIXAL_LEADWS = 0 +SCE_MMIXAL_COMMENT = 1 +SCE_MMIXAL_LABEL = 2 +SCE_MMIXAL_OPCODE = 3 +SCE_MMIXAL_OPCODE_PRE = 4 +SCE_MMIXAL_OPCODE_VALID = 5 +SCE_MMIXAL_OPCODE_UNKNOWN = 6 +SCE_MMIXAL_OPCODE_POST = 7 +SCE_MMIXAL_OPERANDS = 8 +SCE_MMIXAL_NUMBER = 9 +SCE_MMIXAL_REF = 10 +SCE_MMIXAL_CHAR = 11 +SCE_MMIXAL_STRING = 12 +SCE_MMIXAL_REGISTER = 13 +SCE_MMIXAL_HEX = 14 +SCE_MMIXAL_OPERATOR = 15 +SCE_MMIXAL_SYMBOL = 16 +SCE_MMIXAL_INCLUDE = 17 +SCE_CLW_DEFAULT = 0 +SCE_CLW_LABEL = 1 +SCE_CLW_COMMENT = 2 +SCE_CLW_STRING = 3 +SCE_CLW_USER_IDENTIFIER = 4 +SCE_CLW_INTEGER_CONSTANT = 5 +SCE_CLW_REAL_CONSTANT = 6 +SCE_CLW_PICTURE_STRING = 7 +SCE_CLW_KEYWORD = 8 +SCE_CLW_COMPILER_DIRECTIVE = 9 +SCE_CLW_RUNTIME_EXPRESSIONS = 10 +SCE_CLW_BUILTIN_PROCEDURES_FUNCTION = 11 +SCE_CLW_STRUCTURE_DATA_TYPE = 12 +SCE_CLW_ATTRIBUTE = 13 +SCE_CLW_STANDARD_EQUATE = 14 +SCE_CLW_ERROR = 15 +SCE_CLW_DEPRECATED = 16 +SCE_LOT_DEFAULT = 0 +SCE_LOT_HEADER = 1 +SCE_LOT_BREAK = 2 +SCE_LOT_SET = 3 +SCE_LOT_PASS = 4 +SCE_LOT_FAIL = 5 +SCE_LOT_ABORT = 6 +SCE_YAML_DEFAULT = 0 +SCE_YAML_COMMENT = 1 +SCE_YAML_IDENTIFIER = 2 +SCE_YAML_KEYWORD = 3 +SCE_YAML_NUMBER = 4 +SCE_YAML_REFERENCE = 5 +SCE_YAML_DOCUMENT = 6 +SCE_YAML_TEXT = 7 +SCE_YAML_ERROR = 8 +SCE_YAML_OPERATOR = 9 +SCE_TEX_DEFAULT = 0 +SCE_TEX_SPECIAL = 1 +SCE_TEX_GROUP = 2 +SCE_TEX_SYMBOL = 3 +SCE_TEX_COMMAND = 4 +SCE_TEX_TEXT = 5 +SCE_METAPOST_DEFAULT = 0 +SCE_METAPOST_SPECIAL = 1 +SCE_METAPOST_GROUP = 2 +SCE_METAPOST_SYMBOL = 3 +SCE_METAPOST_COMMAND = 4 +SCE_METAPOST_TEXT = 5 +SCE_METAPOST_EXTRA = 6 +SCE_ERLANG_DEFAULT = 0 +SCE_ERLANG_COMMENT = 1 +SCE_ERLANG_VARIABLE = 2 +SCE_ERLANG_NUMBER = 3 +SCE_ERLANG_KEYWORD = 4 +SCE_ERLANG_STRING = 5 +SCE_ERLANG_OPERATOR = 6 +SCE_ERLANG_ATOM = 7 +SCE_ERLANG_FUNCTION_NAME = 8 +SCE_ERLANG_CHARACTER = 9 +SCE_ERLANG_MACRO = 10 +SCE_ERLANG_RECORD = 11 +SCE_ERLANG_SEPARATOR = 12 +SCE_ERLANG_NODE_NAME = 13 +SCE_ERLANG_UNKNOWN = 31 +SCE_MSSQL_DEFAULT = 0 +SCE_MSSQL_COMMENT = 1 +SCE_MSSQL_LINE_COMMENT = 2 +SCE_MSSQL_NUMBER = 3 +SCE_MSSQL_STRING = 4 +SCE_MSSQL_OPERATOR = 5 +SCE_MSSQL_IDENTIFIER = 6 +SCE_MSSQL_VARIABLE = 7 +SCE_MSSQL_COLUMN_NAME = 8 +SCE_MSSQL_STATEMENT = 9 +SCE_MSSQL_DATATYPE = 10 +SCE_MSSQL_SYSTABLE = 11 +SCE_MSSQL_GLOBAL_VARIABLE = 12 +SCE_MSSQL_FUNCTION = 13 +SCE_MSSQL_STORED_PROCEDURE = 14 +SCE_MSSQL_DEFAULT_PREF_DATATYPE = 15 +SCE_MSSQL_COLUMN_NAME_2 = 16 +SCE_V_DEFAULT = 0 +SCE_V_COMMENT = 1 +SCE_V_COMMENTLINE = 2 +SCE_V_COMMENTLINEBANG = 3 +SCE_V_NUMBER = 4 +SCE_V_WORD = 5 +SCE_V_STRING = 6 +SCE_V_WORD2 = 7 +SCE_V_WORD3 = 8 +SCE_V_PREPROCESSOR = 9 +SCE_V_OPERATOR = 10 +SCE_V_IDENTIFIER = 11 +SCE_V_STRINGEOL = 12 +SCE_V_USER = 19 +SCE_KIX_DEFAULT = 0 +SCE_KIX_COMMENT = 1 +SCE_KIX_STRING1 = 2 +SCE_KIX_STRING2 = 3 +SCE_KIX_NUMBER = 4 +SCE_KIX_VAR = 5 +SCE_KIX_MACRO = 6 +SCE_KIX_KEYWORD = 7 +SCE_KIX_FUNCTIONS = 8 +SCE_KIX_OPERATOR = 9 +SCE_KIX_IDENTIFIER = 31 +SCE_GC_DEFAULT = 0 +SCE_GC_COMMENTLINE = 1 +SCE_GC_COMMENTBLOCK = 2 +SCE_GC_GLOBAL = 3 +SCE_GC_EVENT = 4 +SCE_GC_ATTRIBUTE = 5 +SCE_GC_CONTROL = 6 +SCE_GC_COMMAND = 7 +SCE_GC_STRING = 8 +SCE_GC_OPERATOR = 9 +SCE_SN_DEFAULT = 0 +SCE_SN_CODE = 1 +SCE_SN_COMMENTLINE = 2 +SCE_SN_COMMENTLINEBANG = 3 +SCE_SN_NUMBER = 4 +SCE_SN_WORD = 5 +SCE_SN_STRING = 6 +SCE_SN_WORD2 = 7 +SCE_SN_WORD3 = 8 +SCE_SN_PREPROCESSOR = 9 +SCE_SN_OPERATOR = 10 +SCE_SN_IDENTIFIER = 11 +SCE_SN_STRINGEOL = 12 +SCE_SN_REGEXTAG = 13 +SCE_SN_SIGNAL = 14 +SCE_SN_USER = 19 +SCE_AU3_DEFAULT = 0 +SCE_AU3_COMMENT = 1 +SCE_AU3_COMMENTBLOCK = 2 +SCE_AU3_NUMBER = 3 +SCE_AU3_FUNCTION = 4 +SCE_AU3_KEYWORD = 5 +SCE_AU3_MACRO = 6 +SCE_AU3_STRING = 7 +SCE_AU3_OPERATOR = 8 +SCE_AU3_VARIABLE = 9 +SCE_AU3_SENT = 10 +SCE_AU3_PREPROCESSOR = 11 +SCE_AU3_SPECIAL = 12 +SCE_AU3_EXPAND = 13 +SCE_AU3_COMOBJ = 14 +SCE_AU3_UDF = 15 +SCE_APDL_DEFAULT = 0 +SCE_APDL_COMMENT = 1 +SCE_APDL_COMMENTBLOCK = 2 +SCE_APDL_NUMBER = 3 +SCE_APDL_STRING = 4 +SCE_APDL_OPERATOR = 5 +SCE_APDL_WORD = 6 +SCE_APDL_PROCESSOR = 7 +SCE_APDL_COMMAND = 8 +SCE_APDL_SLASHCOMMAND = 9 +SCE_APDL_STARCOMMAND = 10 +SCE_APDL_ARGUMENT = 11 +SCE_APDL_FUNCTION = 12 +SCE_SH_DEFAULT = 0 +SCE_SH_ERROR = 1 +SCE_SH_COMMENTLINE = 2 +SCE_SH_NUMBER = 3 +SCE_SH_WORD = 4 +SCE_SH_STRING = 5 +SCE_SH_CHARACTER = 6 +SCE_SH_OPERATOR = 7 +SCE_SH_IDENTIFIER = 8 +SCE_SH_SCALAR = 9 +SCE_SH_PARAM = 10 +SCE_SH_BACKTICKS = 11 +SCE_SH_HERE_DELIM = 12 +SCE_SH_HERE_Q = 13 +SCE_ASN1_DEFAULT = 0 +SCE_ASN1_COMMENT = 1 +SCE_ASN1_IDENTIFIER = 2 +SCE_ASN1_STRING = 3 +SCE_ASN1_OID = 4 +SCE_ASN1_SCALAR = 5 +SCE_ASN1_KEYWORD = 6 +SCE_ASN1_ATTRIBUTE = 7 +SCE_ASN1_DESCRIPTOR = 8 +SCE_ASN1_TYPE = 9 +SCE_ASN1_OPERATOR = 10 +SCE_VHDL_DEFAULT = 0 +SCE_VHDL_COMMENT = 1 +SCE_VHDL_COMMENTLINEBANG = 2 +SCE_VHDL_NUMBER = 3 +SCE_VHDL_STRING = 4 +SCE_VHDL_OPERATOR = 5 +SCE_VHDL_IDENTIFIER = 6 +SCE_VHDL_STRINGEOL = 7 +SCE_VHDL_KEYWORD = 8 +SCE_VHDL_STDOPERATOR = 9 +SCE_VHDL_ATTRIBUTE = 10 +SCE_VHDL_STDFUNCTION = 11 +SCE_VHDL_STDPACKAGE = 12 +SCE_VHDL_STDTYPE = 13 +SCE_VHDL_USERWORD = 14 +SCE_CAML_DEFAULT = 0 +SCE_CAML_IDENTIFIER = 1 +SCE_CAML_TAGNAME = 2 +SCE_CAML_KEYWORD = 3 +SCE_CAML_KEYWORD2 = 4 +SCE_CAML_KEYWORD3 = 5 +SCE_CAML_LINENUM = 6 +SCE_CAML_OPERATOR = 7 +SCE_CAML_NUMBER = 8 +SCE_CAML_CHAR = 9 +SCE_CAML_STRING = 11 +SCE_CAML_COMMENT = 12 +SCE_CAML_COMMENT1 = 13 +SCE_CAML_COMMENT2 = 14 +SCE_CAML_COMMENT3 = 15 +SCE_HA_DEFAULT = 0 +SCE_HA_IDENTIFIER = 1 +SCE_HA_KEYWORD = 2 +SCE_HA_NUMBER = 3 +SCE_HA_STRING = 4 +SCE_HA_CHARACTER = 5 +SCE_HA_CLASS = 6 +SCE_HA_MODULE = 7 +SCE_HA_CAPITAL = 8 +SCE_HA_DATA = 9 +SCE_HA_IMPORT = 10 +SCE_HA_OPERATOR = 11 +SCE_HA_INSTANCE = 12 +SCE_HA_COMMENTLINE = 13 +SCE_HA_COMMENTBLOCK = 14 +SCE_HA_COMMENTBLOCK2 = 15 +SCE_HA_COMMENTBLOCK3 = 16 +SCE_T3_DEFAULT = 0 +SCE_T3_X_DEFAULT = 1 +SCE_T3_PREPROCESSOR = 2 +SCE_T3_BLOCK_COMMENT = 3 +SCE_T3_LINE_COMMENT = 4 +SCE_T3_OPERATOR = 5 +SCE_T3_KEYWORD = 6 +SCE_T3_NUMBER = 7 +SCE_T3_IDENTIFIER = 8 +SCE_T3_S_STRING = 9 +SCE_T3_D_STRING = 10 +SCE_T3_X_STRING = 11 +SCE_T3_LIB_DIRECTIVE = 12 +SCE_T3_MSG_PARAM = 13 +SCE_T3_HTML_TAG = 14 +SCE_T3_HTML_DEFAULT = 15 +SCE_T3_HTML_STRING = 16 +SCE_T3_USER1 = 17 +SCE_T3_USER2 = 18 +SCE_T3_USER3 = 19 +SCE_T3_BRACE = 20 +SCE_REBOL_DEFAULT = 0 +SCE_REBOL_COMMENTLINE = 1 +SCE_REBOL_COMMENTBLOCK = 2 +SCE_REBOL_PREFACE = 3 +SCE_REBOL_OPERATOR = 4 +SCE_REBOL_CHARACTER = 5 +SCE_REBOL_QUOTEDSTRING = 6 +SCE_REBOL_BRACEDSTRING = 7 +SCE_REBOL_NUMBER = 8 +SCE_REBOL_PAIR = 9 +SCE_REBOL_TUPLE = 10 +SCE_REBOL_BINARY = 11 +SCE_REBOL_MONEY = 12 +SCE_REBOL_ISSUE = 13 +SCE_REBOL_TAG = 14 +SCE_REBOL_FILE = 15 +SCE_REBOL_EMAIL = 16 +SCE_REBOL_URL = 17 +SCE_REBOL_DATE = 18 +SCE_REBOL_TIME = 19 +SCE_REBOL_IDENTIFIER = 20 +SCE_REBOL_WORD = 21 +SCE_REBOL_WORD2 = 22 +SCE_REBOL_WORD3 = 23 +SCE_REBOL_WORD4 = 24 +SCE_REBOL_WORD5 = 25 +SCE_REBOL_WORD6 = 26 +SCE_REBOL_WORD7 = 27 +SCE_REBOL_WORD8 = 28 +SCE_SQL_DEFAULT = 0 +SCE_SQL_COMMENT = 1 +SCE_SQL_COMMENTLINE = 2 +SCE_SQL_COMMENTDOC = 3 +SCE_SQL_NUMBER = 4 +SCE_SQL_WORD = 5 +SCE_SQL_STRING = 6 +SCE_SQL_CHARACTER = 7 +SCE_SQL_SQLPLUS = 8 +SCE_SQL_SQLPLUS_PROMPT = 9 +SCE_SQL_OPERATOR = 10 +SCE_SQL_IDENTIFIER = 11 +SCE_SQL_SQLPLUS_COMMENT = 13 +SCE_SQL_COMMENTLINEDOC = 15 +SCE_SQL_WORD2 = 16 +SCE_SQL_COMMENTDOCKEYWORD = 17 +SCE_SQL_COMMENTDOCKEYWORDERROR = 18 +SCE_SQL_USER1 = 19 +SCE_SQL_USER2 = 20 +SCE_SQL_USER3 = 21 +SCE_SQL_USER4 = 22 +SCE_SQL_QUOTEDIDENTIFIER = 23 +SCE_ST_DEFAULT = 0 +SCE_ST_STRING = 1 +SCE_ST_NUMBER = 2 +SCE_ST_COMMENT = 3 +SCE_ST_SYMBOL = 4 +SCE_ST_BINARY = 5 +SCE_ST_BOOL = 6 +SCE_ST_SELF = 7 +SCE_ST_SUPER = 8 +SCE_ST_NIL = 9 +SCE_ST_GLOBAL = 10 +SCE_ST_RETURN = 11 +SCE_ST_SPECIAL = 12 +SCE_ST_KWSEND = 13 +SCE_ST_ASSIGN = 14 +SCE_ST_CHARACTER = 15 +SCE_ST_SPEC_SEL = 16 +SCE_FS_DEFAULT = 0 +SCE_FS_COMMENT = 1 +SCE_FS_COMMENTLINE = 2 +SCE_FS_COMMENTDOC = 3 +SCE_FS_COMMENTLINEDOC = 4 +SCE_FS_COMMENTDOCKEYWORD = 5 +SCE_FS_COMMENTDOCKEYWORDERROR = 6 +SCE_FS_KEYWORD = 7 +SCE_FS_KEYWORD2 = 8 +SCE_FS_KEYWORD3 = 9 +SCE_FS_KEYWORD4 = 10 +SCE_FS_NUMBER = 11 +SCE_FS_STRING = 12 +SCE_FS_PREPROCESSOR = 13 +SCE_FS_OPERATOR = 14 +SCE_FS_IDENTIFIER = 15 +SCE_FS_DATE = 16 +SCE_FS_STRINGEOL = 17 +SCE_FS_CONSTANT = 18 +SCE_FS_ASM = 19 +SCE_FS_LABEL = 20 +SCE_FS_ERROR = 21 +SCE_FS_HEXNUMBER = 22 +SCE_FS_BINNUMBER = 23 +SCE_CSOUND_DEFAULT = 0 +SCE_CSOUND_COMMENT = 1 +SCE_CSOUND_NUMBER = 2 +SCE_CSOUND_OPERATOR = 3 +SCE_CSOUND_INSTR = 4 +SCE_CSOUND_IDENTIFIER = 5 +SCE_CSOUND_OPCODE = 6 +SCE_CSOUND_HEADERSTMT = 7 +SCE_CSOUND_USERKEYWORD = 8 +SCE_CSOUND_COMMENTBLOCK = 9 +SCE_CSOUND_PARAM = 10 +SCE_CSOUND_ARATE_VAR = 11 +SCE_CSOUND_KRATE_VAR = 12 +SCE_CSOUND_IRATE_VAR = 13 +SCE_CSOUND_GLOBAL_VAR = 14 +SCE_CSOUND_STRINGEOL = 15 +SCE_INNO_DEFAULT = 0 +SCE_INNO_COMMENT = 1 +SCE_INNO_KEYWORD = 2 +SCE_INNO_PARAMETER = 3 +SCE_INNO_SECTION = 4 +SCE_INNO_PREPROC = 5 +SCE_INNO_PREPROC_INLINE = 6 +SCE_INNO_COMMENT_PASCAL = 7 +SCE_INNO_KEYWORD_PASCAL = 8 +SCE_INNO_KEYWORD_USER = 9 +SCE_INNO_STRING_DOUBLE = 10 +SCE_INNO_STRING_SINGLE = 11 +SCE_INNO_IDENTIFIER = 12 +SCE_OPAL_SPACE = 0 +SCE_OPAL_COMMENT_BLOCK = 1 +SCE_OPAL_COMMENT_LINE = 2 +SCE_OPAL_INTEGER = 3 +SCE_OPAL_KEYWORD = 4 +SCE_OPAL_SORT = 5 +SCE_OPAL_STRING = 6 +SCE_OPAL_PAR = 7 +SCE_OPAL_BOOL_CONST = 8 +SCE_OPAL_DEFAULT = 32 +SCE_SPICE_DEFAULT = 0 +SCE_SPICE_IDENTIFIER = 1 +SCE_SPICE_KEYWORD = 2 +SCE_SPICE_KEYWORD2 = 3 +SCE_SPICE_KEYWORD3 = 4 +SCE_SPICE_NUMBER = 5 +SCE_SPICE_DELIMITER = 6 +SCE_SPICE_VALUE = 7 +SCE_SPICE_COMMENTLINE = 8 +SCE_CMAKE_DEFAULT = 0 +SCE_CMAKE_COMMENT = 1 +SCE_CMAKE_STRINGDQ = 2 +SCE_CMAKE_STRINGLQ = 3 +SCE_CMAKE_STRINGRQ = 4 +SCE_CMAKE_COMMANDS = 5 +SCE_CMAKE_PARAMETERS = 6 +SCE_CMAKE_VARIABLE = 7 +SCE_CMAKE_USERDEFINED = 8 +SCE_CMAKE_WHILEDEF = 9 +SCE_CMAKE_FOREACHDEF = 10 +SCE_CMAKE_IFDEFINEDEF = 11 +SCE_CMAKE_MACRODEF = 12 +SCE_CMAKE_STRINGVAR = 13 +SCE_CMAKE_NUMBER = 14 +SCE_GAP_DEFAULT = 0 +SCE_GAP_IDENTIFIER = 1 +SCE_GAP_KEYWORD = 2 +SCE_GAP_KEYWORD2 = 3 +SCE_GAP_KEYWORD3 = 4 +SCE_GAP_KEYWORD4 = 5 +SCE_GAP_STRING = 6 +SCE_GAP_CHAR = 7 +SCE_GAP_OPERATOR = 8 +SCE_GAP_COMMENT = 9 +SCE_GAP_NUMBER = 10 +SCE_GAP_STRINGEOL = 11 +SCE_PLM_DEFAULT = 0 +SCE_PLM_COMMENT = 1 +SCE_PLM_STRING = 2 +SCE_PLM_NUMBER = 3 +SCE_PLM_IDENTIFIER = 4 +SCE_PLM_OPERATOR = 5 +SCE_PLM_CONTROL = 6 +SCE_PLM_KEYWORD = 7 +SCE_4GL_DEFAULT = 0 +SCE_4GL_NUMBER = 1 +SCE_4GL_WORD = 2 +SCE_4GL_STRING = 3 +SCE_4GL_CHARACTER = 4 +SCE_4GL_PREPROCESSOR = 5 +SCE_4GL_OPERATOR = 6 +SCE_4GL_IDENTIFIER = 7 +SCE_4GL_BLOCK = 8 +SCE_4GL_END = 9 +SCE_4GL_COMMENT1 = 10 +SCE_4GL_COMMENT2 = 11 +SCE_4GL_COMMENT3 = 12 +SCE_4GL_COMMENT4 = 13 +SCE_4GL_COMMENT5 = 14 +SCE_4GL_COMMENT6 = 15 +SCE_4GL_DEFAULT_ = 16 +SCE_4GL_NUMBER_ = 17 +SCE_4GL_WORD_ = 18 +SCE_4GL_STRING_ = 19 +SCE_4GL_CHARACTER_ = 20 +SCE_4GL_PREPROCESSOR_ = 21 +SCE_4GL_OPERATOR_ = 22 +SCE_4GL_IDENTIFIER_ = 23 +SCE_4GL_BLOCK_ = 24 +SCE_4GL_END_ = 25 +SCE_4GL_COMMENT1_ = 26 +SCE_4GL_COMMENT2_ = 27 +SCE_4GL_COMMENT3_ = 28 +SCE_4GL_COMMENT4_ = 29 +SCE_4GL_COMMENT5_ = 30 +SCE_4GL_COMMENT6_ = 31 +SCE_ABAQUS_DEFAULT = 0 +SCE_ABAQUS_COMMENT = 1 +SCE_ABAQUS_COMMENTBLOCK = 2 +SCE_ABAQUS_NUMBER = 3 +SCE_ABAQUS_STRING = 4 +SCE_ABAQUS_OPERATOR = 5 +SCE_ABAQUS_WORD = 6 +SCE_ABAQUS_PROCESSOR = 7 +SCE_ABAQUS_COMMAND = 8 +SCE_ABAQUS_SLASHCOMMAND = 9 +SCE_ABAQUS_STARCOMMAND = 10 +SCE_ABAQUS_ARGUMENT = 11 +SCE_ABAQUS_FUNCTION = 12 +SCE_ASY_DEFAULT = 0 +SCE_ASY_COMMENT = 1 +SCE_ASY_COMMENTLINE = 2 +SCE_ASY_NUMBER = 3 +SCE_ASY_WORD = 4 +SCE_ASY_STRING = 5 +SCE_ASY_CHARACTER = 6 +SCE_ASY_OPERATOR = 7 +SCE_ASY_IDENTIFIER = 8 +SCE_ASY_STRINGEOL = 9 +SCE_ASY_COMMENTLINEDOC = 10 +SCE_ASY_WORD2 = 11 +SCE_R_DEFAULT = 0 +SCE_R_COMMENT = 1 +SCE_R_KWORD = 2 +SCE_R_BASEKWORD = 3 +SCE_R_OTHERKWORD = 4 +SCE_R_NUMBER = 5 +SCE_R_STRING = 6 +SCE_R_STRING2 = 7 +SCE_R_OPERATOR = 8 +SCE_R_IDENTIFIER = 9 +SCE_R_INFIX = 10 +SCE_R_INFIXEOL = 11 +SCE_MAGIK_DEFAULT = 0 +SCE_MAGIK_COMMENT = 1 +SCE_MAGIK_HYPER_COMMENT = 16 +SCE_MAGIK_STRING = 2 +SCE_MAGIK_CHARACTER = 3 +SCE_MAGIK_NUMBER = 4 +SCE_MAGIK_IDENTIFIER = 5 +SCE_MAGIK_OPERATOR = 6 +SCE_MAGIK_FLOW = 7 +SCE_MAGIK_CONTAINER = 8 +SCE_MAGIK_BRACKET_BLOCK = 9 +SCE_MAGIK_BRACE_BLOCK = 10 +SCE_MAGIK_SQBRACKET_BLOCK = 11 +SCE_MAGIK_UNKNOWN_KEYWORD = 12 +SCE_MAGIK_KEYWORD = 13 +SCE_MAGIK_PRAGMA = 14 +SCE_MAGIK_SYMBOL = 15 +SCE_POWERSHELL_DEFAULT = 0 +SCE_POWERSHELL_COMMENT = 1 +SCE_POWERSHELL_STRING = 2 +SCE_POWERSHELL_CHARACTER = 3 +SCE_POWERSHELL_NUMBER = 4 +SCE_POWERSHELL_VARIABLE = 5 +SCE_POWERSHELL_OPERATOR = 6 +SCE_POWERSHELL_IDENTIFIER = 7 +SCE_POWERSHELL_KEYWORD = 8 +SCE_POWERSHELL_CMDLET = 9 +SCE_POWERSHELL_ALIAS = 10 +SCE_MYSQL_DEFAULT = 0 +SCE_MYSQL_COMMENT = 1 +SCE_MYSQL_COMMENTLINE = 2 +SCE_MYSQL_VARIABLE = 3 +SCE_MYSQL_SYSTEMVARIABLE = 4 +SCE_MYSQL_KNOWNSYSTEMVARIABLE = 5 +SCE_MYSQL_NUMBER = 6 +SCE_MYSQL_MAJORKEYWORD = 7 +SCE_MYSQL_KEYWORD = 8 +SCE_MYSQL_DATABASEOBJECT = 9 +SCE_MYSQL_PROCEDUREKEYWORD = 10 +SCE_MYSQL_STRING = 11 +SCE_MYSQL_SQSTRING = 12 +SCE_MYSQL_DQSTRING = 13 +SCE_MYSQL_OPERATOR = 14 +SCE_MYSQL_FUNCTION = 15 +SCE_MYSQL_IDENTIFIER = 16 +SCE_MYSQL_QUOTEDIDENTIFIER = 17 +SCE_MYSQL_USER1 = 18 +SCE_MYSQL_USER2 = 19 +SCE_MYSQL_USER3 = 20 +SCE_PO_DEFAULT = 0 +SCE_PO_COMMENT = 1 +SCE_PO_MSGID = 2 +SCE_PO_MSGID_TEXT = 3 +SCE_PO_MSGSTR = 4 +SCE_PO_MSGSTR_TEXT = 5 +SCE_PO_MSGCTXT = 6 +SCE_PO_MSGCTXT_TEXT = 7 +SCE_PO_FUZZY = 8 +SCLEX_ASP = 29 +SCLEX_PHP = 30 diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/view.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/view.py new file mode 100644 index 0000000000000000000000000000000000000000..3783666fc8dcb7b1b53411ab5dfc07ea061efe29 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/scintilla/view.py @@ -0,0 +1,832 @@ +# A general purpose MFC CCtrlView view that uses Scintilla. + +import array +import os +import re +import string +import struct +import sys + +import __main__ # for attribute lookup +import afxres +import win32con +import win32ui +from pywin.mfc import dialog, docview + +from . import IDLEenvironment # IDLE emulation. +from . import bindings, control, keycodes, scintillacon + +PRINTDLGORD = 1538 +IDC_PRINT_MAG_EDIT = 1010 +EM_FORMATRANGE = win32con.WM_USER + 57 + +wordbreaks = "._" + string.ascii_uppercase + string.ascii_lowercase + string.digits + +patImport = re.compile("import (?P.*)") + +_event_commands = [ + # File menu + "win32ui.ID_FILE_LOCATE", + "win32ui.ID_FILE_CHECK", + "afxres.ID_FILE_CLOSE", + "afxres.ID_FILE_NEW", + "afxres.ID_FILE_OPEN", + "afxres.ID_FILE_SAVE", + "afxres.ID_FILE_SAVE_AS", + "win32ui.ID_FILE_SAVE_ALL", + # Edit menu + "afxres.ID_EDIT_UNDO", + "afxres.ID_EDIT_REDO", + "afxres.ID_EDIT_CUT", + "afxres.ID_EDIT_COPY", + "afxres.ID_EDIT_PASTE", + "afxres.ID_EDIT_SELECT_ALL", + "afxres.ID_EDIT_FIND", + "afxres.ID_EDIT_REPEAT", + "afxres.ID_EDIT_REPLACE", + # View menu + "win32ui.ID_VIEW_WHITESPACE", + "win32ui.ID_VIEW_FIXED_FONT", + "win32ui.ID_VIEW_BROWSE", + "win32ui.ID_VIEW_INTERACTIVE", + # Window menu + "afxres.ID_WINDOW_ARRANGE", + "afxres.ID_WINDOW_CASCADE", + "afxres.ID_WINDOW_NEW", + "afxres.ID_WINDOW_SPLIT", + "afxres.ID_WINDOW_TILE_HORZ", + "afxres.ID_WINDOW_TILE_VERT", + # Others + "afxres.ID_APP_EXIT", + "afxres.ID_APP_ABOUT", +] + +_extra_event_commands = [ + ("EditDelete", afxres.ID_EDIT_CLEAR), + ("LocateModule", win32ui.ID_FILE_LOCATE), + ("GotoLine", win32ui.ID_EDIT_GOTO_LINE), + ("DbgBreakpointToggle", win32ui.IDC_DBG_ADD), + ("DbgGo", win32ui.IDC_DBG_GO), + ("DbgStepOver", win32ui.IDC_DBG_STEPOVER), + ("DbgStep", win32ui.IDC_DBG_STEP), + ("DbgStepOut", win32ui.IDC_DBG_STEPOUT), + ("DbgBreakpointClearAll", win32ui.IDC_DBG_CLEAR), + ("DbgClose", win32ui.IDC_DBG_CLOSE), +] + +event_commands = [] + + +def _CreateEvents(): + for name in _event_commands: + val = eval(name) + name_parts = name.split("_")[1:] + name_parts = [p.capitalize() for p in name_parts] + event = "".join(name_parts) + event_commands.append((event, val)) + for name, id in _extra_event_commands: + event_commands.append((name, id)) + + +_CreateEvents() +del _event_commands +del _extra_event_commands + +command_reflectors = [ + (win32ui.ID_EDIT_UNDO, win32con.WM_UNDO), + (win32ui.ID_EDIT_REDO, scintillacon.SCI_REDO), + (win32ui.ID_EDIT_CUT, win32con.WM_CUT), + (win32ui.ID_EDIT_COPY, win32con.WM_COPY), + (win32ui.ID_EDIT_PASTE, win32con.WM_PASTE), + (win32ui.ID_EDIT_CLEAR, win32con.WM_CLEAR), + (win32ui.ID_EDIT_SELECT_ALL, scintillacon.SCI_SELECTALL), +] + + +def DoBraceMatch(control): + curPos = control.SCIGetCurrentPos() + charBefore = " " + if curPos: + charBefore = control.SCIGetCharAt(curPos - 1) + charAt = control.SCIGetCharAt(curPos) + braceAtPos = braceOpposite = -1 + if charBefore in "[](){}": + braceAtPos = curPos - 1 + if braceAtPos == -1: + if charAt in "[](){}": + braceAtPos = curPos + if braceAtPos != -1: + braceOpposite = control.SCIBraceMatch(braceAtPos, 0) + if braceAtPos != -1 and braceOpposite == -1: + control.SCIBraceBadHighlight(braceAtPos) + else: + # either clear them both or set them both. + control.SCIBraceHighlight(braceAtPos, braceOpposite) + + +def _get_class_attributes(ob): + # Recurse into base classes looking for attributes + items = [] + try: + items = items + dir(ob) + for i in ob.__bases__: + for item in _get_class_attributes(i): + if item not in items: + items.append(item) + except AttributeError: + pass + return items + + +# Supposed to look like an MFC CEditView, but +# also supports IDLE extensions and other source code generic features. +class CScintillaView(docview.CtrlView, control.CScintillaColorEditInterface): + def __init__(self, doc): + docview.CtrlView.__init__( + self, + doc, + "Scintilla", + win32con.WS_CHILD + | win32con.WS_VSCROLL + | win32con.WS_HSCROLL + | win32con.WS_CLIPCHILDREN + | win32con.WS_VISIBLE, + ) + self._tabWidth = ( + 8 # Mirror of what we send to Scintilla - never change this directly + ) + self.bAutoCompleteAttributes = 1 + self.bShowCallTips = 1 + self.bMatchBraces = 0 # Editor option will default this to true later! + self.bindings = bindings.BindingsManager(self) + + self.idle = IDLEenvironment.IDLEEditorWindow(self) + self.idle.IDLEExtension("AutoExpand") + # SendScintilla is called so frequently it is worth optimizing. + self.SendScintilla = self._obj_.SendMessage + + def _MakeColorizer(self): + ext = os.path.splitext(self.GetDocument().GetPathName())[1] + from . import formatter + + return formatter.BuiltinPythonSourceFormatter(self, ext) + + # def SendScintilla(self, msg, w=0, l=0): + # return self._obj_.SendMessage(msg, w, l) + + def SCISetTabWidth(self, width): + # I need to remember the tab-width for the AutoIndent extension. This may go. + self._tabWidth = width + control.CScintillaEditInterface.SCISetTabWidth(self, width) + + def GetTabWidth(self): + return self._tabWidth + + def HookHandlers(self): + # Create events for all the menu names. + for name, val in event_commands: + # handler = lambda id, code, tosend=val, parent=parent: parent.OnCommand(tosend, 0) and 0 + self.bindings.bind(name, None, cid=val) + + # Hook commands that do nothing other than send Scintilla messages. + for command, reflection in command_reflectors: + handler = ( + lambda id, code, ss=self.SendScintilla, tosend=reflection: ss(tosend) + and 0 + ) + self.HookCommand(handler, command) + + self.HookCommand(self.OnCmdViewWS, win32ui.ID_VIEW_WHITESPACE) + self.HookCommandUpdate(self.OnUpdateViewWS, win32ui.ID_VIEW_WHITESPACE) + self.HookCommand( + self.OnCmdViewIndentationGuides, win32ui.ID_VIEW_INDENTATIONGUIDES + ) + self.HookCommandUpdate( + self.OnUpdateViewIndentationGuides, win32ui.ID_VIEW_INDENTATIONGUIDES + ) + self.HookCommand(self.OnCmdViewRightEdge, win32ui.ID_VIEW_RIGHT_EDGE) + self.HookCommandUpdate(self.OnUpdateViewRightEdge, win32ui.ID_VIEW_RIGHT_EDGE) + self.HookCommand(self.OnCmdViewEOL, win32ui.ID_VIEW_EOL) + self.HookCommandUpdate(self.OnUpdateViewEOL, win32ui.ID_VIEW_EOL) + self.HookCommand(self.OnCmdViewFixedFont, win32ui.ID_VIEW_FIXED_FONT) + self.HookCommandUpdate(self.OnUpdateViewFixedFont, win32ui.ID_VIEW_FIXED_FONT) + self.HookCommand(self.OnCmdFileLocate, win32ui.ID_FILE_LOCATE) + self.HookCommand(self.OnCmdEditFind, win32ui.ID_EDIT_FIND) + self.HookCommand(self.OnCmdEditRepeat, win32ui.ID_EDIT_REPEAT) + self.HookCommand(self.OnCmdEditReplace, win32ui.ID_EDIT_REPLACE) + self.HookCommand(self.OnCmdGotoLine, win32ui.ID_EDIT_GOTO_LINE) + self.HookCommand(self.OnFilePrint, afxres.ID_FILE_PRINT) + self.HookCommand(self.OnFilePrint, afxres.ID_FILE_PRINT_DIRECT) + self.HookCommand(self.OnFilePrintPreview, win32ui.ID_FILE_PRINT_PREVIEW) + # Key bindings. + self.HookMessage(self.OnKeyDown, win32con.WM_KEYDOWN) + self.HookMessage(self.OnKeyDown, win32con.WM_SYSKEYDOWN) + # Hook wheeley mouse events + # self.HookMessage(self.OnMouseWheel, win32con.WM_MOUSEWHEEL) + self.HookFormatter() + + def OnInitialUpdate(self): + doc = self.GetDocument() + + # Enable Unicode + self.SendScintilla(scintillacon.SCI_SETCODEPAGE, scintillacon.SC_CP_UTF8, 0) + self.SendScintilla(scintillacon.SCI_SETKEYSUNICODE, 1, 0) + + # Create margins + self.SendScintilla( + scintillacon.SCI_SETMARGINTYPEN, 1, scintillacon.SC_MARGIN_SYMBOL + ) + self.SendScintilla(scintillacon.SCI_SETMARGINMASKN, 1, 0xF) + self.SendScintilla( + scintillacon.SCI_SETMARGINTYPEN, 2, scintillacon.SC_MARGIN_SYMBOL + ) + self.SendScintilla( + scintillacon.SCI_SETMARGINMASKN, 2, scintillacon.SC_MASK_FOLDERS + ) + self.SendScintilla(scintillacon.SCI_SETMARGINSENSITIVEN, 2, 1) + + self.GetDocument().HookViewNotifications( + self + ) # is there an MFC way to grab this? + self.HookHandlers() + + # Load the configuration information. + self.OnWinIniChange(None) + + self.SetSel() + + self.GetDocument().FinalizeViewCreation( + self + ) # is there an MFC way to grab this? + + def _GetSubConfigNames(self): + return None # By default we use only sections without sub-sections. + + def OnWinIniChange(self, section=None): + self.bindings.prepare_configure() + try: + self.DoConfigChange() + finally: + self.bindings.complete_configure() + + def DoConfigChange(self): + # Bit of a hack I dont kow what to do about - these should be "editor options" + from pywin.framework.editor import GetEditorOption + + self.bAutoCompleteAttributes = GetEditorOption("Autocomplete Attributes", 1) + self.bShowCallTips = GetEditorOption("Show Call Tips", 1) + # Update the key map and extension data. + configManager.configure(self, self._GetSubConfigNames()) + if configManager.last_error: + win32ui.MessageBox(configManager.last_error, "Configuration Error") + self.bMatchBraces = GetEditorOption("Match Braces", 1) + self.ApplyFormattingStyles(1) + + def OnDestroy(self, msg): + self.bindings.close() + self.bindings = None + self.idle.close() + self.idle = None + control.CScintillaColorEditInterface.close(self) + return docview.CtrlView.OnDestroy(self, msg) + + def OnMouseWheel(self, msg): + zDelta = msg[2] >> 16 + vpos = self.GetScrollPos(win32con.SB_VERT) + vpos = vpos - zDelta / 40 # 3 lines per notch + self.SetScrollPos(win32con.SB_VERT, vpos) + self.SendScintilla( + win32con.WM_VSCROLL, (vpos << 16) | win32con.SB_THUMBPOSITION, 0 + ) + + def OnBraceMatch(self, std, extra): + if not self.bMatchBraces: + return + DoBraceMatch(self) + + def OnNeedShown(self, std, extra): + notify = self.SCIUnpackNotifyMessage(extra) + # OnNeedShown is called before an edit operation when + # text is folded (as it is possible the text insertion will happen + # in a folded region.) As this happens _before_ the insert, + # we ignore the length (if we are at EOF, pos + length may + # actually be beyond the end of buffer) + self.EnsureCharsVisible(notify.position) + + def EnsureCharsVisible(self, start, end=None): + if end is None: + end = start + lineStart = self.LineFromChar(min(start, end)) + lineEnd = self.LineFromChar(max(start, end)) + while lineStart <= lineEnd: + self.SCIEnsureVisible(lineStart) + lineStart = lineStart + 1 + + # Helper to add an event to a menu. + def AppendMenu(self, menu, text="", event=None, flags=None, checked=0): + if event is None: + assert flags is not None, "No event or custom flags!" + cmdid = 0 + else: + cmdid = self.bindings.get_command_id(event) + if cmdid is None: + # No event of that name - no point displaying it. + print( + 'View.AppendMenu(): Unknown event "%s" specified for menu text "%s" - ignored' + % (event, text) + ) + return + keyname = configManager.get_key_binding(event, self._GetSubConfigNames()) + if keyname is not None: + text = text + "\t" + keyname + if flags is None: + flags = win32con.MF_STRING | win32con.MF_ENABLED + if checked: + flags = flags | win32con.MF_CHECKED + menu.AppendMenu(flags, cmdid, text) + + def OnKeyDown(self, msg): + return self.bindings.fire_key_event(msg) + + def GotoEndOfFileEvent(self, event): + self.SetSel(-1) + + def KeyDotEvent(self, event): + ## Don't trigger autocomplete if any text is selected + s, e = self.GetSel() + if s != e: + return 1 + self.SCIAddText(".") + if self.bAutoCompleteAttributes: + self._AutoComplete() + + # View Whitespace/EOL/Indentation UI. + + def OnCmdViewWS(self, cmd, code): # Handle the menu command + viewWS = self.SCIGetViewWS() + self.SCISetViewWS(not viewWS) + + def OnUpdateViewWS(self, cmdui): # Update the tick on the UI. + cmdui.SetCheck(self.SCIGetViewWS()) + cmdui.Enable() + + def OnCmdViewIndentationGuides(self, cmd, code): # Handle the menu command + viewIG = self.SCIGetIndentationGuides() + self.SCISetIndentationGuides(not viewIG) + + def OnUpdateViewIndentationGuides(self, cmdui): # Update the tick on the UI. + cmdui.SetCheck(self.SCIGetIndentationGuides()) + cmdui.Enable() + + def OnCmdViewRightEdge(self, cmd, code): # Handle the menu command + if self.SCIGetEdgeMode() == scintillacon.EDGE_NONE: + mode = scintillacon.EDGE_BACKGROUND + else: + mode = scintillacon.EDGE_NONE + self.SCISetEdgeMode(mode) + + def OnUpdateViewRightEdge(self, cmdui): # Update the tick on the UI. + cmdui.SetCheck(self.SCIGetEdgeMode() != scintillacon.EDGE_NONE) + cmdui.Enable() + + def OnCmdViewEOL(self, cmd, code): # Handle the menu command + viewEOL = self.SCIGetViewEOL() + self.SCISetViewEOL(not viewEOL) + + def OnUpdateViewEOL(self, cmdui): # Update the tick on the UI. + cmdui.SetCheck(self.SCIGetViewEOL()) + cmdui.Enable() + + def OnCmdViewFixedFont(self, cmd, code): # Handle the menu command + self._GetColorizer().bUseFixed = not self._GetColorizer().bUseFixed + self.ApplyFormattingStyles(0) + # Ensure the selection is visible! + self.ScrollCaret() + + def OnUpdateViewFixedFont(self, cmdui): # Update the tick on the UI. + c = self._GetColorizer() + if c is not None: + cmdui.SetCheck(c.bUseFixed) + cmdui.Enable(c is not None) + + def OnCmdEditFind(self, cmd, code): + from . import find + + find.ShowFindDialog() + + def OnCmdEditRepeat(self, cmd, code): + from . import find + + find.FindNext() + + def OnCmdEditReplace(self, cmd, code): + from . import find + + find.ShowReplaceDialog() + + def OnCmdFileLocate(self, cmd, id): + line = self.GetLine().strip() + import pywin.framework.scriptutils + + m = patImport.match(line) + if m: + # Module name on this line - locate that! + modName = m.group("name") + fileName = pywin.framework.scriptutils.LocatePythonFile(modName) + if fileName is None: + win32ui.SetStatusText("Can't locate module %s" % modName) + return 1 # Let the default get it. + else: + win32ui.GetApp().OpenDocumentFile(fileName) + else: + # Just to a "normal" locate - let the default handler get it. + return 1 + return 0 + + def OnCmdGotoLine(self, cmd, id): + try: + lineNo = int(input("Enter Line Number")) - 1 + except (ValueError, KeyboardInterrupt): + return 0 + self.SCIEnsureVisible(lineNo) + self.SCIGotoLine(lineNo) + return 0 + + def SaveTextFile(self, filename, encoding=None): + doc = self.GetDocument() + doc._SaveTextToFile(self, filename, encoding=encoding) + doc.SetModifiedFlag(0) + return 1 + + def _AutoComplete(self): + def list2dict(l): + ret = {} + for i in l: + ret[i] = None + return ret + + self.SCIAutoCCancel() # Cancel old auto-complete lists. + # First try and get an object without evaluating calls + ob = self._GetObjectAtPos(bAllowCalls=0) + # If that failed, try and process call or indexing to get the object. + if ob is None: + ob = self._GetObjectAtPos(bAllowCalls=1) + items_dict = {} + if ob is not None: + try: # Catch unexpected errors when fetching attribute names from the object + # extra attributes of win32ui objects + if hasattr(ob, "_obj_"): + try: + items_dict.update(list2dict(dir(ob._obj_))) + except AttributeError: + pass # object has no __dict__ + + # normal attributes + try: + items_dict.update(list2dict(dir(ob))) + except AttributeError: + pass # object has no __dict__ + if hasattr(ob, "__class__"): + items_dict.update(list2dict(_get_class_attributes(ob.__class__))) + # The object may be a COM object with typelib support - lets see if we can get its props. + # (contributed by Stefan Migowsky) + try: + # Get the automation attributes + items_dict.update(ob.__class__._prop_map_get_) + # See if there is an write only property + # could be optimized + items_dict.update(ob.__class__._prop_map_put_) + # append to the already evaluated list + except AttributeError: + pass + # The object might be a pure COM dynamic dispatch with typelib support - lets see if we can get its props. + if hasattr(ob, "_oleobj_"): + try: + for iTI in range(0, ob._oleobj_.GetTypeInfoCount()): + typeInfo = ob._oleobj_.GetTypeInfo(iTI) + self._UpdateWithITypeInfo(items_dict, typeInfo) + except: + pass + except: + win32ui.SetStatusText( + "Error attempting to get object attributes - %s" + % (repr(sys.exc_info()[0]),) + ) + + # ensure all keys are strings. + items = [str(k) for k in items_dict.keys()] + # All names that start with "_" go! + items = [k for k in items if not k.startswith("_")] + + if not items: + # Heuristics a-la AutoExpand + # The idea is to find other usages of the current binding + # and assume, that it refers to the same object (or at least, + # to an object of the same type) + # Contributed by Vadim Chugunov [vadimch@yahoo.com] + left, right = self._GetWordSplit() + if left == "": # Ignore standalone dots + return None + # We limit our search to the current class, if that + # information is available + minline, maxline, curclass = self._GetClassInfoFromBrowser() + endpos = self.LineIndex(maxline) + text = self.GetTextRange(self.LineIndex(minline), endpos) + try: + l = re.findall(r"\b" + left + "\.\w+", text) + except re.error: + # parens etc may make an invalid RE, but this code wouldnt + # benefit even if the RE did work :-) + l = [] + prefix = len(left) + 1 + unique = {} + for li in l: + unique[li[prefix:]] = 1 + # Assuming traditional usage of self... + if curclass and left == "self": + self._UpdateWithClassMethods(unique, curclass) + + items = [ + word for word in unique.keys() if word[:2] != "__" or word[-2:] != "__" + ] + # Ignore the word currently to the right of the dot - probably a red-herring. + try: + items.remove(right[1:]) + except ValueError: + pass + if items: + items.sort() + self.SCIAutoCSetAutoHide(0) + self.SCIAutoCShow(items) + + def _UpdateWithITypeInfo(self, items_dict, typeInfo): + import pythoncom + + typeInfos = [typeInfo] + # suppress IDispatch and IUnknown methods + inspectedIIDs = {pythoncom.IID_IDispatch: None} + + while len(typeInfos) > 0: + typeInfo = typeInfos.pop() + typeAttr = typeInfo.GetTypeAttr() + + if typeAttr.iid not in inspectedIIDs: + inspectedIIDs[typeAttr.iid] = None + for iFun in range(0, typeAttr.cFuncs): + funDesc = typeInfo.GetFuncDesc(iFun) + funName = typeInfo.GetNames(funDesc.memid)[0] + if funName not in items_dict: + items_dict[funName] = None + + # Inspect the type info of all implemented types + # E.g. IShellDispatch5 implements IShellDispatch4 which implements IShellDispatch3 ... + for iImplType in range(0, typeAttr.cImplTypes): + iRefType = typeInfo.GetRefTypeOfImplType(iImplType) + refTypeInfo = typeInfo.GetRefTypeInfo(iRefType) + typeInfos.append(refTypeInfo) + + # TODO: This is kinda slow. Probably need some kind of cache + # here that is flushed upon file save + # Or maybe we don't need the superclass methods at all ? + def _UpdateWithClassMethods(self, dict, classinfo): + if not hasattr(classinfo, "methods"): + # No 'methods' - probably not what we think it is. + return + dict.update(classinfo.methods) + for super in classinfo.super: + if hasattr(super, "methods"): + self._UpdateWithClassMethods(dict, super) + + # Find which class definition caret is currently in and return + # indexes of the the first and the last lines of that class definition + # Data is obtained from module browser (if enabled) + def _GetClassInfoFromBrowser(self, pos=-1): + minline = 0 + maxline = self.GetLineCount() - 1 + doc = self.GetParentFrame().GetActiveDocument() + browser = None + try: + if doc is not None: + browser = doc.GetAllViews()[1] + except IndexError: + pass + if browser is None: + return (minline, maxline, None) # Current window has no browser + if not browser.list: + return (minline, maxline, None) # Not initialized + path = self.GetDocument().GetPathName() + if not path: + return (minline, maxline, None) # No current path + + import pywin.framework.scriptutils + + curmodule, path = pywin.framework.scriptutils.GetPackageModuleName(path) + try: + clbrdata = browser.list.root.clbrdata + except AttributeError: + return (minline, maxline, None) # No class data for this module. + curline = self.LineFromChar(pos) + curclass = None + # Find out which class we are in + for item in clbrdata.values(): + if item.module == curmodule: + item_lineno = ( + item.lineno - 1 + ) # Scintilla counts lines from 0, whereas pyclbr - from 1 + if minline < item_lineno <= curline: + minline = item_lineno + curclass = item + if curline < item_lineno < maxline: + maxline = item_lineno + return (minline, maxline, curclass) + + def _GetObjectAtPos(self, pos=-1, bAllowCalls=0): + left, right = self._GetWordSplit(pos, bAllowCalls) + if left: # It is an attribute lookup + # How is this for a hack! + namespace = sys.modules.copy() + namespace.update(__main__.__dict__) + # Get the debugger's context. + try: + from pywin.framework import interact + + if interact.edit is not None and interact.edit.currentView is not None: + globs, locs = interact.edit.currentView.GetContext()[:2] + if globs: + namespace.update(globs) + if locs: + namespace.update(locs) + except ImportError: + pass + try: + return eval(left, namespace) + except: + pass + return None + + def _GetWordSplit(self, pos=-1, bAllowCalls=0): + if pos == -1: + pos = self.GetSel()[0] - 1 # Character before current one + limit = self.GetTextLength() + before = [] + after = [] + index = pos - 1 + wordbreaks_use = wordbreaks + if bAllowCalls: + wordbreaks_use = wordbreaks_use + "()[]" + while index >= 0: + char = self.SCIGetCharAt(index) + if char not in wordbreaks_use: + break + before.insert(0, char) + index = index - 1 + index = pos + while index <= limit: + char = self.SCIGetCharAt(index) + if char not in wordbreaks_use: + break + after.append(char) + index = index + 1 + return "".join(before), "".join(after) + + def OnPrepareDC(self, dc, pInfo): + # print "OnPrepareDC for page", pInfo.GetCurPage(), "of", pInfo.GetFromPage(), "to", pInfo.GetToPage(), ", starts=", self.starts + if dc.IsPrinting(): + # Check if we are beyond the end. + # (only do this when actually printing, else messes up print preview!) + if not pInfo.GetPreview() and self.starts is not None: + prevPage = pInfo.GetCurPage() - 1 + if prevPage > 0 and self.starts[prevPage] >= self.GetTextLength(): + # All finished. + pInfo.SetContinuePrinting(0) + return + dc.SetMapMode(win32con.MM_TEXT) + + def OnPreparePrinting(self, pInfo): + flags = ( + win32ui.PD_USEDEVMODECOPIES | win32ui.PD_ALLPAGES | win32ui.PD_NOSELECTION + ) # Dont support printing just a selection. + # NOTE: Custom print dialogs are stopping the user's values from coming back :-( + # self.prtDlg = PrintDialog(pInfo, PRINTDLGORD, flags) + # pInfo.SetPrintDialog(self.prtDlg) + pInfo.SetMinPage(1) + # max page remains undefined for now. + pInfo.SetFromPage(1) + pInfo.SetToPage(1) + ret = self.DoPreparePrinting(pInfo) + return ret + + def OnBeginPrinting(self, dc, pInfo): + self.starts = None + return self._obj_.OnBeginPrinting(dc, pInfo) + + def CalculatePageRanges(self, dc, pInfo): + # Calculate page ranges and max page + self.starts = {0: 0} + metrics = dc.GetTextMetrics() + left, top, right, bottom = pInfo.GetDraw() + # Leave space at the top for the header. + rc = (left, top + int((9 * metrics["tmHeight"]) / 2), right, bottom) + pageStart = 0 + maxPage = 0 + textLen = self.GetTextLength() + while pageStart < textLen: + pageStart = self.FormatRange(dc, pageStart, textLen, rc, 0) + maxPage = maxPage + 1 + self.starts[maxPage] = pageStart + # And a sentinal for one page past the end + self.starts[maxPage + 1] = textLen + # When actually printing, maxPage doesnt have any effect at this late state. + # but is needed to make the Print Preview work correctly. + pInfo.SetMaxPage(maxPage) + + def OnFilePrintPreview(self, *arg): + self._obj_.OnFilePrintPreview() + + def OnFilePrint(self, *arg): + self._obj_.OnFilePrint() + + def FormatRange(self, dc, pageStart, lengthDoc, rc, draw): + """ + typedef struct _formatrange { + HDC hdc; + HDC hdcTarget; + RECT rc; + RECT rcPage; + CHARRANGE chrg;} FORMATRANGE; + """ + fmt = "PPIIIIIIIIll" + hdcRender = dc.GetHandleOutput() + hdcFormat = dc.GetHandleAttrib() + fr = struct.pack( + fmt, + hdcRender, + hdcFormat, + rc[0], + rc[1], + rc[2], + rc[3], + rc[0], + rc[1], + rc[2], + rc[3], + pageStart, + lengthDoc, + ) + nextPageStart = self.SendScintilla(EM_FORMATRANGE, draw, fr) + return nextPageStart + + def OnPrint(self, dc, pInfo): + metrics = dc.GetTextMetrics() + # print "dev", w, h, l, metrics['tmAscent'], metrics['tmDescent'] + if self.starts is None: + self.CalculatePageRanges(dc, pInfo) + pageNum = pInfo.GetCurPage() - 1 + # Setup the header of the page - docname on left, pagenum on right. + doc = self.GetDocument() + cxChar = metrics["tmAveCharWidth"] + cyChar = metrics["tmHeight"] + left, top, right, bottom = pInfo.GetDraw() + dc.TextOut(0, 2 * cyChar, doc.GetTitle()) + pagenum_str = win32ui.LoadString(afxres.AFX_IDS_PRINTPAGENUM) % (pageNum + 1,) + dc.SetTextAlign(win32con.TA_RIGHT) + dc.TextOut(right, 2 * cyChar, pagenum_str) + dc.SetTextAlign(win32con.TA_LEFT) + top = top + int((7 * cyChar) / 2) + dc.MoveTo(left, top) + dc.LineTo(right, top) + top = top + cyChar + rc = (left, top, right, bottom) + nextPageStart = self.FormatRange( + dc, self.starts[pageNum], self.starts[pageNum + 1], rc, 1 + ) + + +def LoadConfiguration(): + global configManager + # Bit of a hack I dont kow what to do about? + from .config import ConfigManager + + configName = rc = win32ui.GetProfileVal("Editor", "Keyboard Config", "default") + configManager = ConfigManager(configName) + if configManager.last_error: + bTryDefault = 0 + msg = "Error loading configuration '%s'\n\n%s" % ( + configName, + configManager.last_error, + ) + if configName != "default": + msg = msg + "\n\nThe default configuration will be loaded." + bTryDefault = 1 + win32ui.MessageBox(msg) + if bTryDefault: + configManager = ConfigManager("default") + if configManager.last_error: + win32ui.MessageBox( + "Error loading configuration 'default'\n\n%s" + % (configManager.last_error) + ) + + +configManager = None +LoadConfiguration() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/TraceCollector.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/TraceCollector.py new file mode 100644 index 0000000000000000000000000000000000000000..5800488b917afeac3c4e2f0cf84d271b4f069278 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/TraceCollector.py @@ -0,0 +1,79 @@ +# win32traceutil like utility for Pythonwin +import _thread + +import win32api +import win32event +import win32trace +from pywin.framework import winout + +outputWindow = None + + +def CollectorThread(stopEvent, file): + win32trace.InitRead() + handle = win32trace.GetHandle() + # Run this thread at a lower priority to the main message-loop (and printing output) + # thread can keep up + import win32process + + win32process.SetThreadPriority( + win32api.GetCurrentThread(), win32process.THREAD_PRIORITY_BELOW_NORMAL + ) + + try: + while 1: + rc = win32event.WaitForMultipleObjects( + (handle, stopEvent), 0, win32event.INFINITE + ) + if rc == win32event.WAIT_OBJECT_0: + # About the only char we can't live with is \0! + file.write(win32trace.read().replace("\0", "")) + else: + # Stop event + break + finally: + win32trace.TermRead() + print("Thread dieing") + + +class WindowOutput(winout.WindowOutput): + def __init__(self, *args): + winout.WindowOutput.__init__(*(self,) + args) + self.hStopThread = win32event.CreateEvent(None, 0, 0, None) + _thread.start_new(CollectorThread, (self.hStopThread, self)) + + def _StopThread(self): + win32event.SetEvent(self.hStopThread) + self.hStopThread = None + + def Close(self): + self._StopThread() + winout.WindowOutput.Close(self) + # def OnViewDestroy(self, frame): + # return winout.WindowOutput.OnViewDestroy(self, frame) + # def Create(self, title=None, style = None): + # rc = winout.WindowOutput.Create(self, title, style) + return rc + + +def MakeOutputWindow(): + # Note that it will not show until the first string written or + # you pass bShow = 1 + global outputWindow + if outputWindow is None: + title = "Python Trace Collector" + # queueingFlag doesnt matter, as all output will come from new thread + outputWindow = WindowOutput(title, title) + # Let people know what this does! + msg = """\ +# This window will display output from any programs that import win32traceutil +# win32com servers registered with '--debug' are in this category. +""" + outputWindow.write(msg) + # force existing window open + outputWindow.write("") + return outputWindow + + +if __name__ == "__main__": + MakeOutputWindow() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/__init__.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/__init__.py @@ -0,0 +1 @@ + diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/browseProjects.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/browseProjects.py new file mode 100644 index 0000000000000000000000000000000000000000..e3255579a1c0217ae20e5fb41b44044e29d14b7b --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/browseProjects.py @@ -0,0 +1,324 @@ +import glob +import os +import pyclbr + +import afxres +import commctrl +import pywin.framework.scriptutils +import regutil +import win32api +import win32con +import win32ui +from pywin.mfc import dialog + +from . import hierlist + + +class HLIErrorItem(hierlist.HierListItem): + def __init__(self, text): + self.text = text + hierlist.HierListItem.__init__(self) + + def GetText(self): + return self.text + + +class HLICLBRItem(hierlist.HierListItem): + def __init__(self, name, file, lineno, suffix=""): + # If the 'name' object itself has a .name, use it. Not sure + # how this happens, but seems pyclbr related. + # See PyWin32 bug 817035 + self.name = getattr(name, "name", name) + self.file = file + self.lineno = lineno + self.suffix = suffix + + def __lt__(self, other): + return self.name < other.name + + def __eq__(self, other): + return self.name == other.name + + def GetText(self): + return self.name + self.suffix + + def TakeDefaultAction(self): + if self.file: + pywin.framework.scriptutils.JumpToDocument( + self.file, self.lineno, bScrollToTop=1 + ) + else: + win32ui.SetStatusText("The source of this object is unknown") + + def PerformItemSelected(self): + if self.file is None: + msg = "%s - source can not be located." % (self.name,) + else: + msg = "%s defined at line %d of %s" % (self.name, self.lineno, self.file) + win32ui.SetStatusText(msg) + + +class HLICLBRClass(HLICLBRItem): + def __init__(self, clbrclass, suffix=""): + try: + name = clbrclass.name + file = clbrclass.file + lineno = clbrclass.lineno + self.super = clbrclass.super + self.methods = clbrclass.methods + except AttributeError: + name = clbrclass + file = lineno = None + self.super = [] + self.methods = {} + HLICLBRItem.__init__(self, name, file, lineno, suffix) + + def GetSubList(self): + ret = [] + for c in self.super: + ret.append(HLICLBRClass(c, " (Parent class)")) + for meth, lineno in self.methods.items(): + ret.append(HLICLBRMethod(meth, self.file, lineno, " (method)")) + return ret + + def IsExpandable(self): + return len(self.methods) + len(self.super) + + def GetBitmapColumn(self): + return 21 + + +class HLICLBRFunction(HLICLBRClass): + def GetBitmapColumn(self): + return 22 + + +class HLICLBRMethod(HLICLBRItem): + def GetBitmapColumn(self): + return 22 + + +class HLIModuleItem(hierlist.HierListItem): + def __init__(self, path): + hierlist.HierListItem.__init__(self) + self.path = path + + def GetText(self): + return os.path.split(self.path)[1] + " (module)" + + def IsExpandable(self): + return 1 + + def TakeDefaultAction(self): + win32ui.GetApp().OpenDocumentFile(self.path) + + def GetBitmapColumn(self): + col = 4 # Default + try: + if win32api.GetFileAttributes(self.path) & win32con.FILE_ATTRIBUTE_READONLY: + col = 5 + except win32api.error: + pass + return col + + def GetSubList(self): + mod, path = pywin.framework.scriptutils.GetPackageModuleName(self.path) + win32ui.SetStatusText("Building class list - please wait...", 1) + win32ui.DoWaitCursor(1) + try: + try: + reader = pyclbr.readmodule_ex # Post 1.5.2 interface. + extra_msg = " or functions" + except AttributeError: + reader = pyclbr.readmodule + extra_msg = "" + data = reader(mod, [path]) + if data: + ret = [] + for item in data.values(): + if ( + item.__class__ != pyclbr.Class + ): # ie, it is a pyclbr Function instance (only introduced post 1.5.2) + ret.append(HLICLBRFunction(item, " (function)")) + else: + ret.append(HLICLBRClass(item, " (class)")) + ret.sort() + return ret + else: + return [HLIErrorItem("No Python classes%s in module." % (extra_msg,))] + finally: + win32ui.DoWaitCursor(0) + win32ui.SetStatusText(win32ui.LoadString(afxres.AFX_IDS_IDLEMESSAGE)) + + +def MakePathSubList(path): + ret = [] + for filename in glob.glob(os.path.join(path, "*")): + if os.path.isdir(filename) and os.path.isfile( + os.path.join(filename, "__init__.py") + ): + ret.append(HLIDirectoryItem(filename, os.path.split(filename)[1])) + else: + if os.path.splitext(filename)[1].lower() in [".py", ".pyw"]: + ret.append(HLIModuleItem(filename)) + return ret + + +class HLIDirectoryItem(hierlist.HierListItem): + def __init__(self, path, displayName=None, bSubDirs=0): + hierlist.HierListItem.__init__(self) + self.path = path + self.bSubDirs = bSubDirs + if displayName: + self.displayName = displayName + else: + self.displayName = path + + def IsExpandable(self): + return 1 + + def GetText(self): + return self.displayName + + def GetSubList(self): + ret = MakePathSubList(self.path) + if ( + os.path.split(self.path)[1] == "win32com" + ): # Complete and utter hack for win32com. + try: + path = win32api.GetFullPathName( + os.path.join(self.path, "..\\win32comext") + ) + ret = ret + MakePathSubList(path) + except win32ui.error: + pass + return ret + + +class HLIProjectRoot(hierlist.HierListItem): + def __init__(self, projectName, displayName=None): + hierlist.HierListItem.__init__(self) + self.projectName = projectName + self.displayName = displayName or projectName + + def GetText(self): + return self.displayName + + def IsExpandable(self): + return 1 + + def GetSubList(self): + paths = regutil.GetRegisteredNamedPath(self.projectName) + pathList = paths.split(";") + if len(pathList) == 1: # Single dir - dont bother putting the dir in + ret = MakePathSubList(pathList[0]) + else: + ret = list(map(HLIDirectoryItem, pathList)) + return ret + + +class HLIRoot(hierlist.HierListItem): + def __init__(self): + hierlist.HierListItem.__init__(self) + + def IsExpandable(self): + return 1 + + def GetSubList(self): + keyStr = regutil.BuildDefaultPythonKey() + "\\PythonPath" + hKey = win32api.RegOpenKey(regutil.GetRootKey(), keyStr) + try: + ret = [] + ret.append(HLIProjectRoot("", "Standard Python Library")) # The core path. + index = 0 + while 1: + try: + ret.append(HLIProjectRoot(win32api.RegEnumKey(hKey, index))) + index = index + 1 + except win32api.error: + break + return ret + finally: + win32api.RegCloseKey(hKey) + + +class dynamic_browser(dialog.Dialog): + style = win32con.WS_OVERLAPPEDWINDOW | win32con.WS_VISIBLE + cs = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | commctrl.TVS_HASLINES + | commctrl.TVS_LINESATROOT + | commctrl.TVS_HASBUTTONS + ) + + dt = [ + ["Python Projects", (0, 0, 200, 200), style, None, (8, "MS Sans Serif")], + ["SysTreeView32", None, win32ui.IDC_LIST1, (0, 0, 200, 200), cs], + ] + + def __init__(self, hli_root): + dialog.Dialog.__init__(self, self.dt) + self.hier_list = hierlist.HierListWithItems(hli_root, win32ui.IDB_BROWSER_HIER) + self.HookMessage(self.on_size, win32con.WM_SIZE) + + def OnInitDialog(self): + self.hier_list.HierInit(self) + return dialog.Dialog.OnInitDialog(self) + + def on_size(self, params): + lparam = params[3] + w = win32api.LOWORD(lparam) + h = win32api.HIWORD(lparam) + self.GetDlgItem(win32ui.IDC_LIST1).MoveWindow((0, 0, w, h)) + + +def BrowseDialog(): + root = HLIRoot() + if not root.IsExpandable(): + raise TypeError( + "Browse() argument must have __dict__ attribute, or be a Browser supported type" + ) + + dlg = dynamic_browser(root) + dlg.CreateWindow() + + +def DockableBrowserCreator(parent): + root = HLIRoot() + hl = hierlist.HierListWithItems(root, win32ui.IDB_BROWSER_HIER) + + style = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | win32con.WS_BORDER + | commctrl.TVS_HASLINES + | commctrl.TVS_LINESATROOT + | commctrl.TVS_HASBUTTONS + ) + + control = win32ui.CreateTreeCtrl() + control.CreateWindow(style, (0, 0, 150, 300), parent, win32ui.IDC_LIST1) + list = hl.HierInit(parent, control) + return control + + +def DockablePathBrowser(): + import pywin.docking.DockingBar + + bar = pywin.docking.DockingBar.DockingBar() + bar.CreateWindow( + win32ui.GetMainFrame(), DockableBrowserCreator, "Path Browser", 0x8E0A + ) + bar.SetBarStyle( + bar.GetBarStyle() + | afxres.CBRS_TOOLTIPS + | afxres.CBRS_FLYBY + | afxres.CBRS_SIZE_DYNAMIC + ) + bar.EnableDocking(afxres.CBRS_ALIGN_ANY) + win32ui.GetMainFrame().DockControlBar(bar) + + +# The "default" entry point +Browse = DockablePathBrowser diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/browser.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/browser.py new file mode 100644 index 0000000000000000000000000000000000000000..9d9a193db7ea0fba645a0c3bfd08d1a26c5726d1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/browser.py @@ -0,0 +1,517 @@ +# basic module browser. + +# usage: +# >>> import browser +# >>> browser.Browse() +# or +# >>> browser.Browse(your_module) +import sys +import types + +import __main__ +import win32ui +from pywin.mfc import dialog + +from . import hierlist + +special_names = ["__doc__", "__name__", "__self__"] + + +# +# HierList items +class HLIPythonObject(hierlist.HierListItem): + def __init__(self, myobject=None, name=None): + hierlist.HierListItem.__init__(self) + self.myobject = myobject + self.knownExpandable = None + if name: + self.name = name + else: + try: + self.name = myobject.__name__ + except (AttributeError, TypeError): + try: + r = repr(myobject) + if len(r) > 20: + r = r[:20] + "..." + self.name = r + except (AttributeError, TypeError): + self.name = "???" + + def __lt__(self, other): + return self.name < other.name + + def __eq__(self, other): + return self.name == other.name + + def __repr__(self): + try: + type = self.GetHLIType() + except: + type = "Generic" + return ( + "HLIPythonObject(" + + type + + ") - name: " + + self.name + + " object: " + + repr(self.myobject) + ) + + def GetText(self): + try: + return str(self.name) + " (" + self.GetHLIType() + ")" + except AttributeError: + return str(self.name) + " = " + repr(self.myobject) + + def InsertDocString(self, lst): + ob = None + try: + ob = self.myobject.__doc__ + except (AttributeError, TypeError): + pass + # I don't quite grok descriptors enough to know how to + # best hook them up. Eg: + # >>> object.__getattribute__.__class__.__doc__ + # + if ob and isinstance(ob, str): + lst.insert(0, HLIDocString(ob, "Doc")) + + def GetSubList(self): + ret = [] + try: + for key, ob in self.myobject.__dict__.items(): + if key not in special_names: + ret.append(MakeHLI(ob, key)) + except (AttributeError, TypeError): + pass + try: + for name in self.myobject.__methods__: + ret.append(HLIMethod(name)) # no MakeHLI, as cant auto detect + except (AttributeError, TypeError): + pass + try: + for member in self.myobject.__members__: + if not member in special_names: + ret.append(MakeHLI(getattr(self.myobject, member), member)) + except (AttributeError, TypeError): + pass + ret.sort() + self.InsertDocString(ret) + return ret + + # if the has a dict, it is expandable. + def IsExpandable(self): + if self.knownExpandable is None: + self.knownExpandable = self.CalculateIsExpandable() + return self.knownExpandable + + def CalculateIsExpandable(self): + if hasattr(self.myobject, "__doc__"): + return 1 + try: + for key in self.myobject.__dict__.keys(): + if key not in special_names: + return 1 + except (AttributeError, TypeError): + pass + try: + self.myobject.__methods__ + return 1 + except (AttributeError, TypeError): + pass + try: + for item in self.myobject.__members__: + if item not in special_names: + return 1 + except (AttributeError, TypeError): + pass + return 0 + + def GetBitmapColumn(self): + if self.IsExpandable(): + return 0 + else: + return 4 + + def TakeDefaultAction(self): + ShowObject(self.myobject, self.name) + + +class HLIDocString(HLIPythonObject): + def GetHLIType(self): + return "DocString" + + def GetText(self): + return self.myobject.strip() + + def IsExpandable(self): + return 0 + + def GetBitmapColumn(self): + return 6 + + +class HLIModule(HLIPythonObject): + def GetHLIType(self): + return "Module" + + +class HLIFrame(HLIPythonObject): + def GetHLIType(self): + return "Stack Frame" + + +class HLITraceback(HLIPythonObject): + def GetHLIType(self): + return "Traceback" + + +class HLIClass(HLIPythonObject): + def GetHLIType(self): + return "Class" + + def GetSubList(self): + ret = [] + for base in self.myobject.__bases__: + ret.append(MakeHLI(base, "Base class: " + base.__name__)) + ret = ret + HLIPythonObject.GetSubList(self) + return ret + + +class HLIMethod(HLIPythonObject): + # myobject is just a string for methods. + def GetHLIType(self): + return "Method" + + def GetText(self): + return "Method: " + self.myobject + "()" + + +class HLICode(HLIPythonObject): + def GetHLIType(self): + return "Code" + + def IsExpandable(self): + return self.myobject + + def GetSubList(self): + ret = [] + ret.append(MakeHLI(self.myobject.co_consts, "Constants (co_consts)")) + ret.append(MakeHLI(self.myobject.co_names, "Names (co_names)")) + ret.append(MakeHLI(self.myobject.co_filename, "Filename (co_filename)")) + ret.append(MakeHLI(self.myobject.co_argcount, "Number of args (co_argcount)")) + ret.append(MakeHLI(self.myobject.co_varnames, "Param names (co_varnames)")) + + return ret + + +class HLIInstance(HLIPythonObject): + def GetHLIType(self): + return "Instance" + + def GetText(self): + return ( + str(self.name) + + " (Instance of class " + + str(self.myobject.__class__.__name__) + + ")" + ) + + def IsExpandable(self): + return 1 + + def GetSubList(self): + ret = [] + ret.append(MakeHLI(self.myobject.__class__)) + ret = ret + HLIPythonObject.GetSubList(self) + return ret + + +class HLIBuiltinFunction(HLIPythonObject): + def GetHLIType(self): + return "Builtin Function" + + +class HLIFunction(HLIPythonObject): + def GetHLIType(self): + return "Function" + + def IsExpandable(self): + return 1 + + def GetSubList(self): + ret = [] + # ret.append( MakeHLI( self.myobject.func_argcount, "Arg Count" )) + try: + ret.append(MakeHLI(self.myobject.func_argdefs, "Arg Defs")) + except AttributeError: + pass + try: + code = self.myobject.__code__ + globs = self.myobject.__globals__ + except AttributeError: + # must be py2.5 or earlier... + code = self.myobject.func_code + globs = self.myobject.func_globals + ret.append(MakeHLI(code, "Code")) + ret.append(MakeHLI(globs, "Globals")) + self.InsertDocString(ret) + return ret + + +class HLISeq(HLIPythonObject): + def GetHLIType(self): + return "Sequence (abstract!)" + + def IsExpandable(self): + return len(self.myobject) > 0 + + def GetSubList(self): + ret = [] + pos = 0 + for item in self.myobject: + ret.append(MakeHLI(item, "[" + str(pos) + "]")) + pos = pos + 1 + self.InsertDocString(ret) + return ret + + +class HLIList(HLISeq): + def GetHLIType(self): + return "List" + + +class HLITuple(HLISeq): + def GetHLIType(self): + return "Tuple" + + +class HLIDict(HLIPythonObject): + def GetHLIType(self): + return "Dict" + + def IsExpandable(self): + try: + self.myobject.__doc__ + return 1 + except (AttributeError, TypeError): + return len(self.myobject) > 0 + + def GetSubList(self): + ret = [] + keys = list(self.myobject.keys()) + keys.sort() + for key in keys: + ob = self.myobject[key] + ret.append(MakeHLI(ob, str(key))) + self.InsertDocString(ret) + return ret + + +# In Python 1.6, strings and Unicode have builtin methods, but we dont really want to see these +class HLIString(HLIPythonObject): + def IsExpandable(self): + return 0 + + +TypeMap = { + type: HLIClass, + types.FunctionType: HLIFunction, + tuple: HLITuple, + dict: HLIDict, + list: HLIList, + types.ModuleType: HLIModule, + types.CodeType: HLICode, + types.BuiltinFunctionType: HLIBuiltinFunction, + types.FrameType: HLIFrame, + types.TracebackType: HLITraceback, + str: HLIString, + int: HLIPythonObject, + bool: HLIPythonObject, + float: HLIPythonObject, +} + + +def MakeHLI(ob, name=None): + try: + cls = TypeMap[type(ob)] + except KeyError: + # hrmph - this check gets more and more bogus as Python + # improves. Its possible we should just *always* use + # HLIInstance? + if hasattr(ob, "__class__"): # 'new style' class + cls = HLIInstance + else: + cls = HLIPythonObject + return cls(ob, name) + + +######################################### +# +# Dialog related. + + +class DialogShowObject(dialog.Dialog): + def __init__(self, object, title): + self.object = object + self.title = title + dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT) + + def OnInitDialog(self): + import re + + self.SetWindowText(self.title) + self.edit = self.GetDlgItem(win32ui.IDC_EDIT1) + try: + strval = str(self.object) + except: + t, v, tb = sys.exc_info() + strval = "Exception getting object value\n\n%s:%s" % (t, v) + tb = None + strval = re.sub("\n", "\r\n", strval) + self.edit.ReplaceSel(strval) + + +def ShowObject(object, title): + dlg = DialogShowObject(object, title) + dlg.DoModal() + + +# And some mods for a sizable dialog from Sam Rushing! +import commctrl +import win32api +import win32con + + +class dynamic_browser(dialog.Dialog): + style = win32con.WS_OVERLAPPEDWINDOW | win32con.WS_VISIBLE + cs = ( + win32con.WS_CHILD + | win32con.WS_VISIBLE + | commctrl.TVS_HASLINES + | commctrl.TVS_LINESATROOT + | commctrl.TVS_HASBUTTONS + ) + + dt = [ + ["Python Object Browser", (0, 0, 200, 200), style, None, (8, "MS Sans Serif")], + ["SysTreeView32", None, win32ui.IDC_LIST1, (0, 0, 200, 200), cs], + ] + + def __init__(self, hli_root): + dialog.Dialog.__init__(self, self.dt) + self.hier_list = hierlist.HierListWithItems(hli_root, win32ui.IDB_BROWSER_HIER) + self.HookMessage(self.on_size, win32con.WM_SIZE) + + def OnInitDialog(self): + self.hier_list.HierInit(self) + return dialog.Dialog.OnInitDialog(self) + + def OnOK(self): + self.hier_list.HierTerm() + self.hier_list = None + return self._obj_.OnOK() + + def OnCancel(self): + self.hier_list.HierTerm() + self.hier_list = None + return self._obj_.OnCancel() + + def on_size(self, params): + lparam = params[3] + w = win32api.LOWORD(lparam) + h = win32api.HIWORD(lparam) + self.GetDlgItem(win32ui.IDC_LIST1).MoveWindow((0, 0, w, h)) + + +def Browse(ob=__main__): + "Browse the argument, or the main dictionary" + root = MakeHLI(ob, "root") + if not root.IsExpandable(): + raise TypeError( + "Browse() argument must have __dict__ attribute, or be a Browser supported type" + ) + + dlg = dynamic_browser(root) + dlg.CreateWindow() + return dlg + + +# +# +# Classes for using the browser in an MDI window, rather than a dialog +# +from pywin.mfc import docview + + +class BrowserTemplate(docview.DocTemplate): + def __init__(self): + docview.DocTemplate.__init__( + self, win32ui.IDR_PYTHONTYPE, BrowserDocument, None, BrowserView + ) + + def OpenObject(self, root): # Use this instead of OpenDocumentFile. + # Look for existing open document + for doc in self.GetDocumentList(): + if doc.root == root: + doc.GetFirstView().ActivateFrame() + return doc + # not found - new one. + doc = BrowserDocument(self, root) + frame = self.CreateNewFrame(doc) + doc.OnNewDocument() + self.InitialUpdateFrame(frame, doc, 1) + return doc + + +class BrowserDocument(docview.Document): + def __init__(self, template, root): + docview.Document.__init__(self, template) + self.root = root + self.SetTitle("Browser: " + root.name) + + def OnOpenDocument(self, name): + raise TypeError("This template can not open files") + return 0 + + +class BrowserView(docview.TreeView): + def OnInitialUpdate(self): + import commctrl + + rc = self._obj_.OnInitialUpdate() + list = hierlist.HierListWithItems( + self.GetDocument().root, + win32ui.IDB_BROWSER_HIER, + win32ui.AFX_IDW_PANE_FIRST, + ) + list.HierInit(self.GetParent()) + list.SetStyle( + commctrl.TVS_HASLINES | commctrl.TVS_LINESATROOT | commctrl.TVS_HASBUTTONS + ) + return rc + + +template = None + + +def MakeTemplate(): + global template + if template is None: + template = ( + BrowserTemplate() + ) # win32ui.IDR_PYTHONTYPE, BrowserDocument, None, BrowserView) + + +def BrowseMDI(ob=__main__): + """Browse an object using an MDI window.""" + + MakeTemplate() + root = MakeHLI(ob, repr(ob)) + if not root.IsExpandable(): + raise TypeError( + "Browse() argument must have __dict__ attribute, or be a Browser supported type" + ) + + template.OpenObject(root) diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/hierlist.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/hierlist.py new file mode 100644 index 0000000000000000000000000000000000000000..a60b732472234cf09ae2fdb0a4c4dcf6114e3851 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/hierlist.py @@ -0,0 +1,367 @@ +# hierlist +# +# IMPORTANT - Please read before using. + +# This module exposes an API for a Hierarchical Tree Control. +# Previously, a custom tree control was included in Pythonwin which +# has an API very similar to this. + +# The current control used is the common "Tree Control". This module exists now +# to provide an API similar to the old control, but for the new Tree control. + +# If you need to use the Tree Control, you may still find this API a reasonable +# choice. However, you should investigate using the tree control directly +# to provide maximum flexibility (but with extra work). + +import sys + +import commctrl +import win32api +import win32con +import win32ui +from pywin.mfc import dialog, docview, object, window +from win32api import RGB + + +# helper to get the text of an arbitary item +def GetItemText(item): + if type(item) == type(()) or type(item) == type([]): + use = item[0] + else: + use = item + if type(use) == type(""): + return use + else: + return repr(item) + + +class HierDialog(dialog.Dialog): + def __init__( + self, + title, + hierList, + bitmapID=win32ui.IDB_HIERFOLDERS, + dlgID=win32ui.IDD_TREE, + dll=None, + childListBoxID=win32ui.IDC_LIST1, + ): + dialog.Dialog.__init__(self, dlgID, dll) # reuse this dialog. + self.hierList = hierList + self.dlgID = dlgID + self.title = title + + # self.childListBoxID = childListBoxID + def OnInitDialog(self): + self.SetWindowText(self.title) + self.hierList.HierInit(self) + return dialog.Dialog.OnInitDialog(self) + + +class HierList(object.Object): + def __init__( + self, root, bitmapID=win32ui.IDB_HIERFOLDERS, listBoxId=None, bitmapMask=None + ): # used to create object. + self.listControl = None + self.bitmapID = bitmapID + self.root = root + self.listBoxId = listBoxId + self.itemHandleMap = {} + self.filledItemHandlesMap = {} + self.bitmapMask = bitmapMask + + def __getattr__(self, attr): + try: + return getattr(self.listControl, attr) + except AttributeError: + return object.Object.__getattr__(self, attr) + + def ItemFromHandle(self, handle): + return self.itemHandleMap[handle] + + def SetStyle(self, newStyle): + hwnd = self.listControl.GetSafeHwnd() + style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE) + win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style | newStyle)) + + def HierInit(self, parent, listControl=None): # Used when window first exists. + # this also calls "Create" on the listbox. + # params - id of listbbox, ID of bitmap, size of bitmaps + if self.bitmapMask is None: + bitmapMask = RGB(0, 0, 255) + else: + bitmapMask = self.bitmapMask + self.imageList = win32ui.CreateImageList(self.bitmapID, 16, 0, bitmapMask) + if listControl is None: + if self.listBoxId is None: + self.listBoxId = win32ui.IDC_LIST1 + self.listControl = parent.GetDlgItem(self.listBoxId) + else: + self.listControl = listControl + lbid = listControl.GetDlgCtrlID() + assert self.listBoxId is None or self.listBoxId == lbid, ( + "An invalid listbox control ID has been specified (specified as %s, but exists as %s)" + % (self.listBoxId, lbid) + ) + self.listBoxId = lbid + self.listControl.SetImageList(self.imageList, commctrl.LVSIL_NORMAL) + # self.list.AttachObject(self) + + ## ??? Need a better way to do this - either some way to detect if it's compiled with UNICODE + ## defined, and/or a way to switch the constants based on UNICODE ??? + if sys.version_info[0] < 3: + parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDINGA) + parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGEDA) + else: + parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDINGW) + parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGEDW) + parent.HookNotify(self.OnTreeItemDoubleClick, commctrl.NM_DBLCLK) + self.notify_parent = parent + + if self.root: + self.AcceptRoot(self.root) + + def DeleteAllItems(self): + self.listControl.DeleteAllItems() + self.root = None + self.itemHandleMap = {} + self.filledItemHandlesMap = {} + + def HierTerm(self): + # Dont want notifies as we kill the list. + parent = self.notify_parent # GetParentFrame() + if sys.version_info[0] < 3: + parent.HookNotify(None, commctrl.TVN_ITEMEXPANDINGA) + parent.HookNotify(None, commctrl.TVN_SELCHANGEDA) + else: + parent.HookNotify(None, commctrl.TVN_ITEMEXPANDINGW) + parent.HookNotify(None, commctrl.TVN_SELCHANGEDW) + parent.HookNotify(None, commctrl.NM_DBLCLK) + + self.DeleteAllItems() + self.listControl = None + self.notify_parent = None # Break a possible cycle + + def OnTreeItemDoubleClick(self, info, extra): + (hwndFrom, idFrom, code) = info + if idFrom != self.listBoxId: + return None + item = self.itemHandleMap[self.listControl.GetSelectedItem()] + self.TakeDefaultAction(item) + return 1 + + def OnTreeItemExpanding(self, info, extra): + (hwndFrom, idFrom, code) = info + if idFrom != self.listBoxId: + return None + action, itemOld, itemNew, pt = extra + itemHandle = itemNew[0] + if itemHandle not in self.filledItemHandlesMap: + item = self.itemHandleMap[itemHandle] + self.AddSubList(itemHandle, self.GetSubList(item)) + self.filledItemHandlesMap[itemHandle] = None + return 0 + + def OnTreeItemSelChanged(self, info, extra): + (hwndFrom, idFrom, code) = info + if idFrom != self.listBoxId: + return None + action, itemOld, itemNew, pt = extra + itemHandle = itemNew[0] + item = self.itemHandleMap[itemHandle] + self.PerformItemSelected(item) + return 1 + + def AddSubList(self, parentHandle, subItems): + for item in subItems: + self.AddItem(parentHandle, item) + + def AddItem(self, parentHandle, item, hInsertAfter=commctrl.TVI_LAST): + text = self.GetText(item) + if self.IsExpandable(item): + cItems = 1 # Trick it !! + else: + cItems = 0 + bitmapCol = self.GetBitmapColumn(item) + bitmapSel = self.GetSelectedBitmapColumn(item) + if bitmapSel is None: + bitmapSel = bitmapCol + ## if type(text) is str: + ## text = text.encode("mbcs") + hitem = self.listControl.InsertItem( + parentHandle, + hInsertAfter, + (None, None, None, text, bitmapCol, bitmapSel, cItems, 0), + ) + self.itemHandleMap[hitem] = item + return hitem + + def _GetChildHandles(self, handle): + ret = [] + try: + handle = self.listControl.GetChildItem(handle) + while 1: + ret.append(handle) + handle = self.listControl.GetNextItem(handle, commctrl.TVGN_NEXT) + except win32ui.error: + # out of children + pass + return ret + + def Refresh(self, hparent=None): + # Attempt to refresh the given item's sub-entries, but maintain the tree state + # (ie, the selected item, expanded items, etc) + if hparent is None: + hparent = commctrl.TVI_ROOT + if hparent not in self.filledItemHandlesMap: + # This item has never been expanded, so no refresh can possibly be required. + return + root_item = self.itemHandleMap[hparent] + old_handles = self._GetChildHandles(hparent) + old_items = list(map(self.ItemFromHandle, old_handles)) + new_items = self.GetSubList(root_item) + # Now an inefficient technique for synching the items. + inew = 0 + hAfter = commctrl.TVI_FIRST + for iold in range(len(old_items)): + inewlook = inew + matched = 0 + while inewlook < len(new_items): + if old_items[iold] == new_items[inewlook]: + matched = 1 + break + inewlook = inewlook + 1 + if matched: + # Insert the new items. + # print "Inserting after", old_items[iold], old_handles[iold] + for i in range(inew, inewlook): + # print "Inserting index %d (%s)" % (i, new_items[i]) + hAfter = self.AddItem(hparent, new_items[i], hAfter) + + inew = inewlook + 1 + # And recursively refresh iold + hold = old_handles[iold] + if hold in self.filledItemHandlesMap: + self.Refresh(hold) + else: + # Remove the deleted items. + # print "Deleting %d (%s)" % (iold, old_items[iold]) + hdelete = old_handles[iold] + # First recurse and remove the children from the map. + for hchild in self._GetChildHandles(hdelete): + del self.itemHandleMap[hchild] + if hchild in self.filledItemHandlesMap: + del self.filledItemHandlesMap[hchild] + self.listControl.DeleteItem(hdelete) + hAfter = old_handles[iold] + # Fill any remaining new items: + for newItem in new_items[inew:]: + # print "Inserting new item", newItem + self.AddItem(hparent, newItem) + + def AcceptRoot(self, root): + self.listControl.DeleteAllItems() + self.itemHandleMap = {commctrl.TVI_ROOT: root} + self.filledItemHandlesMap = {commctrl.TVI_ROOT: root} + subItems = self.GetSubList(root) + self.AddSubList(0, subItems) + + def GetBitmapColumn(self, item): + if self.IsExpandable(item): + return 0 + else: + return 4 + + def GetSelectedBitmapColumn(self, item): + return 0 + + def CheckChangedChildren(self): + return self.listControl.CheckChangedChildren() + + def GetText(self, item): + return GetItemText(item) + + def PerformItemSelected(self, item): + try: + win32ui.SetStatusText("Selected " + self.GetText(item)) + except win32ui.error: # No status bar! + pass + + def TakeDefaultAction(self, item): + win32ui.MessageBox("Got item " + self.GetText(item)) + + +########################################################################## +# +# Classes for use with seperate HierListItems. +# +# +class HierListWithItems(HierList): + def __init__( + self, root, bitmapID=win32ui.IDB_HIERFOLDERS, listBoxID=None, bitmapMask=None + ): # used to create object. + HierList.__init__(self, root, bitmapID, listBoxID, bitmapMask) + + def DelegateCall(self, fn): + return fn() + + def GetBitmapColumn(self, item): + rc = self.DelegateCall(item.GetBitmapColumn) + if rc is None: + rc = HierList.GetBitmapColumn(self, item) + return rc + + def GetSelectedBitmapColumn(self, item): + return self.DelegateCall(item.GetSelectedBitmapColumn) + + def IsExpandable(self, item): + return self.DelegateCall(item.IsExpandable) + + def GetText(self, item): + return self.DelegateCall(item.GetText) + + def GetSubList(self, item): + return self.DelegateCall(item.GetSubList) + + def PerformItemSelected(self, item): + func = getattr(item, "PerformItemSelected", None) + if func is None: + return HierList.PerformItemSelected(self, item) + else: + return self.DelegateCall(func) + + def TakeDefaultAction(self, item): + func = getattr(item, "TakeDefaultAction", None) + if func is None: + return HierList.TakeDefaultAction(self, item) + else: + return self.DelegateCall(func) + + +# A hier list item - for use with a HierListWithItems +class HierListItem: + def __init__(self): + pass + + def GetText(self): + pass + + def GetSubList(self): + pass + + def IsExpandable(self): + pass + + def GetBitmapColumn(self): + return None # indicate he should do it. + + def GetSelectedBitmapColumn(self): + return None # same as other + + # for py3k/rich-comp sorting compatibility. + def __lt__(self, other): + # we want unrelated items to be sortable... + return id(self) < id(other) + + # for py3k/rich-comp equality compatibility. + def __eq__(self, other): + return False diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/regedit.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/regedit.py new file mode 100644 index 0000000000000000000000000000000000000000..b94d3050fb4fd0187b3b8613c875a400c7e9f398 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/regedit.py @@ -0,0 +1,386 @@ +# Regedit - a Registry Editor for Python + +import commctrl +import regutil +import win32api +import win32con +import win32ui +from pywin.mfc import dialog, docview, window + +from . import hierlist + + +def SafeApply(fn, args, err_desc=""): + try: + fn(*args) + return 1 + except win32api.error as exc: + msg = "Error " + err_desc + "\r\n\r\n" + exc.strerror + win32ui.MessageBox(msg) + return 0 + + +class SplitterFrame(window.MDIChildWnd): + def __init__(self): + # call base CreateFrame + self.images = None + window.MDIChildWnd.__init__(self) + + def OnCreateClient(self, cp, context): + splitter = win32ui.CreateSplitter() + doc = context.doc + frame_rect = self.GetWindowRect() + size = ((frame_rect[2] - frame_rect[0]), (frame_rect[3] - frame_rect[1]) // 2) + sub_size = (size[0] // 3, size[1]) + splitter.CreateStatic(self, 1, 2) + # CTreeControl view + self.keysview = RegistryTreeView(doc) + # CListControl view + self.valuesview = RegistryValueView(doc) + + splitter.CreatePane(self.keysview, 0, 0, (sub_size)) + splitter.CreatePane(self.valuesview, 0, 1, (0, 0)) # size ignored. + splitter.SetRowInfo(0, size[1], 0) + # Setup items in the imagelist + + return 1 + + def OnItemDoubleClick(self, info, extra): + (hwndFrom, idFrom, code) = info + if idFrom == win32ui.AFX_IDW_PANE_FIRST: + # Tree control + return None + elif idFrom == win32ui.AFX_IDW_PANE_FIRST + 1: + item = self.keysview.SelectedItem() + self.valuesview.EditValue(item) + return 0 + # List control + else: + return None # Pass it on + + def PerformItemSelected(self, item): + return self.valuesview.UpdateForRegItem(item) + + def OnDestroy(self, msg): + window.MDIChildWnd.OnDestroy(self, msg) + if self.images: + self.images.DeleteImageList() + self.images = None + + +class RegistryTreeView(docview.TreeView): + def OnInitialUpdate(self): + rc = self._obj_.OnInitialUpdate() + self.frame = self.GetParent().GetParent() + self.hierList = hierlist.HierListWithItems( + self.GetHLIRoot(), win32ui.IDB_HIERFOLDERS, win32ui.AFX_IDW_PANE_FIRST + ) + self.hierList.HierInit(self.frame, self.GetTreeCtrl()) + self.hierList.SetStyle( + commctrl.TVS_HASLINES | commctrl.TVS_LINESATROOT | commctrl.TVS_HASBUTTONS + ) + self.hierList.PerformItemSelected = self.PerformItemSelected + + self.frame.HookNotify(self.frame.OnItemDoubleClick, commctrl.NM_DBLCLK) + self.frame.HookNotify(self.OnItemRightClick, commctrl.NM_RCLICK) + + # self.HookMessage(self.OnItemRightClick, win32con.WM_RBUTTONUP) + + def GetHLIRoot(self): + doc = self.GetDocument() + regroot = doc.root + subkey = doc.subkey + return HLIRegistryKey(regroot, subkey, "Root") + + def OnItemRightClick(self, notify_data, extra): + # First select the item we right-clicked on. + pt = self.ScreenToClient(win32api.GetCursorPos()) + flags, hItem = self.HitTest(pt) + if hItem == 0 or commctrl.TVHT_ONITEM & flags == 0: + return None + self.Select(hItem, commctrl.TVGN_CARET) + + menu = win32ui.CreatePopupMenu() + menu.AppendMenu(win32con.MF_STRING | win32con.MF_ENABLED, 1000, "Add Key") + menu.AppendMenu(win32con.MF_STRING | win32con.MF_ENABLED, 1001, "Add Value") + menu.AppendMenu(win32con.MF_STRING | win32con.MF_ENABLED, 1002, "Delete Key") + self.HookCommand(self.OnAddKey, 1000) + self.HookCommand(self.OnAddValue, 1001) + self.HookCommand(self.OnDeleteKey, 1002) + menu.TrackPopupMenu(win32api.GetCursorPos()) # track at mouse position. + return None + + def OnDeleteKey(self, command, code): + hitem = self.hierList.GetSelectedItem() + item = self.hierList.ItemFromHandle(hitem) + msg = "Are you sure you wish to delete the key '%s'?" % (item.keyName,) + id = win32ui.MessageBox(msg, None, win32con.MB_YESNO) + if id != win32con.IDYES: + return + if SafeApply( + win32api.RegDeleteKey, (item.keyRoot, item.keyName), "deleting registry key" + ): + # Get the items parent. + try: + hparent = self.GetParentItem(hitem) + except win32ui.error: + hparent = None + self.hierList.Refresh(hparent) + + def OnAddKey(self, command, code): + from pywin.mfc import dialog + + val = dialog.GetSimpleInput("New key name", "", "Add new key") + if val is None: + return # cancelled. + hitem = self.hierList.GetSelectedItem() + item = self.hierList.ItemFromHandle(hitem) + if SafeApply(win32api.RegCreateKey, (item.keyRoot, item.keyName + "\\" + val)): + self.hierList.Refresh(hitem) + + def OnAddValue(self, command, code): + from pywin.mfc import dialog + + val = dialog.GetSimpleInput("New value", "", "Add new value") + if val is None: + return # cancelled. + hitem = self.hierList.GetSelectedItem() + item = self.hierList.ItemFromHandle(hitem) + if SafeApply( + win32api.RegSetValue, (item.keyRoot, item.keyName, win32con.REG_SZ, val) + ): + # Simply re-select the current item to refresh the right spitter. + self.PerformItemSelected(item) + + # self.Select(hitem, commctrl.TVGN_CARET) + + def PerformItemSelected(self, item): + return self.frame.PerformItemSelected(item) + + def SelectedItem(self): + return self.hierList.ItemFromHandle(self.hierList.GetSelectedItem()) + + def SearchSelectedItem(self): + handle = self.hierList.GetChildItem(0) + while 1: + # print "State is", self.hierList.GetItemState(handle, -1) + if self.hierList.GetItemState(handle, commctrl.TVIS_SELECTED): + # print "Item is ", self.hierList.ItemFromHandle(handle) + return self.hierList.ItemFromHandle(handle) + handle = self.hierList.GetNextSiblingItem(handle) + + +class RegistryValueView(docview.ListView): + def OnInitialUpdate(self): + hwnd = self._obj_.GetSafeHwnd() + style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE) + win32api.SetWindowLong( + hwnd, + win32con.GWL_STYLE, + (style & ~commctrl.LVS_TYPEMASK) | commctrl.LVS_REPORT, + ) + + itemDetails = (commctrl.LVCFMT_LEFT, 100, "Name", 0) + self.InsertColumn(0, itemDetails) + itemDetails = (commctrl.LVCFMT_LEFT, 500, "Data", 0) + self.InsertColumn(1, itemDetails) + + def UpdateForRegItem(self, item): + self.DeleteAllItems() + hkey = win32api.RegOpenKey(item.keyRoot, item.keyName) + try: + valNum = 0 + ret = [] + while 1: + try: + res = win32api.RegEnumValue(hkey, valNum) + except win32api.error: + break + name = res[0] + if not name: + name = "(Default)" + self.InsertItem(valNum, name) + self.SetItemText(valNum, 1, str(res[1])) + valNum = valNum + 1 + finally: + win32api.RegCloseKey(hkey) + + def EditValue(self, item): + # Edit the current value + class EditDialog(dialog.Dialog): + def __init__(self, item): + self.item = item + dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT) + + def OnInitDialog(self): + self.SetWindowText("Enter new value") + self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW) + self.edit = self.GetDlgItem(win32ui.IDC_EDIT1) + # Modify the edit windows style + style = win32api.GetWindowLong( + self.edit.GetSafeHwnd(), win32con.GWL_STYLE + ) + style = style & (~win32con.ES_WANTRETURN) + win32api.SetWindowLong( + self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style + ) + self.edit.SetWindowText(str(self.item)) + self.edit.SetSel(-1) + return dialog.Dialog.OnInitDialog(self) + + def OnDestroy(self, msg): + self.newvalue = self.edit.GetWindowText() + + try: + index = self.GetNextItem(-1, commctrl.LVNI_SELECTED) + except win32ui.error: + return # No item selected. + + if index == 0: + keyVal = "" + else: + keyVal = self.GetItemText(index, 0) + # Query for a new value. + try: + newVal = self.GetItemsCurrentValue(item, keyVal) + except TypeError as details: + win32ui.MessageBox(details) + return + + d = EditDialog(newVal) + if d.DoModal() == win32con.IDOK: + try: + self.SetItemsCurrentValue(item, keyVal, d.newvalue) + except win32api.error as exc: + win32ui.MessageBox("Error setting value\r\n\n%s" % exc.strerror) + self.UpdateForRegItem(item) + + def GetItemsCurrentValue(self, item, valueName): + hkey = win32api.RegOpenKey(item.keyRoot, item.keyName) + try: + val, type = win32api.RegQueryValueEx(hkey, valueName) + if type != win32con.REG_SZ: + raise TypeError("Only strings can be edited") + return val + finally: + win32api.RegCloseKey(hkey) + + def SetItemsCurrentValue(self, item, valueName, value): + # ** Assumes already checked is a string. + hkey = win32api.RegOpenKey( + item.keyRoot, item.keyName, 0, win32con.KEY_SET_VALUE + ) + try: + win32api.RegSetValueEx(hkey, valueName, 0, win32con.REG_SZ, value) + finally: + win32api.RegCloseKey(hkey) + + +class RegTemplate(docview.DocTemplate): + def __init__(self): + docview.DocTemplate.__init__( + self, win32ui.IDR_PYTHONTYPE, None, SplitterFrame, None + ) + + # def InitialUpdateFrame(self, frame, doc, makeVisible=1): + # self._obj_.InitialUpdateFrame(frame, doc, makeVisible) # call default handler. + # frame.InitialUpdateFrame(doc, makeVisible) + + def OpenRegistryKey( + self, root=None, subkey=None + ): # Use this instead of OpenDocumentFile. + # Look for existing open document + if root is None: + root = regutil.GetRootKey() + if subkey is None: + subkey = regutil.BuildDefaultPythonKey() + for doc in self.GetDocumentList(): + if doc.root == root and doc.subkey == subkey: + doc.GetFirstView().ActivateFrame() + return doc + # not found - new one. + doc = RegDocument(self, root, subkey) + frame = self.CreateNewFrame(doc) + doc.OnNewDocument() + self.InitialUpdateFrame(frame, doc, 1) + return doc + + +class RegDocument(docview.Document): + def __init__(self, template, root, subkey): + docview.Document.__init__(self, template) + self.root = root + self.subkey = subkey + self.SetTitle("Registry Editor: " + subkey) + + def OnOpenDocument(self, name): + raise TypeError("This template can not open files") + return 0 + + +class HLIRegistryKey(hierlist.HierListItem): + def __init__(self, keyRoot, keyName, userName): + self.keyRoot = keyRoot + self.keyName = keyName + self.userName = userName + hierlist.HierListItem.__init__(self) + + def __lt__(self, other): + return self.name < other.name + + def __eq__(self, other): + return ( + self.keyRoot == other.keyRoot + and self.keyName == other.keyName + and self.userName == other.userName + ) + + def __repr__(self): + return "<%s with root=%s, key=%s>" % ( + self.__class__.__name__, + self.keyRoot, + self.keyName, + ) + + def GetText(self): + return self.userName + + def IsExpandable(self): + # All keys are expandable, even if they currently have zero children. + return 1 + + ## hkey = win32api.RegOpenKey(self.keyRoot, self.keyName) + ## try: + ## keys, vals, dt = win32api.RegQueryInfoKey(hkey) + ## return (keys>0) + ## finally: + ## win32api.RegCloseKey(hkey) + + def GetSubList(self): + hkey = win32api.RegOpenKey(self.keyRoot, self.keyName) + win32ui.DoWaitCursor(1) + try: + keyNum = 0 + ret = [] + while 1: + try: + key = win32api.RegEnumKey(hkey, keyNum) + except win32api.error: + break + ret.append(HLIRegistryKey(self.keyRoot, self.keyName + "\\" + key, key)) + keyNum = keyNum + 1 + finally: + win32api.RegCloseKey(hkey) + win32ui.DoWaitCursor(0) + return ret + + +template = RegTemplate() + + +def EditRegistry(root=None, key=None): + doc = template.OpenRegistryKey(root, key) + + +if __name__ == "__main__": + EditRegistry() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/regpy.py b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/regpy.py new file mode 100644 index 0000000000000000000000000000000000000000..11ad63af56d0d08df9c08f6efec91c1bc840e1f1 --- /dev/null +++ b/pgsql/pgAdmin 4/python/Lib/site-packages/pythonwin/pywin/tools/regpy.py @@ -0,0 +1,81 @@ +# (sort-of) Registry editor +import commctrl +import dialog +import win32con +import win32ui + + +class RegistryControl: + def __init__(self, key): + self.key = key + + +class RegEditPropertyPage(dialog.PropertyPage): + IDC_LISTVIEW = 1000 + + def GetTemplate(self): + "Return the template used to create this dialog" + + w = 152 # Dialog width + h = 122 # Dialog height + SS_STD = win32con.WS_CHILD | win32con.WS_VISIBLE + FRAMEDLG_STD = win32con.WS_CAPTION | win32con.WS_SYSMENU + style = ( + FRAMEDLG_STD + | win32con.WS_VISIBLE + | win32con.DS_SETFONT + | win32con.WS_MINIMIZEBOX + ) + template = [ + [self.caption, (0, 0, w, h), style, None, (8, "Helv")], + ] + lvStyle = ( + SS_STD + | commctrl.LVS_EDITLABELS + | commctrl.LVS_REPORT + | commctrl.LVS_AUTOARRANGE + | commctrl.LVS_ALIGNLEFT + | win32con.WS_BORDER + | win32con.WS_TABSTOP + ) + template.append( + ["SysListView32", "", self.IDC_LISTVIEW, (10, 10, 185, 100), lvStyle] + ) + return template + + +class RegistryPage(RegEditPropertyPage): + def __init__(self): + self.caption = "Path" + RegEditPropertyPage.__init__(self, self.GetTemplate()) + + def OnInitDialog(self): + self.listview = self.GetDlgItem(self.IDC_LISTVIEW) + RegEditPropertyPage.OnInitDialog(self) + # Setup the listview columns + itemDetails = (commctrl.LVCFMT_LEFT, 100, "App", 0) + self.listview.InsertColumn(0, itemDetails) + itemDetails = (commctrl.LVCFMT_LEFT, 1024, "Paths", 0) + self.listview.InsertColumn(1, itemDetails) + + index = self.listview.InsertItem(0, "App") + self.listview.SetItemText(index, 1, "Path") + + +class RegistrySheet(dialog.PropertySheet): + def __init__(self, title): + dialog.PropertySheet.__init__(self, title) + self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE) + + def OnActivate(self, msg): + print("OnAcivate") + + +def t(): + ps = RegistrySheet("Registry Settings") + ps.AddPage(RegistryPage()) + ps.DoModal() + + +if __name__ == "__main__": + t() diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Buenos_Aires b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Buenos_Aires new file mode 100644 index 0000000000000000000000000000000000000000..cc82e69898f161842b5001f10a84d3ac127c5c6f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Buenos_Aires differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Catamarca b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Catamarca new file mode 100644 index 0000000000000000000000000000000000000000..7268eb3738e5b3ba906f962533f48016cf3dcabc Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Catamarca differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/ComodRivadavia b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/ComodRivadavia new file mode 100644 index 0000000000000000000000000000000000000000..7268eb3738e5b3ba906f962533f48016cf3dcabc Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/ComodRivadavia differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Cordoba b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Cordoba new file mode 100644 index 0000000000000000000000000000000000000000..2ad6ea5db204d599266412558f5a1fae076fc41a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Cordoba differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Jujuy b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Jujuy new file mode 100644 index 0000000000000000000000000000000000000000..7ca0b46f680b80780981aab0699e64dd04070fe7 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Jujuy differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/La_Rioja b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/La_Rioja new file mode 100644 index 0000000000000000000000000000000000000000..a6a6694f3317a25e7bc4c66502e9f396fa106509 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/La_Rioja differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Mendoza b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Mendoza new file mode 100644 index 0000000000000000000000000000000000000000..3232c80e2003489921578f7acbabc73fb9148205 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Mendoza differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Rio_Gallegos b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Rio_Gallegos new file mode 100644 index 0000000000000000000000000000000000000000..8b1a2816ab136098d10a3d294993ea56b6c432dc Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Rio_Gallegos differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Salta b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Salta new file mode 100644 index 0000000000000000000000000000000000000000..7072dec22958ad5ac74ba3457a178a4faadaf570 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Salta differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/San_Juan b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/San_Juan new file mode 100644 index 0000000000000000000000000000000000000000..f3e185c3ab516065c52557aaceaaeacae1f8b221 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/San_Juan differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/San_Luis b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/San_Luis new file mode 100644 index 0000000000000000000000000000000000000000..2d1da3ae3d6f9c6f92a8ddf01c2ff51ae28e4de2 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/San_Luis differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Tucuman b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Tucuman new file mode 100644 index 0000000000000000000000000000000000000000..c6449f582a7804ecf66858a7fceda207c5d979be Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Tucuman differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Ushuaia b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Ushuaia new file mode 100644 index 0000000000000000000000000000000000000000..e74ce049c793c96e855ebb15779887a48622bf26 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Argentina/Ushuaia differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis new file mode 100644 index 0000000000000000000000000000000000000000..a84b6e99671f7305d1c459956e16a4dd772fc60e Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Knox b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Knox new file mode 100644 index 0000000000000000000000000000000000000000..025d132dd48ba978c6fedf86d70173127be49d49 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Knox differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Marengo b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Marengo new file mode 100644 index 0000000000000000000000000000000000000000..677bbff6a9d89180cfd2dd3279a1c412610b6540 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Marengo differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Petersburg b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Petersburg new file mode 100644 index 0000000000000000000000000000000000000000..3082de00c2e0bfe89d4ac5e093d9e5921aa63610 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Petersburg differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Tell_City b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Tell_City new file mode 100644 index 0000000000000000000000000000000000000000..103c5cb31795edc15d548ef4ca71f1e04e2996b5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Tell_City differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Vevay b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Vevay new file mode 100644 index 0000000000000000000000000000000000000000..315b4c45aef1f241d025900544133c085fe4f69d Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Vevay differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Vincennes b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Vincennes new file mode 100644 index 0000000000000000000000000000000000000000..35a24133446b9ee1e8f8a7931519d93517130315 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Vincennes differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Winamac b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Winamac new file mode 100644 index 0000000000000000000000000000000000000000..6d4e19377e9f70c3782daa223753c640c60ab1eb Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Indiana/Winamac differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Kentucky/Louisville b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Kentucky/Louisville new file mode 100644 index 0000000000000000000000000000000000000000..3a335b37165d2b3d6a09a1716cb158e272087c9f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Kentucky/Louisville differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Kentucky/Monticello b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Kentucky/Monticello new file mode 100644 index 0000000000000000000000000000000000000000..576f16bb2b21a7e0871a7222241ad65e533bb93a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/Kentucky/Monticello differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/Beulah b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/Beulah new file mode 100644 index 0000000000000000000000000000000000000000..33e317e25b127335de68052f57d33ceed620524e Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/Beulah differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/Center b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/Center new file mode 100644 index 0000000000000000000000000000000000000000..17fe13bcc1c73ecbc6738499667816f54c164e39 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/Center differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/New_Salem b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/New_Salem new file mode 100644 index 0000000000000000000000000000000000000000..12dbe801aeb06823483525727f6f6695dec1bc24 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/America/North_Dakota/New_Salem differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Belfast b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Belfast new file mode 100644 index 0000000000000000000000000000000000000000..5ad74220e83e6c30a0aeefda4a00271b8ebdfcad Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Belfast differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Belgrade b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Belgrade new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Belgrade differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Berlin b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Berlin new file mode 100644 index 0000000000000000000000000000000000000000..7f6d958f8630cba512d8e58ca8edfbd516291522 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Berlin differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Bratislava b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Bratislava new file mode 100644 index 0000000000000000000000000000000000000000..ce8f433ece44f0b96b18d3b5780730e7f9cad9f5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Bratislava differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Brussels b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Brussels new file mode 100644 index 0000000000000000000000000000000000000000..40d7124e5346af056c75e2f7012a51d94e8154b7 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Brussels differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Bucharest b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Bucharest new file mode 100644 index 0000000000000000000000000000000000000000..4303b903e5e007484c0d8e1eea43a35e9b53f38b Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Bucharest differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Budapest b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Budapest new file mode 100644 index 0000000000000000000000000000000000000000..b76c873d9256e1d73c2ea672140b813f15657bc7 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Budapest differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Busingen b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Busingen new file mode 100644 index 0000000000000000000000000000000000000000..ad6cf59281a1046d9dcd045fda521585e3e33e06 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Busingen differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Chisinau b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Chisinau new file mode 100644 index 0000000000000000000000000000000000000000..5ee23fe0e59f044598675db44d53c20590b88934 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Chisinau differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Copenhagen b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Copenhagen new file mode 100644 index 0000000000000000000000000000000000000000..7f6d958f8630cba512d8e58ca8edfbd516291522 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Copenhagen differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Dublin b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Dublin new file mode 100644 index 0000000000000000000000000000000000000000..c729def42fc0822e6b24f7bf503c67cc7e6965f0 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Dublin differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Gibraltar b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Gibraltar new file mode 100644 index 0000000000000000000000000000000000000000..a38f11ffdf2a9e538695ea8cae20b1d2c04164af Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Gibraltar differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Guernsey b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Guernsey new file mode 100644 index 0000000000000000000000000000000000000000..5ad74220e83e6c30a0aeefda4a00271b8ebdfcad Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Guernsey differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Helsinki b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Helsinki new file mode 100644 index 0000000000000000000000000000000000000000..b4f8f9cbb57450549933f83ac90dd56a2ca75344 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Helsinki differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Isle_of_Man b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Isle_of_Man new file mode 100644 index 0000000000000000000000000000000000000000..5ad74220e83e6c30a0aeefda4a00271b8ebdfcad Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Isle_of_Man differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Istanbul b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Istanbul new file mode 100644 index 0000000000000000000000000000000000000000..7c2336dd80c3c9cbf71cb53d2b2c1f89a65a8ba5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Istanbul differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Jersey b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Jersey new file mode 100644 index 0000000000000000000000000000000000000000..5ad74220e83e6c30a0aeefda4a00271b8ebdfcad Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Jersey differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kaliningrad b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kaliningrad new file mode 100644 index 0000000000000000000000000000000000000000..cc99beabe4ffc5107c4719d1201d6583b9ead03a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kaliningrad differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kiev b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kiev new file mode 100644 index 0000000000000000000000000000000000000000..52efea88065b220e44fd876de3bf3090fe62cc79 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kiev differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kirov b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kirov new file mode 100644 index 0000000000000000000000000000000000000000..0cfb956be223ab593ca27569ad554dae9b106117 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kirov differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kyiv b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kyiv new file mode 100644 index 0000000000000000000000000000000000000000..52efea88065b220e44fd876de3bf3090fe62cc79 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Kyiv differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Lisbon b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Lisbon new file mode 100644 index 0000000000000000000000000000000000000000..55f01930ba92ff6852ae4745e78adb5f96c5b057 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Lisbon differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Ljubljana b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Ljubljana new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Ljubljana differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/London b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/London new file mode 100644 index 0000000000000000000000000000000000000000..5ad74220e83e6c30a0aeefda4a00271b8ebdfcad Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/London differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Luxembourg b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Luxembourg new file mode 100644 index 0000000000000000000000000000000000000000..40d7124e5346af056c75e2f7012a51d94e8154b7 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Luxembourg differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Madrid b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Madrid new file mode 100644 index 0000000000000000000000000000000000000000..53f4cd101c18058a1ee4d4b9d1184ada11d74232 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Madrid differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Malta b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Malta new file mode 100644 index 0000000000000000000000000000000000000000..1d1a7bcfcbbf37ff1ad7025f9843d0d2d8cb06d4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Malta differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Mariehamn b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Mariehamn new file mode 100644 index 0000000000000000000000000000000000000000..b4f8f9cbb57450549933f83ac90dd56a2ca75344 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Mariehamn differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Minsk b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Minsk new file mode 100644 index 0000000000000000000000000000000000000000..3731e40d8634c4d58ddb3378d828c92948f06d67 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Minsk differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Monaco b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Monaco new file mode 100644 index 0000000000000000000000000000000000000000..7d366c6098c49ecd546e1cc1538919e1414a3aee Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Monaco differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Moscow b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Moscow new file mode 100644 index 0000000000000000000000000000000000000000..ddb3f4e99a1030f33b56fad986c8d9c16e59eb32 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Moscow differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Nicosia b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Nicosia new file mode 100644 index 0000000000000000000000000000000000000000..f7f10ab7665e94ca44fd8cd98a362cd4b304eff1 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Nicosia differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Oslo b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Oslo new file mode 100644 index 0000000000000000000000000000000000000000..7f6d958f8630cba512d8e58ca8edfbd516291522 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Oslo differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Paris b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Paris new file mode 100644 index 0000000000000000000000000000000000000000..7d366c6098c49ecd546e1cc1538919e1414a3aee Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Paris differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Podgorica b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Podgorica new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Podgorica differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Prague b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Prague new file mode 100644 index 0000000000000000000000000000000000000000..ce8f433ece44f0b96b18d3b5780730e7f9cad9f5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Prague differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Riga b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Riga new file mode 100644 index 0000000000000000000000000000000000000000..8db477d01736445cafce8af7a7085d226d81f546 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Riga differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Rome b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Rome new file mode 100644 index 0000000000000000000000000000000000000000..32b2899a306dde401fa2e3952d06f5f4d9952bed Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Rome differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Samara b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Samara new file mode 100644 index 0000000000000000000000000000000000000000..d0ea2f25e9b4acaf3167a09a1c647943425e51b1 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Samara differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/San_Marino b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/San_Marino new file mode 100644 index 0000000000000000000000000000000000000000..32b2899a306dde401fa2e3952d06f5f4d9952bed Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/San_Marino differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Sarajevo b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Sarajevo new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Sarajevo differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Saratov b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Saratov new file mode 100644 index 0000000000000000000000000000000000000000..a863913358adb7a9118fcc48a6a5dcfba5f9914b Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Saratov differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Simferopol b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Simferopol new file mode 100644 index 0000000000000000000000000000000000000000..4bf24de1d9f8ebc410f120aa83d98b7e41d1e6c4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Simferopol differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Skopje b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Skopje new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Skopje differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Sofia b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Sofia new file mode 100644 index 0000000000000000000000000000000000000000..0e4d879332d21c93c229fc25587205020eeb3127 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Sofia differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Stockholm b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Stockholm new file mode 100644 index 0000000000000000000000000000000000000000..7f6d958f8630cba512d8e58ca8edfbd516291522 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Stockholm differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tallinn b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tallinn new file mode 100644 index 0000000000000000000000000000000000000000..b5acca3cf51e7f7b3176965748688ff41720246f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tallinn differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tirane b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tirane new file mode 100644 index 0000000000000000000000000000000000000000..0b86017d243f1b7bbb41d6b4feefcb2b7edfc7d8 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tirane differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tiraspol b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tiraspol new file mode 100644 index 0000000000000000000000000000000000000000..5ee23fe0e59f044598675db44d53c20590b88934 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Tiraspol differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Ulyanovsk b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Ulyanovsk new file mode 100644 index 0000000000000000000000000000000000000000..d668233b37f268a745e995177195b06ffab1e69b Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Ulyanovsk differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Uzhgorod b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Uzhgorod new file mode 100644 index 0000000000000000000000000000000000000000..52efea88065b220e44fd876de3bf3090fe62cc79 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Uzhgorod differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vaduz b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vaduz new file mode 100644 index 0000000000000000000000000000000000000000..ad6cf59281a1046d9dcd045fda521585e3e33e06 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vaduz differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vatican b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vatican new file mode 100644 index 0000000000000000000000000000000000000000..32b2899a306dde401fa2e3952d06f5f4d9952bed Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vatican differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vienna b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vienna new file mode 100644 index 0000000000000000000000000000000000000000..3582bb15cd7322088839b0134987ad10e717b6b5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vienna differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vilnius b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vilnius new file mode 100644 index 0000000000000000000000000000000000000000..7abd63fa608e0186b9f154d9fcc32472c28f6759 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Vilnius differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Volgograd b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Volgograd new file mode 100644 index 0000000000000000000000000000000000000000..9d51a38c0ea719c5042837d47e0f427057b845f0 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Volgograd differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Warsaw b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Warsaw new file mode 100644 index 0000000000000000000000000000000000000000..e33cf67171da78aa9e6eb02e50f9b9603da4c3f4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Warsaw differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zagreb b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zagreb new file mode 100644 index 0000000000000000000000000000000000000000..27de456f16ab549627b284a39e2265cbdb4ad8e9 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zagreb differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zaporozhye b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zaporozhye new file mode 100644 index 0000000000000000000000000000000000000000..52efea88065b220e44fd876de3bf3090fe62cc79 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zaporozhye differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zurich b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zurich new file mode 100644 index 0000000000000000000000000000000000000000..ad6cf59281a1046d9dcd045fda521585e3e33e06 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Europe/Zurich differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Antananarivo b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Antananarivo new file mode 100644 index 0000000000000000000000000000000000000000..9dcfc19c56e62b12b730f4335b34479695f273f5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Antananarivo differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Chagos b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Chagos new file mode 100644 index 0000000000000000000000000000000000000000..a5554816e2928c2bd5d02e032bbeb1e1cb101009 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Chagos differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Christmas b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Christmas new file mode 100644 index 0000000000000000000000000000000000000000..fa799db39e7625dd74bd9caa5c29b4819a7cbd3f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Christmas differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Cocos b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Cocos new file mode 100644 index 0000000000000000000000000000000000000000..eef37b42e8a0e7179f8113bea01f4a71d668e8ef Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Cocos differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Comoro b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Comoro new file mode 100644 index 0000000000000000000000000000000000000000..9dcfc19c56e62b12b730f4335b34479695f273f5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Comoro differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Kerguelen b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Kerguelen new file mode 100644 index 0000000000000000000000000000000000000000..555728b1a0187cc0ac63b8fe45c44bd1e0957918 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Kerguelen differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mahe b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mahe new file mode 100644 index 0000000000000000000000000000000000000000..b3ac791aef4e73d6d644c40c614f37f15d462cdd Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mahe differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Maldives b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Maldives new file mode 100644 index 0000000000000000000000000000000000000000..555728b1a0187cc0ac63b8fe45c44bd1e0957918 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Maldives differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mauritius b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mauritius new file mode 100644 index 0000000000000000000000000000000000000000..212d4b2e2afaed06110a1acff4fdb6bd6103b4ff Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mauritius differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mayotte b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mayotte new file mode 100644 index 0000000000000000000000000000000000000000..9dcfc19c56e62b12b730f4335b34479695f273f5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Mayotte differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Reunion b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Reunion new file mode 100644 index 0000000000000000000000000000000000000000..b3ac791aef4e73d6d644c40c614f37f15d462cdd Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Indian/Reunion differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/BajaNorte b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/BajaNorte new file mode 100644 index 0000000000000000000000000000000000000000..63dfdf48a68d02240737ecd6af081e02eb0b6317 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/BajaNorte differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/BajaSur b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/BajaSur new file mode 100644 index 0000000000000000000000000000000000000000..06fa22749d0a3157b5a693f0797086f78e1201c5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/BajaSur differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/General b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/General new file mode 100644 index 0000000000000000000000000000000000000000..68176daa4976b015fb79026f3053e74e4a7457ab Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Mexico/General differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Apia b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Apia new file mode 100644 index 0000000000000000000000000000000000000000..e592a68e53f6215de9e1d1ac61ce062a333283c0 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Apia differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Auckland b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Auckland new file mode 100644 index 0000000000000000000000000000000000000000..6575fdce31183d8238b18f2f30ab5b9227c7071c Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Auckland differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Bougainville b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Bougainville new file mode 100644 index 0000000000000000000000000000000000000000..c535acdabda1b6ed96420e589d4f6868d23d8933 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Bougainville differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Chatham b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Chatham new file mode 100644 index 0000000000000000000000000000000000000000..bde46cf7e4b7909714b93cee39a5d953387d756c Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Chatham differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Chuuk b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Chuuk new file mode 100644 index 0000000000000000000000000000000000000000..7be2474dd91c8a7da181fcda09d838254b890d75 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Chuuk differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Easter b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Easter new file mode 100644 index 0000000000000000000000000000000000000000..184cb6a83b3392d0492c42297531c85e7e38c4f5 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Easter differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Efate b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Efate new file mode 100644 index 0000000000000000000000000000000000000000..777325fc6c6da8795d89aed5206c60f8bf80b0ab Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Efate differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Enderbury b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Enderbury new file mode 100644 index 0000000000000000000000000000000000000000..b1c4b0734483033722c28c8b2884ac9dddd2ab45 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Enderbury differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Fakaofo b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Fakaofo new file mode 100644 index 0000000000000000000000000000000000000000..4905ea72b1640ca67e35b06395e1c700dffa8d21 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Fakaofo differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Fiji b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Fiji new file mode 100644 index 0000000000000000000000000000000000000000..acf8091ac85151a6c887e2b5049ee40754b7b0d3 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Fiji differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Funafuti b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Funafuti new file mode 100644 index 0000000000000000000000000000000000000000..47661d40a4188eb39e8d52e5af8ab23ef7f23766 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Funafuti differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Galapagos b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Galapagos new file mode 100644 index 0000000000000000000000000000000000000000..40051ddf63a32d79e5233b916e3911d6dc3ef759 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Galapagos differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Gambier b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Gambier new file mode 100644 index 0000000000000000000000000000000000000000..84acaf41520d2d302f75e300e2b47c5527218df4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Gambier differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Guadalcanal b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Guadalcanal new file mode 100644 index 0000000000000000000000000000000000000000..1ab8353464ddb93947f871f07cfd12540373269c Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Guadalcanal differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Guam b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Guam new file mode 100644 index 0000000000000000000000000000000000000000..66490d25dff9bcc8f710b0141f1a02e64aeb32f3 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Guam differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Honolulu b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Honolulu new file mode 100644 index 0000000000000000000000000000000000000000..c7cd060159bd22fc5e6f10ac5a2089afb2c19c6a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Honolulu differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Johnston b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Johnston new file mode 100644 index 0000000000000000000000000000000000000000..c7cd060159bd22fc5e6f10ac5a2089afb2c19c6a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Johnston differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kanton b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kanton new file mode 100644 index 0000000000000000000000000000000000000000..b1c4b0734483033722c28c8b2884ac9dddd2ab45 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kanton differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kiritimati b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kiritimati new file mode 100644 index 0000000000000000000000000000000000000000..b4c6037a2d2a8f89539c3df05c32b6f52b1b1e92 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kiritimati differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kosrae b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kosrae new file mode 100644 index 0000000000000000000000000000000000000000..0666fb0dd161cb732b29f84d49c49cc985a3559a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kosrae differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kwajalein b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kwajalein new file mode 100644 index 0000000000000000000000000000000000000000..1887a607422edd499fdf24afe91a04294f1caf6f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Kwajalein differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Majuro b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Majuro new file mode 100644 index 0000000000000000000000000000000000000000..47661d40a4188eb39e8d52e5af8ab23ef7f23766 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Majuro differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Marquesas b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Marquesas new file mode 100644 index 0000000000000000000000000000000000000000..f546c03f96b24859521aab5b9997bfc5dd124ead Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Marquesas differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Midway b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Midway new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Midway differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Nauru b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Nauru new file mode 100644 index 0000000000000000000000000000000000000000..3339b6cf86d6e98ba70c9bd6cab3dbf50588acd2 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Nauru differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Niue b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Niue new file mode 100644 index 0000000000000000000000000000000000000000..f76972f8849a7d6ed8c3e2649b02f44de891094f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Niue differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Norfolk b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Norfolk new file mode 100644 index 0000000000000000000000000000000000000000..3b4186d61152629b764efc4222e41647b65f7fbb Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Norfolk differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Noumea b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Noumea new file mode 100644 index 0000000000000000000000000000000000000000..959cc8cd26f8a7b10a70e0f93bf3b3c9bbc680d2 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Noumea differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pago_Pago b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pago_Pago new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pago_Pago differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Palau b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Palau new file mode 100644 index 0000000000000000000000000000000000000000..1cbebe28afd90c0a2e02786655e18a157284a412 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Palau differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pitcairn b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pitcairn new file mode 100644 index 0000000000000000000000000000000000000000..5ee90e70203d72484b8752475c86139671bcb102 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pitcairn differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pohnpei b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pohnpei new file mode 100644 index 0000000000000000000000000000000000000000..1ab8353464ddb93947f871f07cfd12540373269c Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Pohnpei differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Ponape b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Ponape new file mode 100644 index 0000000000000000000000000000000000000000..1ab8353464ddb93947f871f07cfd12540373269c Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Ponape differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Port_Moresby b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Port_Moresby new file mode 100644 index 0000000000000000000000000000000000000000..7be2474dd91c8a7da181fcda09d838254b890d75 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Port_Moresby differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Rarotonga b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Rarotonga new file mode 100644 index 0000000000000000000000000000000000000000..184a87c112b99536acbafa1ec7aba52c7a94b549 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Rarotonga differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Saipan b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Saipan new file mode 100644 index 0000000000000000000000000000000000000000..66490d25dff9bcc8f710b0141f1a02e64aeb32f3 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Saipan differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Samoa b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Samoa new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Samoa differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tahiti b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tahiti new file mode 100644 index 0000000000000000000000000000000000000000..481edd30580f00eccf69de4f1c332fc048210011 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tahiti differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tarawa b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tarawa new file mode 100644 index 0000000000000000000000000000000000000000..47661d40a4188eb39e8d52e5af8ab23ef7f23766 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tarawa differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tongatapu b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tongatapu new file mode 100644 index 0000000000000000000000000000000000000000..c8824ab5434985650f33e12eace1981f8b116207 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Tongatapu differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Truk b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Truk new file mode 100644 index 0000000000000000000000000000000000000000..7be2474dd91c8a7da181fcda09d838254b890d75 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Truk differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Wake b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Wake new file mode 100644 index 0000000000000000000000000000000000000000..47661d40a4188eb39e8d52e5af8ab23ef7f23766 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Wake differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Wallis b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Wallis new file mode 100644 index 0000000000000000000000000000000000000000..47661d40a4188eb39e8d52e5af8ab23ef7f23766 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Wallis differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Yap b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Yap new file mode 100644 index 0000000000000000000000000000000000000000..7be2474dd91c8a7da181fcda09d838254b890d75 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/Pacific/Yap differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Alaska b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Alaska new file mode 100644 index 0000000000000000000000000000000000000000..9bbb2fd3b361ea8aa4c126d14df5fa370343a63f Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Alaska differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Aleutian b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Aleutian new file mode 100644 index 0000000000000000000000000000000000000000..43236498f681cc06f64ca2afa613880331fe6fbb Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Aleutian differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Arizona b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Arizona new file mode 100644 index 0000000000000000000000000000000000000000..ab37e845566aa95659b7b85be0051d0c67a7e53a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Arizona differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Central b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Central new file mode 100644 index 0000000000000000000000000000000000000000..c6981a06b1d9c26f447518efe265a6454726eae7 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Central differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/East-Indiana b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/East-Indiana new file mode 100644 index 0000000000000000000000000000000000000000..a84b6e99671f7305d1c459956e16a4dd772fc60e Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/East-Indiana differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Eastern b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Eastern new file mode 100644 index 0000000000000000000000000000000000000000..a8b9ab1992257d721ad627b14f535c3d4b020888 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Eastern differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Hawaii b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Hawaii new file mode 100644 index 0000000000000000000000000000000000000000..c7cd060159bd22fc5e6f10ac5a2089afb2c19c6a Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Hawaii differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Indiana-Starke b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Indiana-Starke new file mode 100644 index 0000000000000000000000000000000000000000..025d132dd48ba978c6fedf86d70173127be49d49 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Indiana-Starke differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Michigan b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Michigan new file mode 100644 index 0000000000000000000000000000000000000000..e104faa46545ee873295cde34e1d46bccad8647c Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Michigan differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Mountain b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Mountain new file mode 100644 index 0000000000000000000000000000000000000000..abb2b974a47eb3e5c8b4f5d4370baf4898b239ab Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Mountain differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Pacific b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Pacific new file mode 100644 index 0000000000000000000000000000000000000000..610e7af5fc13d9784de30d272c7c39d7938873a0 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Pacific differ diff --git a/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Samoa b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Samoa new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/pgsql/pgAdmin 4/python/Lib/site-packages/pytz/zoneinfo/US/Samoa differ diff --git a/python/user_packages/Python313/site-packages/py_rust_stemmers-0.1.5.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/py_rust_stemmers-0.1.5.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e831425f26427e3dd51c72d4dc46db622c26a739 --- /dev/null +++ b/python/user_packages/Python313/site-packages/py_rust_stemmers-0.1.5.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 qdrant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/py_rust_stemmers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/py_rust_stemmers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..651ddf004266adf6bee83695080cf7f3026a7be9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/py_rust_stemmers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pygments-2.20.0.dist-info/licenses/AUTHORS b/python/user_packages/Python313/site-packages/pygments-2.20.0.dist-info/licenses/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..909089df67ab84b7f0d06a8b0ec0affb962ac60c --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments-2.20.0.dist-info/licenses/AUTHORS @@ -0,0 +1,292 @@ +Pygments is written and maintained by Georg Brandl . + +Major developers are Tim Hatch and Armin Ronacher +. + +Other contributors, listed alphabetically, are: + +* Sam Aaron -- Ioke lexer +* Jean Abou Samra -- LilyPond lexer +* João Abecasis -- JSLT lexer +* Ali Afshar -- image formatter +* Thomas Aglassinger -- Easytrieve, JCL, Rexx, Transact-SQL and VBScript + lexers +* Maxence Ahlouche -- PostgreSQL Explain lexer +* Muthiah Annamalai -- Ezhil lexer +* Nikolay Antipov -- OpenSCAD lexer +* Kumar Appaiah -- Debian control lexer +* Andreas Amann -- AppleScript lexer +* Timothy Armstrong -- Dart lexer fixes +* Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers +* Eiríkr Åsheim -- Uxntal lexer +* Jeremy Ashkenas -- CoffeeScript lexer +* José Joaquín Atria -- Praat lexer +* Stefan Matthias Aust -- Smalltalk lexer +* Lucas Bajolet -- Nit lexer +* Ben Bangert -- Mako lexers +* Max Battcher -- Darcs patch lexer +* Thomas Baruchel -- APL lexer +* Tim Baumann -- (Literate) Agda lexer +* Paul Baumgart, 280 North, Inc. -- Objective-J lexer +* Michael Bayer -- Myghty lexers +* Thomas Beale -- Archetype lexers +* John Benediktsson -- Factor lexer +* David Benjamin, Google LLC -- TLS lexer +* Trevor Bergeron -- mIRC formatter +* Vincent Bernat -- LessCSS lexer +* Christopher Bertels -- Fancy lexer +* Sébastien Bigaret -- QVT Operational lexer +* Jarrett Billingsley -- MiniD lexer +* Adam Blinkinsop -- Haskell, Redcode lexers +* Stéphane Blondon -- Procfile, SGF and Sieve lexers +* Frits van Bommel -- assembler lexers +* Pierre Bourdon -- bugfixes +* Martijn Braam -- Kernel log lexer, BARE lexer +* JD Browne, Google LLC -- GoogleSQL lexer +* Matthias Bussonnier -- ANSI style handling for terminal-256 formatter +* chebee7i -- Python traceback lexer improvements +* Hiram Chirino -- Scaml and Jade lexers +* Mauricio Caceres -- SAS and Stata lexers. +* Michael Camilleri, John Gabriele, sogaiu -- Janet lexer +* Daren Chandisingh -- Gleam lexer +* Ian Cooper -- VGL lexer +* David Corbett -- Inform, Jasmin, JSGF, Snowball, and TADS 3 lexers +* Leaf Corcoran -- MoonScript lexer +* Fraser Cormack -- TableGen lexer +* Gabriel Corona -- ASN.1 lexer +* Christopher Creutzig -- MuPAD lexer +* Daniël W. Crompton -- Pike lexer +* Pete Curry -- bugfixes +* Bryan Davis -- EBNF lexer +* Bruno Deferrari -- Shen lexer +* Walter Dörwald -- UL4 lexer +* Luke Drummond -- Meson lexer +* Giedrius Dubinskas -- HTML formatter improvements +* Owen Durni -- Haxe lexer +* Alexander Dutton, Oxford University Computing Services -- SPARQL lexer +* James Edwards -- Terraform lexer +* Nick Efford -- Python 3 lexer +* Sven Efftinge -- Xtend lexer +* Artem Egorkine -- terminal256 formatter +* Matthew Fernandez -- CAmkES lexer +* Paweł Fertyk -- GDScript lexer, HTML formatter improvements +* Michael Ficarra -- CPSA lexer +* James H. Fisher -- PostScript lexer +* Amanda Fitch, Google LLC -- GoogleSQL lexer +* William S. Fulton -- SWIG lexer +* Carlos Galdino -- Elixir and Elixir Console lexers +* Michael Galloy -- IDL lexer +* Naveen Garg -- Autohotkey lexer +* Simon Garnotel -- FreeFem++ lexer +* Laurent Gautier -- R/S lexer +* Alex Gaynor -- PyPy log lexer +* Richard Gerkin -- Igor Pro lexer +* Alain Gilbert -- TypeScript lexer +* Alex Gilding -- BlitzBasic lexer +* GitHub, Inc -- DASM16, Augeas, TOML, and Slash lexers +* Bertrand Goetzmann -- Groovy lexer +* Krzysiek Goj -- Scala lexer +* Rostyslav Golda -- FloScript lexer +* Andrey Golovizin -- BibTeX lexers +* Matt Good -- Genshi, Cheetah lexers +* Michał Górny -- vim modeline support +* Alex Gosse -- TrafficScript lexer +* Patrick Gotthardt -- PHP namespaces support +* Hubert Gruniaux -- C and C++ lexer improvements +* Olivier Guibe -- Asymptote lexer +* Phil Hagelberg -- Fennel lexer +* Florian Hahn -- Boogie lexer +* Martin Harriman -- SNOBOL lexer +* Matthew Harrison -- SVG formatter +* Steven Hazel -- Tcl lexer +* Dan Michael Heggø -- Turtle lexer +* Aslak Hellesøy -- Gherkin lexer +* Greg Hendershott -- Racket lexer +* Justin Hendrick -- ParaSail lexer +* Jordi Gutiérrez Hermoso -- Octave lexer +* David Hess, Fish Software, Inc. -- Objective-J lexer +* Ken Hilton -- Typographic Number Theory and Arrow lexers +* Varun Hiremath -- Debian control lexer +* Rob Hoelz -- Perl 6 lexer +* Doug Hogan -- Mscgen lexer +* Ben Hollis -- Mason lexer +* Max Horn -- GAP lexer +* Fred Hornsey -- OMG IDL Lexer +* Alastair Houghton -- Lexer inheritance facility +* Tim Howard -- BlitzMax lexer +* Dustin Howett -- Logos lexer +* Ivan Inozemtsev -- Fantom lexer +* Hiroaki Itoh -- Shell console rewrite, Lexers for PowerShell session, + MSDOS session, BC, WDiff +* Brian R. Jackson -- Tea lexer +* Alex Jeffery, ChromaWay AB -- Rell lexer +* Christian Jann -- ShellSession lexer +* Jonas Camillus Jeppesen -- Line numbers and line highlighting for + RTF-formatter +* Dennis Kaarsemaker -- sources.list lexer +* Dmitri Kabak -- Inferno Limbo lexer +* Igor Kalnitsky -- vhdl lexer +* Colin Kennedy - USD lexer +* Alexander Kit -- MaskJS lexer +* Pekka Klärck -- Robot Framework lexer +* Gerwin Klein -- Isabelle lexer +* Eric Knibbe -- Lasso lexer +* Stepan Koltsov -- Clay lexer +* Oliver Kopp - Friendly grayscale style +* Adam Koprowski -- Opa lexer +* Benjamin Kowarsch -- Modula-2 lexer +* Domen Kožar -- Nix lexer +* Oleh Krekel -- Emacs Lisp lexer +* Alexander Kriegisch -- Kconfig and AspectJ lexers +* Marek Kubica -- Scheme lexer +* Jochen Kupperschmidt -- Markdown processor +* Gerd Kurzbach -- Modelica lexer +* Jon Larimer, Google Inc. -- Smali lexer +* Olov Lassus -- Dart lexer +* Matt Layman -- TAP lexer +* Dan Lazin, Google LLC -- GoogleSQL lexer +* Kristian Lyngstøl -- Varnish lexers +* Sylvestre Ledru -- Scilab lexer +* Chee Sing Lee -- Flatline lexer +* Mark Lee -- Vala lexer +* Thomas Linder Puls -- Visual Prolog lexer +* Pete Lomax -- Phix lexer +* Valentin Lorentz -- C++ lexer improvements +* Ben Mabey -- Gherkin lexer +* Angus MacArthur -- QML lexer +* Louis Mandel -- X10 lexer +* Louis Marchand -- Eiffel lexer +* Simone Margaritelli -- Hybris lexer +* Tim Martin - World of Warcraft TOC lexer +* Kirk McDonald -- D lexer +* Gordon McGregor -- SystemVerilog lexer +* Stephen McKamey -- Duel/JBST lexer +* Brian McKenna -- F# lexer +* Charles McLaughlin -- Puppet lexer +* Kurt McKee -- Tera Term macro lexer, PostgreSQL updates, MySQL overhaul, JSON lexer +* Joe Eli McIlvain -- Savi lexer +* Lukas Meuser -- BBCode formatter, Lua lexer +* Cat Miller -- Pig lexer +* Paul Miller -- LiveScript lexer +* Hong Minhee -- HTTP lexer +* Michael Mior -- Awk lexer +* Bruce Mitchener -- Dylan lexer rewrite +* Reuben Morais -- SourcePawn lexer +* Jon Morton -- Rust lexer +* Paulo Moura -- Logtalk lexer +* Mher Movsisyan -- DTD lexer +* Dejan Muhamedagic -- Crmsh lexer +* Adrien Nayrat -- PostgreSQL Explain lexer +* Ana Nelson -- Ragel, ANTLR, R console lexers +* David Neto, Google LLC -- WebGPU Shading Language lexer +* Kurt Neufeld -- Markdown lexer +* Nam T. Nguyen -- Monokai style +* Jesper Noehr -- HTML formatter "anchorlinenos" +* Mike Nolta -- Julia lexer +* Avery Nortonsmith -- Pointless lexer +* Jonas Obrist -- BBCode lexer +* Edward O'Callaghan -- Cryptol lexer +* David Oliva -- Rebol lexer +* Pat Pannuto -- nesC lexer +* Jon Parise -- Protocol buffers and Thrift lexers +* Benjamin Peterson -- Test suite refactoring +* Ronny Pfannschmidt -- BBCode lexer +* Dominik Picheta -- Nimrod lexer +* Andrew Pinkham -- RTF Formatter Refactoring +* Clément Prévost -- UrbiScript lexer +* Tanner Prynn -- cmdline -x option and loading lexers from files +* Oleh Prypin -- Crystal lexer (based on Ruby lexer) +* Nick Psaris -- K and Q lexers +* Xidorn Quan -- Web IDL lexer +* Elias Rabel -- Fortran fixed form lexer +* raichoo -- Idris lexer +* Daniel Ramirez -- GDScript lexer +* Kashif Rasul -- CUDA lexer +* Nathan Reed -- HLSL lexer +* Justin Reidy -- MXML lexer +* Jonathon Reinhart, Google LLC -- Soong lexer +* Norman Richards -- JSON lexer +* Corey Richardson -- Rust lexer updates +* Fabrizio Riguzzi -- cplint leder +* Lubomir Rintel -- GoodData MAQL and CL lexers +* Andre Roberge -- Tango style +* Georg Rollinger -- HSAIL lexer +* Michiel Roos -- TypoScript lexer +* Konrad Rudolph -- LaTeX formatter enhancements +* Mario Ruggier -- Evoque lexers +* Miikka Salminen -- Lovelace style, Hexdump lexer, lexer enhancements +* Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers +* Matteo Sasso -- Common Lisp lexer +* Joe Schafer -- Ada lexer +* Max Schillinger -- TiddlyWiki5 lexer +* Andrew Schmidt -- X++ lexer +* Ken Schutte -- Matlab lexers +* René Schwaiger -- Rainbow Dash style +* Sebastian Schweizer -- Whiley lexer +* Tassilo Schweyer -- Io, MOOCode lexers +* Pablo Seminario -- PromQL lexer +* Ted Shaw -- AutoIt lexer +* Joerg Sieker -- ABAP lexer +* Robert Simmons -- Standard ML lexer +* Kirill Simonov -- YAML lexer +* Corbin Simpson -- Monte lexer +* Ville Skyttä -- ASCII armored lexer +* Alexander Smishlajev -- Visual FoxPro lexer +* Steve Spigarelli -- XQuery lexer +* Jerome St-Louis -- eC lexer +* Camil Staps -- Clean and NuSMV lexers; Solarized style +* James Strachan -- Kotlin lexer +* Tom Stuart -- Treetop lexer +* Colin Sullivan -- SuperCollider lexer +* Ben Swift -- Extempore lexer +* tatt61880 -- Kuin lexer +* Edoardo Tenani -- Arduino lexer +* Tiberius Teng -- default style overhaul +* Jeremy Thurgood -- Erlang, Squid config lexers +* Brian Tiffin -- OpenCOBOL lexer +* Bob Tolbert -- Hy lexer +* Doug Torrance -- Macaulay2 lexer +* Matthias Trute -- Forth lexer +* Tuoa Spi T4 -- Bdd lexer +* Erick Tryzelaar -- Felix lexer +* Alexander Udalov -- Kotlin lexer improvements +* Thomas Van Doren -- Chapel lexer +* Dave Van Ee -- Uxntal lexer updates +* Daniele Varrazzo -- PostgreSQL lexers +* Abe Voelker -- OpenEdge ABL lexer +* Pepijn de Vos -- HTML formatter CTags support +* Matthias Vallentin -- Bro lexer +* Benoît Vinot -- AMPL lexer +* Linh Vu Hong -- RSL lexer +* Taavi Väänänen -- Debian control, PHP lexers +* Immanuel Washington -- Smithy lexer +* Nathan Weizenbaum -- Haml and Sass lexers +* Nathan Whetsell -- Csound lexers +* Dietmar Winkler -- Modelica lexer +* Nils Winter -- Smalltalk lexer +* Davy Wybiral -- Clojure lexer +* Whitney Young -- ObjectiveC lexer +* Diego Zamboni -- CFengine3 lexer +* Enrique Zamudio -- Ceylon lexer +* Alex Zimin -- Nemerle lexer +* Rob Zimmerman -- Kal lexer +* Evgenii Zheltonozhskii -- Maple lexer +* Vincent Zurczak -- Roboconf lexer +* Hubert Gruniaux -- C and C++ lexer improvements +* Thomas Symalla -- AMDGPU Lexer +* 15b3 -- Image Formatter improvements +* Fabian Neumann -- CDDL lexer +* Thomas Duboucher -- CDDL lexer +* Philipp Imhof -- Pango Markup formatter +* Thomas Voss -- Sed lexer +* Martin Fischer -- WCAG contrast testing +* Marc Auberer -- Spice lexer +* Amr Hesham -- Carbon lexer +* diskdance -- Wikitext lexer +* vanillajonathan -- PRQL lexer +* Nikolay Antipov -- OpenSCAD lexer +* Markus Meyer, Nextron Systems -- YARA lexer +* Hannes Römer -- Mojo lexer +* Jan Frederik Schaefer -- PDDL lexer + +Many thanks for all contributions! diff --git a/python/user_packages/Python313/site-packages/pygments-2.20.0.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/pygments-2.20.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..446a1a805c8a949579fb8a9799f2bec7777349dc --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments-2.20.0.dist-info/licenses/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2006-2022 by the respective authors (see AUTHORS file). +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/python/user_packages/Python313/site-packages/pygments/filters/__init__.py b/python/user_packages/Python313/site-packages/pygments/filters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c7ba6adb5b75ac3bf8e9e94868575e6ce770e6c1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments/filters/__init__.py @@ -0,0 +1,942 @@ +""" + pygments.filters + ~~~~~~~~~~~~~~~~ + + Module containing filter lookup functions and default + filters. + + :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.token import String, Comment, Keyword, Name, Error, Whitespace, \ + string_to_tokentype +from pygments.filter import Filter +from pygments.util import get_list_opt, get_int_opt, get_bool_opt, \ + get_choice_opt, ClassNotFound, OptionError +from pygments.plugin import find_plugin_filters + + +def find_filter_class(filtername): + """Lookup a filter by name. Return None if not found.""" + if filtername in FILTERS: + return FILTERS[filtername] + for name, cls in find_plugin_filters(): + if name == filtername: + return cls + return None + + +def get_filter_by_name(filtername, **options): + """Return an instantiated filter. + + Options are passed to the filter initializer if wanted. + Raise a ClassNotFound if not found. + """ + cls = find_filter_class(filtername) + if cls: + return cls(**options) + else: + raise ClassNotFound(f'filter {filtername!r} not found') + + +def get_all_filters(): + """Return a generator of all filter names.""" + yield from FILTERS + for name, _ in find_plugin_filters(): + yield name + + +def _replace_special(ttype, value, regex, specialttype, + replacefunc=lambda x: x): + last = 0 + for match in regex.finditer(value): + start, end = match.start(), match.end() + if start != last: + yield ttype, value[last:start] + yield specialttype, replacefunc(value[start:end]) + last = end + if last != len(value): + yield ttype, value[last:] + + +class CodeTagFilter(Filter): + """Highlight special code tags in comments and docstrings. + + Options accepted: + + `codetags` : list of strings + A list of strings that are flagged as code tags. The default is to + highlight ``XXX``, ``TODO``, ``FIXME``, ``BUG`` and ``NOTE``. + + .. versionchanged:: 2.13 + Now recognizes ``FIXME`` by default. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + tags = get_list_opt(options, 'codetags', + ['XXX', 'TODO', 'FIXME', 'BUG', 'NOTE']) + self.tag_re = re.compile(r'\b({})\b'.format('|'.join([ + re.escape(tag) for tag in tags if tag + ]))) + + def filter(self, lexer, stream): + regex = self.tag_re + for ttype, value in stream: + if ttype in String.Doc or \ + ttype in Comment and \ + ttype not in Comment.Preproc: + yield from _replace_special(ttype, value, regex, Comment.Special) + else: + yield ttype, value + + +class SymbolFilter(Filter): + """Convert mathematical symbols into Unicode characters. + + Examples are ``\\`` in Isabelle or + ``\\longrightarrow`` in LaTeX. + + This is mostly useful for HTML or console output when you want to + approximate the source rendering you'd see in an IDE. + + Options accepted: + + `lang` : string + The symbol language. Must be one of ``'isabelle'`` or + ``'latex'``. The default is ``'isabelle'``. + """ + + latex_symbols = { + '\\alpha' : '\U000003b1', + '\\beta' : '\U000003b2', + '\\gamma' : '\U000003b3', + '\\delta' : '\U000003b4', + '\\varepsilon' : '\U000003b5', + '\\zeta' : '\U000003b6', + '\\eta' : '\U000003b7', + '\\vartheta' : '\U000003b8', + '\\iota' : '\U000003b9', + '\\kappa' : '\U000003ba', + '\\lambda' : '\U000003bb', + '\\mu' : '\U000003bc', + '\\nu' : '\U000003bd', + '\\xi' : '\U000003be', + '\\pi' : '\U000003c0', + '\\varrho' : '\U000003c1', + '\\sigma' : '\U000003c3', + '\\tau' : '\U000003c4', + '\\upsilon' : '\U000003c5', + '\\varphi' : '\U000003c6', + '\\chi' : '\U000003c7', + '\\psi' : '\U000003c8', + '\\omega' : '\U000003c9', + '\\Gamma' : '\U00000393', + '\\Delta' : '\U00000394', + '\\Theta' : '\U00000398', + '\\Lambda' : '\U0000039b', + '\\Xi' : '\U0000039e', + '\\Pi' : '\U000003a0', + '\\Sigma' : '\U000003a3', + '\\Upsilon' : '\U000003a5', + '\\Phi' : '\U000003a6', + '\\Psi' : '\U000003a8', + '\\Omega' : '\U000003a9', + '\\leftarrow' : '\U00002190', + '\\longleftarrow' : '\U000027f5', + '\\rightarrow' : '\U00002192', + '\\longrightarrow' : '\U000027f6', + '\\Leftarrow' : '\U000021d0', + '\\Longleftarrow' : '\U000027f8', + '\\Rightarrow' : '\U000021d2', + '\\Longrightarrow' : '\U000027f9', + '\\leftrightarrow' : '\U00002194', + '\\longleftrightarrow' : '\U000027f7', + '\\Leftrightarrow' : '\U000021d4', + '\\Longleftrightarrow' : '\U000027fa', + '\\mapsto' : '\U000021a6', + '\\longmapsto' : '\U000027fc', + '\\relbar' : '\U00002500', + '\\Relbar' : '\U00002550', + '\\hookleftarrow' : '\U000021a9', + '\\hookrightarrow' : '\U000021aa', + '\\leftharpoondown' : '\U000021bd', + '\\rightharpoondown' : '\U000021c1', + '\\leftharpoonup' : '\U000021bc', + '\\rightharpoonup' : '\U000021c0', + '\\rightleftharpoons' : '\U000021cc', + '\\leadsto' : '\U0000219d', + '\\downharpoonleft' : '\U000021c3', + '\\downharpoonright' : '\U000021c2', + '\\upharpoonleft' : '\U000021bf', + '\\upharpoonright' : '\U000021be', + '\\restriction' : '\U000021be', + '\\uparrow' : '\U00002191', + '\\Uparrow' : '\U000021d1', + '\\downarrow' : '\U00002193', + '\\Downarrow' : '\U000021d3', + '\\updownarrow' : '\U00002195', + '\\Updownarrow' : '\U000021d5', + '\\langle' : '\U000027e8', + '\\rangle' : '\U000027e9', + '\\lceil' : '\U00002308', + '\\rceil' : '\U00002309', + '\\lfloor' : '\U0000230a', + '\\rfloor' : '\U0000230b', + '\\flqq' : '\U000000ab', + '\\frqq' : '\U000000bb', + '\\bot' : '\U000022a5', + '\\top' : '\U000022a4', + '\\wedge' : '\U00002227', + '\\bigwedge' : '\U000022c0', + '\\vee' : '\U00002228', + '\\bigvee' : '\U000022c1', + '\\forall' : '\U00002200', + '\\exists' : '\U00002203', + '\\nexists' : '\U00002204', + '\\neg' : '\U000000ac', + '\\Box' : '\U000025a1', + '\\Diamond' : '\U000025c7', + '\\vdash' : '\U000022a2', + '\\models' : '\U000022a8', + '\\dashv' : '\U000022a3', + '\\surd' : '\U0000221a', + '\\le' : '\U00002264', + '\\ge' : '\U00002265', + '\\ll' : '\U0000226a', + '\\gg' : '\U0000226b', + '\\lesssim' : '\U00002272', + '\\gtrsim' : '\U00002273', + '\\lessapprox' : '\U00002a85', + '\\gtrapprox' : '\U00002a86', + '\\in' : '\U00002208', + '\\notin' : '\U00002209', + '\\subset' : '\U00002282', + '\\supset' : '\U00002283', + '\\subseteq' : '\U00002286', + '\\supseteq' : '\U00002287', + '\\sqsubset' : '\U0000228f', + '\\sqsupset' : '\U00002290', + '\\sqsubseteq' : '\U00002291', + '\\sqsupseteq' : '\U00002292', + '\\cap' : '\U00002229', + '\\bigcap' : '\U000022c2', + '\\cup' : '\U0000222a', + '\\bigcup' : '\U000022c3', + '\\sqcup' : '\U00002294', + '\\bigsqcup' : '\U00002a06', + '\\sqcap' : '\U00002293', + '\\Bigsqcap' : '\U00002a05', + '\\setminus' : '\U00002216', + '\\propto' : '\U0000221d', + '\\uplus' : '\U0000228e', + '\\bigplus' : '\U00002a04', + '\\sim' : '\U0000223c', + '\\doteq' : '\U00002250', + '\\simeq' : '\U00002243', + '\\approx' : '\U00002248', + '\\asymp' : '\U0000224d', + '\\cong' : '\U00002245', + '\\equiv' : '\U00002261', + '\\Join' : '\U000022c8', + '\\bowtie' : '\U00002a1d', + '\\prec' : '\U0000227a', + '\\succ' : '\U0000227b', + '\\preceq' : '\U0000227c', + '\\succeq' : '\U0000227d', + '\\parallel' : '\U00002225', + '\\mid' : '\U000000a6', + '\\pm' : '\U000000b1', + '\\mp' : '\U00002213', + '\\times' : '\U000000d7', + '\\div' : '\U000000f7', + '\\cdot' : '\U000022c5', + '\\star' : '\U000022c6', + '\\circ' : '\U00002218', + '\\dagger' : '\U00002020', + '\\ddagger' : '\U00002021', + '\\lhd' : '\U000022b2', + '\\rhd' : '\U000022b3', + '\\unlhd' : '\U000022b4', + '\\unrhd' : '\U000022b5', + '\\triangleleft' : '\U000025c3', + '\\triangleright' : '\U000025b9', + '\\triangle' : '\U000025b3', + '\\triangleq' : '\U0000225c', + '\\oplus' : '\U00002295', + '\\bigoplus' : '\U00002a01', + '\\otimes' : '\U00002297', + '\\bigotimes' : '\U00002a02', + '\\odot' : '\U00002299', + '\\bigodot' : '\U00002a00', + '\\ominus' : '\U00002296', + '\\oslash' : '\U00002298', + '\\dots' : '\U00002026', + '\\cdots' : '\U000022ef', + '\\sum' : '\U00002211', + '\\prod' : '\U0000220f', + '\\coprod' : '\U00002210', + '\\infty' : '\U0000221e', + '\\int' : '\U0000222b', + '\\oint' : '\U0000222e', + '\\clubsuit' : '\U00002663', + '\\diamondsuit' : '\U00002662', + '\\heartsuit' : '\U00002661', + '\\spadesuit' : '\U00002660', + '\\aleph' : '\U00002135', + '\\emptyset' : '\U00002205', + '\\nabla' : '\U00002207', + '\\partial' : '\U00002202', + '\\flat' : '\U0000266d', + '\\natural' : '\U0000266e', + '\\sharp' : '\U0000266f', + '\\angle' : '\U00002220', + '\\copyright' : '\U000000a9', + '\\textregistered' : '\U000000ae', + '\\textonequarter' : '\U000000bc', + '\\textonehalf' : '\U000000bd', + '\\textthreequarters' : '\U000000be', + '\\textordfeminine' : '\U000000aa', + '\\textordmasculine' : '\U000000ba', + '\\euro' : '\U000020ac', + '\\pounds' : '\U000000a3', + '\\yen' : '\U000000a5', + '\\textcent' : '\U000000a2', + '\\textcurrency' : '\U000000a4', + '\\textdegree' : '\U000000b0', + } + + isabelle_symbols = { + '\\' : '\U0001d7ec', + '\\' : '\U0001d7ed', + '\\' : '\U0001d7ee', + '\\' : '\U0001d7ef', + '\\' : '\U0001d7f0', + '\\' : '\U0001d7f1', + '\\' : '\U0001d7f2', + '\\' : '\U0001d7f3', + '\\' : '\U0001d7f4', + '\\' : '\U0001d7f5', + '\\
' : '\U0001d49c', + '\\' : '\U0000212c', + '\\' : '\U0001d49e', + '\\' : '\U0001d49f', + '\\' : '\U00002130', + '\\' : '\U00002131', + '\\' : '\U0001d4a2', + '\\' : '\U0000210b', + '\\' : '\U00002110', + '\\' : '\U0001d4a5', + '\\' : '\U0001d4a6', + '\\' : '\U00002112', + '\\' : '\U00002133', + '\\' : '\U0001d4a9', + '\\' : '\U0001d4aa', + '\\

' : '\U0001d5c9', + '\\' : '\U0001d5ca', + '\\' : '\U0001d5cb', + '\\' : '\U0001d5cc', + '\\' : '\U0001d5cd', + '\\' : '\U0001d5ce', + '\\' : '\U0001d5cf', + '\\' : '\U0001d5d0', + '\\' : '\U0001d5d1', + '\\' : '\U0001d5d2', + '\\' : '\U0001d5d3', + '\\' : '\U0001d504', + '\\' : '\U0001d505', + '\\' : '\U0000212d', + '\\

' : '\U0001d507', + '\\' : '\U0001d508', + '\\' : '\U0001d509', + '\\' : '\U0001d50a', + '\\' : '\U0000210c', + '\\' : '\U00002111', + '\\' : '\U0001d50d', + '\\' : '\U0001d50e', + '\\' : '\U0001d50f', + '\\' : '\U0001d510', + '\\' : '\U0001d511', + '\\' : '\U0001d512', + '\\' : '\U0001d513', + '\\' : '\U0001d514', + '\\' : '\U0000211c', + '\\' : '\U0001d516', + '\\' : '\U0001d517', + '\\' : '\U0001d518', + '\\' : '\U0001d519', + '\\' : '\U0001d51a', + '\\' : '\U0001d51b', + '\\' : '\U0001d51c', + '\\' : '\U00002128', + '\\' : '\U0001d51e', + '\\' : '\U0001d51f', + '\\' : '\U0001d520', + '\\
' : '\U0001d521', + '\\' : '\U0001d522', + '\\' : '\U0001d523', + '\\' : '\U0001d524', + '\\' : '\U0001d525', + '\\' : '\U0001d526', + '\\' : '\U0001d527', + '\\' : '\U0001d528', + '\\' : '\U0001d529', + '\\' : '\U0001d52a', + '\\' : '\U0001d52b', + '\\' : '\U0001d52c', + '\\' : '\U0001d52d', + '\\' : '\U0001d52e', + '\\' : '\U0001d52f', + '\\' : '\U0001d530', + '\\' : '\U0001d531', + '\\' : '\U0001d532', + '\\' : '\U0001d533', + '\\' : '\U0001d534', + '\\' : '\U0001d535', + '\\' : '\U0001d536', + '\\' : '\U0001d537', + '\\' : '\U000003b1', + '\\' : '\U000003b2', + '\\' : '\U000003b3', + '\\' : '\U000003b4', + '\\' : '\U000003b5', + '\\' : '\U000003b6', + '\\' : '\U000003b7', + '\\' : '\U000003b8', + '\\' : '\U000003b9', + '\\' : '\U000003ba', + '\\' : '\U000003bb', + '\\' : '\U000003bc', + '\\' : '\U000003bd', + '\\' : '\U000003be', + '\\' : '\U000003c0', + '\\' : '\U000003c1', + '\\' : '\U000003c3', + '\\' : '\U000003c4', + '\\' : '\U000003c5', + '\\' : '\U000003c6', + '\\' : '\U000003c7', + '\\' : '\U000003c8', + '\\' : '\U000003c9', + '\\' : '\U00000393', + '\\' : '\U00000394', + '\\' : '\U00000398', + '\\' : '\U0000039b', + '\\' : '\U0000039e', + '\\' : '\U000003a0', + '\\' : '\U000003a3', + '\\' : '\U000003a5', + '\\' : '\U000003a6', + '\\' : '\U000003a8', + '\\' : '\U000003a9', + '\\' : '\U0001d539', + '\\' : '\U00002102', + '\\' : '\U00002115', + '\\' : '\U0000211a', + '\\' : '\U0000211d', + '\\' : '\U00002124', + '\\' : '\U00002190', + '\\' : '\U000027f5', + '\\' : '\U00002192', + '\\' : '\U000027f6', + '\\' : '\U000021d0', + '\\' : '\U000027f8', + '\\' : '\U000021d2', + '\\' : '\U000027f9', + '\\' : '\U00002194', + '\\' : '\U000027f7', + '\\' : '\U000021d4', + '\\' : '\U000027fa', + '\\' : '\U000021a6', + '\\' : '\U000027fc', + '\\' : '\U00002500', + '\\' : '\U00002550', + '\\' : '\U000021a9', + '\\' : '\U000021aa', + '\\' : '\U000021bd', + '\\' : '\U000021c1', + '\\' : '\U000021bc', + '\\' : '\U000021c0', + '\\' : '\U000021cc', + '\\' : '\U0000219d', + '\\' : '\U000021c3', + '\\' : '\U000021c2', + '\\' : '\U000021bf', + '\\' : '\U000021be', + '\\' : '\U000021be', + '\\' : '\U00002237', + '\\' : '\U00002191', + '\\' : '\U000021d1', + '\\' : '\U00002193', + '\\' : '\U000021d3', + '\\' : '\U00002195', + '\\' : '\U000021d5', + '\\' : '\U000027e8', + '\\' : '\U000027e9', + '\\' : '\U00002308', + '\\' : '\U00002309', + '\\' : '\U0000230a', + '\\' : '\U0000230b', + '\\' : '\U00002987', + '\\' : '\U00002988', + '\\' : '\U000027e6', + '\\' : '\U000027e7', + '\\' : '\U00002983', + '\\' : '\U00002984', + '\\' : '\U000000ab', + '\\' : '\U000000bb', + '\\' : '\U000022a5', + '\\' : '\U000022a4', + '\\' : '\U00002227', + '\\' : '\U000022c0', + '\\' : '\U00002228', + '\\' : '\U000022c1', + '\\' : '\U00002200', + '\\' : '\U00002203', + '\\' : '\U00002204', + '\\' : '\U000000ac', + '\\' : '\U000025a1', + '\\' : '\U000025c7', + '\\' : '\U000022a2', + '\\' : '\U000022a8', + '\\' : '\U000022a9', + '\\' : '\U000022ab', + '\\' : '\U000022a3', + '\\' : '\U0000221a', + '\\' : '\U00002264', + '\\' : '\U00002265', + '\\' : '\U0000226a', + '\\' : '\U0000226b', + '\\' : '\U00002272', + '\\' : '\U00002273', + '\\' : '\U00002a85', + '\\' : '\U00002a86', + '\\' : '\U00002208', + '\\' : '\U00002209', + '\\' : '\U00002282', + '\\' : '\U00002283', + '\\' : '\U00002286', + '\\' : '\U00002287', + '\\' : '\U0000228f', + '\\' : '\U00002290', + '\\' : '\U00002291', + '\\' : '\U00002292', + '\\' : '\U00002229', + '\\' : '\U000022c2', + '\\' : '\U0000222a', + '\\' : '\U000022c3', + '\\' : '\U00002294', + '\\' : '\U00002a06', + '\\' : '\U00002293', + '\\' : '\U00002a05', + '\\' : '\U00002216', + '\\' : '\U0000221d', + '\\' : '\U0000228e', + '\\' : '\U00002a04', + '\\' : '\U00002260', + '\\' : '\U0000223c', + '\\' : '\U00002250', + '\\' : '\U00002243', + '\\' : '\U00002248', + '\\' : '\U0000224d', + '\\' : '\U00002245', + '\\' : '\U00002323', + '\\' : '\U00002261', + '\\' : '\U00002322', + '\\' : '\U000022c8', + '\\' : '\U00002a1d', + '\\' : '\U0000227a', + '\\' : '\U0000227b', + '\\' : '\U0000227c', + '\\' : '\U0000227d', + '\\' : '\U00002225', + '\\' : '\U000000a6', + '\\' : '\U000000b1', + '\\' : '\U00002213', + '\\' : '\U000000d7', + '\\
' : '\U000000f7', + '\\' : '\U000022c5', + '\\' : '\U000022c6', + '\\' : '\U00002219', + '\\' : '\U00002218', + '\\' : '\U00002020', + '\\' : '\U00002021', + '\\' : '\U000022b2', + '\\' : '\U000022b3', + '\\' : '\U000022b4', + '\\' : '\U000022b5', + '\\' : '\U000025c3', + '\\' : '\U000025b9', + '\\' : '\U000025b3', + '\\' : '\U0000225c', + '\\' : '\U00002295', + '\\' : '\U00002a01', + '\\' : '\U00002297', + '\\' : '\U00002a02', + '\\' : '\U00002299', + '\\' : '\U00002a00', + '\\' : '\U00002296', + '\\' : '\U00002298', + '\\' : '\U00002026', + '\\' : '\U000022ef', + '\\' : '\U00002211', + '\\' : '\U0000220f', + '\\' : '\U00002210', + '\\' : '\U0000221e', + '\\' : '\U0000222b', + '\\' : '\U0000222e', + '\\' : '\U00002663', + '\\' : '\U00002662', + '\\' : '\U00002661', + '\\' : '\U00002660', + '\\' : '\U00002135', + '\\' : '\U00002205', + '\\' : '\U00002207', + '\\' : '\U00002202', + '\\' : '\U0000266d', + '\\' : '\U0000266e', + '\\' : '\U0000266f', + '\\' : '\U00002220', + '\\' : '\U000000a9', + '\\' : '\U000000ae', + '\\' : '\U000000ad', + '\\' : '\U000000af', + '\\' : '\U000000bc', + '\\' : '\U000000bd', + '\\' : '\U000000be', + '\\' : '\U000000aa', + '\\' : '\U000000ba', + '\\
' : '\U000000a7', + '\\' : '\U000000b6', + '\\' : '\U000000a1', + '\\' : '\U000000bf', + '\\' : '\U000020ac', + '\\' : '\U000000a3', + '\\' : '\U000000a5', + '\\' : '\U000000a2', + '\\' : '\U000000a4', + '\\' : '\U000000b0', + '\\' : '\U00002a3f', + '\\' : '\U00002127', + '\\' : '\U000025ca', + '\\' : '\U00002118', + '\\' : '\U00002240', + '\\' : '\U000022c4', + '\\' : '\U000000b4', + '\\' : '\U00000131', + '\\' : '\U000000a8', + '\\' : '\U000000b8', + '\\' : '\U000002dd', + '\\' : '\U000003f5', + '\\' : '\U000023ce', + '\\' : '\U00002039', + '\\' : '\U0000203a', + '\\' : '\U00002302', + '\\<^sub>' : '\U000021e9', + '\\<^sup>' : '\U000021e7', + '\\<^bold>' : '\U00002759', + '\\<^bsub>' : '\U000021d8', + '\\<^esub>' : '\U000021d9', + '\\<^bsup>' : '\U000021d7', + '\\<^esup>' : '\U000021d6', + } + + lang_map = {'isabelle' : isabelle_symbols, 'latex' : latex_symbols} + + def __init__(self, **options): + Filter.__init__(self, **options) + lang = get_choice_opt(options, 'lang', + ['isabelle', 'latex'], 'isabelle') + self.symbols = self.lang_map[lang] + + def filter(self, lexer, stream): + for ttype, value in stream: + if value in self.symbols: + yield ttype, self.symbols[value] + else: + yield ttype, value + + +class KeywordCaseFilter(Filter): + """Convert keywords to lowercase or uppercase or capitalize them. + + This means first letter uppercase, rest lowercase. + + This can be useful e.g. if you highlight Pascal code and want to adapt the + code to your styleguide. + + Options accepted: + + `case` : string + The casing to convert keywords to. Must be one of ``'lower'``, + ``'upper'`` or ``'capitalize'``. The default is ``'lower'``. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + case = get_choice_opt(options, 'case', + ['lower', 'upper', 'capitalize'], 'lower') + self.convert = getattr(str, case) + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype in Keyword: + yield ttype, self.convert(value) + else: + yield ttype, value + + +class NameHighlightFilter(Filter): + """Highlight a normal Name (and Name.*) token with a different token type. + + Example:: + + filter = NameHighlightFilter( + names=['foo', 'bar', 'baz'], + tokentype=Name.Function, + ) + + This would highlight the names "foo", "bar" and "baz" + as functions. `Name.Function` is the default token type. + + Options accepted: + + `names` : list of strings + A list of names that should be given the different token type. + There is no default. + `tokentype` : TokenType or string + A token type or a string containing a token type name that is + used for highlighting the strings in `names`. The default is + `Name.Function`. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + self.names = set(get_list_opt(options, 'names', [])) + tokentype = options.get('tokentype') + if tokentype: + self.tokentype = string_to_tokentype(tokentype) + else: + self.tokentype = Name.Function + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype in Name and value in self.names: + yield self.tokentype, value + else: + yield ttype, value + + +class ErrorToken(Exception): + pass + + +class RaiseOnErrorTokenFilter(Filter): + """Raise an exception when the lexer generates an error token. + + Options accepted: + + `excclass` : Exception class + The exception class to raise. + The default is `pygments.filters.ErrorToken`. + + .. versionadded:: 0.8 + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + self.exception = options.get('excclass', ErrorToken) + try: + # issubclass() will raise TypeError if first argument is not a class + if not issubclass(self.exception, Exception): + raise TypeError + except TypeError: + raise OptionError('excclass option is not an exception class') + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype is Error: + raise self.exception(value) + yield ttype, value + + +class VisibleWhitespaceFilter(Filter): + """Convert tabs, newlines and/or spaces to visible characters. + + Options accepted: + + `spaces` : string or bool + If this is a one-character string, spaces will be replaces by this string. + If it is another true value, spaces will be replaced by ``·`` (unicode + MIDDLE DOT). If it is a false value, spaces will not be replaced. The + default is ``False``. + `tabs` : string or bool + The same as for `spaces`, but the default replacement character is ``»`` + (unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value + is ``False``. Note: this will not work if the `tabsize` option for the + lexer is nonzero, as tabs will already have been expanded then. + `tabsize` : int + If tabs are to be replaced by this filter (see the `tabs` option), this + is the total number of characters that a tab should be expanded to. + The default is ``8``. + `newlines` : string or bool + The same as for `spaces`, but the default replacement character is ``¶`` + (unicode PILCROW SIGN). The default value is ``False``. + `wstokentype` : bool + If true, give whitespace the special `Whitespace` token type. This allows + styling the visible whitespace differently (e.g. greyed out), but it can + disrupt background colors. The default is ``True``. + + .. versionadded:: 0.8 + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + for name, default in [('spaces', '·'), + ('tabs', '»'), + ('newlines', '¶')]: + opt = options.get(name, False) + if isinstance(opt, str) and len(opt) == 1: + setattr(self, name, opt) + else: + setattr(self, name, (opt and default or '')) + tabsize = get_int_opt(options, 'tabsize', 8) + if self.tabs: + self.tabs += ' ' * (tabsize - 1) + if self.newlines: + self.newlines += '\n' + self.wstt = get_bool_opt(options, 'wstokentype', True) + + def filter(self, lexer, stream): + if self.wstt: + spaces = self.spaces or ' ' + tabs = self.tabs or '\t' + newlines = self.newlines or '\n' + regex = re.compile(r'\s') + + def replacefunc(wschar): + if wschar == ' ': + return spaces + elif wschar == '\t': + return tabs + elif wschar == '\n': + return newlines + return wschar + + for ttype, value in stream: + yield from _replace_special(ttype, value, regex, Whitespace, + replacefunc) + else: + spaces, tabs, newlines = self.spaces, self.tabs, self.newlines + # simpler processing + for ttype, value in stream: + if spaces: + value = value.replace(' ', spaces) + if tabs: + value = value.replace('\t', tabs) + if newlines: + value = value.replace('\n', newlines) + yield ttype, value + + +class GobbleFilter(Filter): + """Gobble source code lines (eats initial characters). + + This filter drops the first ``n`` characters off every line of code. This + may be useful when the source code fed to the lexer is indented by a fixed + amount of space that isn't desired in the output. + + Options accepted: + + `n` : int + The number of characters to gobble. + + .. versionadded:: 1.2 + """ + def __init__(self, **options): + Filter.__init__(self, **options) + self.n = get_int_opt(options, 'n', 0) + + def gobble(self, value, left): + if left < len(value): + return value[left:], 0 + else: + return '', left - len(value) + + def filter(self, lexer, stream): + n = self.n + left = n # How many characters left to gobble. + for ttype, value in stream: + # Remove ``left`` tokens from first line, ``n`` from all others. + parts = value.split('\n') + (parts[0], left) = self.gobble(parts[0], left) + for i in range(1, len(parts)): + (parts[i], left) = self.gobble(parts[i], n) + value = '\n'.join(parts) + + if value != '': + yield ttype, value + + +class TokenMergeFilter(Filter): + """Merge consecutive tokens with the same token type in the output stream. + + .. versionadded:: 1.2 + """ + def __init__(self, **options): + Filter.__init__(self, **options) + + def filter(self, lexer, stream): + current_type = None + current_value = None + for ttype, value in stream: + if ttype is current_type: + current_value += value + else: + if current_type is not None: + yield current_type, current_value + current_type = ttype + current_value = value + if current_type is not None: + yield current_type, current_value + + +FILTERS = { + 'codetagify': CodeTagFilter, + 'keywordcase': KeywordCaseFilter, + 'highlight': NameHighlightFilter, + 'raiseonerror': RaiseOnErrorTokenFilter, + 'whitespace': VisibleWhitespaceFilter, + 'gobble': GobbleFilter, + 'tokenmerge': TokenMergeFilter, + 'symbols': SymbolFilter, +} diff --git a/python/user_packages/Python313/site-packages/pygments/formatters/__init__.py b/python/user_packages/Python313/site-packages/pygments/formatters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..829496dc97e147d159e106ddc12a49e8e416faf1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments/formatters/__init__.py @@ -0,0 +1,157 @@ +""" + pygments.formatters + ~~~~~~~~~~~~~~~~~~~ + + Pygments formatters. + + :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +import sys +import types +import fnmatch +from os.path import basename + +from pygments.formatters._mapping import FORMATTERS +from pygments.plugin import find_plugin_formatters +from pygments.util import ClassNotFound + +__all__ = ['get_formatter_by_name', 'get_formatter_for_filename', + 'get_all_formatters', 'load_formatter_from_file'] + list(FORMATTERS) + +_formatter_cache = {} # classes by name +_pattern_cache = {} + + +def _fn_matches(fn, glob): + """Return whether the supplied file name fn matches pattern filename.""" + if glob not in _pattern_cache: + pattern = _pattern_cache[glob] = re.compile(fnmatch.translate(glob)) + return pattern.match(fn) + return _pattern_cache[glob].match(fn) + + +def _load_formatters(module_name): + """Load a formatter (and all others in the module too).""" + mod = __import__(module_name, None, None, ['__all__']) + for formatter_name in mod.__all__: + cls = getattr(mod, formatter_name) + _formatter_cache[cls.name] = cls + + +def get_all_formatters(): + """Return a generator for all formatter classes.""" + # NB: this returns formatter classes, not info like get_all_lexers(). + for info in FORMATTERS.values(): + if info[1] not in _formatter_cache: + _load_formatters(info[0]) + yield _formatter_cache[info[1]] + for _, formatter in find_plugin_formatters(): + yield formatter + + +def find_formatter_class(alias): + """Lookup a formatter by alias. + + Returns None if not found. + """ + for module_name, name, aliases, _, _ in FORMATTERS.values(): + if alias in aliases: + if name not in _formatter_cache: + _load_formatters(module_name) + return _formatter_cache[name] + for _, cls in find_plugin_formatters(): + if alias in cls.aliases: + return cls + + +def get_formatter_by_name(_alias, **options): + """ + Return an instance of a :class:`.Formatter` subclass that has `alias` in its + aliases list. The formatter is given the `options` at its instantiation. + + Will raise :exc:`pygments.util.ClassNotFound` if no formatter with that + alias is found. + """ + cls = find_formatter_class(_alias) + if cls is None: + raise ClassNotFound(f"no formatter found for name {_alias!r}") + return cls(**options) + + +def load_formatter_from_file(filename, formattername="CustomFormatter", **options): + """ + Return a `Formatter` subclass instance loaded from the provided file, relative + to the current directory. + + The file is expected to contain a Formatter class named ``formattername`` + (by default, CustomFormatter). Users should be very careful with the input, because + this method is equivalent to running ``eval()`` on the input file. The formatter is + given the `options` at its instantiation. + + :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading + the formatter. + + .. versionadded:: 2.2 + """ + try: + # This empty dict will contain the namespace for the exec'd file + custom_namespace = {} + with open(filename, 'rb') as f: + exec(f.read(), custom_namespace) + # Retrieve the class `formattername` from that namespace + if formattername not in custom_namespace: + raise ClassNotFound(f'no valid {formattername} class found in {filename}') + formatter_class = custom_namespace[formattername] + # And finally instantiate it with the options + return formatter_class(**options) + except OSError as err: + raise ClassNotFound(f'cannot read {filename}: {err}') + except ClassNotFound: + raise + except Exception as err: + raise ClassNotFound(f'error when loading custom formatter: {err}') + + +def get_formatter_for_filename(fn, **options): + """ + Return a :class:`.Formatter` subclass instance that has a filename pattern + matching `fn`. The formatter is given the `options` at its instantiation. + + Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename + is found. + """ + fn = basename(fn) + for modname, name, _, filenames, _ in FORMATTERS.values(): + for filename in filenames: + if _fn_matches(fn, filename): + if name not in _formatter_cache: + _load_formatters(modname) + return _formatter_cache[name](**options) + for _name, cls in find_plugin_formatters(): + for filename in cls.filenames: + if _fn_matches(fn, filename): + return cls(**options) + raise ClassNotFound(f"no formatter found for file name {fn!r}") + + +class _automodule(types.ModuleType): + """Automatically import formatters.""" + + def __getattr__(self, name): + info = FORMATTERS.get(name) + if info: + _load_formatters(info[0]) + cls = _formatter_cache[info[1]] + setattr(self, name, cls) + return cls + raise AttributeError(name) + + +oldmod = sys.modules[__name__] +newmod = _automodule(__name__) +newmod.__dict__.update(oldmod.__dict__) +sys.modules[__name__] = newmod +del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types diff --git a/python/user_packages/Python313/site-packages/pygments/formatters/_mapping.py b/python/user_packages/Python313/site-packages/pygments/formatters/_mapping.py new file mode 100644 index 0000000000000000000000000000000000000000..72ca84040b626183e3328679db600c13472021be --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments/formatters/_mapping.py @@ -0,0 +1,23 @@ +# Automatically generated by scripts/gen_mapfiles.py. +# DO NOT EDIT BY HAND; run `tox -e mapfiles` instead. + +FORMATTERS = { + 'BBCodeFormatter': ('pygments.formatters.bbcode', 'BBCode', ('bbcode', 'bb'), (), 'Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.'), + 'BmpImageFormatter': ('pygments.formatters.img', 'img_bmp', ('bmp', 'bitmap'), ('*.bmp',), 'Create a bitmap image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'GifImageFormatter': ('pygments.formatters.img', 'img_gif', ('gif',), ('*.gif',), 'Create a GIF image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'GroffFormatter': ('pygments.formatters.groff', 'groff', ('groff', 'troff', 'roff'), (), 'Format tokens with groff escapes to change their color and font style.'), + 'HtmlFormatter': ('pygments.formatters.html', 'HTML', ('html',), ('*.html', '*.htm'), "Format tokens as HTML 4 ```` tags. By default, the content is enclosed in a ``
`` tag, itself wrapped in a ``
`` tag (but see the `nowrap` option). The ``
``'s CSS class can be set by the `cssclass` option."), + 'IRCFormatter': ('pygments.formatters.irc', 'IRC', ('irc', 'IRC'), (), 'Format tokens with IRC color sequences'), + 'ImageFormatter': ('pygments.formatters.img', 'img', ('img', 'IMG', 'png'), ('*.png',), 'Create a PNG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'JpgImageFormatter': ('pygments.formatters.img', 'img_jpg', ('jpg', 'jpeg'), ('*.jpg',), 'Create a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + 'LatexFormatter': ('pygments.formatters.latex', 'LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'), + 'NullFormatter': ('pygments.formatters.other', 'Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'), + 'PangoMarkupFormatter': ('pygments.formatters.pangomarkup', 'Pango Markup', ('pango', 'pangomarkup'), (), 'Format tokens as Pango Markup code. It can then be rendered to an SVG.'), + 'RawTokenFormatter': ('pygments.formatters.other', 'Raw tokens', ('raw', 'tokens'), ('*.raw',), 'Format tokens as a raw representation for storing token streams.'), + 'RtfFormatter': ('pygments.formatters.rtf', 'RTF', ('rtf',), ('*.rtf',), 'Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents.'), + 'SvgFormatter': ('pygments.formatters.svg', 'SVG', ('svg',), ('*.svg',), 'Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ```` element with explicit ``x`` and ``y`` coordinates containing ```` elements with the individual token styles.'), + 'Terminal256Formatter': ('pygments.formatters.terminal256', 'Terminal256', ('terminal256', 'console256', '256'), (), 'Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), + 'TerminalFormatter': ('pygments.formatters.terminal', 'Terminal', ('terminal', 'console'), (), 'Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.'), + 'TerminalTrueColorFormatter': ('pygments.formatters.terminal256', 'TerminalTrueColor', ('terminal16m', 'console16m', '16m'), (), 'Format tokens with ANSI color sequences, for output in a true-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), + 'TestcaseFormatter': ('pygments.formatters.other', 'Testcase', ('testcase',), (), 'Format tokens as appropriate for a new testcase.'), +} diff --git a/python/user_packages/Python313/site-packages/pygments/formatters/bbcode.py b/python/user_packages/Python313/site-packages/pygments/formatters/bbcode.py new file mode 100644 index 0000000000000000000000000000000000000000..90d8d806f202e9dff22e33c431f3e35cefdd6642 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments/formatters/bbcode.py @@ -0,0 +1,108 @@ +""" + pygments.formatters.bbcode + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + BBcode formatter. + + :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + + +from pygments.formatter import Formatter +from pygments.util import get_bool_opt + +__all__ = ['BBCodeFormatter'] + + +class BBCodeFormatter(Formatter): + """ + Format tokens with BBcodes. These formatting codes are used by many + bulletin boards, so you can highlight your sourcecode with pygments before + posting it there. + + This formatter has no support for background colors and borders, as there + are no common BBcode tags for that. + + Some board systems (e.g. phpBB) don't support colors in their [code] tag, + so you can't use the highlighting together with that tag. + Text in a [code] tag usually is shown with a monospace font (which this + formatter can do with the ``monofont`` option) and no spaces (which you + need for indentation) are removed. + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `codetag` + If set to true, put the output into ``[code]`` tags (default: + ``false``) + + `monofont` + If set to true, add a tag to show the code with a monospace font + (default: ``false``). + """ + name = 'BBCode' + aliases = ['bbcode', 'bb'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + self._code = get_bool_opt(options, 'codetag', False) + self._mono = get_bool_opt(options, 'monofont', False) + + self.styles = {} + self._make_styles() + + def _make_styles(self): + for ttype, ndef in self.style: + start = end = '' + if ndef['color']: + start += '[color=#{}]'.format(ndef['color']) + end = '[/color]' + end + if ndef['bold']: + start += '[b]' + end = '[/b]' + end + if ndef['italic']: + start += '[i]' + end = '[/i]' + end + if ndef['underline']: + start += '[u]' + end = '[/u]' + end + # there are no common BBcodes for background-color and border + + self.styles[ttype] = start, end + + def format_unencoded(self, tokensource, outfile): + if self._code: + outfile.write('[code]') + if self._mono: + outfile.write('[font=monospace]') + + lastval = '' + lasttype = None + + for ttype, value in tokensource: + while ttype not in self.styles: + ttype = ttype.parent + if ttype == lasttype: + lastval += value + else: + if lastval: + start, end = self.styles[lasttype] + outfile.write(''.join((start, lastval, end))) + lastval = value + lasttype = ttype + + if lastval: + start, end = self.styles[lasttype] + outfile.write(''.join((start, lastval, end))) + + if self._mono: + outfile.write('[/font]') + if self._code: + outfile.write('[/code]') + if self._code or self._mono: + outfile.write('\n') diff --git a/python/user_packages/Python313/site-packages/pygments/formatters/groff.py b/python/user_packages/Python313/site-packages/pygments/formatters/groff.py new file mode 100644 index 0000000000000000000000000000000000000000..f5d3146b45b0103dbad53aa2822757b8102d1c42 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments/formatters/groff.py @@ -0,0 +1,170 @@ +""" + pygments.formatters.groff + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for groff output. + + :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import math +from pygments.formatter import Formatter +from pygments.util import get_bool_opt, get_int_opt + +__all__ = ['GroffFormatter'] + + +class GroffFormatter(Formatter): + """ + Format tokens with groff escapes to change their color and font style. + + .. versionadded:: 2.11 + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `monospaced` + If set to true, monospace font will be used (default: ``true``). + + `linenos` + If set to true, print the line numbers (default: ``false``). + + `wrap` + Wrap lines to the specified number of characters. Disabled if set to 0 + (default: ``0``). + """ + + name = 'groff' + aliases = ['groff','troff','roff'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + + self.monospaced = get_bool_opt(options, 'monospaced', True) + self.linenos = get_bool_opt(options, 'linenos', False) + self._lineno = 0 + self.wrap = get_int_opt(options, 'wrap', 0) + self._linelen = 0 + + self.styles = {} + self._make_styles() + + + def _make_styles(self): + regular = '\\f[CR]' if self.monospaced else '\\f[R]' + bold = '\\f[CB]' if self.monospaced else '\\f[B]' + italic = '\\f[CI]' if self.monospaced else '\\f[I]' + + for ttype, ndef in self.style: + start = end = '' + if ndef['color']: + start += '\\m[{}]'.format(ndef['color']) + end = '\\m[]' + end + if ndef['bold']: + start += bold + end = regular + end + if ndef['italic']: + start += italic + end = regular + end + if ndef['bgcolor']: + start += '\\M[{}]'.format(ndef['bgcolor']) + end = '\\M[]' + end + + self.styles[ttype] = start, end + + + def _define_colors(self, outfile): + colors = set() + for _, ndef in self.style: + if ndef['color'] is not None: + colors.add(ndef['color']) + + for color in sorted(colors): + outfile.write('.defcolor ' + color + ' rgb #' + color + '\n') + + + def _write_lineno(self, outfile): + self._lineno += 1 + outfile.write("%s% 4d " % (self._lineno != 1 and '\n' or '', self._lineno)) + + + def _wrap_line(self, line): + length = len(line.rstrip('\n')) + space = ' ' if self.linenos else '' + newline = '' + + if length > self.wrap: + for i in range(0, math.floor(length / self.wrap)): + chunk = line[i*self.wrap:i*self.wrap+self.wrap] + newline += (chunk + '\n' + space) + remainder = length % self.wrap + if remainder > 0: + newline += line[-remainder-1:] + self._linelen = remainder + elif self._linelen + length > self.wrap: + newline = ('\n' + space) + line + self._linelen = length + else: + newline = line + self._linelen += length + + return newline + + + def _escape_chars(self, text): + text = text.replace('\\', '\\[u005C]'). \ + replace('.', '\\[char46]'). \ + replace('\'', '\\[u0027]'). \ + replace('`', '\\[u0060]'). \ + replace('~', '\\[u007E]') + copy = text + + for char in copy: + if len(char) != len(char.encode()): + uni = char.encode('unicode_escape') \ + .decode()[1:] \ + .replace('x', 'u00') \ + .upper() + text = text.replace(char, '\\[u' + uni[1:] + ']') + + return text + + + def format_unencoded(self, tokensource, outfile): + self._define_colors(outfile) + + outfile.write('.nf\n\\f[CR]\n') + + if self.linenos: + self._write_lineno(outfile) + + for ttype, value in tokensource: + while ttype not in self.styles: + ttype = ttype.parent + start, end = self.styles[ttype] + + for line in value.splitlines(True): + if self.wrap > 0: + line = self._wrap_line(line) + + if start and end: + text = self._escape_chars(line.rstrip('\n')) + if text != '': + outfile.write(''.join((start, text, end))) + else: + outfile.write(self._escape_chars(line.rstrip('\n'))) + + if line.endswith('\n'): + if self.linenos: + self._write_lineno(outfile) + self._linelen = 0 + else: + outfile.write('\n') + self._linelen = 0 + + outfile.write('\n.fi') diff --git a/python/user_packages/Python313/site-packages/pygments/formatters/html.py b/python/user_packages/Python313/site-packages/pygments/formatters/html.py new file mode 100644 index 0000000000000000000000000000000000000000..17e67414520e016127fba1541207f23c19a0d187 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pygments/formatters/html.py @@ -0,0 +1,997 @@ +""" + pygments.formatters.html + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for HTML output. + + :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import functools +import os +import sys +import os.path +from io import StringIO + +from pygments.formatter import Formatter +from pygments.token import Token, Text, STANDARD_TYPES +from pygments.util import get_bool_opt, get_int_opt, get_list_opt + +import html + +try: + import ctags +except ImportError: + ctags = None + +__all__ = ['HtmlFormatter'] + + +_escape_html_table = { + ord('&'): '&', + ord('<'): '<', + ord('>'): '>', + ord('"'): '"', + ord("'"): ''', +} + + +def escape_html(text, table=_escape_html_table): + """Escape &, <, > as well as single and double quotes for HTML.""" + return text.translate(table) + + +def webify(color): + if color.startswith('calc') or color.startswith('var'): + return color + else: + # Check if the color can be shortened from 6 to 3 characters + color = color.upper() + if (len(color) == 6 and + ( color[0] == color[1] + and color[2] == color[3] + and color[4] == color[5])): + return f'#{color[0]}{color[2]}{color[4]}' + else: + return f'#{color}' + + +def _get_ttype_class(ttype): + fname = STANDARD_TYPES.get(ttype) + if fname: + return fname + aname = '' + while fname is None: + aname = '-' + ttype[-1] + aname + ttype = ttype.parent + fname = STANDARD_TYPES.get(ttype) + return fname + aname + + +CSSFILE_TEMPLATE = '''\ +/* +generated by Pygments +Copyright 2006-present by the Pygments team. +Licensed under the BSD license, see LICENSE for details. +*/ +%(styledefs)s +''' + +DOC_HEADER = '''\ + + + + + %(title)s + + + + +

%(title)s

+ +''' + +DOC_HEADER_EXTERNALCSS = '''\ + + + + + %(title)s + + + + +

%(title)s

+ +''' + +DOC_FOOTER = '''\ + + +''' + + +class HtmlFormatter(Formatter): + r""" + Format tokens as HTML 4 ```` tags. By default, the content is enclosed + in a ``
`` tag, itself wrapped in a ``
`` tag (but see the `nowrap` option). + The ``
``'s CSS class can be set by the `cssclass` option. + + If the `linenos` option is set to ``"table"``, the ``
`` is
+    additionally wrapped inside a ```` which has one row and two
+    cells: one containing the line numbers and one containing the code.
+    Example:
+
+    .. sourcecode:: html
+
+        
+
+ + +
+
1
+            2
+
+
def foo(bar):
+              pass
+            
+
+ + (whitespace added to improve clarity). + + A list of lines can be specified using the `hl_lines` option to make these + lines highlighted (as of Pygments 0.11). + + With the `full` option, a complete HTML 4 document is output, including + the style definitions inside a `` + {% else %} + {{ head | safe }} + {% endif %} +{% if not embed %} + + +{% endif %} + +{{ body | safe }} +{% for diagram in diagrams %} +
+

{{ diagram.title }}

+
{{ diagram.text }}
+
+ {{ diagram.svg }} +
+
+{% endfor %} +{% if not embed %} + + +{% endif %} +""" + +template = Template(jinja2_template_source) + + +_bookmark_lookup = {} +_bookmark_ids = itertools.count(start=1) + +def _make_bookmark(s: str) -> str: + """ + Converts a string into a valid HTML bookmark (ID or anchor name). + """ + if s in _bookmark_lookup: + return _bookmark_lookup[s] + + # Replace invalid characters with hyphens and ensure only valid characters + bookmark = re.sub(r'[^a-zA-Z0-9-]+', '-', s) + + # Ensure it starts with a letter by adding 'z' if necessary + if not bookmark[:1].isalpha(): + bookmark = f"z{bookmark}" + + # Convert to lowercase and strip hyphens + bookmark = bookmark.lower().strip('-') + + _bookmark_lookup[s] = bookmark = f"{bookmark}-{next(_bookmark_ids):04d}" + + return bookmark + + +def _collapse_verbose_regex(regex_str: str) -> str: + if "\n" not in regex_str: + return regex_str + collapsed = pyparsing.Regex(r"#.*$").suppress().transform_string(regex_str) + collapsed = re.sub(r"\s*\n\s*", "", collapsed) + return collapsed + + +@dataclasses.dataclass +class NamedDiagram: + """ + A simple structure for associating a name with a railroad diagram + """ + + name: str + index: int + diagram: railroad.DiagramItem = None + + @property + def bookmark(self): + bookmark = _make_bookmark(self.name) + return bookmark + + +T = TypeVar("T") + + +class EachItem(railroad.Group): + """ + Custom railroad item to compose a: + + - :class:`railroad.Group` containing a + + - :class:`railroad.OneOrMore` containing a + + - :class:`railroad.Choice` of the elements in the + :class:`railroad.Each` + + with the group label indicating that all must be matched + """ + + all_label = "[ALL]" + + def __init__(self, *items) -> None: + choice_item = railroad.Choice(len(items) - 1, *items) + one_or_more_item = railroad.OneOrMore(item=choice_item) + super().__init__(one_or_more_item, label=self.all_label) + + +class AnnotatedItem(railroad.Group): + """ + Simple subclass of Group that creates an annotation label + """ + + def __init__(self, label: str, item) -> None: + super().__init__(item=item, label=f"[{label}]" if label else "") + + +class EditablePartial(Generic[T]): + """ + Acts like a functools.partial, but can be edited. In other words, it represents a type that hasn't yet been + constructed. + """ + + # We need this here because the railroad constructors actually transform the data, so can't be called until the + # entire tree is assembled + + def __init__(self, func: Callable[..., T], args: list, kwargs: dict) -> None: + self.func = func + self.args = args + self.kwargs = kwargs + + @classmethod + def from_call(cls, func: Callable[..., T], *args, **kwargs) -> EditablePartial[T]: + """ + If you call this function in the same way that you would call the constructor, + it will store the arguments as you expect. For example + ``EditablePartial.from_call(Fraction, 1, 3)() == Fraction(1, 3)`` + """ + return EditablePartial(func=func, args=list(args), kwargs=kwargs) + + @property + def name(self): + return self.kwargs["name"] + + def __call__(self) -> T: + """ + Evaluate the partial and return the result + """ + args = self.args.copy() + kwargs = self.kwargs.copy() + + # This is a helpful hack to allow you to specify varargs parameters (e.g. *args) as keyword args (e.g. + # args=['list', 'of', 'things']) + arg_spec = inspect.getfullargspec(self.func) + if arg_spec.varargs in self.kwargs: + args += kwargs.pop(arg_spec.varargs) + + return self.func(*args, **kwargs) + + +def railroad_to_html(diagrams: list[NamedDiagram], embed=False, **kwargs) -> str: + """ + Given a list of :class:`NamedDiagram`, produce a single HTML string + that visualises those diagrams. + + :params kwargs: kwargs to be passed in to the template + """ + data = [] + for diagram in diagrams: + if diagram.diagram is None: + continue + io = StringIO() + try: + css = kwargs.get("css") + diagram.diagram.writeStandalone(io.write, css=css) + except AttributeError: + diagram.diagram.writeSvg(io.write) + title = diagram.name + if diagram.index == 0: + title += " (root)" + data.append( + { + "title": title, "text": "", "svg": io.getvalue(), "bookmark": diagram.bookmark + } + ) + + return template.render(diagrams=data, embed=embed, **kwargs) + + +def resolve_partial(partial: EditablePartial[T]) -> T: + """ + Recursively resolves a collection of Partials into whatever type they are + """ + if isinstance(partial, EditablePartial): + partial.args = resolve_partial(partial.args) + partial.kwargs = resolve_partial(partial.kwargs) + return partial() + elif isinstance(partial, list): + return [resolve_partial(x) for x in partial] + elif isinstance(partial, dict): + return {key: resolve_partial(x) for key, x in partial.items()} + else: + return partial + + +def to_railroad( + element: pyparsing.ParserElement, + diagram_kwargs: typing.Optional[dict] = None, + vertical: int = 3, + show_results_names: bool = False, + show_groups: bool = False, + show_hidden: bool = False, +) -> list[NamedDiagram]: + """ + Convert a pyparsing element tree into a list of diagrams. This is the recommended entrypoint to diagram + creation if you want to access the Railroad tree before it is converted to HTML + + :param element: base element of the parser being diagrammed + + :param diagram_kwargs: kwargs to pass to the :meth:`Diagram` constructor + + :param vertical: (optional) int - limit at which number of alternatives + should be shown vertically instead of horizontally + + :param show_results_names: bool to indicate whether results name + annotations should be included in the diagram + + :param show_groups: bool to indicate whether groups should be highlighted + with an unlabeled surrounding box + + :param show_hidden: bool to indicate whether internal elements that are + typically hidden should be shown + """ + # Convert the whole tree underneath the root + lookup = ConverterState(diagram_kwargs=diagram_kwargs or {}) + _to_diagram_element( + element, + lookup=lookup, + parent=None, + vertical=vertical, + show_results_names=show_results_names, + show_groups=show_groups, + show_hidden=show_hidden, + ) + + root_id = id(element) + # Convert the root if it hasn't been already + if root_id in lookup: + if not element.customName: + lookup[root_id].name = "" + lookup[root_id].mark_for_extraction(root_id, lookup, force=True) + + # Now that we're finished, we can convert from intermediate structures into Railroad elements + diags = list(lookup.diagrams.values()) + if len(diags) > 1: + # collapse out duplicate diags with the same name + seen = set() + deduped_diags = [] + for d in diags: + # don't extract SkipTo elements, they are uninformative as subdiagrams + if d.name == "...": + continue + if d.name is not None and d.name not in seen: + seen.add(d.name) + deduped_diags.append(d) + resolved = [resolve_partial(partial) for partial in deduped_diags] + else: + # special case - if just one diagram, always display it, even if + # it has no name + resolved = [resolve_partial(partial) for partial in diags] + return sorted(resolved, key=lambda diag: diag.index) + + +def _should_vertical( + specification: int, exprs: Iterable[pyparsing.ParserElement] +) -> bool: + """ + Returns true if we should return a vertical list of elements + """ + if specification is None: + return False + else: + return len(_visible_exprs(exprs)) >= specification + + +@dataclasses.dataclass +class ElementState: + """ + State recorded for an individual pyparsing Element + """ + + #: The pyparsing element that this represents + element: pyparsing.ParserElement + #: The output Railroad element in an unconverted state + converted: EditablePartial + #: The parent Railroad element, which we store so that we can extract this if it's duplicated + parent: EditablePartial + #: The order in which we found this element, used for sorting diagrams if this is extracted into a diagram + number: int + #: The name of the element + name: str = None + #: The index of this inside its parent + parent_index: typing.Optional[int] = None + #: If true, we should extract this out into a subdiagram + extract: bool = False + #: If true, all of this element's children have been filled out + complete: bool = False + + def mark_for_extraction( + self, el_id: int, state: ConverterState, name: str = None, force: bool = False + ): + """ + Called when this instance has been seen twice, and thus should eventually be extracted into a sub-diagram + :param el_id: id of the element + :param state: element/diagram state tracker + :param name: name to use for this element's text + :param force: If true, force extraction now, regardless of the state of this. Only useful for extracting the + root element when we know we're finished + """ + self.extract = True + + # Set the name + if not self.name: + if name: + # Allow forcing a custom name + self.name = name + elif self.element.customName: + self.name = self.element.customName + else: + self.name = "" + + # Just because this is marked for extraction doesn't mean we can do it yet. We may have to wait for children + # to be added + # Also, if this is just a string literal etc, don't bother extracting it + if force or (self.complete and _worth_extracting(self.element)): + state.extract_into_diagram(el_id) + + +class ConverterState: + """ + Stores some state that persists between recursions into the element tree + """ + index_generator = itertools.count(start=1) + + def __init__(self, diagram_kwargs: typing.Optional[dict] = None) -> None: + #: A dictionary mapping ParserElements to state relating to them + self._element_diagram_states: dict[int, ElementState] = {} + #: A dictionary mapping ParserElement IDs to subdiagrams generated from them + self.diagrams: dict[int, EditablePartial[NamedDiagram]] = {} + #: The index of the next element. This is used for sorting + self.index: int = 0 + #: Shared kwargs that are used to customize the construction of diagrams + self.diagram_kwargs: dict = diagram_kwargs or {} + self.extracted_diagram_names: set[str] = set() + + def __setitem__(self, key: int, value: ElementState): + self._element_diagram_states[key] = value + + def __getitem__(self, key: int) -> ElementState: + return self._element_diagram_states[key] + + def __delitem__(self, key: int): + del self._element_diagram_states[key] + + def __contains__(self, key: int): + return key in self._element_diagram_states + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default + + def generate_index(self) -> int: + """ + Generate a number used to index a diagram + """ + return next(self.index_generator) + + def extract_into_diagram(self, el_id: int): + """ + Used when we encounter the same token twice in the same tree. When this + happens, we replace all instances of that token with a terminal, and + create a new subdiagram for the token + """ + position = self[el_id] + + # Replace the original definition of this element with a regular block + if position.parent: + href = f"#{_make_bookmark(position.name)}" + ret = EditablePartial.from_call(railroad.NonTerminal, text=position.name, href=href) + if "item" in position.parent.kwargs: + position.parent.kwargs["item"] = ret + elif "items" in position.parent.kwargs: + position.parent.kwargs["items"][position.parent_index] = ret + + # If the element we're extracting is a group, skip to its content but keep the title + if position.converted.func == railroad.Group: + content = position.converted.kwargs["item"] + else: + content = position.converted + + self.diagrams[el_id] = EditablePartial.from_call( + NamedDiagram, + name=position.name, + diagram=EditablePartial.from_call( + railroad.Diagram, content, **self.diagram_kwargs + ), + index=position.number, + ) + + del self[el_id] + + +def _worth_extracting(element: pyparsing.ParserElement) -> bool: + """ + Returns true if this element is worth having its own sub-diagram. Simply, if any of its children + themselves have children, then its complex enough to extract + """ + children = element.recurse() + return any(child.recurse() for child in children) + + +def _apply_diagram_item_enhancements(fn): + """ + decorator to ensure enhancements to a diagram item (such as results name annotations) + get applied on return from _to_diagram_element (we do this since there are several + returns in _to_diagram_element) + """ + + def _inner( + element: pyparsing.ParserElement, + parent: typing.Optional[EditablePartial], + lookup: ConverterState = None, + vertical: int = None, + index: int = 0, + name_hint: str = None, + show_results_names: bool = False, + show_groups: bool = False, + show_hidden: bool = False, + ) -> typing.Optional[EditablePartial]: + ret = fn( + element, + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + show_hidden, + ) + + # apply annotation for results name, if present + if show_results_names and ret is not None: + element_results_name = element.resultsName + if element_results_name: + # add "*" to indicate if this is a "list all results" name + modal_tag = "" if element.modalResults else "*" + ret = EditablePartial.from_call( + railroad.Group, + item=ret, + label=f"{repr(element_results_name)}{modal_tag}", + ) + + return ret + + return _inner + + +def _visible_exprs(exprs: Iterable[pyparsing.ParserElement]): + non_diagramming_exprs = ( + pyparsing.ParseElementEnhance, + pyparsing.PositionToken, + pyparsing.And._ErrorStop, + ) + return [ + e + for e in exprs + if not isinstance(e, non_diagramming_exprs) + ] + + +@_apply_diagram_item_enhancements +def _to_diagram_element( + element: pyparsing.ParserElement, + parent: typing.Optional[EditablePartial], + lookup: ConverterState = None, + vertical: int = None, + index: int = 0, + name_hint: str = None, + show_results_names: bool = False, + show_groups: bool = False, + show_hidden: bool = False, +) -> typing.Optional[EditablePartial]: + """ + Recursively converts a PyParsing Element to a railroad Element + :param lookup: The shared converter state that keeps track of useful things + :param index: The index of this element within the parent + :param parent: The parent of this element in the output tree + :param vertical: Controls at what point we make a list of elements vertical. If this is an integer (the default), + it sets the threshold of the number of items before we go vertical. If True, always go vertical, if False, never + do so + :param name_hint: If provided, this will override the generated name + :param show_results_names: bool flag indicating whether to add annotations for results names + :param show_groups: bool flag indicating whether to show groups using bounding box + :param show_hidden: bool flag indicating whether to show elements that are typically hidden + :returns: The converted version of the input element, but as a Partial that hasn't yet been constructed + """ + exprs = element.recurse() + name = name_hint or element.customName or type(element).__name__ + + # Python's id() is used to provide a unique identifier for elements + el_id = id(element) + + element_results_name = element.resultsName + + # Here we basically bypass processing certain wrapper elements if they contribute nothing to the diagram + if not element.customName: + if isinstance( + element, + ( + # pyparsing.TokenConverter, + pyparsing.Forward, + pyparsing.Located, + pyparsing.AtStringStart, + pyparsing.AtLineStart, + ), + ): + # However, if this element has a useful custom name, and its child does not, we can pass it on to the child + if exprs: + if not exprs[0].customName: + propagated_name = name + else: + propagated_name = None + + return _to_diagram_element( + element.expr, + parent=parent, + lookup=lookup, + vertical=vertical, + index=index, + name_hint=propagated_name, + show_results_names=show_results_names, + show_groups=show_groups, + show_hidden=show_hidden, + ) + + # If the element isn't worth extracting, we always treat it as the first time we say it + if _worth_extracting(element): + looked_up = lookup.get(el_id) + if looked_up and looked_up.name is not None: + # If we've seen this element exactly once before, we are only just now finding out that it's a duplicate, + # so we have to extract it into a new diagram. + looked_up.mark_for_extraction(el_id, lookup, name=name_hint) + href = f"#{_make_bookmark(looked_up.name)}" + ret = EditablePartial.from_call(railroad.NonTerminal, text=looked_up.name, href=href) + return ret + + elif el_id in lookup.diagrams: + # If we have seen the element at least twice before, and have already extracted it into a subdiagram, we + # just put in a marker element that refers to the sub-diagram + text = lookup.diagrams[el_id].kwargs["name"] + ret = EditablePartial.from_call( + railroad.NonTerminal, text=text, href=f"#{_make_bookmark(text)}" + ) + return ret + + # Recursively convert child elements + # Here we find the most relevant Railroad element for matching pyparsing Element + # We use ``items=[]`` here to hold the place for where the child elements will go once created + + # see if this element is normally hidden, and whether hidden elements are desired + # if not, just return None + if not element.show_in_diagram and not show_hidden: + return None + + if isinstance(element, pyparsing.And): + # detect And's created with ``expr*N`` notation - for these use a OneOrMore with a repeat + # (all will have the same name, and resultsName) + if not exprs: + return None + if len(set((e.name, e.resultsName) for e in exprs)) == 1 and len(exprs) > 2: + ret = EditablePartial.from_call( + railroad.OneOrMore, item="", repeat=str(len(exprs)) + ) + elif _should_vertical(vertical, exprs): + ret = EditablePartial.from_call(railroad.Stack, items=[]) + else: + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + elif isinstance(element, (pyparsing.Or, pyparsing.MatchFirst)): + if not exprs: + return None + if _should_vertical(vertical, exprs): + ret = EditablePartial.from_call(railroad.Choice, 0, items=[]) + else: + ret = EditablePartial.from_call(railroad.HorizontalChoice, items=[]) + elif isinstance(element, pyparsing.Each): + if not exprs: + return None + ret = EditablePartial.from_call(EachItem, items=[]) + elif isinstance(element, pyparsing.NotAny): + ret = EditablePartial.from_call(AnnotatedItem, label="NOT", item="") + elif isinstance(element, pyparsing.FollowedBy): + ret = EditablePartial.from_call(AnnotatedItem, label="LOOKAHEAD", item="") + elif isinstance(element, pyparsing.PrecededBy): + ret = EditablePartial.from_call(AnnotatedItem, label="LOOKBEHIND", item="") + elif isinstance(element, pyparsing.Group): + if show_groups: + ret = EditablePartial.from_call(AnnotatedItem, label="", item="") + else: + ret = EditablePartial.from_call( + railroad.Group, item=None, label=element_results_name + ) + elif isinstance(element, pyparsing.TokenConverter): + label = type(element).__name__.lower() + if label == "tokenconverter": + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + else: + ret = EditablePartial.from_call(AnnotatedItem, label=label, item="") + elif isinstance(element, pyparsing.Opt): + ret = EditablePartial.from_call(railroad.Optional, item="") + elif isinstance(element, pyparsing.OneOrMore): + if element.not_ender is not None: + args = [ + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + show_hidden, + ] + return _to_diagram_element( + (~element.not_ender.expr + element.expr)[1, ...].set_name(element.name), + *args, + ) + ret = EditablePartial.from_call(railroad.OneOrMore, item=None) + elif isinstance(element, pyparsing.ZeroOrMore): + if element.not_ender is not None: + args = [ + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + show_hidden, + ] + return _to_diagram_element( + (~element.not_ender.expr + element.expr)[...].set_name(element.name), + *args, + ) + ret = EditablePartial.from_call(railroad.ZeroOrMore, item="") + elif isinstance(element, pyparsing.Empty) and not element.customName: + # Skip unnamed "Empty" elements + ret = None + elif isinstance(element, pyparsing.ParseElementEnhance): + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + elif len(exprs) > 0 and not element_results_name: + ret = EditablePartial.from_call(railroad.Group, item="", label=name) + elif isinstance(element, pyparsing.Regex): + collapsed_patt = _collapse_verbose_regex(element.pattern) + ret = EditablePartial.from_call(railroad.Terminal, collapsed_patt) + elif len(exprs) > 0: + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + else: + terminal = EditablePartial.from_call(railroad.Terminal, element.defaultName) + ret = terminal + + if ret is None: + return + + # Indicate this element's position in the tree so we can extract it if necessary + lookup[el_id] = ElementState( + element=element, + converted=ret, + parent=parent, + parent_index=index, + number=lookup.generate_index(), + ) + if element.customName: + lookup[el_id].mark_for_extraction(el_id, lookup, element.customName) + + i = 0 + for expr in exprs: + # Add a placeholder index in case we have to extract the child before we even add it to the parent + if "items" in ret.kwargs: + ret.kwargs["items"].insert(i, None) + + item = _to_diagram_element( + expr, + parent=ret, + lookup=lookup, + vertical=vertical, + index=i, + show_results_names=show_results_names, + show_groups=show_groups, + show_hidden=show_hidden, + ) + + # Some elements don't need to be shown in the diagram + if item is not None: + if "item" in ret.kwargs: + ret.kwargs["item"] = item + elif "items" in ret.kwargs: + # If we've already extracted the child, don't touch this index, since it's occupied by a nonterminal + ret.kwargs["items"][i] = item + i += 1 + elif "items" in ret.kwargs: + # If we're supposed to skip this element, remove it from the parent + del ret.kwargs["items"][i] + + # If all this items children are none, skip this item + if ret and ( + ("items" in ret.kwargs and len(ret.kwargs["items"]) == 0) + or ("item" in ret.kwargs and ret.kwargs["item"] is None) + ): + ret = EditablePartial.from_call(railroad.Terminal, name) + + # Mark this element as "complete", ie it has all of its children + if el_id in lookup: + lookup[el_id].complete = True + + if el_id in lookup and lookup[el_id].extract and lookup[el_id].complete: + lookup.extract_into_diagram(el_id) + if ret is not None: + text = lookup.diagrams[el_id].kwargs["name"] + href = f"#{_make_bookmark(text)}" + ret = EditablePartial.from_call( + railroad.NonTerminal, text=text, href=href + ) + + return ret diff --git a/python/user_packages/Python313/site-packages/pyparsing/diagram/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyparsing/diagram/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59ae17a3846497af87bbfa89fb631e6bc89ed4a0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyparsing/diagram/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyparsing/tools/__init__.py b/python/user_packages/Python313/site-packages/pyparsing/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/pyparsing/tools/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyparsing/tools/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e0a8cf91f1a206827beb5e1bf9d5d228526ca96 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyparsing/tools/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyparsing/tools/__pycache__/cvt_pyparsing_pep8_names.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyparsing/tools/__pycache__/cvt_pyparsing_pep8_names.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b8cfc51f5bcb7b0db8af975e7828f7068d44ae7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyparsing/tools/__pycache__/cvt_pyparsing_pep8_names.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyparsing/tools/cvt_pyparsing_pep8_names.py b/python/user_packages/Python313/site-packages/pyparsing/tools/cvt_pyparsing_pep8_names.py new file mode 100644 index 0000000000000000000000000000000000000000..ecd2be7b4bc2eac78b4af9dd6829495bcf000338 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pyparsing/tools/cvt_pyparsing_pep8_names.py @@ -0,0 +1,142 @@ +import warnings +from functools import lru_cache +import pyparsing as pp + + +@lru_cache(maxsize=None) +def camel_to_snake(s: str) -> str: + """ + Convert CamelCase to snake_case. + """ + return "".join(f"_{c.lower()}" if c.isupper() else c for c in s).lstrip("_") + + +pre_pep8_method_names = """ +addCondition addParseAction anyCloseTag anyOpenTag asDict asList cStyleComment canParseNext conditionAsParseAction +convertToDate convertToDatetime convertToFloat convertToInteger countedArray cppStyleComment dblQuotedString +dblSlashComment defaultName dictOf disableMemoization downcaseTokens enableLeftRecursion enablePackrat getName +htmlComment ignoreWhitespace infixNotation inlineLiteralsUsing javaStyleComment leaveWhitespace +lineEnd lineStart matchOnlyAtCol matchPreviousExpr matchPreviousLiteral nestedExpr nullDebugAction oneOf +originalTextFor parseFile parseString parseWithTabs pythonStyleComment quotedString removeQuotes replaceWith +resetCache restOfLine runTests scanString searchString setBreak setDebug setDebugActions setDefaultWhitespaceChars +setFailAction setName setParseAction setResultsName setWhitespaceChars sglQuotedString stringEnd stringStart tokenMap +traceParseAction transformString tryParse unicodeString upcaseTokens withAttribute withClass +""".split() + +special_changes = { + "opAssoc": "OpAssoc", + "delimitedList": "DelimitedList", + "delimited_list": "DelimitedList", + "replaceHTMLEntity": "replace_html_entity", + "makeHTMLTags": "make_html_tags", + "makeXMLTags": "make_xml_tags", + "commonHTMLEntity": "common_html_entity", + "stripHTMLTags": "strip_html_tags", + "indentedBlock": "IndentedBlock", + "locatedExpr": "Located", +} + +pre_pep8_arg_names = """parseAll maxMatches listAllMatches callDuringTry includeSeparators fullDump printResults +failureTests postParse matchString identChars maxMismatches initChars bodyChars asKeyword excludeChars asGroupList +asMatch quoteChar escChar escQuote unquoteResults endQuoteChar convertWhitespaceEscapes notChars wordChars stopOn +failOn joinString markerString intExpr useRegex asString ignoreExpr""".split() + +special_changes_arg_names = { + "asList": "aslist", +} + +pre_pep8_method_name = pp.one_of(pre_pep8_method_names, as_keyword=True) +pre_pep8_method_name.set_parse_action(lambda t: camel_to_snake(t[0])) +special_pre_pep8_name = pp.one_of(special_changes, as_keyword=True) +def update_special_changes(s, l, t): + if t[0] == "indentedBlock": + warnings.warn( + "Conversion of 'indentedBlock' to new 'IndentedBlock'" + " requires added code changes to remove 'indentStack' argument\n" + f" {pp.lineno(l, s)}: {pp.line(l, s)}", + stacklevel=2, + ) + elif t[0] == "locatedExpr": + warnings.warn( + "Conversion of 'locatedExpr' to new 'Located'" + " may require added code changes - Located does not automatically" + " group parsed elements\n" + f" {pp.lineno(l, s)}: {pp.line(l, s)}", + stacklevel=2, + ) + return special_changes[t[0]] +special_pre_pep8_name.set_parse_action(update_special_changes) +# only replace arg names if part of an arg list +pre_pep8_arg_name = pp.Regex( + rf"{pp.util.make_compressed_re(pre_pep8_arg_names)}" +) + pp.FollowedBy("=") +pre_pep8_arg_name.set_parse_action(lambda t: camel_to_snake(t[0])) +special_pre_pep8_arg_name = pp.one_of(special_changes_arg_names, as_keyword=True) + pp.FollowedBy("=") +special_pre_pep8_arg_name.set_parse_action(lambda t: special_changes_arg_names[t[0]]) + +pep8_converter = special_pre_pep8_arg_name | pre_pep8_method_name | special_pre_pep8_name | pre_pep8_arg_name + +if __name__ == "__main__": + import argparse + from pathlib import Path + import sys + + argparser = argparse.ArgumentParser( + description = ( + "Utility to convert Python pyparsing scripts using legacy" + " camelCase names to use PEP8 snake_case names." + "\nBy default, this script will only show whether this script would make any changes." + ) + ) + argparser.add_argument("--verbose", "-v", action="store_true", help="Show unified diff for each source file") + argparser.add_argument("-vv", action="store_true", dest="verbose2", help="Show unified diff for each source file, plus names of scanned files with no changes") + argparser.add_argument("--update", "-u", action="store_true", help="Update source files in-place") + argparser.add_argument("--encoding", type=str, default="utf-8", help="Encoding of source files (default: utf-8)") + argparser.add_argument("--exit-zero-even-if-changed", "-exit0", action="store_true", help="Exit with status code 0 even if changes were made") + argparser.add_argument("source_filename", nargs="+", help="Source filenames or filename patterns of Python files to be converted") + args = argparser.parse_args() + + + def show_diffs(original, modified): + import difflib + + diff = difflib.unified_diff( + original.splitlines(), modified.splitlines(), lineterm="" + ) + sys.stdout.writelines(f"{diff_line}\n" for diff_line in diff) + + exit_status = 0 + + for filename_pattern in args.source_filename: + + for filename in Path().glob(filename_pattern): + if not Path(filename).is_file(): + continue + + try: + original_contents = Path(filename).read_text(encoding=args.encoding) + modified_contents = pep8_converter.transform_string( + original_contents + ) + + if modified_contents != original_contents: + if args.update: + Path(filename).write_text(modified_contents, encoding=args.encoding) + print(f"Converted {filename}") + else: + print(f"Found required changes in {filename}") + + if args.verbose: + show_diffs(original_contents, modified_contents) + print() + + exit_status = 1 + + else: + if args.verbose2: + print(f"No required changes in {filename}") + + except Exception as e: + print(f"Failed to convert {filename}: {type(e).__name__}: {e}") + + sys.exit(exit_status if not args.exit_zero_even_if_changed else 0) diff --git a/python/user_packages/Python313/site-packages/pypdf-6.11.0.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/pypdf-6.11.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ab327d0312875458ba74983867f1b2622b6de39d --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf-6.11.0.dist-info/licenses/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2006-2008, Mathieu Fenniak +Some contributions copyright (c) 2007, Ashish Kulkarni +Some contributions copyright (c) 2014, Steve Witham + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +* The name of the author may not be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..197000a428184729c75e7a97171e60f8b2d1b504 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_cmap.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_cmap.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..26743529ec9ab00927466b2d2b9c836dbbe0cae7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_cmap.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_doc_common.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_doc_common.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51a1c5cf1698c0e980a8bbb33b1636d956ea91fc Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_doc_common.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_encryption.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_encryption.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..32639a21246d50a3d8c6a9b319ae7bfedb70e1ff Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_encryption.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_font.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_font.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d7a949fe38c57ef6d485162ac4d83ca799879df Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_font.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_page_labels.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_page_labels.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28133378ec4b26e9aaf11ab2af3a581f5deea12f Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_page_labels.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_protocols.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_protocols.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caa6cd601c0621d261b7ae95ac995bd91ab00659 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_protocols.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_reader.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_reader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cd63b92423efbc7701f5e7c1aa54a3d54fb24dfa Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_reader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a13b6441f9815e24b365bc8002e68027b2bbfffc Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/_version.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_version.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4093ee34ae0927b80b67781c4b191abaf3ed9a4c Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/_version.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/constants.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/constants.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f654db019804e3d8fd4097984a3dc9f08795b0f Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/constants.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/errors.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/errors.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a1dd17e66a9519dcaaaa685e1008675ba4b7f83 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/errors.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/filters.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/filters.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50dceb0ee8fe91b432187ab752c8ab8ca581fd1d Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/filters.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/pagerange.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/pagerange.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0bcd0b198d9eedc39784ddeb025b83f205544a02 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/pagerange.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/papersizes.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/papersizes.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e93d3eecabb4c61405c48c2e9fca73eb55acfbfa Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/papersizes.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/types.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/types.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2073e003a0976b6761e61ec913717d505c021b5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/types.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/__pycache__/xmp.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/__pycache__/xmp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0ee3afdf96d0ac33e7729f57bc7415eedb7fd4a0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/__pycache__/xmp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__init__.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3693a5a87b8e212fe3919e9cef6700cfe71a1428 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/__init__.py @@ -0,0 +1,55 @@ +from .adobe_glyphs import adobe_glyphs +from .pdfdoc import _pdfdoc_encoding +from .std import _std_encoding +from .symbol import _symbol_encoding +from .zapfding import _zapfding_encoding + + +def fill_from_encoding(enc: str) -> list[str]: + lst: list[str] = [] + for x in range(256): + try: + lst += (bytes((x,)).decode(enc),) + except Exception: + lst += (chr(x),) + return lst + + +def rev_encoding(enc: list[str]) -> dict[str, int]: + rev: dict[str, int] = {} + for i in range(256): + char = enc[i] + if char == "\u0000": + continue + assert char not in rev, f"{char} at {i} already at {rev[char]}" + rev[char] = i + return rev + + +_win_encoding = fill_from_encoding("cp1252") +_mac_encoding = fill_from_encoding("mac_roman") + + +_pdfdoc_encoding_rev: dict[str, int] = rev_encoding(_pdfdoc_encoding) + + +charset_encoding: dict[str, list[str]] = { + "/StandardEncoding": _std_encoding, + "/WinAnsiEncoding": _win_encoding, + "/MacRomanEncoding": _mac_encoding, + "/PDFDocEncoding": _pdfdoc_encoding, + "/Symbol": _symbol_encoding, + "/ZapfDingbats": _zapfding_encoding, +} + +__all__ = [ + "_mac_encoding", + "_pdfdoc_encoding", + "_pdfdoc_encoding_rev", + "_std_encoding", + "_symbol_encoding", + "_win_encoding", + "_zapfding_encoding", + "adobe_glyphs", + "charset_encoding", +] diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b93cf4f30add08e46a12d383168432e91e925732 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/_codecs.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/_codecs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..757ee18c7875e78e67c8aaaac87ff766a3874c22 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/_codecs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/pdfdoc.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/pdfdoc.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cb02bf8d54735d8ae34b641b8be86d0e9df0f76e Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/pdfdoc.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/std.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/std.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c339610139b1396413920e35c23fb2644d5e0a4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/std.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/symbol.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/symbol.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64aec1a7496f96da4fae72bd1211dfff7eaab02f Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/symbol.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/zapfding.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/zapfding.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d9e1ee8450abbf84c24502b1fa7164031b8ac16 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_codecs/__pycache__/zapfding.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/_codecs.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/_codecs.py new file mode 100644 index 0000000000000000000000000000000000000000..93f95e5aad3aaf9c65ba15bbedb7acc88b2ba85f --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/_codecs.py @@ -0,0 +1,281 @@ +""" +This module is for codecs only. + +While the codec implementation can contain details of the PDF specification, +the module should not do any PDF parsing. +""" + +import io +from abc import ABC, abstractmethod + +from pypdf._utils import logger_warning +from pypdf.errors import LimitReachedError + + +class Codec(ABC): + """Abstract base class for all codecs.""" + + @abstractmethod + def encode(self, data: bytes) -> bytes: + """ + Encode the input data. + + Args: + data: Data to encode. + + Returns: + Encoded data. + + """ + + @abstractmethod + def decode(self, data: bytes) -> bytes: + """ + Decode the input data. + + Args: + data: Data to decode. + + Returns: + Decoded data. + + """ + + +class LzwCodec(Codec): + """Lempel-Ziv-Welch (LZW) adaptive compression codec.""" + + CLEAR_TABLE_MARKER = 256 # Special code to indicate table reset + EOD_MARKER = 257 # End-of-data marker + INITIAL_BITS_PER_CODE = 9 # Initial code bit width + MAX_BITS_PER_CODE = 12 # Maximum code bit width + + def __init__(self, max_output_length: int = 75_000_000) -> None: + self.max_output_length = max_output_length + + def _initialize_encoding_table(self) -> None: + """Initialize the encoding table and state to initial conditions.""" + self.encoding_table: dict[bytes, int] = {bytes([i]): i for i in range(256)} + self.next_code = self.EOD_MARKER + 1 + self.bits_per_code = self.INITIAL_BITS_PER_CODE + self.max_code_value = (1 << self.bits_per_code) - 1 + + def _increase_next_code(self) -> None: + """Update bits_per_code and max_code_value if necessary.""" + self.next_code += 1 + if ( + self.next_code > self.max_code_value + and self.bits_per_code < self.MAX_BITS_PER_CODE + ): + self.bits_per_code += 1 + self.max_code_value = (1 << self.bits_per_code) - 1 + + def encode(self, data: bytes) -> bytes: + """ + Encode data using the LZW compression algorithm. + + Taken from PDF 1.7 specs, "7.4.4.2 Details of LZW Encoding". + """ + result_codes: list[int] = [] + + # The encoder shall begin by issuing a clear-table code + result_codes.append(self.CLEAR_TABLE_MARKER) + self._initialize_encoding_table() + + current_sequence = b"" + for byte in data: + next_sequence = current_sequence + bytes([byte]) + + if next_sequence in self.encoding_table: + # Extend current sequence if already in the table + current_sequence = next_sequence + else: + # Output code for the current sequence + result_codes.append(self.encoding_table[current_sequence]) + + # Add the new sequence to the table if there's room + if self.next_code <= (1 << self.MAX_BITS_PER_CODE) - 1: + self.encoding_table[next_sequence] = self.next_code + self._increase_next_code() + else: + # If the table is full, emit a clear-table command + result_codes.append(self.CLEAR_TABLE_MARKER) + self._initialize_encoding_table() + + # Start new sequence + current_sequence = bytes([byte]) + + # Ensure everything actually is encoded + if current_sequence: + result_codes.append(self.encoding_table[current_sequence]) + result_codes.append(self.EOD_MARKER) + + return self._pack_codes_into_bytes(result_codes) + + def _pack_codes_into_bytes(self, codes: list[int]) -> bytes: + """ + Convert the list of result codes into a continuous byte stream, with codes packed as per the code bit-width. + The bit-width starts at 9 bits and expands as needed. + """ + self._initialize_encoding_table() + buffer = 0 + bits_in_buffer = 0 + output = bytearray() + + for code in codes: + buffer = (buffer << self.bits_per_code) | code + bits_in_buffer += self.bits_per_code + + # Codes shall be packed into a continuous bit stream, high-order bit + # first. This stream shall then be divided into bytes, high-order bit + # first. + while bits_in_buffer >= 8: + bits_in_buffer -= 8 + output.append((buffer >> bits_in_buffer) & 0xFF) + + if code == self.CLEAR_TABLE_MARKER: + self._initialize_encoding_table() + elif code == self.EOD_MARKER: + continue + else: + self._increase_next_code() + + # Flush any remaining bits in the buffer + if bits_in_buffer > 0: + output.append((buffer << (8 - bits_in_buffer)) & 0xFF) + + return bytes(output) + + def _initialize_decoding_table(self) -> None: + self.max_code_value = (1 << self.MAX_BITS_PER_CODE) - 1 + self.decoding_table = [bytes([i]) for i in range(self.CLEAR_TABLE_MARKER)] + [ + b"" + ] * (self.max_code_value - self.CLEAR_TABLE_MARKER + 1) + self._table_index = self.EOD_MARKER + 1 + self._bits_to_get = 9 + + def _next_code_decode(self, data: bytes) -> int: + self._next_data: int + try: + while self._next_bits < self._bits_to_get: + self._next_data = (self._next_data << 8) | ( + data[self._byte_pointer] + ) + self._byte_pointer += 1 + self._next_bits += 8 + + code = ( + self._next_data >> (self._next_bits - self._bits_to_get) + ) & self._and_table[self._bits_to_get - 9] + self._next_bits -= self._bits_to_get + + # Reduce data to get rid of the overhead, + # which increases performance on large streams significantly. + self._next_data = self._next_data & 0xFFFFF + + return code + except IndexError: + return self.EOD_MARKER + + # The following method has been converted to Python from PDFsharp: + # https://github.com/empira/PDFsharp/blob/5fbf6ed14740bc4e16786816882d32e43af3ff5d/src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Filters/LzwDecode.cs + # + # Original license: + # + # ------------------------------------------------------------------------- + # Copyright (c) 2001-2024 empira Software GmbH, Troisdorf (Cologne Area), + # Germany + # + # http://docs.pdfsharp.net + # + # MIT License + # + # Permission is hereby granted, free of charge, to any person obtaining a + # copy of this software and associated documentation files (the "Software"), + # to deal in the Software without restriction, including without limitation + # the rights to use, copy, modify, merge, publish, distribute, sublicense, + # and/or sell copies of the Software, and to permit persons to whom the + # Software is furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included + # in all copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + # DEALINGS IN THE SOFTWARE. + # -------------------------------------------------------------------------- + def decode(self, data: bytes) -> bytes: + """ + The following code was converted to Python from the following code: + https://github.com/empira/PDFsharp/blob/master/src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Filters/LzwDecode.cs + """ + self._and_table = [511, 1023, 2047, 4095] + self._table_index = 0 + self._bits_to_get = 9 + self._byte_pointer = 0 + self._next_data = 0 + self._next_bits = 0 + + output_stream = io.BytesIO() + output_length = 0 + + self._initialize_decoding_table() + self._byte_pointer = 0 + self._next_data = 0 + self._next_bits = 0 + old_code = self.CLEAR_TABLE_MARKER + + while True: + code = self._next_code_decode(data) + if code == self.EOD_MARKER: + break + + if code == self.CLEAR_TABLE_MARKER: + self._initialize_decoding_table() + code = self._next_code_decode(data) + if code == self.EOD_MARKER: + break + output_stream.write(decoded := self.decoding_table[code]) + old_code = code + elif code < self._table_index: + decoded = self.decoding_table[code] + output_stream.write(decoded) + if old_code != self.CLEAR_TABLE_MARKER: + self._add_entry_decode(self.decoding_table[old_code], decoded[0]) + old_code = code + else: + # The code is not in the table and not one of the special codes + decoded = ( + self.decoding_table[old_code] + self.decoding_table[old_code][:1] + ) + output_stream.write(decoded) + self._add_entry_decode(self.decoding_table[old_code], decoded[0]) + old_code = code + + output_length += len(decoded) + if output_length > self.max_output_length: + raise LimitReachedError( + f"Limit reached while decompressing: {output_length} > {self.max_output_length}" + ) + + return output_stream.getvalue() + + def _add_entry_decode(self, old_string: bytes, new_char: int) -> None: + new_string = old_string + bytes([new_char]) + if self._table_index > self.max_code_value: + logger_warning("Ignoring too large LZW table index.", __name__) + return + self.decoding_table[self._table_index] = new_string + self._table_index += 1 + + # Update the number of bits to get based on the table index + if self._table_index == 511: + self._bits_to_get = 10 + elif self._table_index == 1023: + self._bits_to_get = 11 + elif self._table_index == 2047: + self._bits_to_get = 12 diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/adobe_glyphs.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/adobe_glyphs.py new file mode 100644 index 0000000000000000000000000000000000000000..72d5ed3247b24e4c6887bf2e51001906ee2a3ffb --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/adobe_glyphs.py @@ -0,0 +1,13969 @@ +# https://raw.githubusercontent.com/adobe-type-tools/agl-aglfn/master/glyphlist.txt + +# converted manually to python +# Extended with data from GlyphNameFormatter: +# https://github.com/LettError/glyphNameFormatter + +# ----------------------------------------------------------- +# Copyright 2002-2019 Adobe (http://www.adobe.com/). +# +# Redistribution and use in source and binary forms, with or +# without modification, are permitted provided that the +# following conditions are met: +# +# Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# Neither the name of Adobe nor the names of its contributors +# may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------- +# Name: Adobe Glyph List +# Table version: 2.0 +# Date: September 20, 2002 +# URL: https://github.com/adobe-type-tools/agl-aglfn +# +# Format: two semicolon-delimited fields: +# (1) glyph name--upper/lowercase letters and digits +# (2) Unicode scalar value--four uppercase hexadecimal digits +# +adobe_glyphs = { + "/A": "\u0041", + "/AA": "\uA732", + "/AE": "\u00C6", + "/AEacute": "\u01FC", + "/AEmacron": "\u01E2", + "/AEsmall": "\uF7E6", + "/AO": "\uA734", + "/AU": "\uA736", + "/AV": "\uA738", + "/AVhorizontalbar": "\uA73A", + "/AY": "\uA73C", + "/Aacute": "\u00C1", + "/Aacutesmall": "\uF7E1", + "/Abreve": "\u0102", + "/Abreveacute": "\u1EAE", + "/Abrevecyr": "\u04D0", + "/Abrevecyrillic": "\u04D0", + "/Abrevedotbelow": "\u1EB6", + "/Abrevegrave": "\u1EB0", + "/Abrevehoi": "\u1EB2", + "/Abrevehookabove": "\u1EB2", + "/Abrevetilde": "\u1EB4", + "/Acaron": "\u01CD", + "/Acircle": "\u24B6", + "/Acircleblack": "\u1F150", + "/Acircumflex": "\u00C2", + "/Acircumflexacute": "\u1EA4", + "/Acircumflexdotbelow": "\u1EAC", + "/Acircumflexgrave": "\u1EA6", + "/Acircumflexhoi": "\u1EA8", + "/Acircumflexhookabove": "\u1EA8", + "/Acircumflexsmall": "\uF7E2", + "/Acircumflextilde": "\u1EAA", + "/Acute": "\uF6C9", + "/Acutesmall": "\uF7B4", + "/Acyr": "\u0410", + "/Acyrillic": "\u0410", + "/Adblgrave": "\u0200", + "/Adieresis": "\u00C4", + "/Adieresiscyr": "\u04D2", + "/Adieresiscyrillic": "\u04D2", + "/Adieresismacron": "\u01DE", + "/Adieresissmall": "\uF7E4", + "/Adot": "\u0226", + "/Adotbelow": "\u1EA0", + "/Adotmacron": "\u01E0", + "/Agrave": "\u00C0", + "/Agravedbl": "\u0200", + "/Agravesmall": "\uF7E0", + "/Ahoi": "\u1EA2", + "/Ahookabove": "\u1EA2", + "/Aiecyr": "\u04D4", + "/Aiecyrillic": "\u04D4", + "/Ainvertedbreve": "\u0202", + "/Akbar": "\uFDF3", + "/Alayhe": "\uFDF7", + "/Allah": "\uFDF2", + "/Alpha": "\u0391", + "/Alphaacute": "\u1FBB", + "/Alphaasper": "\u1F09", + "/Alphaasperacute": "\u1F0D", + "/Alphaasperacuteiotasub": "\u1F8D", + "/Alphaaspergrave": "\u1F0B", + "/Alphaaspergraveiotasub": "\u1F8B", + "/Alphaasperiotasub": "\u1F89", + "/Alphaaspertilde": "\u1F0F", + "/Alphaaspertildeiotasub": "\u1F8F", + "/Alphabreve": "\u1FB8", + "/Alphagrave": "\u1FBA", + "/Alphaiotasub": "\u1FBC", + "/Alphalenis": "\u1F08", + "/Alphalenisacute": "\u1F0C", + "/Alphalenisacuteiotasub": "\u1F8C", + "/Alphalenisgrave": "\u1F0A", + "/Alphalenisgraveiotasub": "\u1F8A", + "/Alphalenisiotasub": "\u1F88", + "/Alphalenistilde": "\u1F0E", + "/Alphalenistildeiotasub": "\u1F8E", + "/Alphatonos": "\u0386", + "/Alphawithmacron": "\u1FB9", + "/Amacron": "\u0100", + "/Amonospace": "\uFF21", + "/Aogonek": "\u0104", + "/Aparens": "\u1F110", + "/Aring": "\u00C5", + "/Aringacute": "\u01FA", + "/Aringbelow": "\u1E00", + "/Aringsmall": "\uF7E5", + "/Asmall": "\uF761", + "/Asquare": "\u1F130", + "/Asquareblack": "\u1F170", + "/Astroke": "\u023A", + "/Atilde": "\u00C3", + "/Atildesmall": "\uF7E3", + "/Aturned": "\u2C6F", + "/Ayahend": "\u06DD", + "/Aybarmenian": "\u0531", + "/B": "\u0042", + "/Bcircle": "\u24B7", + "/Bcircleblack": "\u1F151", + "/Bdot": "\u1E02", + "/Bdotaccent": "\u1E02", + "/Bdotbelow": "\u1E04", + "/Becyr": "\u0411", + "/Becyrillic": "\u0411", + "/Benarmenian": "\u0532", + "/Beta": "\u0392", + "/Bflourish": "\uA796", + "/Bhook": "\u0181", + "/BismillahArRahmanArRaheem": "\uFDFD", + "/Blinebelow": "\u1E06", + "/Bmonospace": "\uFF22", + "/Bparens": "\u1F111", + "/Brevesmall": "\uF6F4", + "/Bscript": "\u212C", + "/Bsmall": "\uF762", + "/Bsquare": "\u1F131", + "/Bsquareblack": "\u1F171", + "/Bstroke": "\u0243", + "/Btopbar": "\u0182", + "/C": "\u0043", + "/CDcircle": "\u1F12D", + "/Caarmenian": "\u053E", + "/Cacute": "\u0106", + "/Caron": "\uF6CA", + "/Caronsmall": "\uF6F5", + "/Cbar": "\uA792", + "/Ccaron": "\u010C", + "/Ccedilla": "\u00C7", + "/Ccedillaacute": "\u1E08", + "/Ccedillasmall": "\uF7E7", + "/Ccircle": "\u24B8", + "/Ccircleblack": "\u1F152", + "/Ccircumflex": "\u0108", + "/Cdblstruck": "\u2102", + "/Cdot": "\u010A", + "/Cdotaccent": "\u010A", + "/Cdotreversed": "\uA73E", + "/Cedillasmall": "\uF7B8", + "/Cfraktur": "\u212D", + "/Chaarmenian": "\u0549", + "/Cheabkhasiancyrillic": "\u04BC", + "/Cheabkhcyr": "\u04BC", + "/Cheabkhtailcyr": "\u04BE", + "/Checyr": "\u0427", + "/Checyrillic": "\u0427", + "/Chedescenderabkhasiancyrillic": "\u04BE", + "/Chedescendercyrillic": "\u04B6", + "/Chedieresiscyr": "\u04F4", + "/Chedieresiscyrillic": "\u04F4", + "/Cheharmenian": "\u0543", + "/Chekhakascyr": "\u04CB", + "/Chekhakassiancyrillic": "\u04CB", + "/Chetailcyr": "\u04B6", + "/Chevertcyr": "\u04B8", + "/Cheverticalstrokecyrillic": "\u04B8", + "/Chi": "\u03A7", + "/Chook": "\u0187", + "/Circumflexsmall": "\uF6F6", + "/Citaliccircle": "\u1F12B", + "/Cmonospace": "\uFF23", + "/Coarmenian": "\u0551", + "/Con": "\uA76E", + "/Cparens": "\u1F112", + "/Csmall": "\uF763", + "/Csquare": "\u1F132", + "/Csquareblack": "\u1F172", + "/Cstretched": "\u0297", + "/Cstroke": "\u023B", + "/Cuatrillo": "\uA72C", + "/Cuatrillocomma": "\uA72E", + "/D": "\u0044", + "/DZ": "\u01F1", + "/DZcaron": "\u01C4", + "/Daarmenian": "\u0534", + "/Dafrican": "\u0189", + "/Dcaron": "\u010E", + "/Dcedilla": "\u1E10", + "/Dchecyr": "\u052C", + "/Dcircle": "\u24B9", + "/Dcircleblack": "\u1F153", + "/Dcircumflexbelow": "\u1E12", + "/Dcroat": "\u0110", + "/Ddblstruckitalic": "\u2145", + "/Ddot": "\u1E0A", + "/Ddotaccent": "\u1E0A", + "/Ddotbelow": "\u1E0C", + "/Decyr": "\u0414", + "/Decyrillic": "\u0414", + "/Deicoptic": "\u03EE", + "/Dekomicyr": "\u0500", + "/Delta": "\u2206", + "/Deltagreek": "\u0394", + "/Dhook": "\u018A", + "/Dieresis": "\uF6CB", + "/DieresisAcute": "\uF6CC", + "/DieresisGrave": "\uF6CD", + "/Dieresissmall": "\uF7A8", + "/Digamma": "\u03DC", + "/Digammagreek": "\u03DC", + "/Digammapamphylian": "\u0376", + "/Dinsular": "\uA779", + "/Djecyr": "\u0402", + "/Djecyrillic": "\u0402", + "/Djekomicyr": "\u0502", + "/Dlinebelow": "\u1E0E", + "/Dmonospace": "\uFF24", + "/Dotaccentsmall": "\uF6F7", + "/Dparens": "\u1F113", + "/Dslash": "\u0110", + "/Dsmall": "\uF764", + "/Dsquare": "\u1F133", + "/Dsquareblack": "\u1F173", + "/Dtopbar": "\u018B", + "/Dz": "\u01F2", + "/Dzcaron": "\u01C5", + "/Dzeabkhasiancyrillic": "\u04E0", + "/Dzeabkhcyr": "\u04E0", + "/Dzecyr": "\u0405", + "/Dzecyrillic": "\u0405", + "/Dzhecyr": "\u040F", + "/Dzhecyrillic": "\u040F", + "/Dzjekomicyr": "\u0506", + "/Dzzhecyr": "\u052A", + "/E": "\u0045", + "/Eacute": "\u00C9", + "/Eacutesmall": "\uF7E9", + "/Ebreve": "\u0114", + "/Ecaron": "\u011A", + "/Ecedilla": "\u0228", + "/Ecedillabreve": "\u1E1C", + "/Echarmenian": "\u0535", + "/Ecircle": "\u24BA", + "/Ecircleblack": "\u1F154", + "/Ecircumflex": "\u00CA", + "/Ecircumflexacute": "\u1EBE", + "/Ecircumflexbelow": "\u1E18", + "/Ecircumflexdotbelow": "\u1EC6", + "/Ecircumflexgrave": "\u1EC0", + "/Ecircumflexhoi": "\u1EC2", + "/Ecircumflexhookabove": "\u1EC2", + "/Ecircumflexsmall": "\uF7EA", + "/Ecircumflextilde": "\u1EC4", + "/Ecyrillic": "\u0404", + "/Edblgrave": "\u0204", + "/Edieresis": "\u00CB", + "/Edieresissmall": "\uF7EB", + "/Edot": "\u0116", + "/Edotaccent": "\u0116", + "/Edotbelow": "\u1EB8", + "/Efcyr": "\u0424", + "/Efcyrillic": "\u0424", + "/Egrave": "\u00C8", + "/Egravedbl": "\u0204", + "/Egravesmall": "\uF7E8", + "/Egyptain": "\uA724", + "/Egyptalef": "\uA722", + "/Eharmenian": "\u0537", + "/Ehoi": "\u1EBA", + "/Ehookabove": "\u1EBA", + "/Eightroman": "\u2167", + "/Einvertedbreve": "\u0206", + "/Eiotifiedcyr": "\u0464", + "/Eiotifiedcyrillic": "\u0464", + "/Elcyr": "\u041B", + "/Elcyrillic": "\u041B", + "/Elevenroman": "\u216A", + "/Elhookcyr": "\u0512", + "/Elmiddlehookcyr": "\u0520", + "/Elsharptailcyr": "\u04C5", + "/Eltailcyr": "\u052E", + "/Emacron": "\u0112", + "/Emacronacute": "\u1E16", + "/Emacrongrave": "\u1E14", + "/Emcyr": "\u041C", + "/Emcyrillic": "\u041C", + "/Emonospace": "\uFF25", + "/Emsharptailcyr": "\u04CD", + "/Encyr": "\u041D", + "/Encyrillic": "\u041D", + "/Endescendercyrillic": "\u04A2", + "/Eng": "\u014A", + "/Engecyr": "\u04A4", + "/Enghecyrillic": "\u04A4", + "/Enhookcyr": "\u04C7", + "/Enhookcyrillic": "\u04C7", + "/Enhookleftcyr": "\u0528", + "/Enmiddlehookcyr": "\u0522", + "/Ensharptailcyr": "\u04C9", + "/Entailcyr": "\u04A2", + "/Eogonek": "\u0118", + "/Eopen": "\u0190", + "/Eparens": "\u1F114", + "/Epsilon": "\u0395", + "/Epsilonacute": "\u1FC9", + "/Epsilonasper": "\u1F19", + "/Epsilonasperacute": "\u1F1D", + "/Epsilonaspergrave": "\u1F1B", + "/Epsilongrave": "\u1FC8", + "/Epsilonlenis": "\u1F18", + "/Epsilonlenisacute": "\u1F1C", + "/Epsilonlenisgrave": "\u1F1A", + "/Epsilontonos": "\u0388", + "/Ercyr": "\u0420", + "/Ercyrillic": "\u0420", + "/Ereversed": "\u018E", + "/Ereversedcyr": "\u042D", + "/Ereversedcyrillic": "\u042D", + "/Ereverseddieresiscyr": "\u04EC", + "/Ereversedopen": "\uA7AB", + "/Ertickcyr": "\u048E", + "/Escript": "\u2130", + "/Escyr": "\u0421", + "/Escyrillic": "\u0421", + "/Esdescendercyrillic": "\u04AA", + "/Esh": "\u01A9", + "/Esmall": "\uF765", + "/Esmallturned": "\u2C7B", + "/Esquare": "\u1F134", + "/Esquareblack": "\u1F174", + "/Estailcyr": "\u04AA", + "/Estroke": "\u0246", + "/Et": "\uA76A", + "/Eta": "\u0397", + "/Etaacute": "\u1FCB", + "/Etaasper": "\u1F29", + "/Etaasperacute": "\u1F2D", + "/Etaasperacuteiotasub": "\u1F9D", + "/Etaaspergrave": "\u1F2B", + "/Etaaspergraveiotasub": "\u1F9B", + "/Etaasperiotasub": "\u1F99", + "/Etaaspertilde": "\u1F2F", + "/Etaaspertildeiotasub": "\u1F9F", + "/Etagrave": "\u1FCA", + "/Etaiotasub": "\u1FCC", + "/Etalenis": "\u1F28", + "/Etalenisacute": "\u1F2C", + "/Etalenisacuteiotasub": "\u1F9C", + "/Etalenisgrave": "\u1F2A", + "/Etalenisgraveiotasub": "\u1F9A", + "/Etalenisiotasub": "\u1F98", + "/Etalenistilde": "\u1F2E", + "/Etalenistildeiotasub": "\u1F9E", + "/Etarmenian": "\u0538", + "/Etatonos": "\u0389", + "/Eth": "\u00D0", + "/Ethsmall": "\uF7F0", + "/Etilde": "\u1EBC", + "/Etildebelow": "\u1E1A", + "/Eukrcyr": "\u0404", + "/Euro": "\u20AC", + "/Ezh": "\u01B7", + "/Ezhcaron": "\u01EE", + "/Ezhreversed": "\u01B8", + "/F": "\u0046", + "/Fcircle": "\u24BB", + "/Fcircleblack": "\u1F155", + "/Fdot": "\u1E1E", + "/Fdotaccent": "\u1E1E", + "/Feharmenian": "\u0556", + "/Feicoptic": "\u03E4", + "/Fhook": "\u0191", + "/Finsular": "\uA77B", + "/Fitacyr": "\u0472", + "/Fitacyrillic": "\u0472", + "/Fiveroman": "\u2164", + "/Fmonospace": "\uFF26", + "/Fourroman": "\u2163", + "/Fparens": "\u1F115", + "/Fscript": "\u2131", + "/Fsmall": "\uF766", + "/Fsquare": "\u1F135", + "/Fsquareblack": "\u1F175", + "/Fstroke": "\uA798", + "/Fturned": "\u2132", + "/G": "\u0047", + "/GBsquare": "\u3387", + "/Gacute": "\u01F4", + "/Gamma": "\u0393", + "/Gammaafrican": "\u0194", + "/Gammadblstruck": "\u213E", + "/Gangiacoptic": "\u03EA", + "/Gbreve": "\u011E", + "/Gcaron": "\u01E6", + "/Gcedilla": "\u0122", + "/Gcircle": "\u24BC", + "/Gcircleblack": "\u1F156", + "/Gcircumflex": "\u011C", + "/Gcommaaccent": "\u0122", + "/Gdot": "\u0120", + "/Gdotaccent": "\u0120", + "/Gecyr": "\u0413", + "/Gecyrillic": "\u0413", + "/Gehookcyr": "\u0494", + "/Gehookstrokecyr": "\u04FA", + "/Germandbls": "\u1E9E", + "/Gestrokecyr": "\u0492", + "/Getailcyr": "\u04F6", + "/Geupcyr": "\u0490", + "/Ghadarmenian": "\u0542", + "/Ghemiddlehookcyrillic": "\u0494", + "/Ghestrokecyrillic": "\u0492", + "/Gheupturncyrillic": "\u0490", + "/Ghook": "\u0193", + "/Ghooksmall": "\u029B", + "/Gimarmenian": "\u0533", + "/Ginsular": "\uA77D", + "/Ginsularturned": "\uA77E", + "/Gjecyr": "\u0403", + "/Gjecyrillic": "\u0403", + "/Glottalstop": "\u0241", + "/Gmacron": "\u1E20", + "/Gmonospace": "\uFF27", + "/Gobliquestroke": "\uA7A0", + "/Gparens": "\u1F116", + "/Grave": "\uF6CE", + "/Gravesmall": "\uF760", + "/Gsmall": "\uF767", + "/Gsmallhook": "\u029B", + "/Gsquare": "\u1F136", + "/Gsquareblack": "\u1F176", + "/Gstroke": "\u01E4", + "/Gturnedsans": "\u2141", + "/H": "\u0048", + "/H18533": "\u25CF", + "/H18543": "\u25AA", + "/H18551": "\u25AB", + "/H22073": "\u25A1", + "/HPsquare": "\u33CB", + "/HVsquare": "\u1F14A", + "/Haabkhasiancyrillic": "\u04A8", + "/Haabkhcyr": "\u04A8", + "/Hacyr": "\u0425", + "/Hadescendercyrillic": "\u04B2", + "/Hahookcyr": "\u04FC", + "/Hardcyr": "\u042A", + "/Hardsigncyrillic": "\u042A", + "/Hastrokecyr": "\u04FE", + "/Hbar": "\u0126", + "/Hbrevebelow": "\u1E2A", + "/Hcaron": "\u021E", + "/Hcedilla": "\u1E28", + "/Hcircle": "\u24BD", + "/Hcircleblack": "\u1F157", + "/Hcircumflex": "\u0124", + "/Hdblstruck": "\u210D", + "/Hdescender": "\u2C67", + "/Hdieresis": "\u1E26", + "/Hdot": "\u1E22", + "/Hdotaccent": "\u1E22", + "/Hdotbelow": "\u1E24", + "/Heng": "\uA726", + "/Heta": "\u0370", + "/Hfraktur": "\u210C", + "/Hgfullwidth": "\u32CC", + "/Hhalf": "\u2C75", + "/Hhook": "\uA7AA", + "/Hmonospace": "\uFF28", + "/Hoarmenian": "\u0540", + "/HonAA": "\u0611", + "/HonRA": "\u0612", + "/HonSAW": "\u0610", + "/Horicoptic": "\u03E8", + "/Hparens": "\u1F117", + "/Hscript": "\u210B", + "/Hsmall": "\uF768", + "/Hsquare": "\u1F137", + "/Hsquareblack": "\u1F177", + "/Hstrokemod": "\uA7F8", + "/Hturned": "\uA78D", + "/Hungarumlaut": "\uF6CF", + "/Hungarumlautsmall": "\uF6F8", + "/Hwair": "\u01F6", + "/Hzsquare": "\u3390", + "/I": "\u0049", + "/IAcyrillic": "\u042F", + "/ICsquareblack": "\u1F18B", + "/IJ": "\u0132", + "/IUcyrillic": "\u042E", + "/Iacute": "\u00CD", + "/Iacutesmall": "\uF7ED", + "/Ibreve": "\u012C", + "/Icaron": "\u01CF", + "/Icircle": "\u24BE", + "/Icircleblack": "\u1F158", + "/Icircumflex": "\u00CE", + "/Icircumflexsmall": "\uF7EE", + "/Icyr": "\u0418", + "/Icyrillic": "\u0406", + "/Idblgrave": "\u0208", + "/Idieresis": "\u00CF", + "/Idieresisacute": "\u1E2E", + "/Idieresiscyr": "\u04E4", + "/Idieresiscyrillic": "\u04E4", + "/Idieresissmall": "\uF7EF", + "/Idot": "\u0130", + "/Idotaccent": "\u0130", + "/Idotbelow": "\u1ECA", + "/Iebrevecyr": "\u04D6", + "/Iebrevecyrillic": "\u04D6", + "/Iecyr": "\u0415", + "/Iecyrillic": "\u0415", + "/Iegravecyr": "\u0400", + "/Ifraktur": "\u2111", + "/Igrave": "\u00CC", + "/Igravecyr": "\u040D", + "/Igravedbl": "\u0208", + "/Igravesmall": "\uF7EC", + "/Ihoi": "\u1EC8", + "/Ihookabove": "\u1EC8", + "/Iicyrillic": "\u0418", + "/Iinvertedbreve": "\u020A", + "/Iishortcyrillic": "\u0419", + "/Imacron": "\u012A", + "/Imacroncyr": "\u04E2", + "/Imacroncyrillic": "\u04E2", + "/Imonospace": "\uFF29", + "/Iniarmenian": "\u053B", + "/Iocyr": "\u0401", + "/Iocyrillic": "\u0401", + "/Iogonek": "\u012E", + "/Iota": "\u0399", + "/Iotaacute": "\u1FDB", + "/Iotaafrican": "\u0196", + "/Iotaasper": "\u1F39", + "/Iotaasperacute": "\u1F3D", + "/Iotaaspergrave": "\u1F3B", + "/Iotaaspertilde": "\u1F3F", + "/Iotabreve": "\u1FD8", + "/Iotadieresis": "\u03AA", + "/Iotagrave": "\u1FDA", + "/Iotalenis": "\u1F38", + "/Iotalenisacute": "\u1F3C", + "/Iotalenisgrave": "\u1F3A", + "/Iotalenistilde": "\u1F3E", + "/Iotatonos": "\u038A", + "/Iotawithmacron": "\u1FD9", + "/Iparens": "\u1F118", + "/Is": "\uA76C", + "/Iscript": "\u2110", + "/Ishortcyr": "\u0419", + "/Ishortsharptailcyr": "\u048A", + "/Ismall": "\uF769", + "/Isquare": "\u1F138", + "/Isquareblack": "\u1F178", + "/Istroke": "\u0197", + "/Itilde": "\u0128", + "/Itildebelow": "\u1E2C", + "/Iukrcyr": "\u0406", + "/Izhitsacyr": "\u0474", + "/Izhitsacyrillic": "\u0474", + "/Izhitsadblgravecyrillic": "\u0476", + "/Izhitsagravedblcyr": "\u0476", + "/J": "\u004A", + "/Jaarmenian": "\u0541", + "/Jallajalalouhou": "\uFDFB", + "/Jcircle": "\u24BF", + "/Jcircleblack": "\u1F159", + "/Jcircumflex": "\u0134", + "/Jcrossed-tail": "\uA7B2", + "/Jecyr": "\u0408", + "/Jecyrillic": "\u0408", + "/Jheharmenian": "\u054B", + "/Jmonospace": "\uFF2A", + "/Jparens": "\u1F119", + "/Jsmall": "\uF76A", + "/Jsquare": "\u1F139", + "/Jsquareblack": "\u1F179", + "/Jstroke": "\u0248", + "/K": "\u004B", + "/KBsquare": "\u3385", + "/KKsquare": "\u33CD", + "/KORONIS": "\u1FBD", + "/Kaaleutcyr": "\u051E", + "/Kabashkcyr": "\u04A0", + "/Kabashkircyrillic": "\u04A0", + "/Kacute": "\u1E30", + "/Kacyr": "\u041A", + "/Kacyrillic": "\u041A", + "/Kadescendercyrillic": "\u049A", + "/Kahookcyr": "\u04C3", + "/Kahookcyrillic": "\u04C3", + "/Kaisymbol": "\u03CF", + "/Kappa": "\u039A", + "/Kastrokecyr": "\u049E", + "/Kastrokecyrillic": "\u049E", + "/Katailcyr": "\u049A", + "/Kaverticalstrokecyr": "\u049C", + "/Kaverticalstrokecyrillic": "\u049C", + "/Kcaron": "\u01E8", + "/Kcedilla": "\u0136", + "/Kcircle": "\u24C0", + "/Kcircleblack": "\u1F15A", + "/Kcommaaccent": "\u0136", + "/Kdescender": "\u2C69", + "/Kdiagonalstroke": "\uA742", + "/Kdotbelow": "\u1E32", + "/Keharmenian": "\u0554", + "/Kenarmenian": "\u053F", + "/Khacyrillic": "\u0425", + "/Kheicoptic": "\u03E6", + "/Khook": "\u0198", + "/Kjecyr": "\u040C", + "/Kjecyrillic": "\u040C", + "/Klinebelow": "\u1E34", + "/Kmonospace": "\uFF2B", + "/Kobliquestroke": "\uA7A2", + "/Koppa": "\u03DE", + "/Koppaarchaic": "\u03D8", + "/Koppacyr": "\u0480", + "/Koppacyrillic": "\u0480", + "/Koppagreek": "\u03DE", + "/Kparens": "\u1F11A", + "/Ksicyr": "\u046E", + "/Ksicyrillic": "\u046E", + "/Ksmall": "\uF76B", + "/Ksquare": "\u1F13A", + "/Ksquareblack": "\u1F17A", + "/Kstroke": "\uA740", + "/Kstrokediagonalstroke": "\uA744", + "/Kturned": "\uA7B0", + "/L": "\u004C", + "/LJ": "\u01C7", + "/LL": "\uF6BF", + "/LLwelsh": "\u1EFA", + "/LTDfullwidth": "\u32CF", + "/Lacute": "\u0139", + "/Lambda": "\u039B", + "/Lbar": "\u023D", + "/Lbelt": "\uA7AD", + "/Lbroken": "\uA746", + "/Lcaron": "\u013D", + "/Lcedilla": "\u013B", + "/Lcircle": "\u24C1", + "/Lcircleblack": "\u1F15B", + "/Lcircumflexbelow": "\u1E3C", + "/Lcommaaccent": "\u013B", + "/Ldblbar": "\u2C60", + "/Ldot": "\u013F", + "/Ldotaccent": "\u013F", + "/Ldotbelow": "\u1E36", + "/Ldotbelowmacron": "\u1E38", + "/Lhacyr": "\u0514", + "/Liwnarmenian": "\u053C", + "/Lj": "\u01C8", + "/Ljecyr": "\u0409", + "/Ljecyrillic": "\u0409", + "/Ljekomicyr": "\u0508", + "/Llinebelow": "\u1E3A", + "/Lmacrondot": "\u1E38", + "/Lmiddletilde": "\u2C62", + "/Lmonospace": "\uFF2C", + "/Lparens": "\u1F11B", + "/Lreversedsans": "\u2143", + "/Lscript": "\u2112", + "/Lslash": "\u0141", + "/Lslashsmall": "\uF6F9", + "/Lsmall": "\uF76C", + "/Lsquare": "\u1F13B", + "/Lsquareblack": "\u1F17B", + "/Lstroke": "\uA748", + "/Lturned": "\uA780", + "/Lturnedsans": "\u2142", + "/M": "\u004D", + "/MBsquare": "\u3386", + "/MVsquare": "\u1F14B", + "/Macron": "\uF6D0", + "/Macronsmall": "\uF7AF", + "/Macute": "\u1E3E", + "/Mcircle": "\u24C2", + "/Mcircleblack": "\u1F15C", + "/Mdot": "\u1E40", + "/Mdotaccent": "\u1E40", + "/Mdotbelow": "\u1E42", + "/Menarmenian": "\u0544", + "/Mhook": "\u2C6E", + "/Mmonospace": "\uFF2D", + "/Mohammad": "\uFDF4", + "/Mparens": "\u1F11C", + "/Mscript": "\u2133", + "/Msmall": "\uF76D", + "/Msquare": "\u1F13C", + "/Msquareblack": "\u1F17C", + "/Mturned": "\u019C", + "/Mturnedsmall": "\uA7FA", + "/Mu": "\u039C", + "/N": "\u004E", + "/NJ": "\u01CA", + "/Nacute": "\u0143", + "/Ncaron": "\u0147", + "/Ncedilla": "\u0145", + "/Ncircle": "\u24C3", + "/Ncircleblack": "\u1F15D", + "/Ncircumflexbelow": "\u1E4A", + "/Ncommaaccent": "\u0145", + "/Ndblstruck": "\u2115", + "/Ndescender": "\uA790", + "/Ndot": "\u1E44", + "/Ndotaccent": "\u1E44", + "/Ndotbelow": "\u1E46", + "/Ngrave": "\u01F8", + "/Nhookleft": "\u019D", + "/Nineroman": "\u2168", + "/Nj": "\u01CB", + "/Njecyr": "\u040A", + "/Njecyrillic": "\u040A", + "/Njekomicyr": "\u050A", + "/Nlinebelow": "\u1E48", + "/Nlongrightleg": "\u0220", + "/Nmonospace": "\uFF2E", + "/Nobliquestroke": "\uA7A4", + "/Nowarmenian": "\u0546", + "/Nparens": "\u1F11D", + "/Nsmall": "\uF76E", + "/Nsquare": "\u1F13D", + "/Nsquareblack": "\u1F17D", + "/Ntilde": "\u00D1", + "/Ntildesmall": "\uF7F1", + "/Nu": "\u039D", + "/O": "\u004F", + "/OE": "\u0152", + "/OEsmall": "\uF6FA", + "/OO": "\uA74E", + "/Oacute": "\u00D3", + "/Oacutesmall": "\uF7F3", + "/Obar": "\u019F", + "/Obarcyr": "\u04E8", + "/Obardieresiscyr": "\u04EA", + "/Obarredcyrillic": "\u04E8", + "/Obarreddieresiscyrillic": "\u04EA", + "/Obreve": "\u014E", + "/Ocaron": "\u01D1", + "/Ocenteredtilde": "\u019F", + "/Ocircle": "\u24C4", + "/Ocircleblack": "\u1F15E", + "/Ocircumflex": "\u00D4", + "/Ocircumflexacute": "\u1ED0", + "/Ocircumflexdotbelow": "\u1ED8", + "/Ocircumflexgrave": "\u1ED2", + "/Ocircumflexhoi": "\u1ED4", + "/Ocircumflexhookabove": "\u1ED4", + "/Ocircumflexsmall": "\uF7F4", + "/Ocircumflextilde": "\u1ED6", + "/Ocyr": "\u041E", + "/Ocyrillic": "\u041E", + "/Odblacute": "\u0150", + "/Odblgrave": "\u020C", + "/Odieresis": "\u00D6", + "/Odieresiscyr": "\u04E6", + "/Odieresiscyrillic": "\u04E6", + "/Odieresismacron": "\u022A", + "/Odieresissmall": "\uF7F6", + "/Odot": "\u022E", + "/Odotbelow": "\u1ECC", + "/Odotmacron": "\u0230", + "/Ogoneksmall": "\uF6FB", + "/Ograve": "\u00D2", + "/Ogravedbl": "\u020C", + "/Ogravesmall": "\uF7F2", + "/Oharmenian": "\u0555", + "/Ohm": "\u2126", + "/Ohoi": "\u1ECE", + "/Ohookabove": "\u1ECE", + "/Ohorn": "\u01A0", + "/Ohornacute": "\u1EDA", + "/Ohorndotbelow": "\u1EE2", + "/Ohorngrave": "\u1EDC", + "/Ohornhoi": "\u1EDE", + "/Ohornhookabove": "\u1EDE", + "/Ohorntilde": "\u1EE0", + "/Ohungarumlaut": "\u0150", + "/Oi": "\u01A2", + "/Oinvertedbreve": "\u020E", + "/Oloop": "\uA74C", + "/Omacron": "\u014C", + "/Omacronacute": "\u1E52", + "/Omacrongrave": "\u1E50", + "/Omega": "\u2126", + "/Omegaacute": "\u1FFB", + "/Omegaasper": "\u1F69", + "/Omegaasperacute": "\u1F6D", + "/Omegaasperacuteiotasub": "\u1FAD", + "/Omegaaspergrave": "\u1F6B", + "/Omegaaspergraveiotasub": "\u1FAB", + "/Omegaasperiotasub": "\u1FA9", + "/Omegaaspertilde": "\u1F6F", + "/Omegaaspertildeiotasub": "\u1FAF", + "/Omegacyr": "\u0460", + "/Omegacyrillic": "\u0460", + "/Omegagrave": "\u1FFA", + "/Omegagreek": "\u03A9", + "/Omegaiotasub": "\u1FFC", + "/Omegalenis": "\u1F68", + "/Omegalenisacute": "\u1F6C", + "/Omegalenisacuteiotasub": "\u1FAC", + "/Omegalenisgrave": "\u1F6A", + "/Omegalenisgraveiotasub": "\u1FAA", + "/Omegalenisiotasub": "\u1FA8", + "/Omegalenistilde": "\u1F6E", + "/Omegalenistildeiotasub": "\u1FAE", + "/Omegaroundcyr": "\u047A", + "/Omegaroundcyrillic": "\u047A", + "/Omegatitlocyr": "\u047C", + "/Omegatitlocyrillic": "\u047C", + "/Omegatonos": "\u038F", + "/Omicron": "\u039F", + "/Omicronacute": "\u1FF9", + "/Omicronasper": "\u1F49", + "/Omicronasperacute": "\u1F4D", + "/Omicronaspergrave": "\u1F4B", + "/Omicrongrave": "\u1FF8", + "/Omicronlenis": "\u1F48", + "/Omicronlenisacute": "\u1F4C", + "/Omicronlenisgrave": "\u1F4A", + "/Omicrontonos": "\u038C", + "/Omonospace": "\uFF2F", + "/Oneroman": "\u2160", + "/Oogonek": "\u01EA", + "/Oogonekmacron": "\u01EC", + "/Oopen": "\u0186", + "/Oparens": "\u1F11E", + "/Oslash": "\u00D8", + "/Oslashacute": "\u01FE", + "/Oslashsmall": "\uF7F8", + "/Osmall": "\uF76F", + "/Osquare": "\u1F13E", + "/Osquareblack": "\u1F17E", + "/Ostroke": "\uA74A", + "/Ostrokeacute": "\u01FE", + "/Otcyr": "\u047E", + "/Otcyrillic": "\u047E", + "/Otilde": "\u00D5", + "/Otildeacute": "\u1E4C", + "/Otildedieresis": "\u1E4E", + "/Otildemacron": "\u022C", + "/Otildesmall": "\uF7F5", + "/Ou": "\u0222", + "/P": "\u0050", + "/PAsquareblack": "\u1F18C", + "/PPVsquare": "\u1F14E", + "/Pacute": "\u1E54", + "/Palochkacyr": "\u04C0", + "/Pcircle": "\u24C5", + "/Pcircleblack": "\u1F15F", + "/Pcrosssquareblack": "\u1F18A", + "/Pdblstruck": "\u2119", + "/Pdot": "\u1E56", + "/Pdotaccent": "\u1E56", + "/Pecyr": "\u041F", + "/Pecyrillic": "\u041F", + "/Peharmenian": "\u054A", + "/Pehookcyr": "\u04A6", + "/Pemiddlehookcyrillic": "\u04A6", + "/Petailcyr": "\u0524", + "/Pflourish": "\uA752", + "/Phi": "\u03A6", + "/Phook": "\u01A4", + "/Pi": "\u03A0", + "/Pidblstruck": "\u213F", + "/Piwrarmenian": "\u0553", + "/Pmonospace": "\uFF30", + "/Pparens": "\u1F11F", + "/Psi": "\u03A8", + "/Psicyr": "\u0470", + "/Psicyrillic": "\u0470", + "/Psmall": "\uF770", + "/Psquare": "\u1F13F", + "/Psquareblack": "\u1F17F", + "/Pstroke": "\u2C63", + "/Pstrokedescender": "\uA750", + "/Ptail": "\uA754", + "/Q": "\u0051", + "/Qacyr": "\u051A", + "/QalaUsedAsKoranicStopSign": "\uFDF1", + "/Qcircle": "\u24C6", + "/Qcircleblack": "\u1F160", + "/Qdblstruck": "\u211A", + "/Qdiagonalstroke": "\uA758", + "/Qmonospace": "\uFF31", + "/Qparens": "\u1F120", + "/Qrotated": "\u213A", + "/Qsmall": "\uF771", + "/Qsmallhooktail": "\u024A", + "/Qsquare": "\u1F140", + "/Qsquareblack": "\u1F180", + "/Qstrokedescender": "\uA756", + "/R": "\u0052", + "/Raarmenian": "\u054C", + "/Racute": "\u0154", + "/Rasoul": "\uFDF6", + "/Rcaron": "\u0158", + "/Rcedilla": "\u0156", + "/Rcircle": "\u24C7", + "/Rcircleblack": "\u1F161", + "/Rcommaaccent": "\u0156", + "/Rdblgrave": "\u0210", + "/Rdblstruck": "\u211D", + "/Rdot": "\u1E58", + "/Rdotaccent": "\u1E58", + "/Rdotbelow": "\u1E5A", + "/Rdotbelowmacron": "\u1E5C", + "/Reharmenian": "\u0550", + "/Reverseddottedsigmalunatesymbol": "\u03FF", + "/Reversedzecyr": "\u0510", + "/Rfraktur": "\u211C", + "/Rgravedbl": "\u0210", + "/Rhacyr": "\u0516", + "/Rho": "\u03A1", + "/Rhoasper": "\u1FEC", + "/Ringsmall": "\uF6FC", + "/Rinsular": "\uA782", + "/Rinvertedbreve": "\u0212", + "/Rinvertedsmall": "\u0281", + "/Ritaliccircle": "\u1F12C", + "/Rlinebelow": "\u1E5E", + "/Rmacrondot": "\u1E5C", + "/Rmonospace": "\uFF32", + "/Robliquestroke": "\uA7A6", + "/Rparens": "\u1F121", + "/Rrotunda": "\uA75A", + "/Rscript": "\u211B", + "/Rsmall": "\uF772", + "/Rsmallinverted": "\u0281", + "/Rsmallinvertedsuperior": "\u02B6", + "/Rsquare": "\u1F141", + "/Rsquareblack": "\u1F181", + "/Rstroke": "\u024C", + "/Rsupinvertedmod": "\u02B6", + "/Rtail": "\u2C64", + "/RubElHizbstart": "\u06DE", + "/Rumrotunda": "\uA75C", + "/Rumsmall": "\uA776", + "/S": "\u0053", + "/SAsquareblack": "\u1F18D", + "/SDsquare": "\u1F14C", + "/SF010000": "\u250C", + "/SF020000": "\u2514", + "/SF030000": "\u2510", + "/SF040000": "\u2518", + "/SF050000": "\u253C", + "/SF060000": "\u252C", + "/SF070000": "\u2534", + "/SF080000": "\u251C", + "/SF090000": "\u2524", + "/SF100000": "\u2500", + "/SF110000": "\u2502", + "/SF190000": "\u2561", + "/SF200000": "\u2562", + "/SF210000": "\u2556", + "/SF220000": "\u2555", + "/SF230000": "\u2563", + "/SF240000": "\u2551", + "/SF250000": "\u2557", + "/SF260000": "\u255D", + "/SF270000": "\u255C", + "/SF280000": "\u255B", + "/SF360000": "\u255E", + "/SF370000": "\u255F", + "/SF380000": "\u255A", + "/SF390000": "\u2554", + "/SF400000": "\u2569", + "/SF410000": "\u2566", + "/SF420000": "\u2560", + "/SF430000": "\u2550", + "/SF440000": "\u256C", + "/SF450000": "\u2567", + "/SF460000": "\u2568", + "/SF470000": "\u2564", + "/SF480000": "\u2565", + "/SF490000": "\u2559", + "/SF500000": "\u2558", + "/SF510000": "\u2552", + "/SF520000": "\u2553", + "/SF530000": "\u256B", + "/SF540000": "\u256A", + "/SSsquare": "\u1F14D", + "/Sacute": "\u015A", + "/Sacutedotaccent": "\u1E64", + "/Safha": "\u0603", + "/Sajdah": "\u06E9", + "/Salam": "\uFDF5", + "/Salla": "\uFDF9", + "/SallaUsedAsKoranicStopSign": "\uFDF0", + "/SallallahouAlayheWasallam": "\uFDFA", + "/Saltillo": "\uA78B", + "/Sampi": "\u03E0", + "/Sampiarchaic": "\u0372", + "/Sampigreek": "\u03E0", + "/San": "\u03FA", + "/Sanah": "\u0601", + "/Scaron": "\u0160", + "/Scarondot": "\u1E66", + "/Scarondotaccent": "\u1E66", + "/Scaronsmall": "\uF6FD", + "/Scedilla": "\u015E", + "/Schwa": "\u018F", + "/Schwacyr": "\u04D8", + "/Schwacyrillic": "\u04D8", + "/Schwadieresiscyr": "\u04DA", + "/Schwadieresiscyrillic": "\u04DA", + "/Scircle": "\u24C8", + "/Scircleblack": "\u1F162", + "/Scircumflex": "\u015C", + "/Scommaaccent": "\u0218", + "/Scriptg": "\uA7AC", + "/Sdot": "\u1E60", + "/Sdotaccent": "\u1E60", + "/Sdotbelow": "\u1E62", + "/Sdotbelowdotabove": "\u1E68", + "/Sdotbelowdotaccent": "\u1E68", + "/Seharmenian": "\u054D", + "/Semisoftcyr": "\u048C", + "/Sevenroman": "\u2166", + "/Shaarmenian": "\u0547", + "/Shacyr": "\u0428", + "/Shacyrillic": "\u0428", + "/Shchacyr": "\u0429", + "/Shchacyrillic": "\u0429", + "/Sheicoptic": "\u03E2", + "/SheneGerishin:hb": "\u059E", + "/Shhacyr": "\u04BA", + "/Shhacyrillic": "\u04BA", + "/Shhatailcyr": "\u0526", + "/Shimacoptic": "\u03EC", + "/Sho": "\u03F7", + "/Sigma": "\u03A3", + "/Sigmalunatesymbol": "\u03F9", + "/Sigmalunatesymboldotted": "\u03FE", + "/Sigmareversedlunatesymbol": "\u03FD", + "/Sinsular": "\uA784", + "/Sixroman": "\u2165", + "/Sjekomicyr": "\u050C", + "/Smonospace": "\uFF33", + "/Sobliquestroke": "\uA7A8", + "/Softcyr": "\u042C", + "/Softsigncyrillic": "\u042C", + "/Sparens": "\u1F122", + "/Sshell": "\u1F12A", + "/Ssmall": "\uF773", + "/Ssquare": "\u1F142", + "/Ssquareblack": "\u1F182", + "/Sswashtail": "\u2C7E", + "/Stigma": "\u03DA", + "/Stigmagreek": "\u03DA", + "/T": "\u0054", + "/Tau": "\u03A4", + "/Tbar": "\u0166", + "/Tcaron": "\u0164", + "/Tcedilla": "\u0162", + "/Tcircle": "\u24C9", + "/Tcircleblack": "\u1F163", + "/Tcircumflexbelow": "\u1E70", + "/Tcommaaccent": "\u0162", + "/Tdot": "\u1E6A", + "/Tdotaccent": "\u1E6A", + "/Tdotbelow": "\u1E6C", + "/Tecyr": "\u0422", + "/Tecyrillic": "\u0422", + "/Tedescendercyrillic": "\u04AC", + "/Tenroman": "\u2169", + "/Tetailcyr": "\u04AC", + "/Tetsecyr": "\u04B4", + "/Tetsecyrillic": "\u04B4", + "/Theta": "\u0398", + "/Thetasymbol": "\u03F4", + "/Thook": "\u01AC", + "/Thorn": "\u00DE", + "/Thornsmall": "\uF7FE", + "/Thornstroke": "\uA764", + "/Thornstrokedescender": "\uA766", + "/Threeroman": "\u2162", + "/Tildesmall": "\uF6FE", + "/Tinsular": "\uA786", + "/Tiwnarmenian": "\u054F", + "/Tjekomicyr": "\u050E", + "/Tlinebelow": "\u1E6E", + "/Tmonospace": "\uFF34", + "/Toarmenian": "\u0539", + "/Tonefive": "\u01BC", + "/Tonesix": "\u0184", + "/Tonetwo": "\u01A7", + "/Tparens": "\u1F123", + "/Tresillo": "\uA72A", + "/Tretroflexhook": "\u01AE", + "/Tsecyr": "\u0426", + "/Tsecyrillic": "\u0426", + "/Tshecyr": "\u040B", + "/Tshecyrillic": "\u040B", + "/Tsmall": "\uF774", + "/Tsquare": "\u1F143", + "/Tsquareblack": "\u1F183", + "/Tturned": "\uA7B1", + "/Twelveroman": "\u216B", + "/Twithdiagonalstroke": "\u023E", + "/Tworoman": "\u2161", + "/Tz": "\uA728", + "/U": "\u0055", + "/Uacute": "\u00DA", + "/Uacutedblcyr": "\u04F2", + "/Uacutesmall": "\uF7FA", + "/Ubar": "\u0244", + "/Ubreve": "\u016C", + "/Ucaron": "\u01D3", + "/Ucircle": "\u24CA", + "/Ucircleblack": "\u1F164", + "/Ucircumflex": "\u00DB", + "/Ucircumflexbelow": "\u1E76", + "/Ucircumflexsmall": "\uF7FB", + "/Ucyr": "\u0423", + "/Ucyrillic": "\u0423", + "/Udblacute": "\u0170", + "/Udblgrave": "\u0214", + "/Udieresis": "\u00DC", + "/Udieresisacute": "\u01D7", + "/Udieresisbelow": "\u1E72", + "/Udieresiscaron": "\u01D9", + "/Udieresiscyr": "\u04F0", + "/Udieresiscyrillic": "\u04F0", + "/Udieresisgrave": "\u01DB", + "/Udieresismacron": "\u01D5", + "/Udieresissmall": "\uF7FC", + "/Udotbelow": "\u1EE4", + "/Ugrave": "\u00D9", + "/Ugravedbl": "\u0214", + "/Ugravesmall": "\uF7F9", + "/Uhoi": "\u1EE6", + "/Uhookabove": "\u1EE6", + "/Uhorn": "\u01AF", + "/Uhornacute": "\u1EE8", + "/Uhorndotbelow": "\u1EF0", + "/Uhorngrave": "\u1EEA", + "/Uhornhoi": "\u1EEC", + "/Uhornhookabove": "\u1EEC", + "/Uhorntilde": "\u1EEE", + "/Uhungarumlaut": "\u0170", + "/Uhungarumlautcyrillic": "\u04F2", + "/Uinvertedbreve": "\u0216", + "/Ukcyr": "\u0478", + "/Ukcyrillic": "\u0478", + "/Umacron": "\u016A", + "/Umacroncyr": "\u04EE", + "/Umacroncyrillic": "\u04EE", + "/Umacrondieresis": "\u1E7A", + "/Umonospace": "\uFF35", + "/Uogonek": "\u0172", + "/Uparens": "\u1F124", + "/Upsilon": "\u03A5", + "/Upsilon1": "\u03D2", + "/Upsilonacute": "\u1FEB", + "/Upsilonacutehooksymbol": "\u03D3", + "/Upsilonacutehooksymbolgreek": "\u03D3", + "/Upsilonadieresishooksymbol": "\u03D4", + "/Upsilonafrican": "\u01B1", + "/Upsilonasper": "\u1F59", + "/Upsilonasperacute": "\u1F5D", + "/Upsilonaspergrave": "\u1F5B", + "/Upsilonaspertilde": "\u1F5F", + "/Upsilonbreve": "\u1FE8", + "/Upsilondieresis": "\u03AB", + "/Upsilondieresishooksymbolgreek": "\u03D4", + "/Upsilongrave": "\u1FEA", + "/Upsilonhooksymbol": "\u03D2", + "/Upsilontonos": "\u038E", + "/Upsilonwithmacron": "\u1FE9", + "/Uring": "\u016E", + "/Ushortcyr": "\u040E", + "/Ushortcyrillic": "\u040E", + "/Usmall": "\uF775", + "/Usquare": "\u1F144", + "/Usquareblack": "\u1F184", + "/Ustraightcyr": "\u04AE", + "/Ustraightcyrillic": "\u04AE", + "/Ustraightstrokecyr": "\u04B0", + "/Ustraightstrokecyrillic": "\u04B0", + "/Utilde": "\u0168", + "/Utildeacute": "\u1E78", + "/Utildebelow": "\u1E74", + "/V": "\u0056", + "/Vcircle": "\u24CB", + "/Vcircleblack": "\u1F165", + "/Vdiagonalstroke": "\uA75E", + "/Vdotbelow": "\u1E7E", + "/Vecyr": "\u0412", + "/Vecyrillic": "\u0412", + "/Vend": "\uA768", + "/Vewarmenian": "\u054E", + "/Vhook": "\u01B2", + "/Visigothicz": "\uA762", + "/Vmod": "\u2C7D", + "/Vmonospace": "\uFF36", + "/Voarmenian": "\u0548", + "/Volapukae": "\uA79A", + "/Volapukoe": "\uA79C", + "/Volapukue": "\uA79E", + "/Vparens": "\u1F125", + "/Vsmall": "\uF776", + "/Vsquare": "\u1F145", + "/Vsquareblack": "\u1F185", + "/Vtilde": "\u1E7C", + "/Vturned": "\u0245", + "/Vwelsh": "\u1EFC", + "/Vy": "\uA760", + "/W": "\u0057", + "/WZcircle": "\u1F12E", + "/Wacute": "\u1E82", + "/Wasallam": "\uFDF8", + "/Wcircle": "\u24CC", + "/Wcircleblack": "\u1F166", + "/Wcircumflex": "\u0174", + "/Wdieresis": "\u1E84", + "/Wdot": "\u1E86", + "/Wdotaccent": "\u1E86", + "/Wdotbelow": "\u1E88", + "/Wecyr": "\u051C", + "/Wgrave": "\u1E80", + "/Whook": "\u2C72", + "/Wmonospace": "\uFF37", + "/Wparens": "\u1F126", + "/Wsmall": "\uF777", + "/Wsquare": "\u1F146", + "/Wsquareblack": "\u1F186", + "/Wynn": "\u01F7", + "/X": "\u0058", + "/Xatailcyr": "\u04B2", + "/Xcircle": "\u24CD", + "/Xcircleblack": "\u1F167", + "/Xdieresis": "\u1E8C", + "/Xdot": "\u1E8A", + "/Xdotaccent": "\u1E8A", + "/Xeharmenian": "\u053D", + "/Xi": "\u039E", + "/Xmonospace": "\uFF38", + "/Xparens": "\u1F127", + "/Xsmall": "\uF778", + "/Xsquare": "\u1F147", + "/Xsquareblack": "\u1F187", + "/Y": "\u0059", + "/Yacute": "\u00DD", + "/Yacutesmall": "\uF7FD", + "/Yacyr": "\u042F", + "/Yaecyr": "\u0518", + "/Yatcyr": "\u0462", + "/Yatcyrillic": "\u0462", + "/Ycircle": "\u24CE", + "/Ycircleblack": "\u1F168", + "/Ycircumflex": "\u0176", + "/Ydieresis": "\u0178", + "/Ydieresissmall": "\uF7FF", + "/Ydot": "\u1E8E", + "/Ydotaccent": "\u1E8E", + "/Ydotbelow": "\u1EF4", + "/Yericyrillic": "\u042B", + "/Yerudieresiscyrillic": "\u04F8", + "/Ygrave": "\u1EF2", + "/Yhoi": "\u1EF6", + "/Yhook": "\u01B3", + "/Yhookabove": "\u1EF6", + "/Yiarmenian": "\u0545", + "/Yicyrillic": "\u0407", + "/Yiwnarmenian": "\u0552", + "/Ylongcyr": "\u042B", + "/Ylongdieresiscyr": "\u04F8", + "/Yloop": "\u1EFE", + "/Ymacron": "\u0232", + "/Ymonospace": "\uFF39", + "/Yogh": "\u021C", + "/Yot": "\u037F", + "/Yparens": "\u1F128", + "/Ysmall": "\uF779", + "/Ysquare": "\u1F148", + "/Ysquareblack": "\u1F188", + "/Ystroke": "\u024E", + "/Ytilde": "\u1EF8", + "/Yturnedsans": "\u2144", + "/Yucyr": "\u042E", + "/Yukrcyr": "\u0407", + "/Yusbigcyr": "\u046A", + "/Yusbigcyrillic": "\u046A", + "/Yusbigiotifiedcyr": "\u046C", + "/Yusbigiotifiedcyrillic": "\u046C", + "/Yuslittlecyr": "\u0466", + "/Yuslittlecyrillic": "\u0466", + "/Yuslittleiotifiedcyr": "\u0468", + "/Yuslittleiotifiedcyrillic": "\u0468", + "/Z": "\u005A", + "/Zaarmenian": "\u0536", + "/Zacute": "\u0179", + "/Zcaron": "\u017D", + "/Zcaronsmall": "\uF6FF", + "/Zcircle": "\u24CF", + "/Zcircleblack": "\u1F169", + "/Zcircumflex": "\u1E90", + "/Zdblstruck": "\u2124", + "/Zdescender": "\u2C6B", + "/Zdot": "\u017B", + "/Zdotaccent": "\u017B", + "/Zdotbelow": "\u1E92", + "/Zecyr": "\u0417", + "/Zecyrillic": "\u0417", + "/Zedescendercyrillic": "\u0498", + "/Zedieresiscyr": "\u04DE", + "/Zedieresiscyrillic": "\u04DE", + "/Zeta": "\u0396", + "/Zetailcyr": "\u0498", + "/Zfraktur": "\u2128", + "/Zhearmenian": "\u053A", + "/Zhebrevecyr": "\u04C1", + "/Zhebrevecyrillic": "\u04C1", + "/Zhecyr": "\u0416", + "/Zhecyrillic": "\u0416", + "/Zhedescendercyrillic": "\u0496", + "/Zhedieresiscyr": "\u04DC", + "/Zhedieresiscyrillic": "\u04DC", + "/Zhetailcyr": "\u0496", + "/Zhook": "\u0224", + "/Zjekomicyr": "\u0504", + "/Zlinebelow": "\u1E94", + "/Zmonospace": "\uFF3A", + "/Zparens": "\u1F129", + "/Zsmall": "\uF77A", + "/Zsquare": "\u1F149", + "/Zsquareblack": "\u1F189", + "/Zstroke": "\u01B5", + "/Zswashtail": "\u2C7F", + "/a": "\u0061", + "/a.inferior": "\u2090", + "/aHonRAA": "\u0613", + "/aa": "\uA733", + "/aabengali": "\u0986", + "/aacute": "\u00E1", + "/aadeva": "\u0906", + "/aagujarati": "\u0A86", + "/aagurmukhi": "\u0A06", + "/aamatragurmukhi": "\u0A3E", + "/aarusquare": "\u3303", + "/aavowelsignbengali": "\u09BE", + "/aavowelsigndeva": "\u093E", + "/aavowelsigngujarati": "\u0ABE", + "/abbreviationmarkarmenian": "\u055F", + "/abbreviationsigndeva": "\u0970", + "/abengali": "\u0985", + "/abopomofo": "\u311A", + "/abreve": "\u0103", + "/abreveacute": "\u1EAF", + "/abrevecyr": "\u04D1", + "/abrevecyrillic": "\u04D1", + "/abrevedotbelow": "\u1EB7", + "/abrevegrave": "\u1EB1", + "/abrevehoi": "\u1EB3", + "/abrevehookabove": "\u1EB3", + "/abrevetilde": "\u1EB5", + "/absquareblack": "\u1F18E", + "/acaron": "\u01CE", + "/accountof": "\u2100", + "/accurrent": "\u23E6", + "/acircle": "\u24D0", + "/acirclekatakana": "\u32D0", + "/acircumflex": "\u00E2", + "/acircumflexacute": "\u1EA5", + "/acircumflexdotbelow": "\u1EAD", + "/acircumflexgrave": "\u1EA7", + "/acircumflexhoi": "\u1EA9", + "/acircumflexhookabove": "\u1EA9", + "/acircumflextilde": "\u1EAB", + "/activatearabicformshaping": "\u206D", + "/activatesymmetricswapping": "\u206B", + "/acute": "\u00B4", + "/acutebelowcmb": "\u0317", + "/acutecmb": "\u0301", + "/acutecomb": "\u0301", + "/acutedblmiddlemod": "\u02F6", + "/acutedeva": "\u0954", + "/acutelowmod": "\u02CF", + "/acutemod": "\u02CA", + "/acutetonecmb": "\u0341", + "/acyr": "\u0430", + "/acyrillic": "\u0430", + "/adblgrave": "\u0201", + "/addakgurmukhi": "\u0A71", + "/addressedsubject": "\u2101", + "/adegadegpada": "\uA9CB", + "/adegpada": "\uA9CA", + "/adeva": "\u0905", + "/adieresis": "\u00E4", + "/adieresiscyr": "\u04D3", + "/adieresiscyrillic": "\u04D3", + "/adieresismacron": "\u01DF", + "/adishakti": "\u262C", + "/admissionTickets": "\u1F39F", + "/adot": "\u0227", + "/adotbelow": "\u1EA1", + "/adotmacron": "\u01E1", + "/ae": "\u00E6", + "/aeacute": "\u01FD", + "/aekorean": "\u3150", + "/aemacron": "\u01E3", + "/aerialTramway": "\u1F6A1", + "/afghani": "\u060B", + "/afii00208": "\u2015", + "/afii08941": "\u20A4", + "/afii10017": "\u0410", + "/afii10018": "\u0411", + "/afii10019": "\u0412", + "/afii10020": "\u0413", + "/afii10021": "\u0414", + "/afii10022": "\u0415", + "/afii10023": "\u0401", + "/afii10024": "\u0416", + "/afii10025": "\u0417", + "/afii10026": "\u0418", + "/afii10027": "\u0419", + "/afii10028": "\u041A", + "/afii10029": "\u041B", + "/afii10030": "\u041C", + "/afii10031": "\u041D", + "/afii10032": "\u041E", + "/afii10033": "\u041F", + "/afii10034": "\u0420", + "/afii10035": "\u0421", + "/afii10036": "\u0422", + "/afii10037": "\u0423", + "/afii10038": "\u0424", + "/afii10039": "\u0425", + "/afii10040": "\u0426", + "/afii10041": "\u0427", + "/afii10042": "\u0428", + "/afii10043": "\u0429", + "/afii10044": "\u042A", + "/afii10045": "\u042B", + "/afii10046": "\u042C", + "/afii10047": "\u042D", + "/afii10048": "\u042E", + "/afii10049": "\u042F", + "/afii10050": "\u0490", + "/afii10051": "\u0402", + "/afii10052": "\u0403", + "/afii10053": "\u0404", + "/afii10054": "\u0405", + "/afii10055": "\u0406", + "/afii10056": "\u0407", + "/afii10057": "\u0408", + "/afii10058": "\u0409", + "/afii10059": "\u040A", + "/afii10060": "\u040B", + "/afii10061": "\u040C", + "/afii10062": "\u040E", + "/afii10063": "\uF6C4", + "/afii10064": "\uF6C5", + "/afii10065": "\u0430", + "/afii10066": "\u0431", + "/afii10067": "\u0432", + "/afii10068": "\u0433", + "/afii10069": "\u0434", + "/afii10070": "\u0435", + "/afii10071": "\u0451", + "/afii10072": "\u0436", + "/afii10073": "\u0437", + "/afii10074": "\u0438", + "/afii10075": "\u0439", + "/afii10076": "\u043A", + "/afii10077": "\u043B", + "/afii10078": "\u043C", + "/afii10079": "\u043D", + "/afii10080": "\u043E", + "/afii10081": "\u043F", + "/afii10082": "\u0440", + "/afii10083": "\u0441", + "/afii10084": "\u0442", + "/afii10085": "\u0443", + "/afii10086": "\u0444", + "/afii10087": "\u0445", + "/afii10088": "\u0446", + "/afii10089": "\u0447", + "/afii10090": "\u0448", + "/afii10091": "\u0449", + "/afii10092": "\u044A", + "/afii10093": "\u044B", + "/afii10094": "\u044C", + "/afii10095": "\u044D", + "/afii10096": "\u044E", + "/afii10097": "\u044F", + "/afii10098": "\u0491", + "/afii10099": "\u0452", + "/afii10100": "\u0453", + "/afii10101": "\u0454", + "/afii10102": "\u0455", + "/afii10103": "\u0456", + "/afii10104": "\u0457", + "/afii10105": "\u0458", + "/afii10106": "\u0459", + "/afii10107": "\u045A", + "/afii10108": "\u045B", + "/afii10109": "\u045C", + "/afii10110": "\u045E", + "/afii10145": "\u040F", + "/afii10146": "\u0462", + "/afii10147": "\u0472", + "/afii10148": "\u0474", + "/afii10192": "\uF6C6", + "/afii10193": "\u045F", + "/afii10194": "\u0463", + "/afii10195": "\u0473", + "/afii10196": "\u0475", + "/afii10831": "\uF6C7", + "/afii10832": "\uF6C8", + "/afii10846": "\u04D9", + "/afii299": "\u200E", + "/afii300": "\u200F", + "/afii301": "\u200D", + "/afii57381": "\u066A", + "/afii57388": "\u060C", + "/afii57392": "\u0660", + "/afii57393": "\u0661", + "/afii57394": "\u0662", + "/afii57395": "\u0663", + "/afii57396": "\u0664", + "/afii57397": "\u0665", + "/afii57398": "\u0666", + "/afii57399": "\u0667", + "/afii57400": "\u0668", + "/afii57401": "\u0669", + "/afii57403": "\u061B", + "/afii57407": "\u061F", + "/afii57409": "\u0621", + "/afii57410": "\u0622", + "/afii57411": "\u0623", + "/afii57412": "\u0624", + "/afii57413": "\u0625", + "/afii57414": "\u0626", + "/afii57415": "\u0627", + "/afii57416": "\u0628", + "/afii57417": "\u0629", + "/afii57418": "\u062A", + "/afii57419": "\u062B", + "/afii57420": "\u062C", + "/afii57421": "\u062D", + "/afii57422": "\u062E", + "/afii57423": "\u062F", + "/afii57424": "\u0630", + "/afii57425": "\u0631", + "/afii57426": "\u0632", + "/afii57427": "\u0633", + "/afii57428": "\u0634", + "/afii57429": "\u0635", + "/afii57430": "\u0636", + "/afii57431": "\u0637", + "/afii57432": "\u0638", + "/afii57433": "\u0639", + "/afii57434": "\u063A", + "/afii57440": "\u0640", + "/afii57441": "\u0641", + "/afii57442": "\u0642", + "/afii57443": "\u0643", + "/afii57444": "\u0644", + "/afii57445": "\u0645", + "/afii57446": "\u0646", + "/afii57448": "\u0648", + "/afii57449": "\u0649", + "/afii57450": "\u064A", + "/afii57451": "\u064B", + "/afii57452": "\u064C", + "/afii57453": "\u064D", + "/afii57454": "\u064E", + "/afii57455": "\u064F", + "/afii57456": "\u0650", + "/afii57457": "\u0651", + "/afii57458": "\u0652", + "/afii57470": "\u0647", + "/afii57505": "\u06A4", + "/afii57506": "\u067E", + "/afii57507": "\u0686", + "/afii57508": "\u0698", + "/afii57509": "\u06AF", + "/afii57511": "\u0679", + "/afii57512": "\u0688", + "/afii57513": "\u0691", + "/afii57514": "\u06BA", + "/afii57519": "\u06D2", + "/afii57534": "\u06D5", + "/afii57636": "\u20AA", + "/afii57645": "\u05BE", + "/afii57658": "\u05C3", + "/afii57664": "\u05D0", + "/afii57665": "\u05D1", + "/afii57666": "\u05D2", + "/afii57667": "\u05D3", + "/afii57668": "\u05D4", + "/afii57669": "\u05D5", + "/afii57670": "\u05D6", + "/afii57671": "\u05D7", + "/afii57672": "\u05D8", + "/afii57673": "\u05D9", + "/afii57674": "\u05DA", + "/afii57675": "\u05DB", + "/afii57676": "\u05DC", + "/afii57677": "\u05DD", + "/afii57678": "\u05DE", + "/afii57679": "\u05DF", + "/afii57680": "\u05E0", + "/afii57681": "\u05E1", + "/afii57682": "\u05E2", + "/afii57683": "\u05E3", + "/afii57684": "\u05E4", + "/afii57685": "\u05E5", + "/afii57686": "\u05E6", + "/afii57687": "\u05E7", + "/afii57688": "\u05E8", + "/afii57689": "\u05E9", + "/afii57690": "\u05EA", + "/afii57694": "\uFB2A", + "/afii57695": "\uFB2B", + "/afii57700": "\uFB4B", + "/afii57705": "\uFB1F", + "/afii57716": "\u05F0", + "/afii57717": "\u05F1", + "/afii57718": "\u05F2", + "/afii57723": "\uFB35", + "/afii57793": "\u05B4", + "/afii57794": "\u05B5", + "/afii57795": "\u05B6", + "/afii57796": "\u05BB", + "/afii57797": "\u05B8", + "/afii57798": "\u05B7", + "/afii57799": "\u05B0", + "/afii57800": "\u05B2", + "/afii57801": "\u05B1", + "/afii57802": "\u05B3", + "/afii57803": "\u05C2", + "/afii57804": "\u05C1", + "/afii57806": "\u05B9", + "/afii57807": "\u05BC", + "/afii57839": "\u05BD", + "/afii57841": "\u05BF", + "/afii57842": "\u05C0", + "/afii57929": "\u02BC", + "/afii61248": "\u2105", + "/afii61289": "\u2113", + "/afii61352": "\u2116", + "/afii61573": "\u202C", + "/afii61574": "\u202D", + "/afii61575": "\u202E", + "/afii61664": "\u200C", + "/afii63167": "\u066D", + "/afii64937": "\u02BD", + "/agrave": "\u00E0", + "/agravedbl": "\u0201", + "/agujarati": "\u0A85", + "/agurmukhi": "\u0A05", + "/ahiragana": "\u3042", + "/ahoi": "\u1EA3", + "/ahookabove": "\u1EA3", + "/aibengali": "\u0990", + "/aibopomofo": "\u311E", + "/aideva": "\u0910", + "/aiecyr": "\u04D5", + "/aiecyrillic": "\u04D5", + "/aigujarati": "\u0A90", + "/aigurmukhi": "\u0A10", + "/aimatragurmukhi": "\u0A48", + "/ain.fina": "\uFECA", + "/ain.init": "\uFECB", + "/ain.init_alefmaksura.fina": "\uFCF7", + "/ain.init_jeem.fina": "\uFC29", + "/ain.init_jeem.medi": "\uFCBA", + "/ain.init_jeem.medi_meem.medi": "\uFDC4", + "/ain.init_meem.fina": "\uFC2A", + "/ain.init_meem.medi": "\uFCBB", + "/ain.init_meem.medi_meem.medi": "\uFD77", + "/ain.init_yeh.fina": "\uFCF8", + "/ain.isol": "\uFEC9", + "/ain.medi": "\uFECC", + "/ain.medi_alefmaksura.fina": "\uFD13", + "/ain.medi_jeem.medi_meem.fina": "\uFD75", + "/ain.medi_meem.medi_alefmaksura.fina": "\uFD78", + "/ain.medi_meem.medi_meem.fina": "\uFD76", + "/ain.medi_meem.medi_yeh.fina": "\uFDB6", + "/ain.medi_yeh.fina": "\uFD14", + "/ainThreeDotsDownAbove": "\u075E", + "/ainTwoDotsAbove": "\u075D", + "/ainTwoDotsVerticallyAbove": "\u075F", + "/ainarabic": "\u0639", + "/ainfinalarabic": "\uFECA", + "/aininitialarabic": "\uFECB", + "/ainmedialarabic": "\uFECC", + "/ainthreedotsabove": "\u06A0", + "/ainvertedbreve": "\u0203", + "/airplaneArriving": "\u1F6EC", + "/airplaneDeparture": "\u1F6EB", + "/aivowelsignbengali": "\u09C8", + "/aivowelsigndeva": "\u0948", + "/aivowelsigngujarati": "\u0AC8", + "/akatakana": "\u30A2", + "/akatakanahalfwidth": "\uFF71", + "/akorean": "\u314F", + "/aktieselskab": "\u214D", + "/alarmclock": "\u23F0", + "/alef": "\u05D0", + "/alef.fina": "\uFE8E", + "/alef.init_fathatan.fina": "\uFD3D", + "/alef.isol": "\uFE8D", + "/alef.medi_fathatan.fina": "\uFD3C", + "/alef:hb": "\u05D0", + "/alefDigitThreeAbove": "\u0774", + "/alefDigitTwoAbove": "\u0773", + "/alefLamYehabove": "\u0616", + "/alefabove": "\u0670", + "/alefarabic": "\u0627", + "/alefdageshhebrew": "\uFB30", + "/aleffinalarabic": "\uFE8E", + "/alefhamza": "\u0623", + "/alefhamza.fina": "\uFE84", + "/alefhamza.isol": "\uFE83", + "/alefhamzaabovearabic": "\u0623", + "/alefhamzaabovefinalarabic": "\uFE84", + "/alefhamzabelow": "\u0625", + "/alefhamzabelow.fina": "\uFE88", + "/alefhamzabelow.isol": "\uFE87", + "/alefhamzabelowarabic": "\u0625", + "/alefhamzabelowfinalarabic": "\uFE88", + "/alefhebrew": "\u05D0", + "/alefhighhamza": "\u0675", + "/aleflamedhebrew": "\uFB4F", + "/alefmadda": "\u0622", + "/alefmadda.fina": "\uFE82", + "/alefmadda.isol": "\uFE81", + "/alefmaddaabovearabic": "\u0622", + "/alefmaddaabovefinalarabic": "\uFE82", + "/alefmaksura": "\u0649", + "/alefmaksura.fina": "\uFEF0", + "/alefmaksura.init_superscriptalef.fina": "\uFC5D", + "/alefmaksura.isol": "\uFEEF", + "/alefmaksura.medi_superscriptalef.fina": "\uFC90", + "/alefmaksuraarabic": "\u0649", + "/alefmaksurafinalarabic": "\uFEF0", + "/alefmaksurainitialarabic": "\uFEF3", + "/alefmaksuramedialarabic": "\uFEF4", + "/alefpatahhebrew": "\uFB2E", + "/alefqamatshebrew": "\uFB2F", + "/alefwasla": "\u0671", + "/alefwasla.fina": "\uFB51", + "/alefwasla.isol": "\uFB50", + "/alefwavyhamza": "\u0672", + "/alefwavyhamzabelow": "\u0673", + "/alefwide:hb": "\uFB21", + "/alefwithmapiq:hb": "\uFB30", + "/alefwithpatah:hb": "\uFB2E", + "/alefwithqamats:hb": "\uFB2F", + "/alembic": "\u2697", + "/aleph": "\u2135", + "/alienMonster": "\u1F47E", + "/allaroundprofile": "\u232E", + "/allequal": "\u224C", + "/allianceideographiccircled": "\u32AF", + "/allianceideographicparen": "\u323F", + "/almostequalorequal": "\u224A", + "/alpha": "\u03B1", + "/alphaacute": "\u1F71", + "/alphaacuteiotasub": "\u1FB4", + "/alphaasper": "\u1F01", + "/alphaasperacute": "\u1F05", + "/alphaasperacuteiotasub": "\u1F85", + "/alphaaspergrave": "\u1F03", + "/alphaaspergraveiotasub": "\u1F83", + "/alphaasperiotasub": "\u1F81", + "/alphaaspertilde": "\u1F07", + "/alphaaspertildeiotasub": "\u1F87", + "/alphabreve": "\u1FB0", + "/alphafunc": "\u237A", + "/alphagrave": "\u1F70", + "/alphagraveiotasub": "\u1FB2", + "/alphaiotasub": "\u1FB3", + "/alphalenis": "\u1F00", + "/alphalenisacute": "\u1F04", + "/alphalenisacuteiotasub": "\u1F84", + "/alphalenisgrave": "\u1F02", + "/alphalenisgraveiotasub": "\u1F82", + "/alphalenisiotasub": "\u1F80", + "/alphalenistilde": "\u1F06", + "/alphalenistildeiotasub": "\u1F86", + "/alphatilde": "\u1FB6", + "/alphatildeiotasub": "\u1FB7", + "/alphatonos": "\u03AC", + "/alphaturned": "\u0252", + "/alphaunderlinefunc": "\u2376", + "/alphawithmacron": "\u1FB1", + "/alternateonewayleftwaytraffic": "\u26D5", + "/alternative": "\u2387", + "/amacron": "\u0101", + "/ambulance": "\u1F691", + "/americanFootball": "\u1F3C8", + "/amfullwidth": "\u33C2", + "/amonospace": "\uFF41", + "/amountofcheck": "\u2447", + "/ampersand": "\u0026", + "/ampersandSindhi": "\u06FD", + "/ampersandmonospace": "\uFF06", + "/ampersandsmall": "\uF726", + "/ampersandturned": "\u214B", + "/amphora": "\u1F3FA", + "/amsquare": "\u33C2", + "/anbopomofo": "\u3122", + "/anchor": "\u2693", + "/ancoradown": "\u2E14", + "/ancoraup": "\u2E15", + "/andappada": "\uA9C3", + "/angbopomofo": "\u3124", + "/anger": "\u1F4A2", + "/angkhankhuthai": "\u0E5A", + "/angle": "\u2220", + "/anglearcright": "\u22BE", + "/anglebracketleft": "\u3008", + "/anglebracketleftvertical": "\uFE3F", + "/anglebracketright": "\u3009", + "/anglebracketrightvertical": "\uFE40", + "/angledottedright": "\u2E16", + "/angleleft": "\u2329", + "/anglemarkerdottedsubstitutionright": "\u2E01", + "/anglemarkersubstitutionright": "\u2E00", + "/angleright": "\u232A", + "/anglezigzagarrowdownright": "\u237C", + "/angryFace": "\u1F620", + "/angstrom": "\u212B", + "/anguishedFace": "\u1F627", + "/ankh": "\u2625", + "/anoteleia": "\u0387", + "/anpeasquare": "\u3302", + "/ant": "\u1F41C", + "/antennaBars": "\u1F4F6", + "/anticlockwiseDownwardsAndUpwardsOpenCircleArrows": "\u1F504", + "/anudattadeva": "\u0952", + "/anusvarabengali": "\u0982", + "/anusvaradeva": "\u0902", + "/anusvaragujarati": "\u0A82", + "/ao": "\uA735", + "/aogonek": "\u0105", + "/aovermfullwidth": "\u33DF", + "/apaatosquare": "\u3300", + "/aparen": "\u249C", + "/aparenthesized": "\u249C", + "/apostrophearmenian": "\u055A", + "/apostrophedblmod": "\u02EE", + "/apostrophemod": "\u02BC", + "/apple": "\uF8FF", + "/approaches": "\u2250", + "/approacheslimit": "\u2250", + "/approxequal": "\u2248", + "/approxequalorimage": "\u2252", + "/approximatelybutnotactuallyequal": "\u2246", + "/approximatelyequal": "\u2245", + "/approximatelyequalorimage": "\u2252", + "/apriltelegraph": "\u32C3", + "/aquarius": "\u2652", + "/ar:ae": "\u06D5", + "/ar:ain": "\u0639", + "/ar:alef": "\u0627", + "/ar:comma": "\u060C", + "/ar:cuberoot": "\u0606", + "/ar:decimalseparator": "\u066B", + "/ar:e": "\u06D0", + "/ar:eight": "\u0668", + "/ar:feh": "\u0641", + "/ar:five": "\u0665", + "/ar:four": "\u0664", + "/ar:fourthroot": "\u0607", + "/ar:kaf": "\u0643", + "/ar:ng": "\u06AD", + "/ar:nine": "\u0669", + "/ar:numbersign": "\u0600", + "/ar:oe": "\u06C6", + "/ar:one": "\u0661", + "/ar:peh": "\u067E", + "/ar:percent": "\u066A", + "/ar:perthousand": "\u060A", + "/ar:question": "\u061F", + "/ar:reh": "\u0631", + "/ar:semicolon": "\u061B", + "/ar:seven": "\u0667", + "/ar:shadda": "\u0651", + "/ar:six": "\u0666", + "/ar:sukun": "\u0652", + "/ar:three": "\u0663", + "/ar:two": "\u0662", + "/ar:u": "\u06C7", + "/ar:ve": "\u06CB", + "/ar:yu": "\u06C8", + "/ar:zero": "\u0660", + "/araeaekorean": "\u318E", + "/araeakorean": "\u318D", + "/arc": "\u2312", + "/archaicmepigraphic": "\uA7FF", + "/aries": "\u2648", + "/arighthalfring": "\u1E9A", + "/aring": "\u00E5", + "/aringacute": "\u01FB", + "/aringbelow": "\u1E01", + "/armn:Ayb": "\u0531", + "/armn:Ben": "\u0532", + "/armn:Ca": "\u053E", + "/armn:Cha": "\u0549", + "/armn:Cheh": "\u0543", + "/armn:Co": "\u0551", + "/armn:DRAMSIGN": "\u058F", + "/armn:Da": "\u0534", + "/armn:Ech": "\u0535", + "/armn:Eh": "\u0537", + "/armn:Et": "\u0538", + "/armn:Feh": "\u0556", + "/armn:Ghad": "\u0542", + "/armn:Gim": "\u0533", + "/armn:Ho": "\u0540", + "/armn:Ini": "\u053B", + "/armn:Ja": "\u0541", + "/armn:Jheh": "\u054B", + "/armn:Keh": "\u0554", + "/armn:Ken": "\u053F", + "/armn:Liwn": "\u053C", + "/armn:Men": "\u0544", + "/armn:Now": "\u0546", + "/armn:Oh": "\u0555", + "/armn:Peh": "\u054A", + "/armn:Piwr": "\u0553", + "/armn:Ra": "\u054C", + "/armn:Reh": "\u0550", + "/armn:Seh": "\u054D", + "/armn:Sha": "\u0547", + "/armn:Tiwn": "\u054F", + "/armn:To": "\u0539", + "/armn:Vew": "\u054E", + "/armn:Vo": "\u0548", + "/armn:Xeh": "\u053D", + "/armn:Yi": "\u0545", + "/armn:Yiwn": "\u0552", + "/armn:Za": "\u0536", + "/armn:Zhe": "\u053A", + "/armn:abbreviationmark": "\u055F", + "/armn:apostrophe": "\u055A", + "/armn:ayb": "\u0561", + "/armn:ben": "\u0562", + "/armn:ca": "\u056E", + "/armn:cha": "\u0579", + "/armn:cheh": "\u0573", + "/armn:co": "\u0581", + "/armn:comma": "\u055D", + "/armn:da": "\u0564", + "/armn:ech": "\u0565", + "/armn:ech_yiwn": "\u0587", + "/armn:eh": "\u0567", + "/armn:emphasismark": "\u055B", + "/armn:et": "\u0568", + "/armn:exclam": "\u055C", + "/armn:feh": "\u0586", + "/armn:ghad": "\u0572", + "/armn:gim": "\u0563", + "/armn:ho": "\u0570", + "/armn:hyphen": "\u058A", + "/armn:ini": "\u056B", + "/armn:ja": "\u0571", + "/armn:jheh": "\u057B", + "/armn:keh": "\u0584", + "/armn:ken": "\u056F", + "/armn:leftfacingeternitysign": "\u058E", + "/armn:liwn": "\u056C", + "/armn:men": "\u0574", + "/armn:men_ech": "\uFB14", + "/armn:men_ini": "\uFB15", + "/armn:men_now": "\uFB13", + "/armn:men_xeh": "\uFB17", + "/armn:now": "\u0576", + "/armn:oh": "\u0585", + "/armn:peh": "\u057A", + "/armn:period": "\u0589", + "/armn:piwr": "\u0583", + "/armn:question": "\u055E", + "/armn:ra": "\u057C", + "/armn:reh": "\u0580", + "/armn:rightfacingeternitysign": "\u058D", + "/armn:ringhalfleft": "\u0559", + "/armn:seh": "\u057D", + "/armn:sha": "\u0577", + "/armn:tiwn": "\u057F", + "/armn:to": "\u0569", + "/armn:vew": "\u057E", + "/armn:vew_now": "\uFB16", + "/armn:vo": "\u0578", + "/armn:xeh": "\u056D", + "/armn:yi": "\u0575", + "/armn:yiwn": "\u0582", + "/armn:za": "\u0566", + "/armn:zhe": "\u056A", + "/arrowNE": "\u2197", + "/arrowNW": "\u2196", + "/arrowSE": "\u2198", + "/arrowSW": "\u2199", + "/arrowanticlockwiseopencircle": "\u21BA", + "/arrowanticlockwisesemicircle": "\u21B6", + "/arrowboth": "\u2194", + "/arrowclockwiseopencircle": "\u21BB", + "/arrowclockwisesemicircle": "\u21B7", + "/arrowdashdown": "\u21E3", + "/arrowdashleft": "\u21E0", + "/arrowdashright": "\u21E2", + "/arrowdashup": "\u21E1", + "/arrowdblboth": "\u21D4", + "/arrowdbldown": "\u21D3", + "/arrowdblleft": "\u21D0", + "/arrowdblright": "\u21D2", + "/arrowdblup": "\u21D1", + "/arrowdown": "\u2193", + "/arrowdowndashed": "\u21E3", + "/arrowdownfrombar": "\u21A7", + "/arrowdownleft": "\u2199", + "/arrowdownright": "\u2198", + "/arrowdowntwoheaded": "\u21A1", + "/arrowdownwhite": "\u21E9", + "/arrowdownzigzag": "\u21AF", + "/arrowheaddown": "\u2304", + "/arrowheaddownlowmod": "\u02EF", + "/arrowheaddownmod": "\u02C5", + "/arrowheadleftlowmod": "\u02F1", + "/arrowheadleftmod": "\u02C2", + "/arrowheadrightlowmod": "\u02F2", + "/arrowheadrightmod": "\u02C3", + "/arrowheadtwobarsuphorizontal": "\u2324", + "/arrowheadup": "\u2303", + "/arrowheaduplowmod": "\u02F0", + "/arrowheadupmod": "\u02C4", + "/arrowhorizex": "\uF8E7", + "/arrowleft": "\u2190", + "/arrowleftdashed": "\u21E0", + "/arrowleftdbl": "\u21D0", + "/arrowleftdblstroke": "\u21CD", + "/arrowleftdowncorner": "\u21B5", + "/arrowleftdowntip": "\u21B2", + "/arrowleftfrombar": "\u21A4", + "/arrowlefthook": "\u21A9", + "/arrowleftloop": "\u21AB", + "/arrowleftlowmod": "\u02FF", + "/arrowleftoverright": "\u21C6", + "/arrowleftoverrighttobar": "\u21B9", + "/arrowleftright": "\u2194", + "/arrowleftrightstroke": "\u21AE", + "/arrowleftrightwave": "\u21AD", + "/arrowleftsquiggle": "\u21DC", + "/arrowleftstroke": "\u219A", + "/arrowlefttail": "\u21A2", + "/arrowlefttobar": "\u21E4", + "/arrowlefttwoheaded": "\u219E", + "/arrowleftuptip": "\u21B0", + "/arrowleftwave": "\u219C", + "/arrowleftwhite": "\u21E6", + "/arrowlongNWtobar": "\u21B8", + "/arrowright": "\u2192", + "/arrowrightdashed": "\u21E2", + "/arrowrightdblstroke": "\u21CF", + "/arrowrightdowncorner": "\u21B4", + "/arrowrightdowntip": "\u21B3", + "/arrowrightfrombar": "\u21A6", + "/arrowrightheavy": "\u279E", + "/arrowrighthook": "\u21AA", + "/arrowrightloop": "\u21AC", + "/arrowrightoverleft": "\u21C4", + "/arrowrightsmallcircle": "\u21F4", + "/arrowrightsquiggle": "\u21DD", + "/arrowrightstroke": "\u219B", + "/arrowrighttail": "\u21A3", + "/arrowrighttobar": "\u21E5", + "/arrowrighttwoheaded": "\u21A0", + "/arrowrightwave": "\u219D", + "/arrowrightwhite": "\u21E8", + "/arrowspaireddown": "\u21CA", + "/arrowspairedleft": "\u21C7", + "/arrowspairedright": "\u21C9", + "/arrowspairedup": "\u21C8", + "/arrowtableft": "\u21E4", + "/arrowtabright": "\u21E5", + "/arrowup": "\u2191", + "/arrowupdashed": "\u21E1", + "/arrowupdn": "\u2195", + "/arrowupdnbse": "\u21A8", + "/arrowupdown": "\u2195", + "/arrowupdownbase": "\u21A8", + "/arrowupdownwithbase": "\u21A8", + "/arrowupfrombar": "\u21A5", + "/arrowupleft": "\u2196", + "/arrowupleftofdown": "\u21C5", + "/arrowupright": "\u2197", + "/arrowuprighttip": "\u21B1", + "/arrowuptwoheaded": "\u219F", + "/arrowupwhite": "\u21E7", + "/arrowvertex": "\uF8E6", + "/articulatedLorry": "\u1F69B", + "/artistPalette": "\u1F3A8", + "/aruhuasquare": "\u3301", + "/asciicircum": "\u005E", + "/asciicircummonospace": "\uFF3E", + "/asciitilde": "\u007E", + "/asciitildemonospace": "\uFF5E", + "/ascript": "\u0251", + "/ascriptturned": "\u0252", + "/asmallhiragana": "\u3041", + "/asmallkatakana": "\u30A1", + "/asmallkatakanahalfwidth": "\uFF67", + "/asper": "\u1FFE", + "/asperacute": "\u1FDE", + "/aspergrave": "\u1FDD", + "/aspertilde": "\u1FDF", + "/assertion": "\u22A6", + "/asterisk": "\u002A", + "/asteriskaltonearabic": "\u066D", + "/asteriskarabic": "\u066D", + "/asteriskmath": "\u2217", + "/asteriskmonospace": "\uFF0A", + "/asterisksmall": "\uFE61", + "/asterism": "\u2042", + "/astonishedFace": "\u1F632", + "/astroke": "\u2C65", + "/astronomicaluranus": "\u26E2", + "/asuperior": "\uF6E9", + "/asympticallyequal": "\u2243", + "/asymptoticallyequal": "\u2243", + "/at": "\u0040", + "/athleticShoe": "\u1F45F", + "/atilde": "\u00E3", + "/atmonospace": "\uFF20", + "/atnachHafukh:hb": "\u05A2", + "/atom": "\u269B", + "/atsmall": "\uFE6B", + "/attentionideographiccircled": "\u329F", + "/aturned": "\u0250", + "/au": "\uA737", + "/aubengali": "\u0994", + "/aubergine": "\u1F346", + "/aubopomofo": "\u3120", + "/audeva": "\u0914", + "/aufullwidth": "\u3373", + "/augujarati": "\u0A94", + "/augurmukhi": "\u0A14", + "/augusttelegraph": "\u32C7", + "/aulengthmarkbengali": "\u09D7", + "/aumatragurmukhi": "\u0A4C", + "/austral": "\u20B3", + "/automatedTellerMachine": "\u1F3E7", + "/automobile": "\u1F697", + "/auvowelsignbengali": "\u09CC", + "/auvowelsigndeva": "\u094C", + "/auvowelsigngujarati": "\u0ACC", + "/av": "\uA739", + "/avagrahadeva": "\u093D", + "/avhorizontalbar": "\uA73B", + "/ay": "\uA73D", + "/aybarmenian": "\u0561", + "/ayin": "\u05E2", + "/ayin:hb": "\u05E2", + "/ayinalt:hb": "\uFB20", + "/ayinaltonehebrew": "\uFB20", + "/ayinhebrew": "\u05E2", + "/azla:hb": "\u059C", + "/b": "\u0062", + "/baarerusquare": "\u332D", + "/babengali": "\u09AC", + "/babyAngel": "\u1F47C", + "/babyBottle": "\u1F37C", + "/babyChick": "\u1F424", + "/backLeftwardsArrowAbove": "\u1F519", + "/backOfEnvelope": "\u1F582", + "/backslash": "\u005C", + "/backslashbarfunc": "\u2340", + "/backslashdbl": "\u244A", + "/backslashmonospace": "\uFF3C", + "/bactrianCamel": "\u1F42B", + "/badeva": "\u092C", + "/badmintonRacquetAndShuttlecock": "\u1F3F8", + "/bagdelimitersshapeleft": "\u27C5", + "/bagdelimitersshaperight": "\u27C6", + "/baggageClaim": "\u1F6C4", + "/bagujarati": "\u0AAC", + "/bagurmukhi": "\u0A2C", + "/bahiragana": "\u3070", + "/bahtthai": "\u0E3F", + "/bakatakana": "\u30D0", + "/balloon": "\u1F388", + "/ballotBoldScriptX": "\u1F5F6", + "/ballotBoxBallot": "\u1F5F3", + "/ballotBoxBoldCheck": "\u1F5F9", + "/ballotBoxBoldScriptX": "\u1F5F7", + "/ballotBoxScriptX": "\u1F5F5", + "/ballotScriptX": "\u1F5F4", + "/bamurda": "\uA9A8", + "/banana": "\u1F34C", + "/bank": "\u1F3E6", + "/banknoteDollarSign": "\u1F4B5", + "/banknoteEuroSign": "\u1F4B6", + "/banknotePoundSign": "\u1F4B7", + "/banknoteYenSign": "\u1F4B4", + "/bar": "\u007C", + "/barChart": "\u1F4CA", + "/barberPole": "\u1F488", + "/barfullwidth": "\u3374", + "/barmonospace": "\uFF5C", + "/barquillverticalleft": "\u2E20", + "/barquillverticalright": "\u2E21", + "/baseball": "\u26BE", + "/basketballAndHoop": "\u1F3C0", + "/bath": "\u1F6C0", + "/bathtub": "\u1F6C1", + "/battery": "\u1F50B", + "/bbopomofo": "\u3105", + "/bcircle": "\u24D1", + "/bdot": "\u1E03", + "/bdotaccent": "\u1E03", + "/bdotbelow": "\u1E05", + "/beachUmbrella": "\u1F3D6", + "/beamedAscendingMusicalNotes": "\u1F39C", + "/beamedDescendingMusicalNotes": "\u1F39D", + "/beamedeighthnotes": "\u266B", + "/beamedsixteenthnotes": "\u266C", + "/beamfunc": "\u2336", + "/bearFace": "\u1F43B", + "/beatingHeart": "\u1F493", + "/because": "\u2235", + "/becyr": "\u0431", + "/becyrillic": "\u0431", + "/bed": "\u1F6CF", + "/beeh": "\u067B", + "/beeh.fina": "\uFB53", + "/beeh.init": "\uFB54", + "/beeh.isol": "\uFB52", + "/beeh.medi": "\uFB55", + "/beerMug": "\u1F37A", + "/beetasquare": "\u333C", + "/beh": "\u0628", + "/beh.fina": "\uFE90", + "/beh.init": "\uFE91", + "/beh.init_alefmaksura.fina": "\uFC09", + "/beh.init_hah.fina": "\uFC06", + "/beh.init_hah.medi": "\uFC9D", + "/beh.init_heh.medi": "\uFCA0", + "/beh.init_jeem.fina": "\uFC05", + "/beh.init_jeem.medi": "\uFC9C", + "/beh.init_khah.fina": "\uFC07", + "/beh.init_khah.medi": "\uFC9E", + "/beh.init_meem.fina": "\uFC08", + "/beh.init_meem.medi": "\uFC9F", + "/beh.init_yeh.fina": "\uFC0A", + "/beh.isol": "\uFE8F", + "/beh.medi": "\uFE92", + "/beh.medi_alefmaksura.fina": "\uFC6E", + "/beh.medi_hah.medi_yeh.fina": "\uFDC2", + "/beh.medi_heh.medi": "\uFCE2", + "/beh.medi_khah.medi_yeh.fina": "\uFD9E", + "/beh.medi_meem.fina": "\uFC6C", + "/beh.medi_meem.medi": "\uFCE1", + "/beh.medi_noon.fina": "\uFC6D", + "/beh.medi_reh.fina": "\uFC6A", + "/beh.medi_yeh.fina": "\uFC6F", + "/beh.medi_zain.fina": "\uFC6B", + "/behDotBelowThreeDotsAbove": "\u0751", + "/behInvertedSmallVBelow": "\u0755", + "/behSmallV": "\u0756", + "/behThreeDotsHorizontallyBelow": "\u0750", + "/behThreeDotsUpBelow": "\u0752", + "/behThreeDotsUpBelowTwoDotsAbove": "\u0753", + "/behTwoDotsBelowDotAbove": "\u0754", + "/beharabic": "\u0628", + "/beheh": "\u0680", + "/beheh.fina": "\uFB5B", + "/beheh.init": "\uFB5C", + "/beheh.isol": "\uFB5A", + "/beheh.medi": "\uFB5D", + "/behfinalarabic": "\uFE90", + "/behinitialarabic": "\uFE91", + "/behiragana": "\u3079", + "/behmedialarabic": "\uFE92", + "/behmeeminitialarabic": "\uFC9F", + "/behmeemisolatedarabic": "\uFC08", + "/behnoonfinalarabic": "\uFC6D", + "/bekatakana": "\u30D9", + "/bellCancellationStroke": "\u1F515", + "/bellhopBell": "\u1F6CE", + "/beltbuckle": "\u2444", + "/benarmenian": "\u0562", + "/beng:a": "\u0985", + "/beng:aa": "\u0986", + "/beng:aasign": "\u09BE", + "/beng:abbreviationsign": "\u09FD", + "/beng:ai": "\u0990", + "/beng:aisign": "\u09C8", + "/beng:anji": "\u0980", + "/beng:anusvara": "\u0982", + "/beng:au": "\u0994", + "/beng:aulengthmark": "\u09D7", + "/beng:ausign": "\u09CC", + "/beng:avagraha": "\u09BD", + "/beng:ba": "\u09AC", + "/beng:bha": "\u09AD", + "/beng:ca": "\u099A", + "/beng:candrabindu": "\u0981", + "/beng:cha": "\u099B", + "/beng:currencyoneless": "\u09F8", + "/beng:da": "\u09A6", + "/beng:dda": "\u09A1", + "/beng:ddha": "\u09A2", + "/beng:dha": "\u09A7", + "/beng:e": "\u098F", + "/beng:eight": "\u09EE", + "/beng:esign": "\u09C7", + "/beng:five": "\u09EB", + "/beng:four": "\u09EA", + "/beng:fourcurrencynumerator": "\u09F7", + "/beng:ga": "\u0997", + "/beng:gandamark": "\u09FB", + "/beng:gha": "\u0998", + "/beng:ha": "\u09B9", + "/beng:i": "\u0987", + "/beng:ii": "\u0988", + "/beng:iisign": "\u09C0", + "/beng:isign": "\u09BF", + "/beng:isshar": "\u09FA", + "/beng:ja": "\u099C", + "/beng:jha": "\u099D", + "/beng:ka": "\u0995", + "/beng:kha": "\u0996", + "/beng:khandata": "\u09CE", + "/beng:la": "\u09B2", + "/beng:llvocal": "\u09E1", + "/beng:llvocalsign": "\u09E3", + "/beng:lvocal": "\u098C", + "/beng:lvocalsign": "\u09E2", + "/beng:ma": "\u09AE", + "/beng:na": "\u09A8", + "/beng:nga": "\u0999", + "/beng:nine": "\u09EF", + "/beng:nna": "\u09A3", + "/beng:nukta": "\u09BC", + "/beng:nya": "\u099E", + "/beng:o": "\u0993", + "/beng:one": "\u09E7", + "/beng:onecurrencynumerator": "\u09F4", + "/beng:osign": "\u09CB", + "/beng:pa": "\u09AA", + "/beng:pha": "\u09AB", + "/beng:ra": "\u09B0", + "/beng:ralowdiagonal": "\u09F1", + "/beng:ramiddiagonal": "\u09F0", + "/beng:rha": "\u09DD", + "/beng:rra": "\u09DC", + "/beng:rrvocal": "\u09E0", + "/beng:rrvocalsign": "\u09C4", + "/beng:rupee": "\u09F3", + "/beng:rupeemark": "\u09F2", + "/beng:rvocal": "\u098B", + "/beng:rvocalsign": "\u09C3", + "/beng:sa": "\u09B8", + "/beng:seven": "\u09ED", + "/beng:sha": "\u09B6", + "/beng:six": "\u09EC", + "/beng:sixteencurrencydenominator": "\u09F9", + "/beng:ssa": "\u09B7", + "/beng:ta": "\u09A4", + "/beng:tha": "\u09A5", + "/beng:three": "\u09E9", + "/beng:threecurrencynumerator": "\u09F6", + "/beng:tta": "\u099F", + "/beng:ttha": "\u09A0", + "/beng:two": "\u09E8", + "/beng:twocurrencynumerator": "\u09F5", + "/beng:u": "\u0989", + "/beng:usign": "\u09C1", + "/beng:uu": "\u098A", + "/beng:uusign": "\u09C2", + "/beng:vedicanusvara": "\u09FC", + "/beng:virama": "\u09CD", + "/beng:visarga": "\u0983", + "/beng:ya": "\u09AF", + "/beng:yya": "\u09DF", + "/beng:zero": "\u09E6", + "/bentoBox": "\u1F371", + "/benzenering": "\u232C", + "/benzeneringcircle": "\u23E3", + "/bet": "\u05D1", + "/bet:hb": "\u05D1", + "/beta": "\u03B2", + "/betasymbol": "\u03D0", + "/betasymbolgreek": "\u03D0", + "/betdagesh": "\uFB31", + "/betdageshhebrew": "\uFB31", + "/bethebrew": "\u05D1", + "/betrafehebrew": "\uFB4C", + "/between": "\u226C", + "/betwithdagesh:hb": "\uFB31", + "/betwithrafe:hb": "\uFB4C", + "/bflourish": "\uA797", + "/bhabengali": "\u09AD", + "/bhadeva": "\u092D", + "/bhagujarati": "\u0AAD", + "/bhagurmukhi": "\u0A2D", + "/bhook": "\u0253", + "/bicycle": "\u1F6B2", + "/bicyclist": "\u1F6B4", + "/bihiragana": "\u3073", + "/bikatakana": "\u30D3", + "/bikini": "\u1F459", + "/bilabialclick": "\u0298", + "/billiards": "\u1F3B1", + "/bindigurmukhi": "\u0A02", + "/biohazard": "\u2623", + "/bird": "\u1F426", + "/birthdayCake": "\u1F382", + "/birusquare": "\u3331", + "/bishopblack": "\u265D", + "/bishopwhite": "\u2657", + "/bitcoin": "\u20BF", + "/blackDownPointingBackhandIndex": "\u1F5A3", + "/blackDroplet": "\u1F322", + "/blackFolder": "\u1F5BF", + "/blackHardShellFloppyDisk": "\u1F5AA", + "/blackHeart": "\u1F5A4", + "/blackLeftPointingBackhandIndex": "\u1F59C", + "/blackPennant": "\u1F3F2", + "/blackPushpin": "\u1F588", + "/blackRightPointingBackhandIndex": "\u1F59D", + "/blackRosette": "\u1F3F6", + "/blackSkullAndCrossbones": "\u1F571", + "/blackSquareButton": "\u1F532", + "/blackTouchtoneTelephone": "\u1F57F", + "/blackUpPointingBackhandIndex": "\u1F5A2", + "/blackcircle": "\u25CF", + "/blackcircleforrecord": "\u23FA", + "/blackdiamond": "\u25C6", + "/blackdownpointingtriangle": "\u25BC", + "/blackforstopsquare": "\u23F9", + "/blackleftpointingpointer": "\u25C4", + "/blackleftpointingtriangle": "\u25C0", + "/blacklenticularbracketleft": "\u3010", + "/blacklenticularbracketleftvertical": "\uFE3B", + "/blacklenticularbracketright": "\u3011", + "/blacklenticularbracketrightvertical": "\uFE3C", + "/blacklowerlefttriangle": "\u25E3", + "/blacklowerrighttriangle": "\u25E2", + "/blackmediumpointingtriangledown": "\u23F7", + "/blackmediumpointingtriangleleft": "\u23F4", + "/blackmediumpointingtriangleright": "\u23F5", + "/blackmediumpointingtriangleup": "\u23F6", + "/blackpointingdoubletrianglebarverticalleft": "\u23EE", + "/blackpointingdoubletrianglebarverticalright": "\u23ED", + "/blackpointingdoubletriangledown": "\u23EC", + "/blackpointingdoubletriangleleft": "\u23EA", + "/blackpointingdoubletriangleright": "\u23E9", + "/blackpointingdoubletriangleup": "\u23EB", + "/blackpointingtriangledoublebarverticalright": "\u23EF", + "/blackrectangle": "\u25AC", + "/blackrightpointingpointer": "\u25BA", + "/blackrightpointingtriangle": "\u25B6", + "/blacksmallsquare": "\u25AA", + "/blacksmilingface": "\u263B", + "/blacksquare": "\u25A0", + "/blackstar": "\u2605", + "/blackupperlefttriangle": "\u25E4", + "/blackupperrighttriangle": "\u25E5", + "/blackuppointingsmalltriangle": "\u25B4", + "/blackuppointingtriangle": "\u25B2", + "/blackwardsbulletleft": "\u204C", + "/blackwardsbulletright": "\u204D", + "/blank": "\u2423", + "/blinebelow": "\u1E07", + "/block": "\u2588", + "/blossom": "\u1F33C", + "/blowfish": "\u1F421", + "/blueBook": "\u1F4D8", + "/blueHeart": "\u1F499", + "/bmonospace": "\uFF42", + "/boar": "\u1F417", + "/board": "\u2328", + "/bobaimaithai": "\u0E1A", + "/bohiragana": "\u307C", + "/bokatakana": "\u30DC", + "/bomb": "\u1F4A3", + "/book": "\u1F56E", + "/bookmark": "\u1F516", + "/bookmarkTabs": "\u1F4D1", + "/books": "\u1F4DA", + "/bopo:a": "\u311A", + "/bopo:ai": "\u311E", + "/bopo:an": "\u3122", + "/bopo:ang": "\u3124", + "/bopo:au": "\u3120", + "/bopo:b": "\u3105", + "/bopo:c": "\u3118", + "/bopo:ch": "\u3114", + "/bopo:d": "\u3109", + "/bopo:e": "\u311C", + "/bopo:eh": "\u311D", + "/bopo:ei": "\u311F", + "/bopo:en": "\u3123", + "/bopo:eng": "\u3125", + "/bopo:er": "\u3126", + "/bopo:f": "\u3108", + "/bopo:g": "\u310D", + "/bopo:gn": "\u312C", + "/bopo:h": "\u310F", + "/bopo:i": "\u3127", + "/bopo:ih": "\u312D", + "/bopo:iu": "\u3129", + "/bopo:j": "\u3110", + "/bopo:k": "\u310E", + "/bopo:l": "\u310C", + "/bopo:m": "\u3107", + "/bopo:n": "\u310B", + "/bopo:ng": "\u312B", + "/bopo:o": "\u311B", + "/bopo:ou": "\u3121", + "/bopo:owithdotabove": "\u312E", + "/bopo:p": "\u3106", + "/bopo:q": "\u3111", + "/bopo:r": "\u3116", + "/bopo:s": "\u3119", + "/bopo:sh": "\u3115", + "/bopo:t": "\u310A", + "/bopo:u": "\u3128", + "/bopo:v": "\u312A", + "/bopo:x": "\u3112", + "/bopo:z": "\u3117", + "/bopo:zh": "\u3113", + "/borutosquare": "\u333E", + "/bottlePoppingCork": "\u1F37E", + "/bouquet": "\u1F490", + "/bouquetOfFlowers": "\u1F395", + "/bowAndArrow": "\u1F3F9", + "/bowlOfHygieia": "\u1F54F", + "/bowling": "\u1F3B3", + "/boxlineverticalleft": "\u23B8", + "/boxlineverticalright": "\u23B9", + "/boy": "\u1F466", + "/boys": "\u1F6C9", + "/bparen": "\u249D", + "/bparenthesized": "\u249D", + "/bqfullwidth": "\u33C3", + "/bqsquare": "\u33C3", + "/braceex": "\uF8F4", + "/braceleft": "\u007B", + "/braceleftbt": "\uF8F3", + "/braceleftmid": "\uF8F2", + "/braceleftmonospace": "\uFF5B", + "/braceleftsmall": "\uFE5B", + "/bracelefttp": "\uF8F1", + "/braceleftvertical": "\uFE37", + "/braceright": "\u007D", + "/bracerightbt": "\uF8FE", + "/bracerightmid": "\uF8FD", + "/bracerightmonospace": "\uFF5D", + "/bracerightsmall": "\uFE5C", + "/bracerighttp": "\uF8FC", + "/bracerightvertical": "\uFE38", + "/bracketangledblleft": "\u27EA", + "/bracketangledblright": "\u27EB", + "/bracketangleleft": "\u27E8", + "/bracketangleright": "\u27E9", + "/bracketbottomcurly": "\u23DF", + "/bracketbottomsquare": "\u23B5", + "/bracketcornerupleftsquare": "\u23A1", + "/bracketcorneruprightsquare": "\u23A4", + "/bracketdottedsubstitutionleft": "\u2E04", + "/bracketdottedsubstitutionright": "\u2E05", + "/bracketextensioncurly": "\u23AA", + "/bracketextensionleftsquare": "\u23A2", + "/bracketextensionrightsquare": "\u23A5", + "/brackethalfbottomleft": "\u2E24", + "/brackethalfbottomright": "\u2E25", + "/brackethalftopleft": "\u2E22", + "/brackethalftopright": "\u2E23", + "/brackethookupleftcurly": "\u23A7", + "/brackethookuprightcurly": "\u23AB", + "/bracketleft": "\u005B", + "/bracketleftbt": "\uF8F0", + "/bracketleftex": "\uF8EF", + "/bracketleftmonospace": "\uFF3B", + "/bracketleftsquarequill": "\u2045", + "/bracketlefttp": "\uF8EE", + "/bracketlowercornerleftsquare": "\u23A3", + "/bracketlowercornerrightsquare": "\u23A6", + "/bracketlowerhookleftcurly": "\u23A9", + "/bracketlowerhookrightcurly": "\u23AD", + "/bracketmiddlepieceleftcurly": "\u23A8", + "/bracketmiddlepiecerightcurly": "\u23AC", + "/bracketoverbrackettopbottomsquare": "\u23B6", + "/bracketparaphraselowleft": "\u2E1C", + "/bracketparaphraselowright": "\u2E1D", + "/bracketraisedleft": "\u2E0C", + "/bracketraisedright": "\u2E0D", + "/bracketright": "\u005D", + "/bracketrightbt": "\uF8FB", + "/bracketrightex": "\uF8FA", + "/bracketrightmonospace": "\uFF3D", + "/bracketrightsquarequill": "\u2046", + "/bracketrighttp": "\uF8F9", + "/bracketsectionupleftlowerrightcurly": "\u23B0", + "/bracketsectionuprightlowerleftcurly": "\u23B1", + "/bracketshellbottom": "\u23E1", + "/bracketshelltop": "\u23E0", + "/bracketshellwhiteleft": "\u27EC", + "/bracketshellwhiteright": "\u27ED", + "/bracketsubstitutionleft": "\u2E02", + "/bracketsubstitutionright": "\u2E03", + "/brackettopcurly": "\u23DE", + "/brackettopsquare": "\u23B4", + "/brackettranspositionleft": "\u2E09", + "/brackettranspositionright": "\u2E0A", + "/bracketwhitesquareleft": "\u27E6", + "/bracketwhitesquareright": "\u27E7", + "/branchbankidentification": "\u2446", + "/bread": "\u1F35E", + "/breve": "\u02D8", + "/brevebelowcmb": "\u032E", + "/brevecmb": "\u0306", + "/breveinvertedbelowcmb": "\u032F", + "/breveinvertedcmb": "\u0311", + "/breveinverteddoublecmb": "\u0361", + "/brevemetrical": "\u23D1", + "/brideVeil": "\u1F470", + "/bridgeAtNight": "\u1F309", + "/bridgebelowcmb": "\u032A", + "/bridgeinvertedbelowcmb": "\u033A", + "/briefcase": "\u1F4BC", + "/brll:blank": "\u2800", + "/brokenHeart": "\u1F494", + "/brokenbar": "\u00A6", + "/brokencirclenorthwestarrow": "\u238B", + "/bstroke": "\u0180", + "/bsuperior": "\uF6EA", + "/btopbar": "\u0183", + "/bug": "\u1F41B", + "/buhiragana": "\u3076", + "/buildingConstruction": "\u1F3D7", + "/bukatakana": "\u30D6", + "/bullet": "\u2022", + "/bulletinverse": "\u25D8", + "/bulletoperator": "\u2219", + "/bullhorn": "\u1F56B", + "/bullhornSoundWaves": "\u1F56C", + "/bullseye": "\u25CE", + "/burrito": "\u1F32F", + "/bus": "\u1F68C", + "/busStop": "\u1F68F", + "/bussyerusquare": "\u3334", + "/bustInSilhouette": "\u1F464", + "/bustsInSilhouette": "\u1F465", + "/c": "\u0063", + "/caarmenian": "\u056E", + "/cabengali": "\u099A", + "/cactus": "\u1F335", + "/cacute": "\u0107", + "/cadauna": "\u2106", + "/cadeva": "\u091A", + "/caduceus": "\u2624", + "/cagujarati": "\u0A9A", + "/cagurmukhi": "\u0A1A", + "/cakraconsonant": "\uA9BF", + "/calendar": "\u1F4C5", + "/calfullwidth": "\u3388", + "/callideographicparen": "\u323A", + "/calsquare": "\u3388", + "/camera": "\u1F4F7", + "/cameraFlash": "\u1F4F8", + "/camping": "\u1F3D5", + "/camurda": "\uA996", + "/cancellationX": "\u1F5D9", + "/cancer": "\u264B", + "/candle": "\u1F56F", + "/candrabindubengali": "\u0981", + "/candrabinducmb": "\u0310", + "/candrabindudeva": "\u0901", + "/candrabindugujarati": "\u0A81", + "/candy": "\u1F36C", + "/canoe": "\u1F6F6", + "/capitulum": "\u2E3F", + "/capricorn": "\u2651", + "/capslock": "\u21EA", + "/cardFileBox": "\u1F5C3", + "/cardIndex": "\u1F4C7", + "/cardIndexDividers": "\u1F5C2", + "/careof": "\u2105", + "/caret": "\u2038", + "/caretinsertionpoint": "\u2041", + "/carettildedownfunc": "\u2371", + "/carettildeupfunc": "\u2372", + "/caron": "\u02C7", + "/caronbelowcmb": "\u032C", + "/caroncmb": "\u030C", + "/carouselHorse": "\u1F3A0", + "/carpStreamer": "\u1F38F", + "/carriagereturn": "\u21B5", + "/carsliding": "\u26D0", + "/castle": "\u26EB", + "/cat": "\u1F408", + "/catFace": "\u1F431", + "/catFaceWithTearsOfJoy": "\u1F639", + "/catFaceWithWrySmile": "\u1F63C", + "/caution": "\u2621", + "/cbar": "\uA793", + "/cbopomofo": "\u3118", + "/ccaron": "\u010D", + "/ccedilla": "\u00E7", + "/ccedillaacute": "\u1E09", + "/ccfullwidth": "\u33C4", + "/ccircle": "\u24D2", + "/ccircumflex": "\u0109", + "/ccurl": "\u0255", + "/cdfullwidth": "\u33C5", + "/cdot": "\u010B", + "/cdotaccent": "\u010B", + "/cdotreversed": "\uA73F", + "/cdsquare": "\u33C5", + "/cecak": "\uA981", + "/cecaktelu": "\uA9B3", + "/cedi": "\u20B5", + "/cedilla": "\u00B8", + "/cedillacmb": "\u0327", + "/ceilingleft": "\u2308", + "/ceilingright": "\u2309", + "/celticCross": "\u1F548", + "/cent": "\u00A2", + "/centigrade": "\u2103", + "/centinferior": "\uF6DF", + "/centmonospace": "\uFFE0", + "/centoldstyle": "\uF7A2", + "/centreddotwhitediamond": "\u27D0", + "/centreideographiccircled": "\u32A5", + "/centreline": "\u2104", + "/centrelineverticalsquarewhite": "\u2385", + "/centsuperior": "\uF6E0", + "/ceres": "\u26B3", + "/chaarmenian": "\u0579", + "/chabengali": "\u099B", + "/chadeva": "\u091B", + "/chagujarati": "\u0A9B", + "/chagurmukhi": "\u0A1B", + "/chains": "\u26D3", + "/chair": "\u2441", + "/chamkocircle": "\u327C", + "/charactertie": "\u2040", + "/chartDownwardsTrend": "\u1F4C9", + "/chartUpwardsTrend": "\u1F4C8", + "/chartUpwardsTrendAndYenSign": "\u1F4B9", + "/chbopomofo": "\u3114", + "/cheabkhasiancyrillic": "\u04BD", + "/cheabkhcyr": "\u04BD", + "/cheabkhtailcyr": "\u04BF", + "/checkbox": "\u2610", + "/checkboxchecked": "\u2611", + "/checkboxx": "\u2612", + "/checkmark": "\u2713", + "/checyr": "\u0447", + "/checyrillic": "\u0447", + "/chedescenderabkhasiancyrillic": "\u04BF", + "/chedescendercyrillic": "\u04B7", + "/chedieresiscyr": "\u04F5", + "/chedieresiscyrillic": "\u04F5", + "/cheeringMegaphone": "\u1F4E3", + "/cheharmenian": "\u0573", + "/chekhakascyr": "\u04CC", + "/chekhakassiancyrillic": "\u04CC", + "/chequeredFlag": "\u1F3C1", + "/cherries": "\u1F352", + "/cherryBlossom": "\u1F338", + "/chestnut": "\u1F330", + "/chetailcyr": "\u04B7", + "/chevertcyr": "\u04B9", + "/cheverticalstrokecyrillic": "\u04B9", + "/chi": "\u03C7", + "/chicken": "\u1F414", + "/chieuchacirclekorean": "\u3277", + "/chieuchaparenkorean": "\u3217", + "/chieuchcirclekorean": "\u3269", + "/chieuchkorean": "\u314A", + "/chieuchparenkorean": "\u3209", + "/childrenCrossing": "\u1F6B8", + "/chipmunk": "\u1F43F", + "/chirho": "\u2627", + "/chiron": "\u26B7", + "/chochangthai": "\u0E0A", + "/chochanthai": "\u0E08", + "/chochingthai": "\u0E09", + "/chochoethai": "\u0E0C", + "/chocolateBar": "\u1F36B", + "/chook": "\u0188", + "/christmasTree": "\u1F384", + "/church": "\u26EA", + "/cieucacirclekorean": "\u3276", + "/cieucaparenkorean": "\u3216", + "/cieuccirclekorean": "\u3268", + "/cieuckorean": "\u3148", + "/cieucparenkorean": "\u3208", + "/cieucuparenkorean": "\u321C", + "/cinema": "\u1F3A6", + "/circle": "\u25CB", + "/circleallbutupperquadrantleftblack": "\u25D5", + "/circlebackslashfunc": "\u2349", + "/circleblack": "\u25CF", + "/circledCrossPommee": "\u1F540", + "/circledInformationSource": "\u1F6C8", + "/circledasteriskoperator": "\u229B", + "/circledbarnotchhorizontal": "\u2389", + "/circledcrossinglanes": "\u26D2", + "/circleddash": "\u229D", + "/circleddivisionslash": "\u2298", + "/circleddotoperator": "\u2299", + "/circledequals": "\u229C", + "/circlediaeresisfunc": "\u2365", + "/circledminus": "\u2296", + "/circledot": "\u2299", + "/circledotrightwhite": "\u2686", + "/circledotted": "\u25CC", + "/circledringoperator": "\u229A", + "/circledtriangledown": "\u238A", + "/circlehalfleftblack": "\u25D0", + "/circlehalfrightblack": "\u25D1", + "/circleinversewhite": "\u25D9", + "/circlejotfunc": "\u233E", + "/circlelowerhalfblack": "\u25D2", + "/circlelowerquadrantleftwhite": "\u25F5", + "/circlelowerquadrantrightwhite": "\u25F6", + "/circlemultiply": "\u2297", + "/circleot": "\u2299", + "/circleplus": "\u2295", + "/circlepostalmark": "\u3036", + "/circlestarfunc": "\u235F", + "/circlestilefunc": "\u233D", + "/circlestroketwodotsaboveheavy": "\u26E3", + "/circletwodotsblackwhite": "\u2689", + "/circletwodotswhite": "\u2687", + "/circleunderlinefunc": "\u235C", + "/circleupperhalfblack": "\u25D3", + "/circleupperquadrantleftwhite": "\u25F4", + "/circleupperquadrantrightblack": "\u25D4", + "/circleupperquadrantrightwhite": "\u25F7", + "/circleverticalfill": "\u25CD", + "/circlewhite": "\u25CB", + "/circlewhitedotrightblack": "\u2688", + "/circlewithlefthalfblack": "\u25D0", + "/circlewithrighthalfblack": "\u25D1", + "/circumflex": "\u02C6", + "/circumflexbelowcmb": "\u032D", + "/circumflexcmb": "\u0302", + "/circumflexlow": "\uA788", + "/circusTent": "\u1F3AA", + "/cityscape": "\u1F3D9", + "/cityscapeAtDusk": "\u1F306", + "/cjk:ideographiccomma": "\u3001", + "/cjk:tortoiseshellbracketleft": "\u3014", + "/cjk:tortoiseshellbracketright": "\u3015", + "/clamshellMobilePhone": "\u1F581", + "/clapperBoard": "\u1F3AC", + "/clappingHandsSign": "\u1F44F", + "/classicalBuilding": "\u1F3DB", + "/clear": "\u2327", + "/clearscreen": "\u239A", + "/clickalveolar": "\u01C2", + "/clickbilabial": "\u0298", + "/clickdental": "\u01C0", + "/clicklateral": "\u01C1", + "/clickretroflex": "\u01C3", + "/clinkingBeerMugs": "\u1F37B", + "/clipboard": "\u1F4CB", + "/clockFaceEight-thirty": "\u1F563", + "/clockFaceEightOclock": "\u1F557", + "/clockFaceEleven-thirty": "\u1F566", + "/clockFaceElevenOclock": "\u1F55A", + "/clockFaceFive-thirty": "\u1F560", + "/clockFaceFiveOclock": "\u1F554", + "/clockFaceFour-thirty": "\u1F55F", + "/clockFaceFourOclock": "\u1F553", + "/clockFaceNine-thirty": "\u1F564", + "/clockFaceNineOclock": "\u1F558", + "/clockFaceOne-thirty": "\u1F55C", + "/clockFaceOneOclock": "\u1F550", + "/clockFaceSeven-thirty": "\u1F562", + "/clockFaceSevenOclock": "\u1F556", + "/clockFaceSix-thirty": "\u1F561", + "/clockFaceSixOclock": "\u1F555", + "/clockFaceTen-thirty": "\u1F565", + "/clockFaceTenOclock": "\u1F559", + "/clockFaceThree-thirty": "\u1F55E", + "/clockFaceThreeOclock": "\u1F552", + "/clockFaceTwelve-thirty": "\u1F567", + "/clockFaceTwelveOclock": "\u1F55B", + "/clockFaceTwo-thirty": "\u1F55D", + "/clockFaceTwoOclock": "\u1F551", + "/clockwiseDownwardsAndUpwardsOpenCircleArrows": "\u1F503", + "/clockwiseRightAndLeftSemicircleArrows": "\u1F5D8", + "/clockwiseRightwardsAndLeftwardsOpenCircleArrows": "\u1F501", + "/clockwiseRightwardsAndLeftwardsOpenCircleArrowsCircledOneOverlay": "\u1F502", + "/closedBook": "\u1F4D5", + "/closedLockKey": "\u1F510", + "/closedMailboxLoweredFlag": "\u1F4EA", + "/closedMailboxRaisedFlag": "\u1F4EB", + "/closedUmbrella": "\u1F302", + "/closedentryleft": "\u26DC", + "/closeup": "\u2050", + "/cloud": "\u2601", + "/cloudLightning": "\u1F329", + "/cloudRain": "\u1F327", + "/cloudSnow": "\u1F328", + "/cloudTornado": "\u1F32A", + "/clsquare": "\u1F191", + "/club": "\u2663", + "/clubblack": "\u2663", + "/clubsuitblack": "\u2663", + "/clubsuitwhite": "\u2667", + "/clubwhite": "\u2667", + "/cm2fullwidth": "\u33A0", + "/cm3fullwidth": "\u33A4", + "/cmb:a": "\u0363", + "/cmb:aaboveflat": "\u1DD3", + "/cmb:aboveogonek": "\u1DCE", + "/cmb:acute": "\u0301", + "/cmb:acutebelow": "\u0317", + "/cmb:acutegraveacute": "\u1DC9", + "/cmb:acutemacron": "\u1DC7", + "/cmb:acutetone": "\u0341", + "/cmb:adieresis": "\u1DF2", + "/cmb:ae": "\u1DD4", + "/cmb:almostequalabove": "\u034C", + "/cmb:almostequaltobelow": "\u1DFD", + "/cmb:alpha": "\u1DE7", + "/cmb:ao": "\u1DD5", + "/cmb:arrowheadleftbelow": "\u0354", + "/cmb:arrowheadrightabove": "\u0350", + "/cmb:arrowheadrightarrowheadupbelow": "\u0356", + "/cmb:arrowheadrightbelow": "\u0355", + "/cmb:arrowleftrightbelow": "\u034D", + "/cmb:arrowrightdoublebelow": "\u0362", + "/cmb:arrowupbelow": "\u034E", + "/cmb:asteriskbelow": "\u0359", + "/cmb:av": "\u1DD6", + "/cmb:b": "\u1DE8", + "/cmb:belowbreve": "\u032E", + "/cmb:beta": "\u1DE9", + "/cmb:breve": "\u0306", + "/cmb:brevemacron": "\u1DCB", + "/cmb:bridgeabove": "\u0346", + "/cmb:bridgebelow": "\u032A", + "/cmb:c": "\u0368", + "/cmb:candrabindu": "\u0310", + "/cmb:caron": "\u030C", + "/cmb:caronbelow": "\u032C", + "/cmb:ccedilla": "\u1DD7", + "/cmb:cedilla": "\u0327", + "/cmb:circumflex": "\u0302", + "/cmb:circumflexbelow": "\u032D", + "/cmb:commaaccentbelow": "\u0326", + "/cmb:commaturnedabove": "\u0312", + "/cmb:d": "\u0369", + "/cmb:dblarchinvertedbelow": "\u032B", + "/cmb:dbloverline": "\u033F", + "/cmb:dblverticallineabove": "\u030E", + "/cmb:dblverticallinebelow": "\u0348", + "/cmb:deletionmark": "\u1DFB", + "/cmb:dialytikatonos": "\u0344", + "/cmb:dieresis": "\u0308", + "/cmb:dieresisbelow": "\u0324", + "/cmb:dotaboveleft": "\u1DF8", + "/cmb:dotaccent": "\u0307", + "/cmb:dotbelowcomb": "\u0323", + "/cmb:dotrightabove": "\u0358", + "/cmb:dottedacute": "\u1DC1", + "/cmb:dottedgrave": "\u1DC0", + "/cmb:doubleabovecircumflex": "\u1DCD", + "/cmb:doublebelowbreve": "\u035C", + "/cmb:doublebreve": "\u035D", + "/cmb:doubleinvertedbelowbreve": "\u1DFC", + "/cmb:doubleringbelow": "\u035A", + "/cmb:downtackbelow": "\u031E", + "/cmb:e": "\u0364", + "/cmb:equalbelow": "\u0347", + "/cmb:esh": "\u1DEF", + "/cmb:eth": "\u1DD9", + "/cmb:f": "\u1DEB", + "/cmb:fermata": "\u0352", + "/cmb:g": "\u1DDA", + "/cmb:graphemejoiner": "\u034F", + "/cmb:grave": "\u0300", + "/cmb:graveacutegrave": "\u1DC8", + "/cmb:gravebelow": "\u0316", + "/cmb:gravedouble": "\u030F", + "/cmb:gravemacron": "\u1DC5", + "/cmb:gravetone": "\u0340", + "/cmb:gsmall": "\u1DDB", + "/cmb:h": "\u036A", + "/cmb:halfleftringabove": "\u0351", + "/cmb:halfleftringbelow": "\u031C", + "/cmb:halfrightringabove": "\u0357", + "/cmb:halfrightringbelow": "\u0339", + "/cmb:homotheticabove": "\u034B", + "/cmb:hookabove": "\u0309", + "/cmb:horn": "\u031B", + "/cmb:hungarumlaut": "\u030B", + "/cmb:i": "\u0365", + "/cmb:insulard": "\u1DD8", + "/cmb:invertedbelowbreve": "\u032F", + "/cmb:invertedbreve": "\u0311", + "/cmb:invertedbridgebelow": "\u033A", + "/cmb:inverteddoublebreve": "\u0361", + "/cmb:iotasub": "\u0345", + "/cmb:isbelow": "\u1DD0", + "/cmb:k": "\u1DDC", + "/cmb:kavykaaboveleft": "\u1DF7", + "/cmb:kavykaaboveright": "\u1DF6", + "/cmb:koronis": "\u0343", + "/cmb:l": "\u1DDD", + "/cmb:leftangleabove": "\u031A", + "/cmb:leftanglebelow": "\u0349", + "/cmb:leftarrowheadabove": "\u1DFE", + "/cmb:lefttackbelow": "\u0318", + "/cmb:lineverticalabove": "\u030D", + "/cmb:lineverticalbelow": "\u0329", + "/cmb:longs": "\u1DE5", + "/cmb:lowline": "\u0332", + "/cmb:lowlinedouble": "\u0333", + "/cmb:lsmall": "\u1DDE", + "/cmb:lwithdoublemiddletilde": "\u1DEC", + "/cmb:m": "\u036B", + "/cmb:macron": "\u0304", + "/cmb:macronacute": "\u1DC4", + "/cmb:macronbelow": "\u0331", + "/cmb:macronbreve": "\u1DCC", + "/cmb:macrondouble": "\u035E", + "/cmb:macrondoublebelow": "\u035F", + "/cmb:macrongrave": "\u1DC6", + "/cmb:minusbelow": "\u0320", + "/cmb:msmall": "\u1DDF", + "/cmb:n": "\u1DE0", + "/cmb:nottildeabove": "\u034A", + "/cmb:nsmall": "\u1DE1", + "/cmb:o": "\u0366", + "/cmb:odieresis": "\u1DF3", + "/cmb:ogonek": "\u0328", + "/cmb:overlaystrokelong": "\u0336", + "/cmb:overlaystrokeshort": "\u0335", + "/cmb:overline": "\u0305", + "/cmb:owithlightcentralizationstroke": "\u1DED", + "/cmb:p": "\u1DEE", + "/cmb:palatalizedhookbelow": "\u0321", + "/cmb:perispomeni": "\u0342", + "/cmb:plusbelow": "\u031F", + "/cmb:r": "\u036C", + "/cmb:rbelow": "\u1DCA", + "/cmb:retroflexhookbelow": "\u0322", + "/cmb:reversedcommaabove": "\u0314", + "/cmb:rightarrowheadanddownarrowheadbelow": "\u1DFF", + "/cmb:righttackbelow": "\u0319", + "/cmb:ringabove": "\u030A", + "/cmb:ringbelow": "\u0325", + "/cmb:rrotunda": "\u1DE3", + "/cmb:rsmall": "\u1DE2", + "/cmb:s": "\u1DE4", + "/cmb:schwa": "\u1DEA", + "/cmb:seagullbelow": "\u033C", + "/cmb:snakebelow": "\u1DC2", + "/cmb:soliduslongoverlay": "\u0338", + "/cmb:solidusshortoverlay": "\u0337", + "/cmb:squarebelow": "\u033B", + "/cmb:suspensionmark": "\u1DC3", + "/cmb:t": "\u036D", + "/cmb:tilde": "\u0303", + "/cmb:tildebelow": "\u0330", + "/cmb:tildedouble": "\u0360", + "/cmb:tildeoverlay": "\u0334", + "/cmb:tildevertical": "\u033E", + "/cmb:turnedabove": "\u0313", + "/cmb:turnedcommaabove": "\u0315", + "/cmb:u": "\u0367", + "/cmb:udieresis": "\u1DF4", + "/cmb:uptackabove": "\u1DF5", + "/cmb:uptackbelow": "\u031D", + "/cmb:urabove": "\u1DD1", + "/cmb:usabove": "\u1DD2", + "/cmb:uwithlightcentralizationstroke": "\u1DF0", + "/cmb:v": "\u036E", + "/cmb:w": "\u1DF1", + "/cmb:wideinvertedbridgebelow": "\u1DF9", + "/cmb:x": "\u036F", + "/cmb:xabove": "\u033D", + "/cmb:xbelow": "\u0353", + "/cmb:z": "\u1DE6", + "/cmb:zigzagabove": "\u035B", + "/cmb:zigzagbelow": "\u1DCF", + "/cmcubedsquare": "\u33A4", + "/cmfullwidth": "\u339D", + "/cmonospace": "\uFF43", + "/cmsquaredsquare": "\u33A0", + "/cntr:acknowledge": "\u2406", + "/cntr:backspace": "\u2408", + "/cntr:bell": "\u2407", + "/cntr:blank": "\u2422", + "/cntr:cancel": "\u2418", + "/cntr:carriagereturn": "\u240D", + "/cntr:datalinkescape": "\u2410", + "/cntr:delete": "\u2421", + "/cntr:deleteformtwo": "\u2425", + "/cntr:devicecontrolfour": "\u2414", + "/cntr:devicecontrolone": "\u2411", + "/cntr:devicecontrolthree": "\u2413", + "/cntr:devicecontroltwo": "\u2412", + "/cntr:endofmedium": "\u2419", + "/cntr:endoftext": "\u2403", + "/cntr:endoftransmission": "\u2404", + "/cntr:endoftransmissionblock": "\u2417", + "/cntr:enquiry": "\u2405", + "/cntr:escape": "\u241B", + "/cntr:fileseparator": "\u241C", + "/cntr:formfeed": "\u240C", + "/cntr:groupseparator": "\u241D", + "/cntr:horizontaltab": "\u2409", + "/cntr:linefeed": "\u240A", + "/cntr:negativeacknowledge": "\u2415", + "/cntr:newline": "\u2424", + "/cntr:null": "\u2400", + "/cntr:openbox": "\u2423", + "/cntr:recordseparator": "\u241E", + "/cntr:shiftin": "\u240F", + "/cntr:shiftout": "\u240E", + "/cntr:space": "\u2420", + "/cntr:startofheading": "\u2401", + "/cntr:startoftext": "\u2402", + "/cntr:substitute": "\u241A", + "/cntr:substituteformtwo": "\u2426", + "/cntr:synchronousidle": "\u2416", + "/cntr:unitseparator": "\u241F", + "/cntr:verticaltab": "\u240B", + "/coarmenian": "\u0581", + "/cocktailGlass": "\u1F378", + "/coffin": "\u26B0", + "/cofullwidth": "\u33C7", + "/collision": "\u1F4A5", + "/colon": "\u003A", + "/colonequals": "\u2254", + "/colonmod": "\uA789", + "/colonmonetary": "\u20A1", + "/colonmonospace": "\uFF1A", + "/colonraisedmod": "\u02F8", + "/colonsign": "\u20A1", + "/colonsmall": "\uFE55", + "/colontriangularhalfmod": "\u02D1", + "/colontriangularmod": "\u02D0", + "/comet": "\u2604", + "/comma": "\u002C", + "/commaabovecmb": "\u0313", + "/commaaboverightcmb": "\u0315", + "/commaaccent": "\uF6C3", + "/commaarabic": "\u060C", + "/commaarmenian": "\u055D", + "/commabarfunc": "\u236A", + "/commainferior": "\uF6E1", + "/commamonospace": "\uFF0C", + "/commaraised": "\u2E34", + "/commareversed": "\u2E41", + "/commareversedabovecmb": "\u0314", + "/commareversedmod": "\u02BD", + "/commasmall": "\uFE50", + "/commasuperior": "\uF6E2", + "/commaturnedabovecmb": "\u0312", + "/commaturnedmod": "\u02BB", + "/commercialat": "\uFE6B", + "/commercialminussign": "\u2052", + "/compass": "\u263C", + "/complement": "\u2201", + "/composition": "\u2384", + "/compression": "\u1F5DC", + "/con": "\uA76F", + "/confettiBall": "\u1F38A", + "/confoundedFace": "\u1F616", + "/confusedFace": "\u1F615", + "/congratulationideographiccircled": "\u3297", + "/congratulationideographicparen": "\u3237", + "/congruent": "\u2245", + "/conicaltaper": "\u2332", + "/conjunction": "\u260C", + "/consquareupblack": "\u26FE", + "/constructionSign": "\u1F6A7", + "/constructionWorker": "\u1F477", + "/containsasmembersmall": "\u220D", + "/containsasnormalsubgroorequalup": "\u22B5", + "/containsasnormalsubgroup": "\u22B3", + "/containslonghorizontalstroke": "\u22FA", + "/containsoverbar": "\u22FD", + "/containsoverbarsmall": "\u22FE", + "/containssmallverticalbarhorizontalstroke": "\u22FC", + "/containsverticalbarhorizontalstroke": "\u22FB", + "/continuousunderline": "\u2381", + "/contourintegral": "\u222E", + "/control": "\u2303", + "/controlACK": "\u0006", + "/controlBEL": "\u0007", + "/controlBS": "\u0008", + "/controlCAN": "\u0018", + "/controlCR": "\u000D", + "/controlDC1": "\u0011", + "/controlDC2": "\u0012", + "/controlDC3": "\u0013", + "/controlDC4": "\u0014", + "/controlDEL": "\u007F", + "/controlDLE": "\u0010", + "/controlEM": "\u0019", + "/controlENQ": "\u0005", + "/controlEOT": "\u0004", + "/controlESC": "\u001B", + "/controlETB": "\u0017", + "/controlETX": "\u0003", + "/controlFF": "\u000C", + "/controlFS": "\u001C", + "/controlGS": "\u001D", + "/controlHT": "\u0009", + "/controlKnobs": "\u1F39B", + "/controlLF": "\u000A", + "/controlNAK": "\u0015", + "/controlRS": "\u001E", + "/controlSI": "\u000F", + "/controlSO": "\u000E", + "/controlSOT": "\u0002", + "/controlSTX": "\u0001", + "/controlSUB": "\u001A", + "/controlSYN": "\u0016", + "/controlUS": "\u001F", + "/controlVT": "\u000B", + "/convavediamondwhite": "\u27E1", + "/convenienceStore": "\u1F3EA", + "/cookedRice": "\u1F35A", + "/cookie": "\u1F36A", + "/cooking": "\u1F373", + "/coolsquare": "\u1F192", + "/coproductarray": "\u2210", + "/copyideographiccircled": "\u32A2", + "/copyright": "\u00A9", + "/copyrightsans": "\uF8E9", + "/copyrightserif": "\uF6D9", + "/cornerbottomleft": "\u231E", + "/cornerbottomright": "\u231F", + "/cornerbracketleft": "\u300C", + "/cornerbracketlefthalfwidth": "\uFF62", + "/cornerbracketleftvertical": "\uFE41", + "/cornerbracketright": "\u300D", + "/cornerbracketrighthalfwidth": "\uFF63", + "/cornerbracketrightvertical": "\uFE42", + "/cornerdotupleft": "\u27D4", + "/cornertopleft": "\u231C", + "/cornertopright": "\u231D", + "/coroniseditorial": "\u2E0E", + "/corporationsquare": "\u337F", + "/correctideographiccircled": "\u32A3", + "/corresponds": "\u2258", + "/cosquare": "\u33C7", + "/couchAndLamp": "\u1F6CB", + "/counterbore": "\u2334", + "/countersink": "\u2335", + "/coupleHeart": "\u1F491", + "/coverkgfullwidth": "\u33C6", + "/coverkgsquare": "\u33C6", + "/cow": "\u1F404", + "/cowFace": "\u1F42E", + "/cpalatalhook": "\uA794", + "/cparen": "\u249E", + "/cparenthesized": "\u249E", + "/creditCard": "\u1F4B3", + "/crescentMoon": "\u1F319", + "/creversed": "\u2184", + "/cricketBatAndBall": "\u1F3CF", + "/crocodile": "\u1F40A", + "/cropbottomleft": "\u230D", + "/cropbottomright": "\u230C", + "/croptopleft": "\u230F", + "/croptopright": "\u230E", + "/crossPommee": "\u1F542", + "/crossPommeeHalf-circleBelow": "\u1F541", + "/crossedFlags": "\u1F38C", + "/crossedswords": "\u2694", + "/crossinglanes": "\u26CC", + "/crossmod": "\u02DF", + "/crossofjerusalem": "\u2629", + "/crossoflorraine": "\u2628", + "/crossonshieldblack": "\u26E8", + "/crown": "\u1F451", + "/crrn:rupee": "\u20A8", + "/cruzeiro": "\u20A2", + "/cryingCatFace": "\u1F63F", + "/cryingFace": "\u1F622", + "/crystalBall": "\u1F52E", + "/cstretched": "\u0297", + "/cstroke": "\u023C", + "/cuatrillo": "\uA72D", + "/cuatrillocomma": "\uA72F", + "/curlyand": "\u22CF", + "/curlylogicaland": "\u22CF", + "/curlylogicalor": "\u22CE", + "/curlyor": "\u22CE", + "/currency": "\u00A4", + "/currencyExchange": "\u1F4B1", + "/curryAndRice": "\u1F35B", + "/custard": "\u1F36E", + "/customeraccountnumber": "\u2449", + "/customs": "\u1F6C3", + "/cyclone": "\u1F300", + "/cylindricity": "\u232D", + "/cyrBreve": "\uF6D1", + "/cyrFlex": "\uF6D2", + "/cyrbreve": "\uF6D4", + "/cyrflex": "\uF6D5", + "/d": "\u0064", + "/daarmenian": "\u0564", + "/daasusquare": "\u3324", + "/dabengali": "\u09A6", + "/dad": "\u0636", + "/dad.fina": "\uFEBE", + "/dad.init": "\uFEBF", + "/dad.init_alefmaksura.fina": "\uFD07", + "/dad.init_hah.fina": "\uFC23", + "/dad.init_hah.medi": "\uFCB5", + "/dad.init_jeem.fina": "\uFC22", + "/dad.init_jeem.medi": "\uFCB4", + "/dad.init_khah.fina": "\uFC24", + "/dad.init_khah.medi": "\uFCB6", + "/dad.init_khah.medi_meem.medi": "\uFD70", + "/dad.init_meem.fina": "\uFC25", + "/dad.init_meem.medi": "\uFCB7", + "/dad.init_reh.fina": "\uFD10", + "/dad.init_yeh.fina": "\uFD08", + "/dad.isol": "\uFEBD", + "/dad.medi": "\uFEC0", + "/dad.medi_alefmaksura.fina": "\uFD23", + "/dad.medi_hah.medi_alefmaksura.fina": "\uFD6E", + "/dad.medi_hah.medi_yeh.fina": "\uFDAB", + "/dad.medi_khah.medi_meem.fina": "\uFD6F", + "/dad.medi_reh.fina": "\uFD2C", + "/dad.medi_yeh.fina": "\uFD24", + "/dadarabic": "\u0636", + "/daddotbelow": "\u06FB", + "/dadeva": "\u0926", + "/dadfinalarabic": "\uFEBE", + "/dadinitialarabic": "\uFEBF", + "/dadmedialarabic": "\uFEC0", + "/dafullwidth": "\u3372", + "/dagesh": "\u05BC", + "/dagesh:hb": "\u05BC", + "/dageshhebrew": "\u05BC", + "/dagger": "\u2020", + "/daggerKnife": "\u1F5E1", + "/daggerdbl": "\u2021", + "/daggerwithguardleft": "\u2E36", + "/daggerwithguardright": "\u2E37", + "/dagujarati": "\u0AA6", + "/dagurmukhi": "\u0A26", + "/dahal": "\u068C", + "/dahal.fina": "\uFB85", + "/dahal.isol": "\uFB84", + "/dahiragana": "\u3060", + "/dakatakana": "\u30C0", + "/dal": "\u062F", + "/dal.fina": "\uFEAA", + "/dal.isol": "\uFEA9", + "/dalInvertedSmallVBelow": "\u075A", + "/dalTwoDotsVerticallyBelowSmallTah": "\u0759", + "/dalarabic": "\u062F", + "/daldotbelow": "\u068A", + "/daldotbelowtahsmall": "\u068B", + "/daldownthreedotsabove": "\u068F", + "/dalet": "\u05D3", + "/dalet:hb": "\u05D3", + "/daletdagesh": "\uFB33", + "/daletdageshhebrew": "\uFB33", + "/dalethatafpatah": "\u05D3", + "/dalethatafpatahhebrew": "\u05D3", + "/dalethatafsegol": "\u05D3", + "/dalethatafsegolhebrew": "\u05D3", + "/dalethebrew": "\u05D3", + "/dalethiriq": "\u05D3", + "/dalethiriqhebrew": "\u05D3", + "/daletholam": "\u05D3", + "/daletholamhebrew": "\u05D3", + "/daletpatah": "\u05D3", + "/daletpatahhebrew": "\u05D3", + "/daletqamats": "\u05D3", + "/daletqamatshebrew": "\u05D3", + "/daletqubuts": "\u05D3", + "/daletqubutshebrew": "\u05D3", + "/daletsegol": "\u05D3", + "/daletsegolhebrew": "\u05D3", + "/daletsheva": "\u05D3", + "/daletshevahebrew": "\u05D3", + "/dalettsere": "\u05D3", + "/dalettserehebrew": "\u05D3", + "/daletwide:hb": "\uFB22", + "/daletwithdagesh:hb": "\uFB33", + "/dalfinalarabic": "\uFEAA", + "/dalfourdotsabove": "\u0690", + "/dalinvertedV": "\u06EE", + "/dalring": "\u0689", + "/damahaprana": "\uA9A3", + "/damma": "\u064F", + "/dammaIsol": "\uFE78", + "/dammaMedi": "\uFE79", + "/dammaarabic": "\u064F", + "/dammalowarabic": "\u064F", + "/dammareversed": "\u065D", + "/dammasmall": "\u0619", + "/dammatan": "\u064C", + "/dammatanIsol": "\uFE72", + "/dammatanaltonearabic": "\u064C", + "/dammatanarabic": "\u064C", + "/dancer": "\u1F483", + "/danda": "\u0964", + "/dango": "\u1F361", + "/darga:hb": "\u05A7", + "/dargahebrew": "\u05A7", + "/dargalefthebrew": "\u05A7", + "/darkShade": "\u2593", + "/darkSunglasses": "\u1F576", + "/dashwithupturnleft": "\u2E43", + "/dasiacmbcyr": "\u0485", + "/dasiapneumatacyrilliccmb": "\u0485", + "/dateseparator": "\u060D", + "/dayeighteentelegraph": "\u33F1", + "/dayeighttelegraph": "\u33E7", + "/dayeleventelegraph": "\u33EA", + "/dayfifteentelegraph": "\u33EE", + "/dayfivetelegraph": "\u33E4", + "/dayfourteentelegraph": "\u33ED", + "/dayfourtelegraph": "\u33E3", + "/daynineteentelegraph": "\u33F2", + "/dayninetelegraph": "\u33E8", + "/dayonetelegraph": "\u33E0", + "/dayseventeentelegraph": "\u33F0", + "/dayseventelegraph": "\u33E6", + "/daysixteentelegraph": "\u33EF", + "/daysixtelegraph": "\u33E5", + "/daytentelegraph": "\u33E9", + "/daythirteentelegraph": "\u33EC", + "/daythirtyonetelegraph": "\u33FE", + "/daythirtytelegraph": "\u33FD", + "/daythreetelegraph": "\u33E2", + "/daytwelvetelegraph": "\u33EB", + "/daytwentyeighttelegraph": "\u33FB", + "/daytwentyfivetelegraph": "\u33F8", + "/daytwentyfourtelegraph": "\u33F7", + "/daytwentyninetelegraph": "\u33FC", + "/daytwentyonetelegraph": "\u33F4", + "/daytwentyseventelegraph": "\u33FA", + "/daytwentysixtelegraph": "\u33F9", + "/daytwentytelegraph": "\u33F3", + "/daytwentythreetelegraph": "\u33F6", + "/daytwentytwotelegraph": "\u33F5", + "/daytwotelegraph": "\u33E1", + "/dbdigraph": "\u0238", + "/dbfullwidth": "\u33C8", + "/dblGrave": "\uF6D3", + "/dblanglebracketleft": "\u300A", + "/dblanglebracketleftvertical": "\uFE3D", + "/dblanglebracketright": "\u300B", + "/dblanglebracketrightvertical": "\uFE3E", + "/dblarchinvertedbelowcmb": "\u032B", + "/dblarrowNE": "\u21D7", + "/dblarrowNW": "\u21D6", + "/dblarrowSE": "\u21D8", + "/dblarrowSW": "\u21D9", + "/dblarrowdown": "\u21D3", + "/dblarrowleft": "\u21D4", + "/dblarrowleftright": "\u21D4", + "/dblarrowleftrightstroke": "\u21CE", + "/dblarrowleftstroke": "\u21CD", + "/dblarrowright": "\u21D2", + "/dblarrowrightstroke": "\u21CF", + "/dblarrowup": "\u21D1", + "/dblarrowupdown": "\u21D5", + "/dbldanda": "\u0965", + "/dbldnhorz": "\u2566", + "/dbldnleft": "\u2557", + "/dbldnright": "\u2554", + "/dblgrave": "\uF6D6", + "/dblgravecmb": "\u030F", + "/dblhorz": "\u2550", + "/dblintegral": "\u222C", + "/dbllowline": "\u2017", + "/dbllowlinecmb": "\u0333", + "/dbloverlinecmb": "\u033F", + "/dblprimemod": "\u02BA", + "/dblstrokearrowdown": "\u21DF", + "/dblstrokearrowup": "\u21DE", + "/dbluphorz": "\u2569", + "/dblupleft": "\u255D", + "/dblupright": "\u255A", + "/dblvert": "\u2551", + "/dblverthorz": "\u256C", + "/dblverticalbar": "\u2016", + "/dblverticallineabovecmb": "\u030E", + "/dblvertleft": "\u2563", + "/dblvertright": "\u2560", + "/dbopomofo": "\u3109", + "/dbsquare": "\u33C8", + "/dcaron": "\u010F", + "/dcedilla": "\u1E11", + "/dchecyr": "\u052D", + "/dcircle": "\u24D3", + "/dcircumflexbelow": "\u1E13", + "/dcroat": "\u0111", + "/dcurl": "\u0221", + "/ddabengali": "\u09A1", + "/ddadeva": "\u0921", + "/ddagujarati": "\u0AA1", + "/ddagurmukhi": "\u0A21", + "/ddahal": "\u068D", + "/ddahal.fina": "\uFB83", + "/ddahal.isol": "\uFB82", + "/ddal": "\u0688", + "/ddal.fina": "\uFB89", + "/ddal.isol": "\uFB88", + "/ddalarabic": "\u0688", + "/ddalfinalarabic": "\uFB89", + "/ddamahaprana": "\uA99E", + "/ddblstruckitalic": "\u2146", + "/dddhadeva": "\u095C", + "/ddhabengali": "\u09A2", + "/ddhadeva": "\u0922", + "/ddhagujarati": "\u0AA2", + "/ddhagurmukhi": "\u0A22", + "/ddot": "\u1E0B", + "/ddotaccent": "\u1E0B", + "/ddotbelow": "\u1E0D", + "/decembertelegraph": "\u32CB", + "/deciduousTree": "\u1F333", + "/decimalexponent": "\u23E8", + "/decimalseparatorarabic": "\u066B", + "/decimalseparatorpersian": "\u066B", + "/decreaseFontSize": "\u1F5DB", + "/decyr": "\u0434", + "/decyrillic": "\u0434", + "/degree": "\u00B0", + "/degreecelsius": "\u2103", + "/degreefahrenheit": "\u2109", + "/dehi:hb": "\u05AD", + "/dehihebrew": "\u05AD", + "/dehiragana": "\u3067", + "/deicoptic": "\u03EF", + "/dekatakana": "\u30C7", + "/dekomicyr": "\u0501", + "/deldiaeresisfunc": "\u2362", + "/deleteleft": "\u232B", + "/deleteright": "\u2326", + "/deliveryTruck": "\u1F69A", + "/delstilefunc": "\u2352", + "/delta": "\u03B4", + "/deltaequal": "\u225C", + "/deltastilefunc": "\u234B", + "/deltaturned": "\u018D", + "/deltaunderlinefunc": "\u2359", + "/deltildefunc": "\u236B", + "/denominatorminusonenumeratorbengali": "\u09F8", + "/dentistrybottomverticalleft": "\u23CC", + "/dentistrybottomverticalright": "\u23BF", + "/dentistrycircledownhorizontal": "\u23C1", + "/dentistrycircleuphorizontal": "\u23C2", + "/dentistrycirclevertical": "\u23C0", + "/dentistrydownhorizontal": "\u23C9", + "/dentistrytopverticalleft": "\u23CB", + "/dentistrytopverticalright": "\u23BE", + "/dentistrytriangledownhorizontal": "\u23C4", + "/dentistrytriangleuphorizontal": "\u23C5", + "/dentistrytrianglevertical": "\u23C3", + "/dentistryuphorizontal": "\u23CA", + "/dentistrywavedownhorizontal": "\u23C7", + "/dentistrywaveuphorizontal": "\u23C8", + "/dentistrywavevertical": "\u23C6", + "/departmentStore": "\u1F3EC", + "/derelictHouseBuilding": "\u1F3DA", + "/desert": "\u1F3DC", + "/desertIsland": "\u1F3DD", + "/desisquare": "\u3325", + "/desktopComputer": "\u1F5A5", + "/desktopWindow": "\u1F5D4", + "/deva:a": "\u0905", + "/deva:aa": "\u0906", + "/deva:aasign": "\u093E", + "/deva:abbreviation": "\u0970", + "/deva:acandra": "\u0972", + "/deva:acute": "\u0954", + "/deva:ai": "\u0910", + "/deva:aisign": "\u0948", + "/deva:anudatta": "\u0952", + "/deva:anusvara": "\u0902", + "/deva:ashort": "\u0904", + "/deva:au": "\u0914", + "/deva:ausign": "\u094C", + "/deva:avagraha": "\u093D", + "/deva:aw": "\u0975", + "/deva:awsign": "\u094F", + "/deva:ba": "\u092C", + "/deva:bba": "\u097F", + "/deva:bha": "\u092D", + "/deva:ca": "\u091A", + "/deva:candrabindu": "\u0901", + "/deva:candrabinduinverted": "\u0900", + "/deva:cha": "\u091B", + "/deva:da": "\u0926", + "/deva:danda": "\u0964", + "/deva:dbldanda": "\u0965", + "/deva:dda": "\u0921", + "/deva:ddda": "\u097E", + "/deva:dddha": "\u095C", + "/deva:ddha": "\u0922", + "/deva:dha": "\u0927", + "/deva:dothigh": "\u0971", + "/deva:e": "\u090F", + "/deva:ecandra": "\u090D", + "/deva:eight": "\u096E", + "/deva:eshort": "\u090E", + "/deva:esign": "\u0947", + "/deva:esigncandra": "\u0945", + "/deva:esignprishthamatra": "\u094E", + "/deva:esignshort": "\u0946", + "/deva:fa": "\u095E", + "/deva:five": "\u096B", + "/deva:four": "\u096A", + "/deva:ga": "\u0917", + "/deva:gga": "\u097B", + "/deva:gha": "\u0918", + "/deva:ghha": "\u095A", + "/deva:glottalstop": "\u097D", + "/deva:grave": "\u0953", + "/deva:ha": "\u0939", + "/deva:i": "\u0907", + "/deva:ii": "\u0908", + "/deva:iisign": "\u0940", + "/deva:isign": "\u093F", + "/deva:ja": "\u091C", + "/deva:jha": "\u091D", + "/deva:jja": "\u097C", + "/deva:ka": "\u0915", + "/deva:kha": "\u0916", + "/deva:khha": "\u0959", + "/deva:la": "\u0932", + "/deva:lla": "\u0933", + "/deva:llla": "\u0934", + "/deva:llvocal": "\u0961", + "/deva:llvocalsign": "\u0963", + "/deva:lvocal": "\u090C", + "/deva:lvocalsign": "\u0962", + "/deva:ma": "\u092E", + "/deva:marwaridda": "\u0978", + "/deva:na": "\u0928", + "/deva:nga": "\u0919", + "/deva:nine": "\u096F", + "/deva:nna": "\u0923", + "/deva:nnna": "\u0929", + "/deva:nukta": "\u093C", + "/deva:nya": "\u091E", + "/deva:o": "\u0913", + "/deva:ocandra": "\u0911", + "/deva:oe": "\u0973", + "/deva:oesign": "\u093A", + "/deva:om": "\u0950", + "/deva:one": "\u0967", + "/deva:ooe": "\u0974", + "/deva:ooesign": "\u093B", + "/deva:oshort": "\u0912", + "/deva:osign": "\u094B", + "/deva:osigncandra": "\u0949", + "/deva:osignshort": "\u094A", + "/deva:pa": "\u092A", + "/deva:pha": "\u092B", + "/deva:qa": "\u0958", + "/deva:ra": "\u0930", + "/deva:rha": "\u095D", + "/deva:rra": "\u0931", + "/deva:rrvocal": "\u0960", + "/deva:rrvocalsign": "\u0944", + "/deva:rvocal": "\u090B", + "/deva:rvocalsign": "\u0943", + "/deva:sa": "\u0938", + "/deva:seven": "\u096D", + "/deva:sha": "\u0936", + "/deva:signelongcandra": "\u0955", + "/deva:six": "\u096C", + "/deva:ssa": "\u0937", + "/deva:ta": "\u0924", + "/deva:tha": "\u0925", + "/deva:three": "\u0969", + "/deva:tta": "\u091F", + "/deva:ttha": "\u0920", + "/deva:two": "\u0968", + "/deva:u": "\u0909", + "/deva:udatta": "\u0951", + "/deva:ue": "\u0976", + "/deva:uesign": "\u0956", + "/deva:usign": "\u0941", + "/deva:uu": "\u090A", + "/deva:uue": "\u0977", + "/deva:uuesign": "\u0957", + "/deva:uusign": "\u0942", + "/deva:va": "\u0935", + "/deva:virama": "\u094D", + "/deva:visarga": "\u0903", + "/deva:ya": "\u092F", + "/deva:yaheavy": "\u097A", + "/deva:yya": "\u095F", + "/deva:za": "\u095B", + "/deva:zero": "\u0966", + "/deva:zha": "\u0979", + "/dezh": "\u02A4", + "/dfemaledbl": "\u26A2", + "/dhabengali": "\u09A7", + "/dhadeva": "\u0927", + "/dhagujarati": "\u0AA7", + "/dhagurmukhi": "\u0A27", + "/dhook": "\u0257", + "/diaeresisgreaterfunc": "\u2369", + "/dialytikatonos": "\u0385", + "/dialytikatonoscmb": "\u0344", + "/diametersign": "\u2300", + "/diamond": "\u2666", + "/diamondShapeADotInside": "\u1F4A0", + "/diamondinsquarewhite": "\u26CB", + "/diamondoperator": "\u22C4", + "/diamondsuitwhite": "\u2662", + "/diamondunderlinefunc": "\u235A", + "/diamondwhitewithdiamondsmallblack": "\u25C8", + "/diefive": "\u2684", + "/diefour": "\u2683", + "/dieone": "\u2680", + "/dieresis": "\u00A8", + "/dieresisacute": "\uF6D7", + "/dieresisbelowcmb": "\u0324", + "/dieresiscmb": "\u0308", + "/dieresisgrave": "\uF6D8", + "/dieresistilde": "\u1FC1", + "/dieresistonos": "\u0385", + "/dieselLocomotive": "\u1F6F2", + "/diesix": "\u2685", + "/diethree": "\u2682", + "/dietwo": "\u2681", + "/differencebetween": "\u224F", + "/digamma": "\u03DD", + "/digammapamphylian": "\u0377", + "/digramgreateryang": "\u268C", + "/digramgreateryin": "\u268F", + "/digramlesseryang": "\u268E", + "/digramlesseryin": "\u268D", + "/dihiragana": "\u3062", + "/dikatakana": "\u30C2", + "/dimensionorigin": "\u2331", + "/dingbatSAns-serifzerocircle": "\u1F10B", + "/dingbatSAns-serifzerocircleblack": "\u1F10C", + "/dinsular": "\uA77A", + "/directHit": "\u1F3AF", + "/directcurrentformtwo": "\u2393", + "/dirgamurevowel": "\uA9BB", + "/disabledcar": "\u26CD", + "/disappointedButRelievedFace": "\u1F625", + "/disappointedFace": "\u1F61E", + "/discontinuousunderline": "\u2382", + "/dittomark": "\u3003", + "/divide": "\u00F7", + "/divides": "\u2223", + "/divisionslash": "\u2215", + "/divisiontimes": "\u22C7", + "/divorce": "\u26AE", + "/dizzy": "\u1F4AB", + "/dizzyFace": "\u1F635", + "/djecyr": "\u0452", + "/djecyrillic": "\u0452", + "/djekomicyr": "\u0503", + "/dkshade": "\u2593", + "/dlfullwidth": "\u3397", + "/dlinebelow": "\u1E0F", + "/dlogicalorsquare": "\u27CF", + "/dlogicalsquare": "\u27CE", + "/dlsquare": "\u3397", + "/dm2fullwidth": "\u3378", + "/dm3fullwidth": "\u3379", + "/dmacron": "\u0111", + "/dmaledbl": "\u26A3", + "/dmfullwidth": "\u3377", + "/dmonospace": "\uFF44", + "/dnblock": "\u2584", + "/dndblhorzsng": "\u2565", + "/dndblleftsng": "\u2556", + "/dndblrightsng": "\u2553", + "/dngb:airplane": "\u2708", + "/dngb:arrowfeatheredblackNE": "\u27B6", + "/dngb:arrowfeatheredblackSE": "\u27B4", + "/dngb:arrowfeatheredblackheavyNE": "\u27B9", + "/dngb:arrowfeatheredblackheavySE": "\u27B7", + "/dngb:arrowheadrightblack": "\u27A4", + "/dngb:arrowheadrightthreeDbottomlight": "\u27A3", + "/dngb:arrowheadrightthreeDtoplight": "\u27A2", + "/dngb:arrowheavyNE": "\u279A", + "/dngb:arrowheavySE": "\u2798", + "/dngb:arrowrightbacktiltedshadowedwhite": "\u27AB", + "/dngb:arrowrightblack": "\u27A1", + "/dngb:arrowrightcircledwhiteheavy": "\u27B2", + "/dngb:arrowrightcurvedownblackheavy": "\u27A5", + "/dngb:arrowrightcurveupblackheavy": "\u27A6", + "/dngb:arrowrightfeatheredblack": "\u27B5", + "/dngb:arrowrightfeatheredblackheavy": "\u27B8", + "/dngb:arrowrightfeatheredwhite": "\u27B3", + "/dngb:arrowrightfronttiltedshadowedwhite": "\u27AC", + "/dngb:arrowrightheavy": "\u2799", + "/dngb:arrowrightleftshadedwhite": "\u27AA", + "/dngb:arrowrightoutlinedopen": "\u27BE", + "/dngb:arrowrightpointed": "\u279B", + "/dngb:arrowrightpointedblackheavy": "\u27A8", + "/dngb:arrowrightrightshadedwhite": "\u27A9", + "/dngb:arrowrightroundheavy": "\u279C", + "/dngb:arrowrightsquatblack": "\u27A7", + "/dngb:arrowrighttriangle": "\u279D", + "/dngb:arrowrighttriangledashed": "\u279F", + "/dngb:arrowrighttriangledashedheavy": "\u27A0", + "/dngb:arrowrighttriangleheavy": "\u279E", + "/dngb:arrowrightwedge": "\u27BC", + "/dngb:arrowrightwedgeheavy": "\u27BD", + "/dngb:arrowrightwideheavy": "\u2794", + "/dngb:arrowshadowrightlowerwhiteheavy": "\u27AD", + "/dngb:arrowshadowrightnotchedlowerwhite": "\u27AF", + "/dngb:arrowshadowrightnotchedupperwhite": "\u27B1", + "/dngb:arrowshadowrightupperwhiteheavy": "\u27AE", + "/dngb:arrowteardropright": "\u27BA", + "/dngb:arrowteardroprightheavy": "\u27BB", + "/dngb:asteriskballoon": "\u2749", + "/dngb:asteriskballoonfour": "\u2723", + "/dngb:asteriskballoonheavyfour": "\u2724", + "/dngb:asteriskcentreopen": "\u2732", + "/dngb:asteriskclubfour": "\u2725", + "/dngb:asteriskheavy": "\u2731", + "/dngb:asteriskpointedsixteen": "\u273A", + "/dngb:asteriskteardrop": "\u273B", + "/dngb:asteriskteardropcentreopen": "\u273C", + "/dngb:asteriskteardropfour": "\u2722", + "/dngb:asteriskteardropheavy": "\u273D", + "/dngb:asteriskteardroppinwheelheavy": "\u2743", + "/dngb:asteriskteardroppropellereight": "\u274A", + "/dngb:asteriskteardroppropellerheavyeight": "\u274B", + "/dngb:ballotx": "\u2717", + "/dngb:ballotxheavy": "\u2718", + "/dngb:bracketleftpointedangleheavyornament": "\u2770", + "/dngb:bracketleftpointedanglemediumornament": "\u276C", + "/dngb:bracketrightpointedangleheavyornament": "\u2771", + "/dngb:bracketrightpointedanglemediumornament": "\u276D", + "/dngb:bracketshellleftlightornament": "\u2772", + "/dngb:bracketshellrightlightornament": "\u2773", + "/dngb:check": "\u2713", + "/dngb:checkheavy": "\u2714", + "/dngb:checkwhiteheavy": "\u2705", + "/dngb:chevronsnowflakeheavy": "\u2746", + "/dngb:circleshadowedwhite": "\u274D", + "/dngb:commaheavydoubleornament": "\u275E", + "/dngb:commaheavydoubleturnedornament": "\u275D", + "/dngb:commaheavyornament": "\u275C", + "/dngb:commaheavyturnedornament": "\u275B", + "/dngb:compasstarpointedblackeight": "\u2737", + "/dngb:compasstarpointedblackheavyeight": "\u2738", + "/dngb:cross": "\u274C", + "/dngb:crosscentreopen": "\u271B", + "/dngb:crosscentreopenheavy": "\u271C", + "/dngb:curlybracketleftmediumornament": "\u2774", + "/dngb:curlybracketrightmediumornament": "\u2775", + "/dngb:curlyloop": "\u27B0", + "/dngb:curlyloopdouble": "\u27BF", + "/dngb:curvedstemparagraphsignornament": "\u2761", + "/dngb:diamondminusxblackwhite": "\u2756", + "/dngb:divisionsignheavy": "\u2797", + "/dngb:eightnegativecircled": "\u277D", + "/dngb:eightsanscircled": "\u2787", + "/dngb:eightsansnegativecircled": "\u2791", + "/dngb:envelope": "\u2709", + "/dngb:exclamationheavy": "\u2757", + "/dngb:exclamationheavyornament": "\u2762", + "/dngb:exclamationwhiteornament": "\u2755", + "/dngb:fivenegativecircled": "\u277A", + "/dngb:fivesanscircled": "\u2784", + "/dngb:fivesansnegativecircled": "\u278E", + "/dngb:floralheart": "\u2766", + "/dngb:floralheartbulletrotated": "\u2767", + "/dngb:floretteblack": "\u273F", + "/dngb:floretteoutlinedpetalledblackeight": "\u2741", + "/dngb:florettepetalledblackwhitesix": "\u273E", + "/dngb:florettewhite": "\u2740", + "/dngb:fournegativecircled": "\u2779", + "/dngb:foursanscircled": "\u2783", + "/dngb:foursansnegativecircled": "\u278D", + "/dngb:greekcrossheavy": "\u271A", + "/dngb:greekcrossoutlined": "\u2719", + "/dngb:heartblackheavy": "\u2764", + "/dngb:heartbulletrotatedblackheavy": "\u2765", + "/dngb:heartexclamationheavyornament": "\u2763", + "/dngb:hvictory": "\u270C", + "/dngb:hwriting": "\u270D", + "/dngb:latincross": "\u271D", + "/dngb:latincrossoutlined": "\u271F", + "/dngb:latincrossshadowedwhite": "\u271E", + "/dngb:lowcommaheavydoubleornament": "\u2760", + "/dngb:lowcommaheavyornament": "\u275F", + "/dngb:maltesecross": "\u2720", + "/dngb:minussignheavy": "\u2796", + "/dngb:multiplicationx": "\u2715", + "/dngb:multiplicationxheavy": "\u2716", + "/dngb:nibblack": "\u2712", + "/dngb:nibwhite": "\u2711", + "/dngb:ninenegativecircled": "\u277E", + "/dngb:ninesanscircled": "\u2788", + "/dngb:ninesansnegativecircled": "\u2792", + "/dngb:onenegativecircled": "\u2776", + "/dngb:onesanscircled": "\u2780", + "/dngb:onesansnegativecircled": "\u278A", + "/dngb:parenthesisleftflattenedmediumornament": "\u276A", + "/dngb:parenthesisleftmediumornament": "\u2768", + "/dngb:parenthesisrightflattenedmediumornament": "\u276B", + "/dngb:parenthesisrightmediumornament": "\u2769", + "/dngb:pencil": "\u270F", + "/dngb:pencillowerright": "\u270E", + "/dngb:pencilupperright": "\u2710", + "/dngb:plussignheavy": "\u2795", + "/dngb:questionblackornament": "\u2753", + "/dngb:questionwhiteornament": "\u2754", + "/dngb:quotationleftpointedangleheavyornament": "\u276E", + "/dngb:quotationrightpointedangleheavyornament": "\u276F", + "/dngb:raisedfist": "\u270A", + "/dngb:raisedh": "\u270B", + "/dngb:safetyscissorsblack": "\u2700", + "/dngb:scissorsblack": "\u2702", + "/dngb:scissorslowerblade": "\u2703", + "/dngb:scissorsupperblade": "\u2701", + "/dngb:scissorswhite": "\u2704", + "/dngb:sevennegativecircled": "\u277C", + "/dngb:sevensanscircled": "\u2786", + "/dngb:sevensansnegativecircled": "\u2790", + "/dngb:sixnegativecircled": "\u277B", + "/dngb:sixsanscircled": "\u2785", + "/dngb:sixsansnegativecircled": "\u278F", + "/dngb:snowflake": "\u2744", + "/dngb:snowflaketight": "\u2745", + "/dngb:sparkle": "\u2747", + "/dngb:sparkleheavy": "\u2748", + "/dngb:sparkles": "\u2728", + "/dngb:spokedasteriskeight": "\u2733", + "/dngb:squaredcrossnegative": "\u274E", + "/dngb:squarelowerrightshadowedwhite": "\u2751", + "/dngb:squareshadowlowerrightwhite": "\u274F", + "/dngb:squareshadowupperrightwhite": "\u2750", + "/dngb:squareupperrightshadowedwhite": "\u2752", + "/dngb:starcentreblackwhite": "\u272C", + "/dngb:starcentreopenblack": "\u272B", + "/dngb:starcentreopenpointedcircledeight": "\u2742", + "/dngb:starcircledwhite": "\u272A", + "/dngb:starofdavid": "\u2721", + "/dngb:staroutlinedblack": "\u272D", + "/dngb:staroutlinedblackheavy": "\u272E", + "/dngb:staroutlinedstresswhite": "\u2729", + "/dngb:starpinwheel": "\u272F", + "/dngb:starpointedblackeight": "\u2734", + "/dngb:starpointedblackfour": "\u2726", + "/dngb:starpointedblacksix": "\u2736", + "/dngb:starpointedblacktwelve": "\u2739", + "/dngb:starpointedpinwheeleight": "\u2735", + "/dngb:starpointedwhitefour": "\u2727", + "/dngb:starshadowedwhite": "\u2730", + "/dngb:tapedrive": "\u2707", + "/dngb:telephonelocationsign": "\u2706", + "/dngb:tennegativecircled": "\u277F", + "/dngb:tensanscircled": "\u2789", + "/dngb:tensansnegativecircled": "\u2793", + "/dngb:threenegativecircled": "\u2778", + "/dngb:threesanscircled": "\u2782", + "/dngb:threesansnegativecircled": "\u278C", + "/dngb:twonegativecircled": "\u2777", + "/dngb:twosanscircled": "\u2781", + "/dngb:twosansnegativecircled": "\u278B", + "/dngb:verticalbarheavy": "\u275A", + "/dngb:verticalbarlight": "\u2758", + "/dngb:verticalbarmedium": "\u2759", + "/dnheavyhorzlight": "\u2530", + "/dnheavyleftlight": "\u2512", + "/dnheavyleftuplight": "\u2527", + "/dnheavyrightlight": "\u250E", + "/dnheavyrightuplight": "\u251F", + "/dnheavyuphorzlight": "\u2541", + "/dnlighthorzheavy": "\u252F", + "/dnlightleftheavy": "\u2511", + "/dnlightleftupheavy": "\u2529", + "/dnlightrightheavy": "\u250D", + "/dnlightrightupheavy": "\u2521", + "/dnlightuphorzheavy": "\u2547", + "/dnsnghorzdbl": "\u2564", + "/dnsngleftdbl": "\u2555", + "/dnsngrightdbl": "\u2552", + "/doNotLitter": "\u1F6AF", + "/dochadathai": "\u0E0E", + "/document": "\u1F5CE", + "/documentPicture": "\u1F5BB", + "/documentText": "\u1F5B9", + "/documentTextAndPicture": "\u1F5BA", + "/dodekthai": "\u0E14", + "/doesnotcontainasnormalsubgroorequalup": "\u22ED", + "/doesnotcontainasnormalsubgroup": "\u22EB", + "/doesnotdivide": "\u2224", + "/doesnotforce": "\u22AE", + "/doesnotprecede": "\u2280", + "/doesnotprecedeorequal": "\u22E0", + "/doesnotprove": "\u22AC", + "/doesnotsucceed": "\u2281", + "/doesnotsucceedorequal": "\u22E1", + "/dog": "\u1F415", + "/dogFace": "\u1F436", + "/dohiragana": "\u3069", + "/dokatakana": "\u30C9", + "/dollar": "\u0024", + "/dollarinferior": "\uF6E3", + "/dollarmonospace": "\uFF04", + "/dollaroldstyle": "\uF724", + "/dollarsmall": "\uFE69", + "/dollarsuperior": "\uF6E4", + "/dolphin": "\u1F42C", + "/dominohorizontal_00_00": "\u1F031", + "/dominohorizontal_00_01": "\u1F032", + "/dominohorizontal_00_02": "\u1F033", + "/dominohorizontal_00_03": "\u1F034", + "/dominohorizontal_00_04": "\u1F035", + "/dominohorizontal_00_05": "\u1F036", + "/dominohorizontal_00_06": "\u1F037", + "/dominohorizontal_01_00": "\u1F038", + "/dominohorizontal_01_01": "\u1F039", + "/dominohorizontal_01_02": "\u1F03A", + "/dominohorizontal_01_03": "\u1F03B", + "/dominohorizontal_01_04": "\u1F03C", + "/dominohorizontal_01_05": "\u1F03D", + "/dominohorizontal_01_06": "\u1F03E", + "/dominohorizontal_02_00": "\u1F03F", + "/dominohorizontal_02_01": "\u1F040", + "/dominohorizontal_02_02": "\u1F041", + "/dominohorizontal_02_03": "\u1F042", + "/dominohorizontal_02_04": "\u1F043", + "/dominohorizontal_02_05": "\u1F044", + "/dominohorizontal_02_06": "\u1F045", + "/dominohorizontal_03_00": "\u1F046", + "/dominohorizontal_03_01": "\u1F047", + "/dominohorizontal_03_02": "\u1F048", + "/dominohorizontal_03_03": "\u1F049", + "/dominohorizontal_03_04": "\u1F04A", + "/dominohorizontal_03_05": "\u1F04B", + "/dominohorizontal_03_06": "\u1F04C", + "/dominohorizontal_04_00": "\u1F04D", + "/dominohorizontal_04_01": "\u1F04E", + "/dominohorizontal_04_02": "\u1F04F", + "/dominohorizontal_04_03": "\u1F050", + "/dominohorizontal_04_04": "\u1F051", + "/dominohorizontal_04_05": "\u1F052", + "/dominohorizontal_04_06": "\u1F053", + "/dominohorizontal_05_00": "\u1F054", + "/dominohorizontal_05_01": "\u1F055", + "/dominohorizontal_05_02": "\u1F056", + "/dominohorizontal_05_03": "\u1F057", + "/dominohorizontal_05_04": "\u1F058", + "/dominohorizontal_05_05": "\u1F059", + "/dominohorizontal_05_06": "\u1F05A", + "/dominohorizontal_06_00": "\u1F05B", + "/dominohorizontal_06_01": "\u1F05C", + "/dominohorizontal_06_02": "\u1F05D", + "/dominohorizontal_06_03": "\u1F05E", + "/dominohorizontal_06_04": "\u1F05F", + "/dominohorizontal_06_05": "\u1F060", + "/dominohorizontal_06_06": "\u1F061", + "/dominohorizontalback": "\u1F030", + "/dominovertical_00_00": "\u1F063", + "/dominovertical_00_01": "\u1F064", + "/dominovertical_00_02": "\u1F065", + "/dominovertical_00_03": "\u1F066", + "/dominovertical_00_04": "\u1F067", + "/dominovertical_00_05": "\u1F068", + "/dominovertical_00_06": "\u1F069", + "/dominovertical_01_00": "\u1F06A", + "/dominovertical_01_01": "\u1F06B", + "/dominovertical_01_02": "\u1F06C", + "/dominovertical_01_03": "\u1F06D", + "/dominovertical_01_04": "\u1F06E", + "/dominovertical_01_05": "\u1F06F", + "/dominovertical_01_06": "\u1F070", + "/dominovertical_02_00": "\u1F071", + "/dominovertical_02_01": "\u1F072", + "/dominovertical_02_02": "\u1F073", + "/dominovertical_02_03": "\u1F074", + "/dominovertical_02_04": "\u1F075", + "/dominovertical_02_05": "\u1F076", + "/dominovertical_02_06": "\u1F077", + "/dominovertical_03_00": "\u1F078", + "/dominovertical_03_01": "\u1F079", + "/dominovertical_03_02": "\u1F07A", + "/dominovertical_03_03": "\u1F07B", + "/dominovertical_03_04": "\u1F07C", + "/dominovertical_03_05": "\u1F07D", + "/dominovertical_03_06": "\u1F07E", + "/dominovertical_04_00": "\u1F07F", + "/dominovertical_04_01": "\u1F080", + "/dominovertical_04_02": "\u1F081", + "/dominovertical_04_03": "\u1F082", + "/dominovertical_04_04": "\u1F083", + "/dominovertical_04_05": "\u1F084", + "/dominovertical_04_06": "\u1F085", + "/dominovertical_05_00": "\u1F086", + "/dominovertical_05_01": "\u1F087", + "/dominovertical_05_02": "\u1F088", + "/dominovertical_05_03": "\u1F089", + "/dominovertical_05_04": "\u1F08A", + "/dominovertical_05_05": "\u1F08B", + "/dominovertical_05_06": "\u1F08C", + "/dominovertical_06_00": "\u1F08D", + "/dominovertical_06_01": "\u1F08E", + "/dominovertical_06_02": "\u1F08F", + "/dominovertical_06_03": "\u1F090", + "/dominovertical_06_04": "\u1F091", + "/dominovertical_06_05": "\u1F092", + "/dominovertical_06_06": "\u1F093", + "/dominoverticalback": "\u1F062", + "/dong": "\u20AB", + "/door": "\u1F6AA", + "/dorusquare": "\u3326", + "/dot": "\u27D1", + "/dotaccent": "\u02D9", + "/dotaccentcmb": "\u0307", + "/dotbelowcmb": "\u0323", + "/dotbelowcomb": "\u0323", + "/dotkatakana": "\u30FB", + "/dotlessbeh": "\u066E", + "/dotlessfeh": "\u06A1", + "/dotlessi": "\u0131", + "/dotlessj": "\uF6BE", + "/dotlessjstroke": "\u025F", + "/dotlessjstrokehook": "\u0284", + "/dotlesskhahabove": "\u06E1", + "/dotlessqaf": "\u066F", + "/dotlower:hb": "\u05C5", + "/dotmath": "\u22C5", + "/dotminus": "\u2238", + "/dotplus": "\u2214", + "/dotraised": "\u2E33", + "/dots1": "\u2801", + "/dots12": "\u2803", + "/dots123": "\u2807", + "/dots1234": "\u280F", + "/dots12345": "\u281F", + "/dots123456": "\u283F", + "/dots1234567": "\u287F", + "/dots12345678": "\u28FF", + "/dots1234568": "\u28BF", + "/dots123457": "\u285F", + "/dots1234578": "\u28DF", + "/dots123458": "\u289F", + "/dots12346": "\u282F", + "/dots123467": "\u286F", + "/dots1234678": "\u28EF", + "/dots123468": "\u28AF", + "/dots12347": "\u284F", + "/dots123478": "\u28CF", + "/dots12348": "\u288F", + "/dots1235": "\u2817", + "/dots12356": "\u2837", + "/dots123567": "\u2877", + "/dots1235678": "\u28F7", + "/dots123568": "\u28B7", + "/dots12357": "\u2857", + "/dots123578": "\u28D7", + "/dots12358": "\u2897", + "/dots1236": "\u2827", + "/dots12367": "\u2867", + "/dots123678": "\u28E7", + "/dots12368": "\u28A7", + "/dots1237": "\u2847", + "/dots12378": "\u28C7", + "/dots1238": "\u2887", + "/dots124": "\u280B", + "/dots1245": "\u281B", + "/dots12456": "\u283B", + "/dots124567": "\u287B", + "/dots1245678": "\u28FB", + "/dots124568": "\u28BB", + "/dots12457": "\u285B", + "/dots124578": "\u28DB", + "/dots12458": "\u289B", + "/dots1246": "\u282B", + "/dots12467": "\u286B", + "/dots124678": "\u28EB", + "/dots12468": "\u28AB", + "/dots1247": "\u284B", + "/dots12478": "\u28CB", + "/dots1248": "\u288B", + "/dots125": "\u2813", + "/dots1256": "\u2833", + "/dots12567": "\u2873", + "/dots125678": "\u28F3", + "/dots12568": "\u28B3", + "/dots1257": "\u2853", + "/dots12578": "\u28D3", + "/dots1258": "\u2893", + "/dots126": "\u2823", + "/dots1267": "\u2863", + "/dots12678": "\u28E3", + "/dots1268": "\u28A3", + "/dots127": "\u2843", + "/dots1278": "\u28C3", + "/dots128": "\u2883", + "/dots13": "\u2805", + "/dots134": "\u280D", + "/dots1345": "\u281D", + "/dots13456": "\u283D", + "/dots134567": "\u287D", + "/dots1345678": "\u28FD", + "/dots134568": "\u28BD", + "/dots13457": "\u285D", + "/dots134578": "\u28DD", + "/dots13458": "\u289D", + "/dots1346": "\u282D", + "/dots13467": "\u286D", + "/dots134678": "\u28ED", + "/dots13468": "\u28AD", + "/dots1347": "\u284D", + "/dots13478": "\u28CD", + "/dots1348": "\u288D", + "/dots135": "\u2815", + "/dots1356": "\u2835", + "/dots13567": "\u2875", + "/dots135678": "\u28F5", + "/dots13568": "\u28B5", + "/dots1357": "\u2855", + "/dots13578": "\u28D5", + "/dots1358": "\u2895", + "/dots136": "\u2825", + "/dots1367": "\u2865", + "/dots13678": "\u28E5", + "/dots1368": "\u28A5", + "/dots137": "\u2845", + "/dots1378": "\u28C5", + "/dots138": "\u2885", + "/dots14": "\u2809", + "/dots145": "\u2819", + "/dots1456": "\u2839", + "/dots14567": "\u2879", + "/dots145678": "\u28F9", + "/dots14568": "\u28B9", + "/dots1457": "\u2859", + "/dots14578": "\u28D9", + "/dots1458": "\u2899", + "/dots146": "\u2829", + "/dots1467": "\u2869", + "/dots14678": "\u28E9", + "/dots1468": "\u28A9", + "/dots147": "\u2849", + "/dots1478": "\u28C9", + "/dots148": "\u2889", + "/dots15": "\u2811", + "/dots156": "\u2831", + "/dots1567": "\u2871", + "/dots15678": "\u28F1", + "/dots1568": "\u28B1", + "/dots157": "\u2851", + "/dots1578": "\u28D1", + "/dots158": "\u2891", + "/dots16": "\u2821", + "/dots167": "\u2861", + "/dots1678": "\u28E1", + "/dots168": "\u28A1", + "/dots17": "\u2841", + "/dots178": "\u28C1", + "/dots18": "\u2881", + "/dots2": "\u2802", + "/dots23": "\u2806", + "/dots234": "\u280E", + "/dots2345": "\u281E", + "/dots23456": "\u283E", + "/dots234567": "\u287E", + "/dots2345678": "\u28FE", + "/dots234568": "\u28BE", + "/dots23457": "\u285E", + "/dots234578": "\u28DE", + "/dots23458": "\u289E", + "/dots2346": "\u282E", + "/dots23467": "\u286E", + "/dots234678": "\u28EE", + "/dots23468": "\u28AE", + "/dots2347": "\u284E", + "/dots23478": "\u28CE", + "/dots2348": "\u288E", + "/dots235": "\u2816", + "/dots2356": "\u2836", + "/dots23567": "\u2876", + "/dots235678": "\u28F6", + "/dots23568": "\u28B6", + "/dots2357": "\u2856", + "/dots23578": "\u28D6", + "/dots2358": "\u2896", + "/dots236": "\u2826", + "/dots2367": "\u2866", + "/dots23678": "\u28E6", + "/dots2368": "\u28A6", + "/dots237": "\u2846", + "/dots2378": "\u28C6", + "/dots238": "\u2886", + "/dots24": "\u280A", + "/dots245": "\u281A", + "/dots2456": "\u283A", + "/dots24567": "\u287A", + "/dots245678": "\u28FA", + "/dots24568": "\u28BA", + "/dots2457": "\u285A", + "/dots24578": "\u28DA", + "/dots2458": "\u289A", + "/dots246": "\u282A", + "/dots2467": "\u286A", + "/dots24678": "\u28EA", + "/dots2468": "\u28AA", + "/dots247": "\u284A", + "/dots2478": "\u28CA", + "/dots248": "\u288A", + "/dots25": "\u2812", + "/dots256": "\u2832", + "/dots2567": "\u2872", + "/dots25678": "\u28F2", + "/dots2568": "\u28B2", + "/dots257": "\u2852", + "/dots2578": "\u28D2", + "/dots258": "\u2892", + "/dots26": "\u2822", + "/dots267": "\u2862", + "/dots2678": "\u28E2", + "/dots268": "\u28A2", + "/dots27": "\u2842", + "/dots278": "\u28C2", + "/dots28": "\u2882", + "/dots3": "\u2804", + "/dots34": "\u280C", + "/dots345": "\u281C", + "/dots3456": "\u283C", + "/dots34567": "\u287C", + "/dots345678": "\u28FC", + "/dots34568": "\u28BC", + "/dots3457": "\u285C", + "/dots34578": "\u28DC", + "/dots3458": "\u289C", + "/dots346": "\u282C", + "/dots3467": "\u286C", + "/dots34678": "\u28EC", + "/dots3468": "\u28AC", + "/dots347": "\u284C", + "/dots3478": "\u28CC", + "/dots348": "\u288C", + "/dots35": "\u2814", + "/dots356": "\u2834", + "/dots3567": "\u2874", + "/dots35678": "\u28F4", + "/dots3568": "\u28B4", + "/dots357": "\u2854", + "/dots3578": "\u28D4", + "/dots358": "\u2894", + "/dots36": "\u2824", + "/dots367": "\u2864", + "/dots3678": "\u28E4", + "/dots368": "\u28A4", + "/dots37": "\u2844", + "/dots378": "\u28C4", + "/dots38": "\u2884", + "/dots4": "\u2808", + "/dots45": "\u2818", + "/dots456": "\u2838", + "/dots4567": "\u2878", + "/dots45678": "\u28F8", + "/dots4568": "\u28B8", + "/dots457": "\u2858", + "/dots4578": "\u28D8", + "/dots458": "\u2898", + "/dots46": "\u2828", + "/dots467": "\u2868", + "/dots4678": "\u28E8", + "/dots468": "\u28A8", + "/dots47": "\u2848", + "/dots478": "\u28C8", + "/dots48": "\u2888", + "/dots5": "\u2810", + "/dots56": "\u2830", + "/dots567": "\u2870", + "/dots5678": "\u28F0", + "/dots568": "\u28B0", + "/dots57": "\u2850", + "/dots578": "\u28D0", + "/dots58": "\u2890", + "/dots6": "\u2820", + "/dots67": "\u2860", + "/dots678": "\u28E0", + "/dots68": "\u28A0", + "/dots7": "\u2840", + "/dots78": "\u28C0", + "/dots8": "\u2880", + "/dotsquarefour": "\u2E2C", + "/dottedcircle": "\u25CC", + "/dottedcross": "\u205C", + "/dotupper:hb": "\u05C4", + "/doublebarvertical": "\u23F8", + "/doubleyodpatah": "\uFB1F", + "/doubleyodpatahhebrew": "\uFB1F", + "/doughnut": "\u1F369", + "/doveOfPeace": "\u1F54A", + "/downtackbelowcmb": "\u031E", + "/downtackmod": "\u02D5", + "/downwarrowleftofuparrow": "\u21F5", + "/dparen": "\u249F", + "/dparenthesized": "\u249F", + "/drachma": "\u20AF", + "/dragon": "\u1F409", + "/dragonFace": "\u1F432", + "/draughtskingblack": "\u26C3", + "/draughtskingwhite": "\u26C1", + "/draughtsmanblack": "\u26C2", + "/draughtsmanwhite": "\u26C0", + "/dress": "\u1F457", + "/driveslow": "\u26DA", + "/dromedaryCamel": "\u1F42A", + "/droplet": "\u1F4A7", + "/dsquare": "\u1F1A5", + "/dsuperior": "\uF6EB", + "/dtail": "\u0256", + "/dtopbar": "\u018C", + "/duhiragana": "\u3065", + "/dukatakana": "\u30C5", + "/dul": "\u068E", + "/dul.fina": "\uFB87", + "/dul.isol": "\uFB86", + "/dum": "\uA771", + "/dvd": "\u1F4C0", + "/dyeh": "\u0684", + "/dyeh.fina": "\uFB73", + "/dyeh.init": "\uFB74", + "/dyeh.isol": "\uFB72", + "/dyeh.medi": "\uFB75", + "/dz": "\u01F3", + "/dzaltone": "\u02A3", + "/dzcaron": "\u01C6", + "/dzcurl": "\u02A5", + "/dzeabkhasiancyrillic": "\u04E1", + "/dzeabkhcyr": "\u04E1", + "/dzecyr": "\u0455", + "/dzecyrillic": "\u0455", + "/dzed": "\u02A3", + "/dzedcurl": "\u02A5", + "/dzhecyr": "\u045F", + "/dzhecyrillic": "\u045F", + "/dzjekomicyr": "\u0507", + "/dzzhecyr": "\u052B", + "/e": "\u0065", + "/e-mail": "\u1F4E7", + "/e.fina": "\uFBE5", + "/e.inferior": "\u2091", + "/e.init": "\uFBE6", + "/e.isol": "\uFBE4", + "/e.medi": "\uFBE7", + "/eVfullwidth": "\u32CE", + "/eacute": "\u00E9", + "/earOfMaize": "\u1F33D", + "/earOfRice": "\u1F33E", + "/earth": "\u2641", + "/earthGlobeAmericas": "\u1F30E", + "/earthGlobeAsiaAustralia": "\u1F30F", + "/earthGlobeEuropeAfrica": "\u1F30D", + "/earthground": "\u23DA", + "/earthideographiccircled": "\u328F", + "/earthideographicparen": "\u322F", + "/eastsyriaccross": "\u2671", + "/ebengali": "\u098F", + "/ebopomofo": "\u311C", + "/ebreve": "\u0115", + "/ecandradeva": "\u090D", + "/ecandragujarati": "\u0A8D", + "/ecandravowelsigndeva": "\u0945", + "/ecandravowelsigngujarati": "\u0AC5", + "/ecaron": "\u011B", + "/ecedilla": "\u0229", + "/ecedillabreve": "\u1E1D", + "/echarmenian": "\u0565", + "/echyiwnarmenian": "\u0587", + "/ecircle": "\u24D4", + "/ecirclekatakana": "\u32D3", + "/ecircumflex": "\u00EA", + "/ecircumflexacute": "\u1EBF", + "/ecircumflexbelow": "\u1E19", + "/ecircumflexdotbelow": "\u1EC7", + "/ecircumflexgrave": "\u1EC1", + "/ecircumflexhoi": "\u1EC3", + "/ecircumflexhookabove": "\u1EC3", + "/ecircumflextilde": "\u1EC5", + "/ecyrillic": "\u0454", + "/edblgrave": "\u0205", + "/edblstruckitalic": "\u2147", + "/edeva": "\u090F", + "/edieresis": "\u00EB", + "/edot": "\u0117", + "/edotaccent": "\u0117", + "/edotbelow": "\u1EB9", + "/eegurmukhi": "\u0A0F", + "/eekaasquare": "\u3308", + "/eematragurmukhi": "\u0A47", + "/efcyr": "\u0444", + "/efcyrillic": "\u0444", + "/egrave": "\u00E8", + "/egravedbl": "\u0205", + "/egujarati": "\u0A8F", + "/egyptain": "\uA725", + "/egyptalef": "\uA723", + "/eharmenian": "\u0567", + "/ehbopomofo": "\u311D", + "/ehiragana": "\u3048", + "/ehoi": "\u1EBB", + "/ehookabove": "\u1EBB", + "/eibopomofo": "\u311F", + "/eight": "\u0038", + "/eight.inferior": "\u2088", + "/eight.roman": "\u2167", + "/eight.romansmall": "\u2177", + "/eight.superior": "\u2078", + "/eightarabic": "\u0668", + "/eightbengali": "\u09EE", + "/eightcircle": "\u2467", + "/eightcircledbl": "\u24FC", + "/eightcircleinversesansserif": "\u2791", + "/eightcomma": "\u1F109", + "/eightdeva": "\u096E", + "/eighteencircle": "\u2471", + "/eighteencircleblack": "\u24F2", + "/eighteenparen": "\u2485", + "/eighteenparenthesized": "\u2485", + "/eighteenperiod": "\u2499", + "/eightfar": "\u06F8", + "/eightgujarati": "\u0AEE", + "/eightgurmukhi": "\u0A6E", + "/eighthackarabic": "\u0668", + "/eighthangzhou": "\u3028", + "/eighthnote": "\u266A", + "/eighthnotebeamed": "\u266B", + "/eightideographiccircled": "\u3287", + "/eightideographicparen": "\u3227", + "/eightinferior": "\u2088", + "/eightksquare": "\u1F19F", + "/eightmonospace": "\uFF18", + "/eightoldstyle": "\uF738", + "/eightparen": "\u247B", + "/eightparenthesized": "\u247B", + "/eightperiod": "\u248F", + "/eightpersian": "\u06F8", + "/eightroman": "\u2177", + "/eightsuperior": "\u2078", + "/eightthai": "\u0E58", + "/eightycirclesquare": "\u324F", + "/einvertedbreve": "\u0207", + "/eiotifiedcyr": "\u0465", + "/eiotifiedcyrillic": "\u0465", + "/eject": "\u23CF", + "/ekatakana": "\u30A8", + "/ekatakanahalfwidth": "\uFF74", + "/ekonkargurmukhi": "\u0A74", + "/ekorean": "\u3154", + "/elcyr": "\u043B", + "/elcyrillic": "\u043B", + "/electricLightBulb": "\u1F4A1", + "/electricPlug": "\u1F50C", + "/electricTorch": "\u1F526", + "/electricalintersection": "\u23E7", + "/electricarrow": "\u2301", + "/element": "\u2208", + "/elementdotabove": "\u22F5", + "/elementlonghorizontalstroke": "\u22F2", + "/elementopeningup": "\u27D2", + "/elementoverbar": "\u22F6", + "/elementoverbarsmall": "\u22F7", + "/elementsmall": "\u220A", + "/elementsmallverticalbarhorizontalstroke": "\u22F4", + "/elementtwoshorizontalstroke": "\u22F9", + "/elementunderbar": "\u22F8", + "/elementverticalbarhorizontalstroke": "\u22F3", + "/elephant": "\u1F418", + "/eleven.roman": "\u216A", + "/eleven.romansmall": "\u217A", + "/elevencircle": "\u246A", + "/elevencircleblack": "\u24EB", + "/elevenparen": "\u247E", + "/elevenparenthesized": "\u247E", + "/elevenperiod": "\u2492", + "/elevenroman": "\u217A", + "/elhookcyr": "\u0513", + "/ellipsis": "\u2026", + "/ellipsisdiagonaldownright": "\u22F1", + "/ellipsisdiagonalupright": "\u22F0", + "/ellipsismidhorizontal": "\u22EF", + "/ellipsisvertical": "\u22EE", + "/elmiddlehookcyr": "\u0521", + "/elsharptailcyr": "\u04C6", + "/eltailcyr": "\u052F", + "/emacron": "\u0113", + "/emacronacute": "\u1E17", + "/emacrongrave": "\u1E15", + "/emcyr": "\u043C", + "/emcyrillic": "\u043C", + "/emdash": "\u2014", + "/emdashdbl": "\u2E3A", + "/emdashtpl": "\u2E3B", + "/emdashvertical": "\uFE31", + "/emojiModifierFitzpatrickType-1-2": "\u1F3FB", + "/emojiModifierFitzpatrickType-3": "\u1F3FC", + "/emojiModifierFitzpatrickType-4": "\u1F3FD", + "/emojiModifierFitzpatrickType-5": "\u1F3FE", + "/emojiModifierFitzpatrickType-6": "\u1F3FF", + "/emonospace": "\uFF45", + "/emphasis": "\u2383", + "/emphasismarkarmenian": "\u055B", + "/emptyDocument": "\u1F5CB", + "/emptyNote": "\u1F5C5", + "/emptyNotePad": "\u1F5C7", + "/emptyNotePage": "\u1F5C6", + "/emptyPage": "\u1F5CC", + "/emptyPages": "\u1F5CD", + "/emptyset": "\u2205", + "/emquad": "\u2001", + "/emsharptailcyr": "\u04CE", + "/emspace": "\u2003", + "/enbopomofo": "\u3123", + "/encyr": "\u043D", + "/encyrillic": "\u043D", + "/endLeftwardsArrowAbove": "\u1F51A", + "/endash": "\u2013", + "/endashvertical": "\uFE32", + "/endescendercyrillic": "\u04A3", + "/endpro": "\u220E", + "/eng": "\u014B", + "/engbopomofo": "\u3125", + "/engecyr": "\u04A5", + "/enghecyrillic": "\u04A5", + "/enhookcyr": "\u04C8", + "/enhookcyrillic": "\u04C8", + "/enhookleftcyr": "\u0529", + "/enmiddlehookcyr": "\u0523", + "/enotch": "\u2C78", + "/enquad": "\u2000", + "/ensharptailcyr": "\u04CA", + "/enspace": "\u2002", + "/entailcyr": "\u04A3", + "/enter": "\u2386", + "/enterpriseideographiccircled": "\u32AD", + "/enterpriseideographicparen": "\u323D", + "/envelopeDownwardsArrowAbove": "\u1F4E9", + "/envelopeLightning": "\u1F584", + "/eogonek": "\u0119", + "/eokorean": "\u3153", + "/eopen": "\u025B", + "/eopenclosed": "\u029A", + "/eopenreversed": "\u025C", + "/eopenreversedclosed": "\u025E", + "/eopenreversedhook": "\u025D", + "/eparen": "\u24A0", + "/eparenthesized": "\u24A0", + "/epsilon": "\u03B5", + "/epsilonacute": "\u1F73", + "/epsilonasper": "\u1F11", + "/epsilonasperacute": "\u1F15", + "/epsilonaspergrave": "\u1F13", + "/epsilongrave": "\u1F72", + "/epsilonlenis": "\u1F10", + "/epsilonlenisacute": "\u1F14", + "/epsilonlenisgrave": "\u1F12", + "/epsilonlunatesymbol": "\u03F5", + "/epsilonreversedlunatesymbol": "\u03F6", + "/epsilontonos": "\u03AD", + "/epsilonunderlinefunc": "\u2377", + "/equal": "\u003D", + "/equal.inferior": "\u208C", + "/equal.superior": "\u207C", + "/equalandparallel": "\u22D5", + "/equalbydefinition": "\u225D", + "/equalmonospace": "\uFF1D", + "/equalorgreater": "\u22DD", + "/equalorless": "\u22DC", + "/equalorprecedes": "\u22DE", + "/equalorsucceeds": "\u22DF", + "/equalscolon": "\u2255", + "/equalsmall": "\uFE66", + "/equalsuperior": "\u207C", + "/equiangular": "\u225A", + "/equivalence": "\u2261", + "/equivalent": "\u224D", + "/eranameheiseisquare": "\u337B", + "/eranamemeizisquare": "\u337E", + "/eranamesyouwasquare": "\u337C", + "/eranametaisyousquare": "\u337D", + "/eraseleft": "\u232B", + "/eraseright": "\u2326", + "/erbopomofo": "\u3126", + "/ercyr": "\u0440", + "/ercyrillic": "\u0440", + "/ereversed": "\u0258", + "/ereversedcyr": "\u044D", + "/ereversedcyrillic": "\u044D", + "/ereverseddieresiscyr": "\u04ED", + "/ergfullwidth": "\u32CD", + "/ertickcyr": "\u048F", + "/escript": "\u212F", + "/escyr": "\u0441", + "/escyrillic": "\u0441", + "/esdescendercyrillic": "\u04AB", + "/esh": "\u0283", + "/eshcurl": "\u0286", + "/eshortdeva": "\u090E", + "/eshortvowelsigndeva": "\u0946", + "/eshreversedloop": "\u01AA", + "/eshsquatreversed": "\u0285", + "/esmallhiragana": "\u3047", + "/esmallkatakana": "\u30A7", + "/esmallkatakanahalfwidth": "\uFF6A", + "/estailcyr": "\u04AB", + "/estimated": "\u212E", + "/estimates": "\u2259", + "/estroke": "\u0247", + "/esukuudosquare": "\u3307", + "/esuperior": "\uF6EC", + "/et": "\uA76B", + "/eta": "\u03B7", + "/etaacute": "\u1F75", + "/etaacuteiotasub": "\u1FC4", + "/etaasper": "\u1F21", + "/etaasperacute": "\u1F25", + "/etaasperacuteiotasub": "\u1F95", + "/etaaspergrave": "\u1F23", + "/etaaspergraveiotasub": "\u1F93", + "/etaasperiotasub": "\u1F91", + "/etaaspertilde": "\u1F27", + "/etaaspertildeiotasub": "\u1F97", + "/etagrave": "\u1F74", + "/etagraveiotasub": "\u1FC2", + "/etaiotasub": "\u1FC3", + "/etalenis": "\u1F20", + "/etalenisacute": "\u1F24", + "/etalenisacuteiotasub": "\u1F94", + "/etalenisgrave": "\u1F22", + "/etalenisgraveiotasub": "\u1F92", + "/etalenisiotasub": "\u1F90", + "/etalenistilde": "\u1F26", + "/etalenistildeiotasub": "\u1F96", + "/etarmenian": "\u0568", + "/etatilde": "\u1FC6", + "/etatildeiotasub": "\u1FC7", + "/etatonos": "\u03AE", + "/eth": "\u00F0", + "/ethi:aaglottal": "\u12A3", + "/ethi:aglottal": "\u12A0", + "/ethi:ba": "\u1260", + "/ethi:baa": "\u1263", + "/ethi:be": "\u1265", + "/ethi:bee": "\u1264", + "/ethi:bi": "\u1262", + "/ethi:bo": "\u1266", + "/ethi:bu": "\u1261", + "/ethi:bwa": "\u1267", + "/ethi:ca": "\u1278", + "/ethi:caa": "\u127B", + "/ethi:ce": "\u127D", + "/ethi:cee": "\u127C", + "/ethi:cha": "\u1328", + "/ethi:chaa": "\u132B", + "/ethi:che": "\u132D", + "/ethi:chee": "\u132C", + "/ethi:chi": "\u132A", + "/ethi:cho": "\u132E", + "/ethi:chu": "\u1329", + "/ethi:chwa": "\u132F", + "/ethi:ci": "\u127A", + "/ethi:co": "\u127E", + "/ethi:colon": "\u1365", + "/ethi:comma": "\u1363", + "/ethi:cu": "\u1279", + "/ethi:cwa": "\u127F", + "/ethi:da": "\u12F0", + "/ethi:daa": "\u12F3", + "/ethi:dda": "\u12F8", + "/ethi:ddaa": "\u12FB", + "/ethi:dde": "\u12FD", + "/ethi:ddee": "\u12FC", + "/ethi:ddi": "\u12FA", + "/ethi:ddo": "\u12FE", + "/ethi:ddu": "\u12F9", + "/ethi:ddwa": "\u12FF", + "/ethi:de": "\u12F5", + "/ethi:dee": "\u12F4", + "/ethi:di": "\u12F2", + "/ethi:do": "\u12F6", + "/ethi:du": "\u12F1", + "/ethi:dwa": "\u12F7", + "/ethi:eeglottal": "\u12A4", + "/ethi:eglottal": "\u12A5", + "/ethi:eight": "\u1370", + "/ethi:eighty": "\u1379", + "/ethi:fa": "\u1348", + "/ethi:faa": "\u134B", + "/ethi:fe": "\u134D", + "/ethi:fee": "\u134C", + "/ethi:fi": "\u134A", + "/ethi:fifty": "\u1376", + "/ethi:five": "\u136D", + "/ethi:fo": "\u134E", + "/ethi:forty": "\u1375", + "/ethi:four": "\u136C", + "/ethi:fu": "\u1349", + "/ethi:fullstop": "\u1362", + "/ethi:fwa": "\u134F", + "/ethi:fya": "\u135A", + "/ethi:ga": "\u1308", + "/ethi:gaa": "\u130B", + "/ethi:ge": "\u130D", + "/ethi:gee": "\u130C", + "/ethi:geminationandvowellengthmarkcmb": "\u135D", + "/ethi:geminationmarkcmb": "\u135F", + "/ethi:gga": "\u1318", + "/ethi:ggaa": "\u131B", + "/ethi:gge": "\u131D", + "/ethi:ggee": "\u131C", + "/ethi:ggi": "\u131A", + "/ethi:ggo": "\u131E", + "/ethi:ggu": "\u1319", + "/ethi:ggwaa": "\u131F", + "/ethi:gi": "\u130A", + "/ethi:go": "\u130E", + "/ethi:goa": "\u130F", + "/ethi:gu": "\u1309", + "/ethi:gwa": "\u1310", + "/ethi:gwaa": "\u1313", + "/ethi:gwe": "\u1315", + "/ethi:gwee": "\u1314", + "/ethi:gwi": "\u1312", + "/ethi:ha": "\u1200", + "/ethi:haa": "\u1203", + "/ethi:he": "\u1205", + "/ethi:hee": "\u1204", + "/ethi:hha": "\u1210", + "/ethi:hhaa": "\u1213", + "/ethi:hhe": "\u1215", + "/ethi:hhee": "\u1214", + "/ethi:hhi": "\u1212", + "/ethi:hho": "\u1216", + "/ethi:hhu": "\u1211", + "/ethi:hhwa": "\u1217", + "/ethi:hi": "\u1202", + "/ethi:ho": "\u1206", + "/ethi:hoa": "\u1207", + "/ethi:hu": "\u1201", + "/ethi:hundred": "\u137B", + "/ethi:iglottal": "\u12A2", + "/ethi:ja": "\u1300", + "/ethi:jaa": "\u1303", + "/ethi:je": "\u1305", + "/ethi:jee": "\u1304", + "/ethi:ji": "\u1302", + "/ethi:jo": "\u1306", + "/ethi:ju": "\u1301", + "/ethi:jwa": "\u1307", + "/ethi:ka": "\u12A8", + "/ethi:kaa": "\u12AB", + "/ethi:ke": "\u12AD", + "/ethi:kee": "\u12AC", + "/ethi:ki": "\u12AA", + "/ethi:ko": "\u12AE", + "/ethi:koa": "\u12AF", + "/ethi:ku": "\u12A9", + "/ethi:kwa": "\u12B0", + "/ethi:kwaa": "\u12B3", + "/ethi:kwe": "\u12B5", + "/ethi:kwee": "\u12B4", + "/ethi:kwi": "\u12B2", + "/ethi:kxa": "\u12B8", + "/ethi:kxaa": "\u12BB", + "/ethi:kxe": "\u12BD", + "/ethi:kxee": "\u12BC", + "/ethi:kxi": "\u12BA", + "/ethi:kxo": "\u12BE", + "/ethi:kxu": "\u12B9", + "/ethi:kxwa": "\u12C0", + "/ethi:kxwaa": "\u12C3", + "/ethi:kxwe": "\u12C5", + "/ethi:kxwee": "\u12C4", + "/ethi:kxwi": "\u12C2", + "/ethi:la": "\u1208", + "/ethi:laa": "\u120B", + "/ethi:le": "\u120D", + "/ethi:lee": "\u120C", + "/ethi:li": "\u120A", + "/ethi:lo": "\u120E", + "/ethi:lu": "\u1209", + "/ethi:lwa": "\u120F", + "/ethi:ma": "\u1218", + "/ethi:maa": "\u121B", + "/ethi:me": "\u121D", + "/ethi:mee": "\u121C", + "/ethi:mi": "\u121A", + "/ethi:mo": "\u121E", + "/ethi:mu": "\u1219", + "/ethi:mwa": "\u121F", + "/ethi:mya": "\u1359", + "/ethi:na": "\u1290", + "/ethi:naa": "\u1293", + "/ethi:ne": "\u1295", + "/ethi:nee": "\u1294", + "/ethi:ni": "\u1292", + "/ethi:nine": "\u1371", + "/ethi:ninety": "\u137A", + "/ethi:no": "\u1296", + "/ethi:nu": "\u1291", + "/ethi:nwa": "\u1297", + "/ethi:nya": "\u1298", + "/ethi:nyaa": "\u129B", + "/ethi:nye": "\u129D", + "/ethi:nyee": "\u129C", + "/ethi:nyi": "\u129A", + "/ethi:nyo": "\u129E", + "/ethi:nyu": "\u1299", + "/ethi:nywa": "\u129F", + "/ethi:oglottal": "\u12A6", + "/ethi:one": "\u1369", + "/ethi:pa": "\u1350", + "/ethi:paa": "\u1353", + "/ethi:paragraphseparator": "\u1368", + "/ethi:pe": "\u1355", + "/ethi:pee": "\u1354", + "/ethi:pha": "\u1330", + "/ethi:phaa": "\u1333", + "/ethi:pharyngeala": "\u12D0", + "/ethi:pharyngealaa": "\u12D3", + "/ethi:pharyngeale": "\u12D5", + "/ethi:pharyngealee": "\u12D4", + "/ethi:pharyngeali": "\u12D2", + "/ethi:pharyngealo": "\u12D6", + "/ethi:pharyngealu": "\u12D1", + "/ethi:phe": "\u1335", + "/ethi:phee": "\u1334", + "/ethi:phi": "\u1332", + "/ethi:pho": "\u1336", + "/ethi:phu": "\u1331", + "/ethi:phwa": "\u1337", + "/ethi:pi": "\u1352", + "/ethi:po": "\u1356", + "/ethi:prefacecolon": "\u1366", + "/ethi:pu": "\u1351", + "/ethi:pwa": "\u1357", + "/ethi:qa": "\u1240", + "/ethi:qaa": "\u1243", + "/ethi:qe": "\u1245", + "/ethi:qee": "\u1244", + "/ethi:qha": "\u1250", + "/ethi:qhaa": "\u1253", + "/ethi:qhe": "\u1255", + "/ethi:qhee": "\u1254", + "/ethi:qhi": "\u1252", + "/ethi:qho": "\u1256", + "/ethi:qhu": "\u1251", + "/ethi:qhwa": "\u1258", + "/ethi:qhwaa": "\u125B", + "/ethi:qhwe": "\u125D", + "/ethi:qhwee": "\u125C", + "/ethi:qhwi": "\u125A", + "/ethi:qi": "\u1242", + "/ethi:qo": "\u1246", + "/ethi:qoa": "\u1247", + "/ethi:qu": "\u1241", + "/ethi:questionmark": "\u1367", + "/ethi:qwa": "\u1248", + "/ethi:qwaa": "\u124B", + "/ethi:qwe": "\u124D", + "/ethi:qwee": "\u124C", + "/ethi:qwi": "\u124A", + "/ethi:ra": "\u1228", + "/ethi:raa": "\u122B", + "/ethi:re": "\u122D", + "/ethi:ree": "\u122C", + "/ethi:ri": "\u122A", + "/ethi:ro": "\u122E", + "/ethi:ru": "\u1229", + "/ethi:rwa": "\u122F", + "/ethi:rya": "\u1358", + "/ethi:sa": "\u1230", + "/ethi:saa": "\u1233", + "/ethi:se": "\u1235", + "/ethi:sectionmark": "\u1360", + "/ethi:see": "\u1234", + "/ethi:semicolon": "\u1364", + "/ethi:seven": "\u136F", + "/ethi:seventy": "\u1378", + "/ethi:sha": "\u1238", + "/ethi:shaa": "\u123B", + "/ethi:she": "\u123D", + "/ethi:shee": "\u123C", + "/ethi:shi": "\u123A", + "/ethi:sho": "\u123E", + "/ethi:shu": "\u1239", + "/ethi:shwa": "\u123F", + "/ethi:si": "\u1232", + "/ethi:six": "\u136E", + "/ethi:sixty": "\u1377", + "/ethi:so": "\u1236", + "/ethi:su": "\u1231", + "/ethi:swa": "\u1237", + "/ethi:sza": "\u1220", + "/ethi:szaa": "\u1223", + "/ethi:sze": "\u1225", + "/ethi:szee": "\u1224", + "/ethi:szi": "\u1222", + "/ethi:szo": "\u1226", + "/ethi:szu": "\u1221", + "/ethi:szwa": "\u1227", + "/ethi:ta": "\u1270", + "/ethi:taa": "\u1273", + "/ethi:te": "\u1275", + "/ethi:tee": "\u1274", + "/ethi:ten": "\u1372", + "/ethi:tenthousand": "\u137C", + "/ethi:tha": "\u1320", + "/ethi:thaa": "\u1323", + "/ethi:the": "\u1325", + "/ethi:thee": "\u1324", + "/ethi:thi": "\u1322", + "/ethi:thirty": "\u1374", + "/ethi:tho": "\u1326", + "/ethi:three": "\u136B", + "/ethi:thu": "\u1321", + "/ethi:thwa": "\u1327", + "/ethi:ti": "\u1272", + "/ethi:to": "\u1276", + "/ethi:tsa": "\u1338", + "/ethi:tsaa": "\u133B", + "/ethi:tse": "\u133D", + "/ethi:tsee": "\u133C", + "/ethi:tsi": "\u133A", + "/ethi:tso": "\u133E", + "/ethi:tsu": "\u1339", + "/ethi:tswa": "\u133F", + "/ethi:tu": "\u1271", + "/ethi:twa": "\u1277", + "/ethi:twenty": "\u1373", + "/ethi:two": "\u136A", + "/ethi:tza": "\u1340", + "/ethi:tzaa": "\u1343", + "/ethi:tze": "\u1345", + "/ethi:tzee": "\u1344", + "/ethi:tzi": "\u1342", + "/ethi:tzo": "\u1346", + "/ethi:tzoa": "\u1347", + "/ethi:tzu": "\u1341", + "/ethi:uglottal": "\u12A1", + "/ethi:va": "\u1268", + "/ethi:vaa": "\u126B", + "/ethi:ve": "\u126D", + "/ethi:vee": "\u126C", + "/ethi:vi": "\u126A", + "/ethi:vo": "\u126E", + "/ethi:vowellengthmarkcmb": "\u135E", + "/ethi:vu": "\u1269", + "/ethi:vwa": "\u126F", + "/ethi:wa": "\u12C8", + "/ethi:waa": "\u12CB", + "/ethi:waglottal": "\u12A7", + "/ethi:we": "\u12CD", + "/ethi:wee": "\u12CC", + "/ethi:wi": "\u12CA", + "/ethi:wo": "\u12CE", + "/ethi:woa": "\u12CF", + "/ethi:wordspace": "\u1361", + "/ethi:wu": "\u12C9", + "/ethi:xa": "\u1280", + "/ethi:xaa": "\u1283", + "/ethi:xe": "\u1285", + "/ethi:xee": "\u1284", + "/ethi:xi": "\u1282", + "/ethi:xo": "\u1286", + "/ethi:xoa": "\u1287", + "/ethi:xu": "\u1281", + "/ethi:xwa": "\u1288", + "/ethi:xwaa": "\u128B", + "/ethi:xwe": "\u128D", + "/ethi:xwee": "\u128C", + "/ethi:xwi": "\u128A", + "/ethi:ya": "\u12E8", + "/ethi:yaa": "\u12EB", + "/ethi:ye": "\u12ED", + "/ethi:yee": "\u12EC", + "/ethi:yi": "\u12EA", + "/ethi:yo": "\u12EE", + "/ethi:yoa": "\u12EF", + "/ethi:yu": "\u12E9", + "/ethi:za": "\u12D8", + "/ethi:zaa": "\u12DB", + "/ethi:ze": "\u12DD", + "/ethi:zee": "\u12DC", + "/ethi:zha": "\u12E0", + "/ethi:zhaa": "\u12E3", + "/ethi:zhe": "\u12E5", + "/ethi:zhee": "\u12E4", + "/ethi:zhi": "\u12E2", + "/ethi:zho": "\u12E6", + "/ethi:zhu": "\u12E1", + "/ethi:zhwa": "\u12E7", + "/ethi:zi": "\u12DA", + "/ethi:zo": "\u12DE", + "/ethi:zu": "\u12D9", + "/ethi:zwa": "\u12DF", + "/etilde": "\u1EBD", + "/etildebelow": "\u1E1B", + "/etnahta:hb": "\u0591", + "/etnahtafoukhhebrew": "\u0591", + "/etnahtafoukhlefthebrew": "\u0591", + "/etnahtahebrew": "\u0591", + "/etnahtalefthebrew": "\u0591", + "/eturned": "\u01DD", + "/eukorean": "\u3161", + "/eukrcyr": "\u0454", + "/euler": "\u2107", + "/euro": "\u20AC", + "/euroarchaic": "\u20A0", + "/europeanCastle": "\u1F3F0", + "/europeanPostOffice": "\u1F3E4", + "/evergreenTree": "\u1F332", + "/evowelsignbengali": "\u09C7", + "/evowelsigndeva": "\u0947", + "/evowelsigngujarati": "\u0AC7", + "/excellentideographiccircled": "\u329D", + "/excess": "\u2239", + "/exclam": "\u0021", + "/exclamarmenian": "\u055C", + "/exclamationquestion": "\u2049", + "/exclamdbl": "\u203C", + "/exclamdown": "\u00A1", + "/exclamdownsmall": "\uF7A1", + "/exclammonospace": "\uFF01", + "/exclamsmall": "\uF721", + "/existential": "\u2203", + "/expressionlessFace": "\u1F611", + "/extraterrestrialAlien": "\u1F47D", + "/eye": "\u1F441", + "/eyeglasses": "\u1F453", + "/eyes": "\u1F440", + "/ezh": "\u0292", + "/ezhcaron": "\u01EF", + "/ezhcurl": "\u0293", + "/ezhreversed": "\u01B9", + "/ezhtail": "\u01BA", + "/f": "\u0066", + "/f_f": "\uFB00", + "/f_f_i": "\uFB03", + "/f_f_l": "\uFB04", + "/faceMassage": "\u1F486", + "/faceSavouringDeliciousFood": "\u1F60B", + "/faceScreamingInFear": "\u1F631", + "/faceThrowingAKiss": "\u1F618", + "/faceWithColdSweat": "\u1F613", + "/faceWithLookOfTriumph": "\u1F624", + "/faceWithMedicalMask": "\u1F637", + "/faceWithNoGoodGesture": "\u1F645", + "/faceWithOkGesture": "\u1F646", + "/faceWithOpenMouth": "\u1F62E", + "/faceWithOpenMouthAndColdSweat": "\u1F630", + "/faceWithRollingEyes": "\u1F644", + "/faceWithStuckOutTongue": "\u1F61B", + "/faceWithStuckOutTongueAndTightlyClosedEyes": "\u1F61D", + "/faceWithStuckOutTongueAndWinkingEye": "\u1F61C", + "/faceWithTearsOfJoy": "\u1F602", + "/faceWithoutMouth": "\u1F636", + "/facsimile": "\u213B", + "/factory": "\u1F3ED", + "/fadeva": "\u095E", + "/fagurmukhi": "\u0A5E", + "/fahrenheit": "\u2109", + "/fallenLeaf": "\u1F342", + "/fallingdiagonal": "\u27CD", + "/fallingdiagonalincircleinsquareblackwhite": "\u26DE", + "/family": "\u1F46A", + "/farsi": "\u262B", + "/farsiYehDigitFourBelow": "\u0777", + "/farsiYehDigitThreeAbove": "\u0776", + "/farsiYehDigitTwoAbove": "\u0775", + "/fatha": "\u064E", + "/fathaIsol": "\uFE76", + "/fathaMedi": "\uFE77", + "/fathaarabic": "\u064E", + "/fathalowarabic": "\u064E", + "/fathasmall": "\u0618", + "/fathatan": "\u064B", + "/fathatanIsol": "\uFE70", + "/fathatanarabic": "\u064B", + "/fathatwodotsdots": "\u065E", + "/fatherChristmas": "\u1F385", + "/faxIcon": "\u1F5B7", + "/faxMachine": "\u1F4E0", + "/fbopomofo": "\u3108", + "/fcircle": "\u24D5", + "/fdot": "\u1E1F", + "/fdotaccent": "\u1E1F", + "/fearfulFace": "\u1F628", + "/februarytelegraph": "\u32C1", + "/feh.fina": "\uFED2", + "/feh.init": "\uFED3", + "/feh.init_alefmaksura.fina": "\uFC31", + "/feh.init_hah.fina": "\uFC2E", + "/feh.init_hah.medi": "\uFCBF", + "/feh.init_jeem.fina": "\uFC2D", + "/feh.init_jeem.medi": "\uFCBE", + "/feh.init_khah.fina": "\uFC2F", + "/feh.init_khah.medi": "\uFCC0", + "/feh.init_khah.medi_meem.medi": "\uFD7D", + "/feh.init_meem.fina": "\uFC30", + "/feh.init_meem.medi": "\uFCC1", + "/feh.init_yeh.fina": "\uFC32", + "/feh.isol": "\uFED1", + "/feh.medi": "\uFED4", + "/feh.medi_alefmaksura.fina": "\uFC7C", + "/feh.medi_khah.medi_meem.fina": "\uFD7C", + "/feh.medi_meem.medi_yeh.fina": "\uFDC1", + "/feh.medi_yeh.fina": "\uFC7D", + "/fehThreeDotsUpBelow": "\u0761", + "/fehTwoDotsBelow": "\u0760", + "/feharabic": "\u0641", + "/feharmenian": "\u0586", + "/fehdotbelow": "\u06A3", + "/fehdotbelowright": "\u06A2", + "/fehfinalarabic": "\uFED2", + "/fehinitialarabic": "\uFED3", + "/fehmedialarabic": "\uFED4", + "/fehthreedotsbelow": "\u06A5", + "/feicoptic": "\u03E5", + "/female": "\u2640", + "/femaleideographiccircled": "\u329B", + "/feng": "\u02A9", + "/ferrisWheel": "\u1F3A1", + "/ferry": "\u26F4", + "/festivalideographicparen": "\u3240", + "/ff": "\uFB00", + "/ffi": "\uFB03", + "/ffl": "\uFB04", + "/fhook": "\u0192", + "/fi": "\uFB01", # ligature "fi" + "/fieldHockeyStickAndBall": "\u1F3D1", + "/fifteencircle": "\u246E", + "/fifteencircleblack": "\u24EF", + "/fifteenparen": "\u2482", + "/fifteenparenthesized": "\u2482", + "/fifteenperiod": "\u2496", + "/fifty.roman": "\u216C", + "/fifty.romansmall": "\u217C", + "/fiftycircle": "\u32BF", + "/fiftycirclesquare": "\u324C", + "/fiftyearlyform.roman": "\u2186", + "/fiftythousand.roman": "\u2187", + "/figuredash": "\u2012", + "/figurespace": "\u2007", + "/fileCabinet": "\u1F5C4", + "/fileFolder": "\u1F4C1", + "/filledbox": "\u25A0", + "/filledrect": "\u25AC", + "/filledstopabove": "\u06EC", + "/filmFrames": "\u1F39E", + "/filmProjector": "\u1F4FD", + "/finalkaf": "\u05DA", + "/finalkaf:hb": "\u05DA", + "/finalkafdagesh": "\uFB3A", + "/finalkafdageshhebrew": "\uFB3A", + "/finalkafhebrew": "\u05DA", + "/finalkafqamats": "\u05DA", + "/finalkafqamatshebrew": "\u05DA", + "/finalkafsheva": "\u05DA", + "/finalkafshevahebrew": "\u05DA", + "/finalkafwithdagesh:hb": "\uFB3A", + "/finalmem": "\u05DD", + "/finalmem:hb": "\u05DD", + "/finalmemhebrew": "\u05DD", + "/finalmemwide:hb": "\uFB26", + "/finalnun": "\u05DF", + "/finalnun:hb": "\u05DF", + "/finalnunhebrew": "\u05DF", + "/finalpe": "\u05E3", + "/finalpe:hb": "\u05E3", + "/finalpehebrew": "\u05E3", + "/finalpewithdagesh:hb": "\uFB43", + "/finalsigma": "\u03C2", + "/finaltsadi": "\u05E5", + "/finaltsadi:hb": "\u05E5", + "/finaltsadihebrew": "\u05E5", + "/financialideographiccircled": "\u3296", + "/financialideographicparen": "\u3236", + "/finsular": "\uA77C", + "/fire": "\u1F525", + "/fireEngine": "\u1F692", + "/fireideographiccircled": "\u328B", + "/fireideographicparen": "\u322B", + "/fireworkSparkler": "\u1F387", + "/fireworks": "\u1F386", + "/firstQuarterMoon": "\u1F313", + "/firstQuarterMoonFace": "\u1F31B", + "/firstquartermoon": "\u263D", + "/firststrongisolate": "\u2068", + "/firsttonechinese": "\u02C9", + "/fish": "\u1F41F", + "/fishCakeSwirlDesign": "\u1F365", + "/fisheye": "\u25C9", + "/fishingPoleAndFish": "\u1F3A3", + "/fistedHandSign": "\u1F44A", + "/fitacyr": "\u0473", + "/fitacyrillic": "\u0473", + "/five": "\u0035", + "/five.inferior": "\u2085", + "/five.roman": "\u2164", + "/five.romansmall": "\u2174", + "/five.superior": "\u2075", + "/fivearabic": "\u0665", + "/fivebengali": "\u09EB", + "/fivecircle": "\u2464", + "/fivecircledbl": "\u24F9", + "/fivecircleinversesansserif": "\u278E", + "/fivecomma": "\u1F106", + "/fivedeva": "\u096B", + "/fivedot": "\u2E2D", + "/fivedotpunctuation": "\u2059", + "/fiveeighths": "\u215D", + "/fivefar": "\u06F5", + "/fivegujarati": "\u0AEB", + "/fivegurmukhi": "\u0A6B", + "/fivehackarabic": "\u0665", + "/fivehangzhou": "\u3025", + "/fivehundred.roman": "\u216E", + "/fivehundred.romansmall": "\u217E", + "/fiveideographiccircled": "\u3284", + "/fiveideographicparen": "\u3224", + "/fiveinferior": "\u2085", + "/fivemonospace": "\uFF15", + "/fiveoldstyle": "\uF735", + "/fiveparen": "\u2478", + "/fiveparenthesized": "\u2478", + "/fiveperiod": "\u248C", + "/fivepersian": "\u06F5", + "/fivepointedstar": "\u066D", + "/fivepointonesquare": "\u1F1A0", + "/fiveroman": "\u2174", + "/fivesixths": "\u215A", + "/fivesuperior": "\u2075", + "/fivethai": "\u0E55", + "/fivethousand.roman": "\u2181", + "/fl": "\uFB02", + "/flagblack": "\u2691", + "/flaghorizontalmiddlestripeblackwhite": "\u26FF", + "/flaginhole": "\u26F3", + "/flagwhite": "\u2690", + "/flatness": "\u23E5", + "/fleurdelis": "\u269C", + "/flexedBiceps": "\u1F4AA", + "/floorleft": "\u230A", + "/floorright": "\u230B", + "/floppyDisk": "\u1F4BE", + "/floralheartbulletreversedrotated": "\u2619", + "/florin": "\u0192", + "/flower": "\u2698", + "/flowerPlayingCards": "\u1F3B4", + "/flowerpunctuationmark": "\u2055", + "/flushedFace": "\u1F633", + "/flyingEnvelope": "\u1F585", + "/flyingSaucer": "\u1F6F8", + "/fmfullwidth": "\u3399", + "/fmonospace": "\uFF46", + "/fmsquare": "\u3399", + "/fofanthai": "\u0E1F", + "/fofathai": "\u0E1D", + "/fog": "\u1F32B", + "/foggy": "\u1F301", + "/folder": "\u1F5C0", + "/fongmanthai": "\u0E4F", + "/footnote": "\u0602", + "/footprints": "\u1F463", + "/footsquare": "\u23CD", + "/forall": "\u2200", + "/forces": "\u22A9", + "/fork": "\u2442", + "/forkKnife": "\u1F374", + "/forkKnifePlate": "\u1F37D", + "/forsamaritan": "\u214F", + "/fortycircle": "\u32B5", + "/fortycirclesquare": "\u324B", + "/fortyeightcircle": "\u32BD", + "/fortyfivecircle": "\u32BA", + "/fortyfourcircle": "\u32B9", + "/fortyninecircle": "\u32BE", + "/fortyonecircle": "\u32B6", + "/fortysevencircle": "\u32BC", + "/fortysixcircle": "\u32BB", + "/fortythreecircle": "\u32B8", + "/fortytwocircle": "\u32B7", + "/fountain": "\u26F2", + "/four": "\u0034", + "/four.inferior": "\u2084", + "/four.roman": "\u2163", + "/four.romansmall": "\u2173", + "/four.superior": "\u2074", + "/fourLeafClover": "\u1F340", + "/fourarabic": "\u0664", + "/fourbengali": "\u09EA", + "/fourcircle": "\u2463", + "/fourcircledbl": "\u24F8", + "/fourcircleinversesansserif": "\u278D", + "/fourcomma": "\u1F105", + "/fourdeva": "\u096A", + "/fourdotmark": "\u205B", + "/fourdotpunctuation": "\u2058", + "/fourfar": "\u06F4", + "/fourfifths": "\u2158", + "/fourgujarati": "\u0AEA", + "/fourgurmukhi": "\u0A6A", + "/fourhackarabic": "\u0664", + "/fourhangzhou": "\u3024", + "/fourideographiccircled": "\u3283", + "/fourideographicparen": "\u3223", + "/fourinferior": "\u2084", + "/fourksquare": "\u1F19E", + "/fourmonospace": "\uFF14", + "/fournumeratorbengali": "\u09F7", + "/fouroldstyle": "\uF734", + "/fourparen": "\u2477", + "/fourparenthesized": "\u2477", + "/fourperemspace": "\u2005", + "/fourperiod": "\u248B", + "/fourpersian": "\u06F4", + "/fourroman": "\u2173", + "/foursuperior": "\u2074", + "/fourteencircle": "\u246D", + "/fourteencircleblack": "\u24EE", + "/fourteenparen": "\u2481", + "/fourteenparenthesized": "\u2481", + "/fourteenperiod": "\u2495", + "/fourthai": "\u0E54", + "/fourthtonechinese": "\u02CB", + "/fparen": "\u24A1", + "/fparenthesized": "\u24A1", + "/fraction": "\u2044", + "/frameAnX": "\u1F5BE", + "/framePicture": "\u1F5BC", + "/frameTiles": "\u1F5BD", + "/franc": "\u20A3", + "/freesquare": "\u1F193", + "/frenchFries": "\u1F35F", + "/freversedepigraphic": "\uA7FB", + "/friedShrimp": "\u1F364", + "/frogFace": "\u1F438", + "/front-facingBabyChick": "\u1F425", + "/frown": "\u2322", + "/frowningFaceWithOpenMouth": "\u1F626", + "/frowningfacewhite": "\u2639", + "/fstroke": "\uA799", + "/fturned": "\u214E", + "/fuelpump": "\u26FD", + "/fullBlock": "\u2588", + "/fullMoon": "\u1F315", + "/fullMoonFace": "\u1F31D", + "/functionapplication": "\u2061", + "/funeralurn": "\u26B1", + "/fuse": "\u23DB", + "/fwd:A": "\uFF21", + "/fwd:B": "\uFF22", + "/fwd:C": "\uFF23", + "/fwd:D": "\uFF24", + "/fwd:E": "\uFF25", + "/fwd:F": "\uFF26", + "/fwd:G": "\uFF27", + "/fwd:H": "\uFF28", + "/fwd:I": "\uFF29", + "/fwd:J": "\uFF2A", + "/fwd:K": "\uFF2B", + "/fwd:L": "\uFF2C", + "/fwd:M": "\uFF2D", + "/fwd:N": "\uFF2E", + "/fwd:O": "\uFF2F", + "/fwd:P": "\uFF30", + "/fwd:Q": "\uFF31", + "/fwd:R": "\uFF32", + "/fwd:S": "\uFF33", + "/fwd:T": "\uFF34", + "/fwd:U": "\uFF35", + "/fwd:V": "\uFF36", + "/fwd:W": "\uFF37", + "/fwd:X": "\uFF38", + "/fwd:Y": "\uFF39", + "/fwd:Z": "\uFF3A", + "/fwd:a": "\uFF41", + "/fwd:ampersand": "\uFF06", + "/fwd:asciicircum": "\uFF3E", + "/fwd:asciitilde": "\uFF5E", + "/fwd:asterisk": "\uFF0A", + "/fwd:at": "\uFF20", + "/fwd:b": "\uFF42", + "/fwd:backslash": "\uFF3C", + "/fwd:bar": "\uFF5C", + "/fwd:braceleft": "\uFF5B", + "/fwd:braceright": "\uFF5D", + "/fwd:bracketleft": "\uFF3B", + "/fwd:bracketright": "\uFF3D", + "/fwd:brokenbar": "\uFFE4", + "/fwd:c": "\uFF43", + "/fwd:centsign": "\uFFE0", + "/fwd:colon": "\uFF1A", + "/fwd:comma": "\uFF0C", + "/fwd:d": "\uFF44", + "/fwd:dollar": "\uFF04", + "/fwd:e": "\uFF45", + "/fwd:eight": "\uFF18", + "/fwd:equal": "\uFF1D", + "/fwd:exclam": "\uFF01", + "/fwd:f": "\uFF46", + "/fwd:five": "\uFF15", + "/fwd:four": "\uFF14", + "/fwd:g": "\uFF47", + "/fwd:grave": "\uFF40", + "/fwd:greater": "\uFF1E", + "/fwd:h": "\uFF48", + "/fwd:hyphen": "\uFF0D", + "/fwd:i": "\uFF49", + "/fwd:j": "\uFF4A", + "/fwd:k": "\uFF4B", + "/fwd:l": "\uFF4C", + "/fwd:leftwhiteparenthesis": "\uFF5F", + "/fwd:less": "\uFF1C", + "/fwd:m": "\uFF4D", + "/fwd:macron": "\uFFE3", + "/fwd:n": "\uFF4E", + "/fwd:nine": "\uFF19", + "/fwd:notsign": "\uFFE2", + "/fwd:numbersign": "\uFF03", + "/fwd:o": "\uFF4F", + "/fwd:one": "\uFF11", + "/fwd:p": "\uFF50", + "/fwd:parenthesisleft": "\uFF08", + "/fwd:parenthesisright": "\uFF09", + "/fwd:percent": "\uFF05", + "/fwd:period": "\uFF0E", + "/fwd:plus": "\uFF0B", + "/fwd:poundsign": "\uFFE1", + "/fwd:q": "\uFF51", + "/fwd:question": "\uFF1F", + "/fwd:quotedbl": "\uFF02", + "/fwd:quotesingle": "\uFF07", + "/fwd:r": "\uFF52", + "/fwd:rightwhiteparenthesis": "\uFF60", + "/fwd:s": "\uFF53", + "/fwd:semicolon": "\uFF1B", + "/fwd:seven": "\uFF17", + "/fwd:six": "\uFF16", + "/fwd:slash": "\uFF0F", + "/fwd:t": "\uFF54", + "/fwd:three": "\uFF13", + "/fwd:two": "\uFF12", + "/fwd:u": "\uFF55", + "/fwd:underscore": "\uFF3F", + "/fwd:v": "\uFF56", + "/fwd:w": "\uFF57", + "/fwd:wonsign": "\uFFE6", + "/fwd:x": "\uFF58", + "/fwd:y": "\uFF59", + "/fwd:yensign": "\uFFE5", + "/fwd:z": "\uFF5A", + "/fwd:zero": "\uFF10", + "/g": "\u0067", + "/gabengali": "\u0997", + "/gacute": "\u01F5", + "/gadeva": "\u0917", + "/gaf": "\u06AF", + "/gaf.fina": "\uFB93", + "/gaf.init": "\uFB94", + "/gaf.isol": "\uFB92", + "/gaf.medi": "\uFB95", + "/gafarabic": "\u06AF", + "/gaffinalarabic": "\uFB93", + "/gafinitialarabic": "\uFB94", + "/gafmedialarabic": "\uFB95", + "/gafring": "\u06B0", + "/gafthreedotsabove": "\u06B4", + "/gaftwodotsbelow": "\u06B2", + "/gagujarati": "\u0A97", + "/gagurmukhi": "\u0A17", + "/gahiragana": "\u304C", + "/gakatakana": "\u30AC", + "/galsquare": "\u33FF", + "/gameDie": "\u1F3B2", + "/gamma": "\u03B3", + "/gammadblstruck": "\u213D", + "/gammalatinsmall": "\u0263", + "/gammasuperior": "\u02E0", + "/gammasupmod": "\u02E0", + "/gamurda": "\uA993", + "/gangiacoptic": "\u03EB", + "/ganmasquare": "\u330F", + "/garonsquare": "\u330E", + "/gbfullwidth": "\u3387", + "/gbopomofo": "\u310D", + "/gbreve": "\u011F", + "/gcaron": "\u01E7", + "/gcedilla": "\u0123", + "/gcircle": "\u24D6", + "/gcircumflex": "\u011D", + "/gcommaaccent": "\u0123", + "/gdot": "\u0121", + "/gdotaccent": "\u0121", + "/gear": "\u2699", + "/gearhles": "\u26EE", + "/gearouthub": "\u26ED", + "/gecyr": "\u0433", + "/gecyrillic": "\u0433", + "/gehiragana": "\u3052", + "/gehookcyr": "\u0495", + "/gehookstrokecyr": "\u04FB", + "/gekatakana": "\u30B2", + "/gemStone": "\u1F48E", + "/gemini": "\u264A", + "/geometricallyequal": "\u2251", + "/geometricallyequivalent": "\u224E", + "/geometricproportion": "\u223A", + "/geresh:hb": "\u05F3", + "/gereshMuqdam:hb": "\u059D", + "/gereshaccenthebrew": "\u059C", + "/gereshhebrew": "\u05F3", + "/gereshmuqdamhebrew": "\u059D", + "/germandbls": "\u00DF", + "/germanpenny": "\u20B0", + "/gershayim:hb": "\u05F4", + "/gershayimaccenthebrew": "\u059E", + "/gershayimhebrew": "\u05F4", + "/gestrokecyr": "\u0493", + "/getailcyr": "\u04F7", + "/getamark": "\u3013", + "/geupcyr": "\u0491", + "/ghabengali": "\u0998", + "/ghadarmenian": "\u0572", + "/ghadeva": "\u0918", + "/ghagujarati": "\u0A98", + "/ghagurmukhi": "\u0A18", + "/ghain": "\u063A", + "/ghain.fina": "\uFECE", + "/ghain.init": "\uFECF", + "/ghain.init_alefmaksura.fina": "\uFCF9", + "/ghain.init_jeem.fina": "\uFC2B", + "/ghain.init_jeem.medi": "\uFCBC", + "/ghain.init_meem.fina": "\uFC2C", + "/ghain.init_meem.medi": "\uFCBD", + "/ghain.init_yeh.fina": "\uFCFA", + "/ghain.isol": "\uFECD", + "/ghain.medi": "\uFED0", + "/ghain.medi_alefmaksura.fina": "\uFD15", + "/ghain.medi_meem.medi_alefmaksura.fina": "\uFD7B", + "/ghain.medi_meem.medi_meem.fina": "\uFD79", + "/ghain.medi_meem.medi_yeh.fina": "\uFD7A", + "/ghain.medi_yeh.fina": "\uFD16", + "/ghainarabic": "\u063A", + "/ghaindotbelow": "\u06FC", + "/ghainfinalarabic": "\uFECE", + "/ghaininitialarabic": "\uFECF", + "/ghainmedialarabic": "\uFED0", + "/ghemiddlehookcyrillic": "\u0495", + "/ghestrokecyrillic": "\u0493", + "/gheupturncyrillic": "\u0491", + "/ghhadeva": "\u095A", + "/ghhagurmukhi": "\u0A5A", + "/ghook": "\u0260", + "/ghost": "\u1F47B", + "/ghzfullwidth": "\u3393", + "/ghzsquare": "\u3393", + "/gigasquare": "\u3310", + "/gihiragana": "\u304E", + "/gikatakana": "\u30AE", + "/gimarmenian": "\u0563", + "/gimel": "\u05D2", + "/gimel:hb": "\u05D2", + "/gimeldagesh": "\uFB32", + "/gimeldageshhebrew": "\uFB32", + "/gimelhebrew": "\u05D2", + "/gimelwithdagesh:hb": "\uFB32", + "/giniisquare": "\u3311", + "/ginsularturned": "\uA77F", + "/girl": "\u1F467", + "/girls": "\u1F6CA", + "/girudaasquare": "\u3313", + "/gjecyr": "\u0453", + "/gjecyrillic": "\u0453", + "/globeMeridians": "\u1F310", + "/glottalinvertedstroke": "\u01BE", + "/glottalstop": "\u0294", + "/glottalstopinverted": "\u0296", + "/glottalstopmod": "\u02C0", + "/glottalstopreversed": "\u0295", + "/glottalstopreversedmod": "\u02C1", + "/glottalstopreversedsuperior": "\u02E4", + "/glottalstopstroke": "\u02A1", + "/glottalstopstrokereversed": "\u02A2", + "/glottalstopsupreversedmod": "\u02E4", + "/glowingStar": "\u1F31F", + "/gmacron": "\u1E21", + "/gmonospace": "\uFF47", + "/gmtr:diamondblack": "\u25C6", + "/gmtr:diamondwhite": "\u25C7", + "/gnrl:hyphen": "\u2010", + "/goat": "\u1F410", + "/gobliquestroke": "\uA7A1", + "/gohiragana": "\u3054", + "/gokatakana": "\u30B4", + "/golfer": "\u1F3CC", + "/gpafullwidth": "\u33AC", + "/gparen": "\u24A2", + "/gparenthesized": "\u24A2", + "/gpasquare": "\u33AC", + "/gr:acute": "\u1FFD", + "/gr:grave": "\u1FEF", + "/gr:question": "\u037E", + "/gr:tilde": "\u1FC0", + "/gradient": "\u2207", + "/graduationCap": "\u1F393", + "/grapes": "\u1F347", + "/grave": "\u0060", + "/gravebelowcmb": "\u0316", + "/gravecmb": "\u0300", + "/gravecomb": "\u0300", + "/gravedblmiddlemod": "\u02F5", + "/gravedeva": "\u0953", + "/gravelowmod": "\u02CE", + "/gravemiddlemod": "\u02F4", + "/gravemod": "\u02CB", + "/gravemonospace": "\uFF40", + "/gravetonecmb": "\u0340", + "/greater": "\u003E", + "/greaterbutnotequal": "\u2269", + "/greaterbutnotequivalent": "\u22E7", + "/greaterdot": "\u22D7", + "/greaterequal": "\u2265", + "/greaterequalorless": "\u22DB", + "/greatermonospace": "\uFF1E", + "/greaterorequivalent": "\u2273", + "/greaterorless": "\u2277", + "/greateroverequal": "\u2267", + "/greatersmall": "\uFE65", + "/greenApple": "\u1F34F", + "/greenBook": "\u1F4D7", + "/greenHeart": "\u1F49A", + "/grimacingFace": "\u1F62C", + "/grinningCatFaceWithSmilingEyes": "\u1F638", + "/grinningFace": "\u1F600", + "/grinningFaceWithSmilingEyes": "\u1F601", + "/growingHeart": "\u1F497", + "/gscript": "\u0261", + "/gstroke": "\u01E5", + "/guarani": "\u20B2", + "/guardsman": "\u1F482", + "/gueh": "\u06B3", + "/gueh.fina": "\uFB97", + "/gueh.init": "\uFB98", + "/gueh.isol": "\uFB96", + "/gueh.medi": "\uFB99", + "/guhiragana": "\u3050", + "/guillemetleft": "\u00AB", + "/guillemetright": "\u00BB", + "/guillemotleft": "\u00AB", + "/guillemotright": "\u00BB", + "/guilsinglleft": "\u2039", + "/guilsinglright": "\u203A", + "/guitar": "\u1F3B8", + "/gujr:a": "\u0A85", + "/gujr:aa": "\u0A86", + "/gujr:aasign": "\u0ABE", + "/gujr:abbreviation": "\u0AF0", + "/gujr:ai": "\u0A90", + "/gujr:aisign": "\u0AC8", + "/gujr:anusvara": "\u0A82", + "/gujr:au": "\u0A94", + "/gujr:ausign": "\u0ACC", + "/gujr:avagraha": "\u0ABD", + "/gujr:ba": "\u0AAC", + "/gujr:bha": "\u0AAD", + "/gujr:binducandra": "\u0A81", + "/gujr:ca": "\u0A9A", + "/gujr:cha": "\u0A9B", + "/gujr:circlenuktaabove": "\u0AFE", + "/gujr:da": "\u0AA6", + "/gujr:dda": "\u0AA1", + "/gujr:ddha": "\u0AA2", + "/gujr:dha": "\u0AA7", + "/gujr:e": "\u0A8F", + "/gujr:ecandra": "\u0A8D", + "/gujr:eight": "\u0AEE", + "/gujr:esign": "\u0AC7", + "/gujr:esigncandra": "\u0AC5", + "/gujr:five": "\u0AEB", + "/gujr:four": "\u0AEA", + "/gujr:ga": "\u0A97", + "/gujr:gha": "\u0A98", + "/gujr:ha": "\u0AB9", + "/gujr:i": "\u0A87", + "/gujr:ii": "\u0A88", + "/gujr:iisign": "\u0AC0", + "/gujr:isign": "\u0ABF", + "/gujr:ja": "\u0A9C", + "/gujr:jha": "\u0A9D", + "/gujr:ka": "\u0A95", + "/gujr:kha": "\u0A96", + "/gujr:la": "\u0AB2", + "/gujr:lla": "\u0AB3", + "/gujr:llvocal": "\u0AE1", + "/gujr:llvocalsign": "\u0AE3", + "/gujr:lvocal": "\u0A8C", + "/gujr:lvocalsign": "\u0AE2", + "/gujr:ma": "\u0AAE", + "/gujr:maddah": "\u0AFC", + "/gujr:na": "\u0AA8", + "/gujr:nga": "\u0A99", + "/gujr:nine": "\u0AEF", + "/gujr:nna": "\u0AA3", + "/gujr:nukta": "\u0ABC", + "/gujr:nya": "\u0A9E", + "/gujr:o": "\u0A93", + "/gujr:ocandra": "\u0A91", + "/gujr:om": "\u0AD0", + "/gujr:one": "\u0AE7", + "/gujr:osign": "\u0ACB", + "/gujr:osigncandra": "\u0AC9", + "/gujr:pa": "\u0AAA", + "/gujr:pha": "\u0AAB", + "/gujr:ra": "\u0AB0", + "/gujr:rrvocal": "\u0AE0", + "/gujr:rrvocalsign": "\u0AC4", + "/gujr:rupee": "\u0AF1", + "/gujr:rvocal": "\u0A8B", + "/gujr:rvocalsign": "\u0AC3", + "/gujr:sa": "\u0AB8", + "/gujr:seven": "\u0AED", + "/gujr:sha": "\u0AB6", + "/gujr:shadda": "\u0AFB", + "/gujr:six": "\u0AEC", + "/gujr:ssa": "\u0AB7", + "/gujr:sukun": "\u0AFA", + "/gujr:ta": "\u0AA4", + "/gujr:tha": "\u0AA5", + "/gujr:three": "\u0AE9", + "/gujr:three-dotnuktaabove": "\u0AFD", + "/gujr:tta": "\u0A9F", + "/gujr:ttha": "\u0AA0", + "/gujr:two": "\u0AE8", + "/gujr:two-circlenuktaabove": "\u0AFF", + "/gujr:u": "\u0A89", + "/gujr:usign": "\u0AC1", + "/gujr:uu": "\u0A8A", + "/gujr:uusign": "\u0AC2", + "/gujr:va": "\u0AB5", + "/gujr:virama": "\u0ACD", + "/gujr:visarga": "\u0A83", + "/gujr:ya": "\u0AAF", + "/gujr:zero": "\u0AE6", + "/gujr:zha": "\u0AF9", + "/gukatakana": "\u30B0", + "/guramusquare": "\u3318", + "/guramutonsquare": "\u3319", + "/guru:a": "\u0A05", + "/guru:aa": "\u0A06", + "/guru:aasign": "\u0A3E", + "/guru:adakbindisign": "\u0A01", + "/guru:addak": "\u0A71", + "/guru:ai": "\u0A10", + "/guru:aisign": "\u0A48", + "/guru:au": "\u0A14", + "/guru:ausign": "\u0A4C", + "/guru:ba": "\u0A2C", + "/guru:bha": "\u0A2D", + "/guru:bindisign": "\u0A02", + "/guru:ca": "\u0A1A", + "/guru:cha": "\u0A1B", + "/guru:da": "\u0A26", + "/guru:dda": "\u0A21", + "/guru:ddha": "\u0A22", + "/guru:dha": "\u0A27", + "/guru:ee": "\u0A0F", + "/guru:eesign": "\u0A47", + "/guru:eight": "\u0A6E", + "/guru:ekonkar": "\u0A74", + "/guru:fa": "\u0A5E", + "/guru:five": "\u0A6B", + "/guru:four": "\u0A6A", + "/guru:ga": "\u0A17", + "/guru:gha": "\u0A18", + "/guru:ghha": "\u0A5A", + "/guru:ha": "\u0A39", + "/guru:i": "\u0A07", + "/guru:ii": "\u0A08", + "/guru:iisign": "\u0A40", + "/guru:iri": "\u0A72", + "/guru:isign": "\u0A3F", + "/guru:ja": "\u0A1C", + "/guru:jha": "\u0A1D", + "/guru:ka": "\u0A15", + "/guru:kha": "\u0A16", + "/guru:khha": "\u0A59", + "/guru:la": "\u0A32", + "/guru:lla": "\u0A33", + "/guru:ma": "\u0A2E", + "/guru:na": "\u0A28", + "/guru:nga": "\u0A19", + "/guru:nine": "\u0A6F", + "/guru:nna": "\u0A23", + "/guru:nukta": "\u0A3C", + "/guru:nya": "\u0A1E", + "/guru:one": "\u0A67", + "/guru:oo": "\u0A13", + "/guru:oosign": "\u0A4B", + "/guru:pa": "\u0A2A", + "/guru:pha": "\u0A2B", + "/guru:ra": "\u0A30", + "/guru:rra": "\u0A5C", + "/guru:sa": "\u0A38", + "/guru:seven": "\u0A6D", + "/guru:sha": "\u0A36", + "/guru:six": "\u0A6C", + "/guru:ta": "\u0A24", + "/guru:tha": "\u0A25", + "/guru:three": "\u0A69", + "/guru:tippi": "\u0A70", + "/guru:tta": "\u0A1F", + "/guru:ttha": "\u0A20", + "/guru:two": "\u0A68", + "/guru:u": "\u0A09", + "/guru:udaatsign": "\u0A51", + "/guru:ura": "\u0A73", + "/guru:usign": "\u0A41", + "/guru:uu": "\u0A0A", + "/guru:uusign": "\u0A42", + "/guru:va": "\u0A35", + "/guru:virama": "\u0A4D", + "/guru:visarga": "\u0A03", + "/guru:ya": "\u0A2F", + "/guru:yakashsign": "\u0A75", + "/guru:za": "\u0A5B", + "/guru:zero": "\u0A66", + "/gyfullwidth": "\u33C9", + "/gysquare": "\u33C9", + "/h": "\u0068", + "/h.inferior": "\u2095", + "/haabkhasiancyrillic": "\u04A9", + "/haabkhcyr": "\u04A9", + "/haaltonearabic": "\u06C1", + "/habengali": "\u09B9", + "/hacirclekatakana": "\u32E9", + "/hacyr": "\u0445", + "/hadescendercyrillic": "\u04B3", + "/hadeva": "\u0939", + "/hafullwidth": "\u33CA", + "/hagujarati": "\u0AB9", + "/hagurmukhi": "\u0A39", + "/hah": "\u062D", + "/hah.fina": "\uFEA2", + "/hah.init": "\uFEA3", + "/hah.init_alefmaksura.fina": "\uFCFF", + "/hah.init_jeem.fina": "\uFC17", + "/hah.init_jeem.medi": "\uFCA9", + "/hah.init_meem.fina": "\uFC18", + "/hah.init_meem.medi": "\uFCAA", + "/hah.init_yeh.fina": "\uFD00", + "/hah.isol": "\uFEA1", + "/hah.medi": "\uFEA4", + "/hah.medi_alefmaksura.fina": "\uFD1B", + "/hah.medi_jeem.medi_yeh.fina": "\uFDBF", + "/hah.medi_meem.medi_alefmaksura.fina": "\uFD5B", + "/hah.medi_meem.medi_yeh.fina": "\uFD5A", + "/hah.medi_yeh.fina": "\uFD1C", + "/hahDigitFourBelow": "\u077C", + "/hahSmallTahAbove": "\u0772", + "/hahSmallTahBelow": "\u076E", + "/hahSmallTahTwoDots": "\u076F", + "/hahThreeDotsUpBelow": "\u0758", + "/hahTwoDotsAbove": "\u0757", + "/haharabic": "\u062D", + "/hahfinalarabic": "\uFEA2", + "/hahhamza": "\u0681", + "/hahinitialarabic": "\uFEA3", + "/hahiragana": "\u306F", + "/hahmedialarabic": "\uFEA4", + "/hahookcyr": "\u04FD", + "/hahthreedotsabove": "\u0685", + "/hahtwodotsvertical": "\u0682", + "/haircut": "\u1F487", + "/hairspace": "\u200A", + "/haitusquare": "\u332A", + "/hakatakana": "\u30CF", + "/hakatakanahalfwidth": "\uFF8A", + "/halantgurmukhi": "\u0A4D", + "/halfcircleleftblack": "\u25D6", + "/halfcirclerightblack": "\u25D7", + "/hamburger": "\u1F354", + "/hammer": "\u1F528", + "/hammerAndWrench": "\u1F6E0", + "/hammerpick": "\u2692", + "/hammersickle": "\u262D", + "/hamsterFace": "\u1F439", + "/hamza": "\u0621", + "/hamzaIsol": "\uFE80", + "/hamzaabove": "\u0654", + "/hamzaarabic": "\u0621", + "/hamzabelow": "\u0655", + "/hamzadammaarabic": "\u0621", + "/hamzadammatanarabic": "\u0621", + "/hamzafathaarabic": "\u0621", + "/hamzafathatanarabic": "\u0621", + "/hamzalowarabic": "\u0621", + "/hamzalowkasraarabic": "\u0621", + "/hamzalowkasratanarabic": "\u0621", + "/hamzasukunarabic": "\u0621", + "/handbag": "\u1F45C", + "/handtailfishhookturned": "\u02AF", + "/hangulchieuchaparen": "\u3217", + "/hangulchieuchparen": "\u3209", + "/hangulcieucaparen": "\u3216", + "/hangulcieucparen": "\u3208", + "/hangulcieucuparen": "\u321C", + "/hanguldottonemarkdbl": "\u302F", + "/hangulfiller": "\u3164", + "/hangulhieuhaparen": "\u321B", + "/hangulhieuhparen": "\u320D", + "/hangulieungaparen": "\u3215", + "/hangulieungparen": "\u3207", + "/hangulkhieukhaparen": "\u3218", + "/hangulkhieukhparen": "\u320A", + "/hangulkiyeokaparen": "\u320E", + "/hangulkiyeokparen": "\u3200", + "/hangulmieumaparen": "\u3212", + "/hangulmieumparen": "\u3204", + "/hangulnieunaparen": "\u320F", + "/hangulnieunparen": "\u3201", + "/hangulphieuphaparen": "\u321A", + "/hangulphieuphparen": "\u320C", + "/hangulpieupaparen": "\u3213", + "/hangulpieupparen": "\u3205", + "/hangulrieulaparen": "\u3211", + "/hangulrieulparen": "\u3203", + "/hangulsingledottonemark": "\u302E", + "/hangulsiosaparen": "\u3214", + "/hangulsiosparen": "\u3206", + "/hangulthieuthaparen": "\u3219", + "/hangulthieuthparen": "\u320B", + "/hangultikeutaparen": "\u3210", + "/hangultikeutparen": "\u3202", + "/happyPersonRaisingOneHand": "\u1F64B", + "/hardDisk": "\u1F5B4", + "/hardcyr": "\u044A", + "/hardsigncyrillic": "\u044A", + "/harpoondownbarbleft": "\u21C3", + "/harpoondownbarbright": "\u21C2", + "/harpoonleftbarbdown": "\u21BD", + "/harpoonleftbarbup": "\u21BC", + "/harpoonrightbarbdown": "\u21C1", + "/harpoonrightbarbup": "\u21C0", + "/harpoonupbarbleft": "\u21BF", + "/harpoonupbarbright": "\u21BE", + "/hasquare": "\u33CA", + "/hastrokecyr": "\u04FF", + "/hatafPatah:hb": "\u05B2", + "/hatafQamats:hb": "\u05B3", + "/hatafSegol:hb": "\u05B1", + "/hatafpatah": "\u05B2", + "/hatafpatah16": "\u05B2", + "/hatafpatah23": "\u05B2", + "/hatafpatah2f": "\u05B2", + "/hatafpatahhebrew": "\u05B2", + "/hatafpatahnarrowhebrew": "\u05B2", + "/hatafpatahquarterhebrew": "\u05B2", + "/hatafpatahwidehebrew": "\u05B2", + "/hatafqamats": "\u05B3", + "/hatafqamats1b": "\u05B3", + "/hatafqamats28": "\u05B3", + "/hatafqamats34": "\u05B3", + "/hatafqamatshebrew": "\u05B3", + "/hatafqamatsnarrowhebrew": "\u05B3", + "/hatafqamatsquarterhebrew": "\u05B3", + "/hatafqamatswidehebrew": "\u05B3", + "/hatafsegol": "\u05B1", + "/hatafsegol17": "\u05B1", + "/hatafsegol24": "\u05B1", + "/hatafsegol30": "\u05B1", + "/hatafsegolhebrew": "\u05B1", + "/hatafsegolnarrowhebrew": "\u05B1", + "/hatafsegolquarterhebrew": "\u05B1", + "/hatafsegolwidehebrew": "\u05B1", + "/hatchingChick": "\u1F423", + "/haveideographiccircled": "\u3292", + "/haveideographicparen": "\u3232", + "/hbar": "\u0127", + "/hbopomofo": "\u310F", + "/hbrevebelow": "\u1E2B", + "/hcaron": "\u021F", + "/hcedilla": "\u1E29", + "/hcircle": "\u24D7", + "/hcircumflex": "\u0125", + "/hcsquare": "\u1F1A6", + "/hdescender": "\u2C68", + "/hdieresis": "\u1E27", + "/hdot": "\u1E23", + "/hdotaccent": "\u1E23", + "/hdotbelow": "\u1E25", + "/hdrsquare": "\u1F1A7", + "/he": "\u05D4", + "/he:hb": "\u05D4", + "/headphone": "\u1F3A7", + "/headstonegraveyard": "\u26FC", + "/hearNoEvilMonkey": "\u1F649", + "/heart": "\u2665", + "/heartArrow": "\u1F498", + "/heartDecoration": "\u1F49F", + "/heartRibbon": "\u1F49D", + "/heartTipOnTheLeft": "\u1F394", + "/heartblack": "\u2665", + "/heartsuitblack": "\u2665", + "/heartsuitwhite": "\u2661", + "/heartwhite": "\u2661", + "/heavyDollarSign": "\u1F4B2", + "/heavyLatinCross": "\u1F547", + "/heavydbldashhorz": "\u254D", + "/heavydbldashvert": "\u254F", + "/heavydn": "\u257B", + "/heavydnhorz": "\u2533", + "/heavydnleft": "\u2513", + "/heavydnright": "\u250F", + "/heavyhorz": "\u2501", + "/heavyleft": "\u2578", + "/heavyleftlightright": "\u257E", + "/heavyquaddashhorz": "\u2509", + "/heavyquaddashvert": "\u250B", + "/heavyright": "\u257A", + "/heavytrpldashhorz": "\u2505", + "/heavytrpldashvert": "\u2507", + "/heavyup": "\u2579", + "/heavyuphorz": "\u253B", + "/heavyupleft": "\u251B", + "/heavyuplightdn": "\u257F", + "/heavyupright": "\u2517", + "/heavyvert": "\u2503", + "/heavyverthorz": "\u254B", + "/heavyvertleft": "\u252B", + "/heavyvertright": "\u2523", + "/hecirclekatakana": "\u32EC", + "/hedagesh": "\uFB34", + "/hedageshhebrew": "\uFB34", + "/hedinterlacedpentagramleft": "\u26E6", + "/hedinterlacedpentagramright": "\u26E5", + "/heh": "\u0647", + "/heh.fina": "\uFEEA", + "/heh.init": "\uFEEB", + "/heh.init_alefmaksura.fina": "\uFC53", + "/heh.init_jeem.fina": "\uFC51", + "/heh.init_jeem.medi": "\uFCD7", + "/heh.init_meem.fina": "\uFC52", + "/heh.init_meem.medi": "\uFCD8", + "/heh.init_meem.medi_jeem.medi": "\uFD93", + "/heh.init_meem.medi_meem.medi": "\uFD94", + "/heh.init_superscriptalef.medi": "\uFCD9", + "/heh.init_yeh.fina": "\uFC54", + "/heh.isol": "\uFEE9", + "/heh.medi": "\uFEEC", + "/hehaltonearabic": "\u06C1", + "/heharabic": "\u0647", + "/hehdoachashmee": "\u06BE", + "/hehdoachashmee.fina": "\uFBAB", + "/hehdoachashmee.init": "\uFBAC", + "/hehdoachashmee.isol": "\uFBAA", + "/hehdoachashmee.medi": "\uFBAD", + "/hehebrew": "\u05D4", + "/hehfinalaltonearabic": "\uFBA7", + "/hehfinalalttwoarabic": "\uFEEA", + "/hehfinalarabic": "\uFEEA", + "/hehgoal": "\u06C1", + "/hehgoal.fina": "\uFBA7", + "/hehgoal.init": "\uFBA8", + "/hehgoal.isol": "\uFBA6", + "/hehgoal.medi": "\uFBA9", + "/hehgoalhamza": "\u06C2", + "/hehhamzaabovefinalarabic": "\uFBA5", + "/hehhamzaaboveisolatedarabic": "\uFBA4", + "/hehinitialaltonearabic": "\uFBA8", + "/hehinitialarabic": "\uFEEB", + "/hehinvertedV": "\u06FF", + "/hehiragana": "\u3078", + "/hehmedialaltonearabic": "\uFBA9", + "/hehmedialarabic": "\uFEEC", + "/hehyeh": "\u06C0", + "/hehyeh.fina": "\uFBA5", + "/hehyeh.isol": "\uFBA4", + "/heiseierasquare": "\u337B", + "/hekatakana": "\u30D8", + "/hekatakanahalfwidth": "\uFF8D", + "/hekutaarusquare": "\u3336", + "/helicopter": "\u1F681", + "/helm": "\u2388", + "/helmetcrosswhite": "\u26D1", + "/heng": "\uA727", + "/henghook": "\u0267", + "/herb": "\u1F33F", + "/hermitianconjugatematrix": "\u22B9", + "/herutusquare": "\u3339", + "/het": "\u05D7", + "/het:hb": "\u05D7", + "/heta": "\u0371", + "/hethebrew": "\u05D7", + "/hewide:hb": "\uFB23", + "/hewithmapiq:hb": "\uFB34", + "/hfishhookturned": "\u02AE", + "/hhalf": "\u2C76", + "/hhook": "\u0266", + "/hhooksuperior": "\u02B1", + "/hhooksupmod": "\u02B1", + "/hi-ressquare": "\u1F1A8", + "/hibiscus": "\u1F33A", + "/hicirclekatakana": "\u32EA", + "/hieuhacirclekorean": "\u327B", + "/hieuhaparenkorean": "\u321B", + "/hieuhcirclekorean": "\u326D", + "/hieuhkorean": "\u314E", + "/hieuhparenkorean": "\u320D", + "/high-heeledShoe": "\u1F460", + "/highBrightness": "\u1F506", + "/highSpeedTrain": "\u1F684", + "/highSpeedTrainWithBulletNose": "\u1F685", + "/highhamza": "\u0674", + "/highideographiccircled": "\u32A4", + "/highvoltage": "\u26A1", + "/hihiragana": "\u3072", + "/hikatakana": "\u30D2", + "/hikatakanahalfwidth": "\uFF8B", + "/hira:a": "\u3042", + "/hira:asmall": "\u3041", + "/hira:ba": "\u3070", + "/hira:be": "\u3079", + "/hira:bi": "\u3073", + "/hira:bo": "\u307C", + "/hira:bu": "\u3076", + "/hira:da": "\u3060", + "/hira:de": "\u3067", + "/hira:di": "\u3062", + "/hira:digraphyori": "\u309F", + "/hira:do": "\u3069", + "/hira:du": "\u3065", + "/hira:e": "\u3048", + "/hira:esmall": "\u3047", + "/hira:ga": "\u304C", + "/hira:ge": "\u3052", + "/hira:gi": "\u304E", + "/hira:go": "\u3054", + "/hira:gu": "\u3050", + "/hira:ha": "\u306F", + "/hira:he": "\u3078", + "/hira:hi": "\u3072", + "/hira:ho": "\u307B", + "/hira:hu": "\u3075", + "/hira:i": "\u3044", + "/hira:ismall": "\u3043", + "/hira:iterationhiragana": "\u309D", + "/hira:ka": "\u304B", + "/hira:kasmall": "\u3095", + "/hira:ke": "\u3051", + "/hira:kesmall": "\u3096", + "/hira:ki": "\u304D", + "/hira:ko": "\u3053", + "/hira:ku": "\u304F", + "/hira:ma": "\u307E", + "/hira:me": "\u3081", + "/hira:mi": "\u307F", + "/hira:mo": "\u3082", + "/hira:mu": "\u3080", + "/hira:n": "\u3093", + "/hira:na": "\u306A", + "/hira:ne": "\u306D", + "/hira:ni": "\u306B", + "/hira:no": "\u306E", + "/hira:nu": "\u306C", + "/hira:o": "\u304A", + "/hira:osmall": "\u3049", + "/hira:pa": "\u3071", + "/hira:pe": "\u307A", + "/hira:pi": "\u3074", + "/hira:po": "\u307D", + "/hira:pu": "\u3077", + "/hira:ra": "\u3089", + "/hira:re": "\u308C", + "/hira:ri": "\u308A", + "/hira:ro": "\u308D", + "/hira:ru": "\u308B", + "/hira:sa": "\u3055", + "/hira:se": "\u305B", + "/hira:semivoicedmarkkana": "\u309C", + "/hira:semivoicedmarkkanacmb": "\u309A", + "/hira:si": "\u3057", + "/hira:so": "\u305D", + "/hira:su": "\u3059", + "/hira:ta": "\u305F", + "/hira:te": "\u3066", + "/hira:ti": "\u3061", + "/hira:to": "\u3068", + "/hira:tu": "\u3064", + "/hira:tusmall": "\u3063", + "/hira:u": "\u3046", + "/hira:usmall": "\u3045", + "/hira:voicediterationhiragana": "\u309E", + "/hira:voicedmarkkana": "\u309B", + "/hira:voicedmarkkanacmb": "\u3099", + "/hira:vu": "\u3094", + "/hira:wa": "\u308F", + "/hira:wasmall": "\u308E", + "/hira:we": "\u3091", + "/hira:wi": "\u3090", + "/hira:wo": "\u3092", + "/hira:ya": "\u3084", + "/hira:yasmall": "\u3083", + "/hira:yo": "\u3088", + "/hira:yosmall": "\u3087", + "/hira:yu": "\u3086", + "/hira:yusmall": "\u3085", + "/hira:za": "\u3056", + "/hira:ze": "\u305C", + "/hira:zi": "\u3058", + "/hira:zo": "\u305E", + "/hira:zu": "\u305A", + "/hiriq": "\u05B4", + "/hiriq14": "\u05B4", + "/hiriq21": "\u05B4", + "/hiriq2d": "\u05B4", + "/hiriq:hb": "\u05B4", + "/hiriqhebrew": "\u05B4", + "/hiriqnarrowhebrew": "\u05B4", + "/hiriqquarterhebrew": "\u05B4", + "/hiriqwidehebrew": "\u05B4", + "/historicsite": "\u26EC", + "/hlinebelow": "\u1E96", + "/hmonospace": "\uFF48", + "/hoarmenian": "\u0570", + "/hocho": "\u1F52A", + "/hocirclekatakana": "\u32ED", + "/hohipthai": "\u0E2B", + "/hohiragana": "\u307B", + "/hokatakana": "\u30DB", + "/hokatakanahalfwidth": "\uFF8E", + "/holam": "\u05B9", + "/holam19": "\u05B9", + "/holam26": "\u05B9", + "/holam32": "\u05B9", + "/holam:hb": "\u05B9", + "/holamHaser:hb": "\u05BA", + "/holamhebrew": "\u05B9", + "/holamnarrowhebrew": "\u05B9", + "/holamquarterhebrew": "\u05B9", + "/holamwidehebrew": "\u05B9", + "/hole": "\u1F573", + "/homotic": "\u223B", + "/honeyPot": "\u1F36F", + "/honeybee": "\u1F41D", + "/honokhukthai": "\u0E2E", + "/honsquare": "\u333F", + "/hook": "\u2440", + "/hookabovecomb": "\u0309", + "/hookcmb": "\u0309", + "/hookpalatalizedbelowcmb": "\u0321", + "/hookretroflexbelowcmb": "\u0322", + "/hoonsquare": "\u3342", + "/hoorusquare": "\u3341", + "/horicoptic": "\u03E9", + "/horizontalTrafficLight": "\u1F6A5", + "/horizontalbar": "\u2015", + "/horizontalbarwhitearrowonpedestalup": "\u21EC", + "/horizontalmalestroke": "\u26A9", + "/horncmb": "\u031B", + "/horse": "\u1F40E", + "/horseFace": "\u1F434", + "/horseRacing": "\u1F3C7", + "/hospital": "\u1F3E5", + "/hotDog": "\u1F32D", + "/hotPepper": "\u1F336", + "/hotbeverage": "\u2615", + "/hotel": "\u1F3E8", + "/hotsprings": "\u2668", + "/hourglass": "\u231B", + "/hourglassflowings": "\u23F3", + "/house": "\u2302", + "/houseBuilding": "\u1F3E0", + "/houseBuildings": "\u1F3D8", + "/houseGarden": "\u1F3E1", + "/hpafullwidth": "\u3371", + "/hpalatalhook": "\uA795", + "/hparen": "\u24A3", + "/hparenthesized": "\u24A3", + "/hpfullwidth": "\u33CB", + "/hryvnia": "\u20B4", + "/hsuperior": "\u02B0", + "/hsupmod": "\u02B0", + "/hturned": "\u0265", + "/htypeopencircuit": "\u238F", + "/huaraddosquare": "\u3332", + "/hucirclekatakana": "\u32EB", + "/huhiragana": "\u3075", + "/huiitosquare": "\u3333", + "/hukatakana": "\u30D5", + "/hukatakanahalfwidth": "\uFF8C", + "/hundredPoints": "\u1F4AF", + "/hundredthousandscmbcyr": "\u0488", + "/hungarumlaut": "\u02DD", + "/hungarumlautcmb": "\u030B", + "/huransquare": "\u3335", + "/hushedFace": "\u1F62F", + "/hv": "\u0195", + "/hwd:a": "\uFFC2", + "/hwd:ae": "\uFFC3", + "/hwd:blacksquare": "\uFFED", + "/hwd:chieuch": "\uFFBA", + "/hwd:cieuc": "\uFFB8", + "/hwd:downwardsarrow": "\uFFEC", + "/hwd:e": "\uFFC7", + "/hwd:eo": "\uFFC6", + "/hwd:eu": "\uFFDA", + "/hwd:formslightvertical": "\uFFE8", + "/hwd:hangulfiller": "\uFFA0", + "/hwd:hieuh": "\uFFBE", + "/hwd:i": "\uFFDC", + "/hwd:ideographiccomma": "\uFF64", + "/hwd:ideographicfullstop": "\uFF61", + "/hwd:ieung": "\uFFB7", + "/hwd:kata:a": "\uFF71", + "/hwd:kata:asmall": "\uFF67", + "/hwd:kata:e": "\uFF74", + "/hwd:kata:esmall": "\uFF6A", + "/hwd:kata:ha": "\uFF8A", + "/hwd:kata:he": "\uFF8D", + "/hwd:kata:hi": "\uFF8B", + "/hwd:kata:ho": "\uFF8E", + "/hwd:kata:hu": "\uFF8C", + "/hwd:kata:i": "\uFF72", + "/hwd:kata:ismall": "\uFF68", + "/hwd:kata:ka": "\uFF76", + "/hwd:kata:ke": "\uFF79", + "/hwd:kata:ki": "\uFF77", + "/hwd:kata:ko": "\uFF7A", + "/hwd:kata:ku": "\uFF78", + "/hwd:kata:ma": "\uFF8F", + "/hwd:kata:me": "\uFF92", + "/hwd:kata:mi": "\uFF90", + "/hwd:kata:middledot": "\uFF65", + "/hwd:kata:mo": "\uFF93", + "/hwd:kata:mu": "\uFF91", + "/hwd:kata:n": "\uFF9D", + "/hwd:kata:na": "\uFF85", + "/hwd:kata:ne": "\uFF88", + "/hwd:kata:ni": "\uFF86", + "/hwd:kata:no": "\uFF89", + "/hwd:kata:nu": "\uFF87", + "/hwd:kata:o": "\uFF75", + "/hwd:kata:osmall": "\uFF6B", + "/hwd:kata:prolongedkana": "\uFF70", + "/hwd:kata:ra": "\uFF97", + "/hwd:kata:re": "\uFF9A", + "/hwd:kata:ri": "\uFF98", + "/hwd:kata:ro": "\uFF9B", + "/hwd:kata:ru": "\uFF99", + "/hwd:kata:sa": "\uFF7B", + "/hwd:kata:se": "\uFF7E", + "/hwd:kata:semi-voiced": "\uFF9F", + "/hwd:kata:si": "\uFF7C", + "/hwd:kata:so": "\uFF7F", + "/hwd:kata:su": "\uFF7D", + "/hwd:kata:ta": "\uFF80", + "/hwd:kata:te": "\uFF83", + "/hwd:kata:ti": "\uFF81", + "/hwd:kata:to": "\uFF84", + "/hwd:kata:tu": "\uFF82", + "/hwd:kata:tusmall": "\uFF6F", + "/hwd:kata:u": "\uFF73", + "/hwd:kata:usmall": "\uFF69", + "/hwd:kata:voiced": "\uFF9E", + "/hwd:kata:wa": "\uFF9C", + "/hwd:kata:wo": "\uFF66", + "/hwd:kata:ya": "\uFF94", + "/hwd:kata:yasmall": "\uFF6C", + "/hwd:kata:yo": "\uFF96", + "/hwd:kata:yosmall": "\uFF6E", + "/hwd:kata:yu": "\uFF95", + "/hwd:kata:yusmall": "\uFF6D", + "/hwd:khieukh": "\uFFBB", + "/hwd:kiyeok": "\uFFA1", + "/hwd:kiyeoksios": "\uFFA3", + "/hwd:leftcornerbracket": "\uFF62", + "/hwd:leftwardsarrow": "\uFFE9", + "/hwd:mieum": "\uFFB1", + "/hwd:nieun": "\uFFA4", + "/hwd:nieuncieuc": "\uFFA5", + "/hwd:nieunhieuh": "\uFFA6", + "/hwd:o": "\uFFCC", + "/hwd:oe": "\uFFCF", + "/hwd:phieuph": "\uFFBD", + "/hwd:pieup": "\uFFB2", + "/hwd:pieupsios": "\uFFB4", + "/hwd:rieul": "\uFFA9", + "/hwd:rieulhieuh": "\uFFB0", + "/hwd:rieulkiyeok": "\uFFAA", + "/hwd:rieulmieum": "\uFFAB", + "/hwd:rieulphieuph": "\uFFAF", + "/hwd:rieulpieup": "\uFFAC", + "/hwd:rieulsios": "\uFFAD", + "/hwd:rieulthieuth": "\uFFAE", + "/hwd:rightcornerbracket": "\uFF63", + "/hwd:rightwardsarrow": "\uFFEB", + "/hwd:sios": "\uFFB5", + "/hwd:ssangcieuc": "\uFFB9", + "/hwd:ssangkiyeok": "\uFFA2", + "/hwd:ssangpieup": "\uFFB3", + "/hwd:ssangsios": "\uFFB6", + "/hwd:ssangtikeut": "\uFFA8", + "/hwd:thieuth": "\uFFBC", + "/hwd:tikeut": "\uFFA7", + "/hwd:u": "\uFFD3", + "/hwd:upwardsarrow": "\uFFEA", + "/hwd:wa": "\uFFCD", + "/hwd:wae": "\uFFCE", + "/hwd:we": "\uFFD5", + "/hwd:weo": "\uFFD4", + "/hwd:whitecircle": "\uFFEE", + "/hwd:wi": "\uFFD6", + "/hwd:ya": "\uFFC4", + "/hwd:yae": "\uFFC5", + "/hwd:ye": "\uFFCB", + "/hwd:yeo": "\uFFCA", + "/hwd:yi": "\uFFDB", + "/hwd:yo": "\uFFD2", + "/hwd:yu": "\uFFD7", + "/hyphen": "\u002D", + "/hyphenationpoint": "\u2027", + "/hyphenbullet": "\u2043", + "/hyphendbl": "\u2E40", + "/hyphendbloblique": "\u2E17", + "/hyphendieresis": "\u2E1A", + "/hypheninferior": "\uF6E5", + "/hyphenminus": "\u002D", + "/hyphenmonospace": "\uFF0D", + "/hyphensmall": "\uFE63", + "/hyphensoft": "\u00AD", + "/hyphensuperior": "\uF6E6", + "/hyphentwo": "\u2010", + "/hypodiastole": "\u2E12", + "/hysteresis": "\u238E", + "/hzfullwidth": "\u3390", + "/i": "\u0069", + "/i.superior": "\u2071", + "/iacute": "\u00ED", + "/iacyrillic": "\u044F", + "/iaepigraphic": "\uA7FE", + "/ibengali": "\u0987", + "/ibopomofo": "\u3127", + "/ibreve": "\u012D", + "/icaron": "\u01D0", + "/iceCream": "\u1F368", + "/iceHockeyStickAndPuck": "\u1F3D2", + "/iceskate": "\u26F8", + "/icircle": "\u24D8", + "/icirclekatakana": "\u32D1", + "/icircumflex": "\u00EE", + "/icyr": "\u0438", + "/icyrillic": "\u0456", + "/idblgrave": "\u0209", + "/idblstruckitalic": "\u2148", + "/ideographearthcircle": "\u328F", + "/ideographfirecircle": "\u328B", + "/ideographicallianceparen": "\u323F", + "/ideographiccallparen": "\u323A", + "/ideographiccentrecircle": "\u32A5", + "/ideographicclose": "\u3006", + "/ideographiccomma": "\u3001", + "/ideographiccommaleft": "\uFF64", + "/ideographiccongratulationparen": "\u3237", + "/ideographiccorrectcircle": "\u32A3", + "/ideographicdepartingtonemark": "\u302C", + "/ideographicearthparen": "\u322F", + "/ideographicenteringtonemark": "\u302D", + "/ideographicenterpriseparen": "\u323D", + "/ideographicexcellentcircle": "\u329D", + "/ideographicfestivalparen": "\u3240", + "/ideographicfinancialcircle": "\u3296", + "/ideographicfinancialparen": "\u3236", + "/ideographicfireparen": "\u322B", + "/ideographichalffillspace": "\u303F", + "/ideographichaveparen": "\u3232", + "/ideographichighcircle": "\u32A4", + "/ideographiciterationmark": "\u3005", + "/ideographiclaborcircle": "\u3298", + "/ideographiclaborparen": "\u3238", + "/ideographicleftcircle": "\u32A7", + "/ideographicleveltonemark": "\u302A", + "/ideographiclowcircle": "\u32A6", + "/ideographicmedicinecircle": "\u32A9", + "/ideographicmetalparen": "\u322E", + "/ideographicmoonparen": "\u322A", + "/ideographicnameparen": "\u3234", + "/ideographicperiod": "\u3002", + "/ideographicprintcircle": "\u329E", + "/ideographicreachparen": "\u3243", + "/ideographicrepresentparen": "\u3239", + "/ideographicresourceparen": "\u323E", + "/ideographicrightcircle": "\u32A8", + "/ideographicrisingtonemark": "\u302B", + "/ideographicsecretcircle": "\u3299", + "/ideographicselfparen": "\u3242", + "/ideographicsocietyparen": "\u3233", + "/ideographicspace": "\u3000", + "/ideographicspecialparen": "\u3235", + "/ideographicstockparen": "\u3231", + "/ideographicstudyparen": "\u323B", + "/ideographicsunparen": "\u3230", + "/ideographicsuperviseparen": "\u323C", + "/ideographictelegraphlinefeedseparatorsymbol": "\u3037", + "/ideographictelegraphsymbolforhoureight": "\u3360", + "/ideographictelegraphsymbolforhoureighteen": "\u336A", + "/ideographictelegraphsymbolforhoureleven": "\u3363", + "/ideographictelegraphsymbolforhourfifteen": "\u3367", + "/ideographictelegraphsymbolforhourfive": "\u335D", + "/ideographictelegraphsymbolforhourfour": "\u335C", + "/ideographictelegraphsymbolforhourfourteen": "\u3366", + "/ideographictelegraphsymbolforhournine": "\u3361", + "/ideographictelegraphsymbolforhournineteen": "\u336B", + "/ideographictelegraphsymbolforhourone": "\u3359", + "/ideographictelegraphsymbolforhourseven": "\u335F", + "/ideographictelegraphsymbolforhourseventeen": "\u3369", + "/ideographictelegraphsymbolforhoursix": "\u335E", + "/ideographictelegraphsymbolforhoursixteen": "\u3368", + "/ideographictelegraphsymbolforhourten": "\u3362", + "/ideographictelegraphsymbolforhourthirteen": "\u3365", + "/ideographictelegraphsymbolforhourthree": "\u335B", + "/ideographictelegraphsymbolforhourtwelve": "\u3364", + "/ideographictelegraphsymbolforhourtwenty": "\u336C", + "/ideographictelegraphsymbolforhourtwentyfour": "\u3370", + "/ideographictelegraphsymbolforhourtwentyone": "\u336D", + "/ideographictelegraphsymbolforhourtwentythree": "\u336F", + "/ideographictelegraphsymbolforhourtwentytwo": "\u336E", + "/ideographictelegraphsymbolforhourtwo": "\u335A", + "/ideographictelegraphsymbolforhourzero": "\u3358", + "/ideographicvariationindicator": "\u303E", + "/ideographicwaterparen": "\u322C", + "/ideographicwoodparen": "\u322D", + "/ideographiczero": "\u3007", + "/ideographmetalcircle": "\u328E", + "/ideographmooncircle": "\u328A", + "/ideographnamecircle": "\u3294", + "/ideographsuncircle": "\u3290", + "/ideographwatercircle": "\u328C", + "/ideographwoodcircle": "\u328D", + "/ideva": "\u0907", + "/idieresis": "\u00EF", + "/idieresisacute": "\u1E2F", + "/idieresiscyr": "\u04E5", + "/idieresiscyrillic": "\u04E5", + "/idotbelow": "\u1ECB", + "/idsquare": "\u1F194", + "/iebrevecyr": "\u04D7", + "/iebrevecyrillic": "\u04D7", + "/iecyr": "\u0435", + "/iecyrillic": "\u0435", + "/iegravecyr": "\u0450", + "/iepigraphicsideways": "\uA7F7", + "/ieungacirclekorean": "\u3275", + "/ieungaparenkorean": "\u3215", + "/ieungcirclekorean": "\u3267", + "/ieungkorean": "\u3147", + "/ieungparenkorean": "\u3207", + "/ieungucirclekorean": "\u327E", + "/igrave": "\u00EC", + "/igravecyr": "\u045D", + "/igravedbl": "\u0209", + "/igujarati": "\u0A87", + "/igurmukhi": "\u0A07", + "/ihiragana": "\u3044", + "/ihoi": "\u1EC9", + "/ihookabove": "\u1EC9", + "/iibengali": "\u0988", + "/iicyrillic": "\u0438", + "/iideva": "\u0908", + "/iigujarati": "\u0A88", + "/iigurmukhi": "\u0A08", + "/iimatragurmukhi": "\u0A40", + "/iinvertedbreve": "\u020B", + "/iishortcyrillic": "\u0439", + "/iivowelsignbengali": "\u09C0", + "/iivowelsigndeva": "\u0940", + "/iivowelsigngujarati": "\u0AC0", + "/ij": "\u0133", + "/ikatakana": "\u30A4", + "/ikatakanahalfwidth": "\uFF72", + "/ikawi": "\uA985", + "/ikorean": "\u3163", + "/ilde": "\u02DC", + "/iluy:hb": "\u05AC", + "/iluyhebrew": "\u05AC", + "/imacron": "\u012B", + "/imacroncyr": "\u04E3", + "/imacroncyrillic": "\u04E3", + "/image": "\u22B7", + "/imageorapproximatelyequal": "\u2253", + "/imatragurmukhi": "\u0A3F", + "/imonospace": "\uFF49", + "/imp": "\u1F47F", + "/inboxTray": "\u1F4E5", + "/incomingEnvelope": "\u1F4E8", + "/increaseFontSize": "\u1F5DA", + "/increment": "\u2206", + "/indianrupee": "\u20B9", + "/infinity": "\u221E", + "/information": "\u2139", + "/infullwidth": "\u33CC", + "/inhibitarabicformshaping": "\u206C", + "/inhibitsymmetricswapping": "\u206A", + "/iniarmenian": "\u056B", + "/iningusquare": "\u3304", + "/inmationDeskPerson": "\u1F481", + "/inputLatinCapitalLetters": "\u1F520", + "/inputLatinLetters": "\u1F524", + "/inputLatinSmallLetters": "\u1F521", + "/inputNumbers": "\u1F522", + "/inputS": "\u1F523", + "/insertion": "\u2380", + "/integral": "\u222B", + "/integralbottom": "\u2321", + "/integralbt": "\u2321", + "/integralclockwise": "\u2231", + "/integralcontour": "\u222E", + "/integralcontouranticlockwise": "\u2233", + "/integralcontourclockwise": "\u2232", + "/integraldbl": "\u222C", + "/integralex": "\uF8F5", + "/integralextension": "\u23AE", + "/integralsurface": "\u222F", + "/integraltop": "\u2320", + "/integraltp": "\u2320", + "/integraltpl": "\u222D", + "/integralvolume": "\u2230", + "/intercalate": "\u22BA", + "/interlinearanchor": "\uFFF9", + "/interlinearseparator": "\uFFFA", + "/interlinearterminator": "\uFFFB", + "/interlockedfemalemale": "\u26A4", + "/interrobang": "\u203D", + "/interrobanginverted": "\u2E18", + "/intersection": "\u2229", + "/intersectionarray": "\u22C2", + "/intersectiondbl": "\u22D2", + "/intisquare": "\u3305", + "/invbullet": "\u25D8", + "/invcircle": "\u25D9", + "/inverteddamma": "\u0657", + "/invertedfork": "\u2443", + "/invertedpentagram": "\u26E7", + "/invertedundertie": "\u2054", + "/invisibleplus": "\u2064", + "/invisibleseparator": "\u2063", + "/invisibletimes": "\u2062", + "/invsmileface": "\u263B", + "/iocyr": "\u0451", + "/iocyrillic": "\u0451", + "/iogonek": "\u012F", + "/iota": "\u03B9", + "/iotaacute": "\u1F77", + "/iotaadscript": "\u1FBE", + "/iotaasper": "\u1F31", + "/iotaasperacute": "\u1F35", + "/iotaaspergrave": "\u1F33", + "/iotaaspertilde": "\u1F37", + "/iotabreve": "\u1FD0", + "/iotadieresis": "\u03CA", + "/iotadieresisacute": "\u1FD3", + "/iotadieresisgrave": "\u1FD2", + "/iotadieresistilde": "\u1FD7", + "/iotadieresistonos": "\u0390", + "/iotafunc": "\u2373", + "/iotagrave": "\u1F76", + "/iotalatin": "\u0269", + "/iotalenis": "\u1F30", + "/iotalenisacute": "\u1F34", + "/iotalenisgrave": "\u1F32", + "/iotalenistilde": "\u1F36", + "/iotasub": "\u037A", + "/iotatilde": "\u1FD6", + "/iotatonos": "\u03AF", + "/iotaturned": "\u2129", + "/iotaunderlinefunc": "\u2378", + "/iotawithmacron": "\u1FD1", + "/ipa:Ismall": "\u026A", + "/ipa:alpha": "\u0251", + "/ipa:ereversed": "\u0258", + "/ipa:esh": "\u0283", + "/ipa:gamma": "\u0263", + "/ipa:glottalstop": "\u0294", + "/ipa:gscript": "\u0261", + "/ipa:iota": "\u0269", + "/ipa:phi": "\u0278", + "/ipa:rtail": "\u027D", + "/ipa:schwa": "\u0259", + "/ipa:upsilon": "\u028A", + "/iparen": "\u24A4", + "/iparenthesized": "\u24A4", + "/irigurmukhi": "\u0A72", + "/is": "\uA76D", + "/isen-isenpada": "\uA9DF", + "/ishortcyr": "\u0439", + "/ishortsharptailcyr": "\u048B", + "/ismallhiragana": "\u3043", + "/ismallkatakana": "\u30A3", + "/ismallkatakanahalfwidth": "\uFF68", + "/issharbengali": "\u09FA", + "/istroke": "\u0268", + "/isuperior": "\uF6ED", + "/itemideographiccircled": "\u32A0", + "/iterationhiragana": "\u309D", + "/iterationkatakana": "\u30FD", + "/itilde": "\u0129", + "/itildebelow": "\u1E2D", + "/iubopomofo": "\u3129", + "/iucyrillic": "\u044E", + "/iufullwidth": "\u337A", + "/iukrcyr": "\u0456", + "/ivowelsignbengali": "\u09BF", + "/ivowelsigndeva": "\u093F", + "/ivowelsigngujarati": "\u0ABF", + "/izakayaLantern": "\u1F3EE", + "/izhitsacyr": "\u0475", + "/izhitsacyrillic": "\u0475", + "/izhitsadblgravecyrillic": "\u0477", + "/izhitsagravedblcyr": "\u0477", + "/j": "\u006A", + "/j.inferior": "\u2C7C", + "/jaarmenian": "\u0571", + "/jabengali": "\u099C", + "/jackOLantern": "\u1F383", + "/jadeva": "\u091C", + "/jagujarati": "\u0A9C", + "/jagurmukhi": "\u0A1C", + "/jamahaprana": "\uA999", + "/januarytelegraph": "\u32C0", + "/japaneseBeginner": "\u1F530", + "/japaneseCastle": "\u1F3EF", + "/japaneseDolls": "\u1F38E", + "/japaneseGoblin": "\u1F47A", + "/japaneseOgre": "\u1F479", + "/japanesePostOffice": "\u1F3E3", + "/japanesebank": "\u26FB", + "/java:a": "\uA984", + "/java:ai": "\uA98D", + "/java:ba": "\uA9A7", + "/java:ca": "\uA995", + "/java:da": "\uA9A2", + "/java:dda": "\uA99D", + "/java:e": "\uA98C", + "/java:eight": "\uA9D8", + "/java:five": "\uA9D5", + "/java:four": "\uA9D4", + "/java:ga": "\uA992", + "/java:ha": "\uA9B2", + "/java:i": "\uA986", + "/java:ii": "\uA987", + "/java:ja": "\uA997", + "/java:ka": "\uA98F", + "/java:la": "\uA9AD", + "/java:ma": "\uA9A9", + "/java:na": "\uA9A4", + "/java:nga": "\uA994", + "/java:nine": "\uA9D9", + "/java:nya": "\uA99A", + "/java:o": "\uA98E", + "/java:one": "\uA9D1", + "/java:pa": "\uA9A5", + "/java:ra": "\uA9AB", + "/java:sa": "\uA9B1", + "/java:seven": "\uA9D7", + "/java:six": "\uA9D6", + "/java:ta": "\uA9A0", + "/java:three": "\uA9D3", + "/java:tta": "\uA99B", + "/java:two": "\uA9D2", + "/java:u": "\uA988", + "/java:wa": "\uA9AE", + "/java:ya": "\uA9AA", + "/java:zero": "\uA9D0", + "/jbopomofo": "\u3110", + "/jcaron": "\u01F0", + "/jcircle": "\u24D9", + "/jcircumflex": "\u0135", + "/jcrossedtail": "\u029D", + "/jdblstruckitalic": "\u2149", + "/jdotlessstroke": "\u025F", + "/jeans": "\u1F456", + "/jecyr": "\u0458", + "/jecyrillic": "\u0458", + "/jeem": "\u062C", + "/jeem.fina": "\uFE9E", + "/jeem.init": "\uFE9F", + "/jeem.init_alefmaksura.fina": "\uFD01", + "/jeem.init_hah.fina": "\uFC15", + "/jeem.init_hah.medi": "\uFCA7", + "/jeem.init_meem.fina": "\uFC16", + "/jeem.init_meem.medi": "\uFCA8", + "/jeem.init_meem.medi_hah.medi": "\uFD59", + "/jeem.init_yeh.fina": "\uFD02", + "/jeem.isol": "\uFE9D", + "/jeem.medi": "\uFEA0", + "/jeem.medi_alefmaksura.fina": "\uFD1D", + "/jeem.medi_hah.medi_alefmaksura.fina": "\uFDA6", + "/jeem.medi_hah.medi_yeh.fina": "\uFDBE", + "/jeem.medi_meem.medi_alefmaksura.fina": "\uFDA7", + "/jeem.medi_meem.medi_hah.fina": "\uFD58", + "/jeem.medi_meem.medi_yeh.fina": "\uFDA5", + "/jeem.medi_yeh.fina": "\uFD1E", + "/jeemabove": "\u06DA", + "/jeemarabic": "\u062C", + "/jeemfinalarabic": "\uFE9E", + "/jeeminitialarabic": "\uFE9F", + "/jeemmedialarabic": "\uFEA0", + "/jeh": "\u0698", + "/jeh.fina": "\uFB8B", + "/jeh.isol": "\uFB8A", + "/jeharabic": "\u0698", + "/jehfinalarabic": "\uFB8B", + "/jhabengali": "\u099D", + "/jhadeva": "\u091D", + "/jhagujarati": "\u0A9D", + "/jhagurmukhi": "\u0A1D", + "/jheharmenian": "\u057B", + "/jis": "\u3004", + "/jiterup": "\u2643", + "/jmonospace": "\uFF4A", + "/jotdiaeresisfunc": "\u2364", + "/jotunderlinefunc": "\u235B", + "/joystick": "\u1F579", + "/jparen": "\u24A5", + "/jparenthesized": "\u24A5", + "/jstroke": "\u0249", + "/jsuperior": "\u02B2", + "/jsupmod": "\u02B2", + "/jueuicircle": "\u327D", + "/julytelegraph": "\u32C6", + "/junetelegraph": "\u32C5", + "/juno": "\u26B5", + "/k": "\u006B", + "/k.inferior": "\u2096", + "/kaaba": "\u1F54B", + "/kaaleutcyr": "\u051F", + "/kabashkcyr": "\u04A1", + "/kabashkircyrillic": "\u04A1", + "/kabengali": "\u0995", + "/kacirclekatakana": "\u32D5", + "/kacute": "\u1E31", + "/kacyr": "\u043A", + "/kacyrillic": "\u043A", + "/kadescendercyrillic": "\u049B", + "/kadeva": "\u0915", + "/kaf": "\u05DB", + "/kaf.fina": "\uFEDA", + "/kaf.init": "\uFEDB", + "/kaf.init_alef.fina": "\uFC37", + "/kaf.init_alefmaksura.fina": "\uFC3D", + "/kaf.init_hah.fina": "\uFC39", + "/kaf.init_hah.medi": "\uFCC5", + "/kaf.init_jeem.fina": "\uFC38", + "/kaf.init_jeem.medi": "\uFCC4", + "/kaf.init_khah.fina": "\uFC3A", + "/kaf.init_khah.medi": "\uFCC6", + "/kaf.init_lam.fina": "\uFC3B", + "/kaf.init_lam.medi": "\uFCC7", + "/kaf.init_meem.fina": "\uFC3C", + "/kaf.init_meem.medi": "\uFCC8", + "/kaf.init_meem.medi_meem.medi": "\uFDC3", + "/kaf.init_yeh.fina": "\uFC3E", + "/kaf.isol": "\uFED9", + "/kaf.medi": "\uFEDC", + "/kaf.medi_alef.fina": "\uFC80", + "/kaf.medi_alefmaksura.fina": "\uFC83", + "/kaf.medi_lam.fina": "\uFC81", + "/kaf.medi_lam.medi": "\uFCEB", + "/kaf.medi_meem.fina": "\uFC82", + "/kaf.medi_meem.medi": "\uFCEC", + "/kaf.medi_meem.medi_meem.fina": "\uFDBB", + "/kaf.medi_meem.medi_yeh.fina": "\uFDB7", + "/kaf.medi_yeh.fina": "\uFC84", + "/kaf:hb": "\u05DB", + "/kafTwoDotsAbove": "\u077F", + "/kafarabic": "\u0643", + "/kafdagesh": "\uFB3B", + "/kafdageshhebrew": "\uFB3B", + "/kafdotabove": "\u06AC", + "/kaffinalarabic": "\uFEDA", + "/kafhebrew": "\u05DB", + "/kafinitialarabic": "\uFEDB", + "/kafmedialarabic": "\uFEDC", + "/kafrafehebrew": "\uFB4D", + "/kafring": "\u06AB", + "/kafswash": "\u06AA", + "/kafthreedotsbelow": "\u06AE", + "/kafullwidth": "\u3384", + "/kafwide:hb": "\uFB24", + "/kafwithdagesh:hb": "\uFB3B", + "/kafwithrafe:hb": "\uFB4D", + "/kagujarati": "\u0A95", + "/kagurmukhi": "\u0A15", + "/kahiragana": "\u304B", + "/kahookcyr": "\u04C4", + "/kahookcyrillic": "\u04C4", + "/kairisquare": "\u330B", + "/kaisymbol": "\u03D7", + "/kakatakana": "\u30AB", + "/kakatakanahalfwidth": "\uFF76", + "/kamurda": "\uA991", + "/kappa": "\u03BA", + "/kappa.math": "\u03F0", + "/kappasymbolgreek": "\u03F0", + "/kapyeounmieumkorean": "\u3171", + "/kapyeounphieuphkorean": "\u3184", + "/kapyeounpieupkorean": "\u3178", + "/kapyeounssangpieupkorean": "\u3179", + "/karattosquare": "\u330C", + "/karoriisquare": "\u330D", + "/kasasak": "\uA990", + "/kashida": "\u0640", + "/kashidaFina": "\uFE73", + "/kashidaautoarabic": "\u0640", + "/kashidaautonosidebearingarabic": "\u0640", + "/kashmiriyeh": "\u0620", + "/kasmallkatakana": "\u30F5", + "/kasquare": "\u3384", + "/kasra": "\u0650", + "/kasraIsol": "\uFE7A", + "/kasraMedi": "\uFE7B", + "/kasraarabic": "\u0650", + "/kasrasmall": "\u061A", + "/kasratan": "\u064D", + "/kasratanIsol": "\uFE74", + "/kasratanarabic": "\u064D", + "/kastrokecyr": "\u049F", + "/kastrokecyrillic": "\u049F", + "/kata:a": "\u30A2", + "/kata:asmall": "\u30A1", + "/kata:ba": "\u30D0", + "/kata:be": "\u30D9", + "/kata:bi": "\u30D3", + "/kata:bo": "\u30DC", + "/kata:bu": "\u30D6", + "/kata:da": "\u30C0", + "/kata:de": "\u30C7", + "/kata:di": "\u30C2", + "/kata:digraphkoto": "\u30FF", + "/kata:do": "\u30C9", + "/kata:doublehyphenkana": "\u30A0", + "/kata:du": "\u30C5", + "/kata:e": "\u30A8", + "/kata:esmall": "\u30A7", + "/kata:ga": "\u30AC", + "/kata:ge": "\u30B2", + "/kata:gi": "\u30AE", + "/kata:go": "\u30B4", + "/kata:gu": "\u30B0", + "/kata:ha": "\u30CF", + "/kata:he": "\u30D8", + "/kata:hi": "\u30D2", + "/kata:ho": "\u30DB", + "/kata:hu": "\u30D5", + "/kata:i": "\u30A4", + "/kata:ismall": "\u30A3", + "/kata:iteration": "\u30FD", + "/kata:ka": "\u30AB", + "/kata:kasmall": "\u30F5", + "/kata:ke": "\u30B1", + "/kata:kesmall": "\u30F6", + "/kata:ki": "\u30AD", + "/kata:ko": "\u30B3", + "/kata:ku": "\u30AF", + "/kata:ma": "\u30DE", + "/kata:me": "\u30E1", + "/kata:mi": "\u30DF", + "/kata:middledot": "\u30FB", + "/kata:mo": "\u30E2", + "/kata:mu": "\u30E0", + "/kata:n": "\u30F3", + "/kata:na": "\u30CA", + "/kata:ne": "\u30CD", + "/kata:ni": "\u30CB", + "/kata:no": "\u30CE", + "/kata:nu": "\u30CC", + "/kata:o": "\u30AA", + "/kata:osmall": "\u30A9", + "/kata:pa": "\u30D1", + "/kata:pe": "\u30DA", + "/kata:pi": "\u30D4", + "/kata:po": "\u30DD", + "/kata:prolongedkana": "\u30FC", + "/kata:pu": "\u30D7", + "/kata:ra": "\u30E9", + "/kata:re": "\u30EC", + "/kata:ri": "\u30EA", + "/kata:ro": "\u30ED", + "/kata:ru": "\u30EB", + "/kata:sa": "\u30B5", + "/kata:se": "\u30BB", + "/kata:si": "\u30B7", + "/kata:so": "\u30BD", + "/kata:su": "\u30B9", + "/kata:ta": "\u30BF", + "/kata:te": "\u30C6", + "/kata:ti": "\u30C1", + "/kata:to": "\u30C8", + "/kata:tu": "\u30C4", + "/kata:tusmall": "\u30C3", + "/kata:u": "\u30A6", + "/kata:usmall": "\u30A5", + "/kata:va": "\u30F7", + "/kata:ve": "\u30F9", + "/kata:vi": "\u30F8", + "/kata:vo": "\u30FA", + "/kata:voicediteration": "\u30FE", + "/kata:vu": "\u30F4", + "/kata:wa": "\u30EF", + "/kata:wasmall": "\u30EE", + "/kata:we": "\u30F1", + "/kata:wi": "\u30F0", + "/kata:wo": "\u30F2", + "/kata:ya": "\u30E4", + "/kata:yasmall": "\u30E3", + "/kata:yo": "\u30E8", + "/kata:yosmall": "\u30E7", + "/kata:yu": "\u30E6", + "/kata:yusmall": "\u30E5", + "/kata:za": "\u30B6", + "/kata:ze": "\u30BC", + "/kata:zi": "\u30B8", + "/kata:zo": "\u30BE", + "/kata:zu": "\u30BA", + "/katahiraprolongmarkhalfwidth": "\uFF70", + "/katailcyr": "\u049B", + "/kaverticalstrokecyr": "\u049D", + "/kaverticalstrokecyrillic": "\u049D", + "/kavykainvertedlow": "\u2E45", + "/kavykalow": "\u2E47", + "/kavykawithdotlow": "\u2E48", + "/kavykawithkavykaaboveinvertedlow": "\u2E46", + "/kbfullwidth": "\u3385", + "/kbopomofo": "\u310E", + "/kcalfullwidth": "\u3389", + "/kcalsquare": "\u3389", + "/kcaron": "\u01E9", + "/kcedilla": "\u0137", + "/kcircle": "\u24DA", + "/kcommaaccent": "\u0137", + "/kdescender": "\u2C6A", + "/kdiagonalstroke": "\uA743", + "/kdotbelow": "\u1E33", + "/kecirclekatakana": "\u32D8", + "/keesusquare": "\u331C", + "/keharmenian": "\u0584", + "/keheh": "\u06A9", + "/keheh.fina": "\uFB8F", + "/keheh.init": "\uFB90", + "/keheh.isol": "\uFB8E", + "/keheh.medi": "\uFB91", + "/kehehDotAbove": "\u0762", + "/kehehThreeDotsAbove": "\u0763", + "/kehehThreeDotsUpBelow": "\u0764", + "/kehehthreedotsbelow": "\u063C", + "/kehehtwodotsabove": "\u063B", + "/kehiragana": "\u3051", + "/kekatakana": "\u30B1", + "/kekatakanahalfwidth": "\uFF79", + "/kelvin": "\u212A", + "/kenarmenian": "\u056F", + "/keretconsonant": "\uA9BD", + "/kesmallkatakana": "\u30F6", + "/key": "\u1F511", + "/keyboardAndMouse": "\u1F5A6", + "/keycapTen": "\u1F51F", + "/kgfullwidth": "\u338F", + "/kgreenlandic": "\u0138", + "/khabengali": "\u0996", + "/khacyrillic": "\u0445", + "/khadeva": "\u0916", + "/khagujarati": "\u0A96", + "/khagurmukhi": "\u0A16", + "/khah": "\u062E", + "/khah.fina": "\uFEA6", + "/khah.init": "\uFEA7", + "/khah.init_alefmaksura.fina": "\uFD03", + "/khah.init_hah.fina": "\uFC1A", + "/khah.init_jeem.fina": "\uFC19", + "/khah.init_jeem.medi": "\uFCAB", + "/khah.init_meem.fina": "\uFC1B", + "/khah.init_meem.medi": "\uFCAC", + "/khah.init_yeh.fina": "\uFD04", + "/khah.isol": "\uFEA5", + "/khah.medi": "\uFEA8", + "/khah.medi_alefmaksura.fina": "\uFD1F", + "/khah.medi_yeh.fina": "\uFD20", + "/khaharabic": "\u062E", + "/khahfinalarabic": "\uFEA6", + "/khahinitialarabic": "\uFEA7", + "/khahmedialarabic": "\uFEA8", + "/kheicoptic": "\u03E7", + "/khhadeva": "\u0959", + "/khhagurmukhi": "\u0A59", + "/khieukhacirclekorean": "\u3278", + "/khieukhaparenkorean": "\u3218", + "/khieukhcirclekorean": "\u326A", + "/khieukhkorean": "\u314B", + "/khieukhparenkorean": "\u320A", + "/khokhaithai": "\u0E02", + "/khokhonthai": "\u0E05", + "/khokhuatthai": "\u0E03", + "/khokhwaithai": "\u0E04", + "/khomutthai": "\u0E5B", + "/khook": "\u0199", + "/khorakhangthai": "\u0E06", + "/khzfullwidth": "\u3391", + "/khzsquare": "\u3391", + "/kicirclekatakana": "\u32D6", + "/kihiragana": "\u304D", + "/kikatakana": "\u30AD", + "/kikatakanahalfwidth": "\uFF77", + "/kimono": "\u1F458", + "/kindergartenideographiccircled": "\u3245", + "/kingblack": "\u265A", + "/kingwhite": "\u2654", + "/kip": "\u20AD", + "/kiroguramusquare": "\u3315", + "/kiromeetorusquare": "\u3316", + "/kirosquare": "\u3314", + "/kirowattosquare": "\u3317", + "/kiss": "\u1F48F", + "/kissMark": "\u1F48B", + "/kissingCatFaceWithClosedEyes": "\u1F63D", + "/kissingFace": "\u1F617", + "/kissingFaceWithClosedEyes": "\u1F61A", + "/kissingFaceWithSmilingEyes": "\u1F619", + "/kiyeokacirclekorean": "\u326E", + "/kiyeokaparenkorean": "\u320E", + "/kiyeokcirclekorean": "\u3260", + "/kiyeokkorean": "\u3131", + "/kiyeokparenkorean": "\u3200", + "/kiyeoksioskorean": "\u3133", + "/kjecyr": "\u045C", + "/kjecyrillic": "\u045C", + "/kkfullwidth": "\u33CD", + "/klfullwidth": "\u3398", + "/klinebelow": "\u1E35", + "/klsquare": "\u3398", + "/km2fullwidth": "\u33A2", + "/km3fullwidth": "\u33A6", + "/kmcapitalfullwidth": "\u33CE", + "/kmcubedsquare": "\u33A6", + "/kmfullwidth": "\u339E", + "/kmonospace": "\uFF4B", + "/kmsquaredsquare": "\u33A2", + "/knda:a": "\u0C85", + "/knda:aa": "\u0C86", + "/knda:aasign": "\u0CBE", + "/knda:ai": "\u0C90", + "/knda:ailength": "\u0CD6", + "/knda:aisign": "\u0CC8", + "/knda:anusvara": "\u0C82", + "/knda:au": "\u0C94", + "/knda:ausign": "\u0CCC", + "/knda:avagraha": "\u0CBD", + "/knda:ba": "\u0CAC", + "/knda:bha": "\u0CAD", + "/knda:ca": "\u0C9A", + "/knda:cha": "\u0C9B", + "/knda:da": "\u0CA6", + "/knda:dda": "\u0CA1", + "/knda:ddha": "\u0CA2", + "/knda:dha": "\u0CA7", + "/knda:e": "\u0C8E", + "/knda:ee": "\u0C8F", + "/knda:eesign": "\u0CC7", + "/knda:eight": "\u0CEE", + "/knda:esign": "\u0CC6", + "/knda:fa": "\u0CDE", + "/knda:five": "\u0CEB", + "/knda:four": "\u0CEA", + "/knda:ga": "\u0C97", + "/knda:gha": "\u0C98", + "/knda:ha": "\u0CB9", + "/knda:i": "\u0C87", + "/knda:ii": "\u0C88", + "/knda:iisign": "\u0CC0", + "/knda:isign": "\u0CBF", + "/knda:ja": "\u0C9C", + "/knda:jha": "\u0C9D", + "/knda:jihvamuliya": "\u0CF1", + "/knda:ka": "\u0C95", + "/knda:kha": "\u0C96", + "/knda:la": "\u0CB2", + "/knda:length": "\u0CD5", + "/knda:lla": "\u0CB3", + "/knda:llvocal": "\u0CE1", + "/knda:llvocalsign": "\u0CE3", + "/knda:lvocal": "\u0C8C", + "/knda:lvocalsign": "\u0CE2", + "/knda:ma": "\u0CAE", + "/knda:na": "\u0CA8", + "/knda:nga": "\u0C99", + "/knda:nine": "\u0CEF", + "/knda:nna": "\u0CA3", + "/knda:nukta": "\u0CBC", + "/knda:nya": "\u0C9E", + "/knda:o": "\u0C92", + "/knda:one": "\u0CE7", + "/knda:oo": "\u0C93", + "/knda:oosign": "\u0CCB", + "/knda:osign": "\u0CCA", + "/knda:pa": "\u0CAA", + "/knda:pha": "\u0CAB", + "/knda:ra": "\u0CB0", + "/knda:rra": "\u0CB1", + "/knda:rrvocal": "\u0CE0", + "/knda:rrvocalsign": "\u0CC4", + "/knda:rvocal": "\u0C8B", + "/knda:rvocalsign": "\u0CC3", + "/knda:sa": "\u0CB8", + "/knda:seven": "\u0CED", + "/knda:sha": "\u0CB6", + "/knda:signcandrabindu": "\u0C81", + "/knda:signspacingcandrabindu": "\u0C80", + "/knda:six": "\u0CEC", + "/knda:ssa": "\u0CB7", + "/knda:ta": "\u0CA4", + "/knda:tha": "\u0CA5", + "/knda:three": "\u0CE9", + "/knda:tta": "\u0C9F", + "/knda:ttha": "\u0CA0", + "/knda:two": "\u0CE8", + "/knda:u": "\u0C89", + "/knda:upadhmaniya": "\u0CF2", + "/knda:usign": "\u0CC1", + "/knda:uu": "\u0C8A", + "/knda:uusign": "\u0CC2", + "/knda:va": "\u0CB5", + "/knda:virama": "\u0CCD", + "/knda:visarga": "\u0C83", + "/knda:ya": "\u0CAF", + "/knda:zero": "\u0CE6", + "/knightblack": "\u265E", + "/knightwhite": "\u2658", + "/ko:a": "\u314F", + "/ko:ae": "\u3150", + "/ko:aejungseong": "\u1162", + "/ko:aeujungseong": "\u11A3", + "/ko:ajungseong": "\u1161", + "/ko:aojungseong": "\u1176", + "/ko:araea": "\u318D", + "/ko:araeae": "\u318E", + "/ko:araeaeojungseong": "\u119F", + "/ko:araeaijungseong": "\u11A1", + "/ko:araeajungseong": "\u119E", + "/ko:araeaujungseong": "\u11A0", + "/ko:aujungseong": "\u1177", + "/ko:ceongchieumchieuchchoseong": "\u1155", + "/ko:ceongchieumcieucchoseong": "\u1150", + "/ko:ceongchieumsioschoseong": "\u113E", + "/ko:ceongchieumssangcieucchoseong": "\u1151", + "/ko:ceongchieumssangsioschoseong": "\u113F", + "/ko:chieuch": "\u314A", + "/ko:chieuchchoseong": "\u110E", + "/ko:chieuchhieuhchoseong": "\u1153", + "/ko:chieuchjongseong": "\u11BE", + "/ko:chieuchkhieukhchoseong": "\u1152", + "/ko:chitueumchieuchchoseong": "\u1154", + "/ko:chitueumcieucchoseong": "\u114E", + "/ko:chitueumsioschoseong": "\u113C", + "/ko:chitueumssangcieucchoseong": "\u114F", + "/ko:chitueumssangsioschoseong": "\u113D", + "/ko:cieuc": "\u3148", + "/ko:cieucchoseong": "\u110C", + "/ko:cieucieungchoseong": "\u114D", + "/ko:cieucjongseong": "\u11BD", + "/ko:e": "\u3154", + "/ko:ejungseong": "\u1166", + "/ko:eo": "\u3153", + "/ko:eo_eujungseong": "\u117C", + "/ko:eojungseong": "\u1165", + "/ko:eoojungseong": "\u117A", + "/ko:eoujungseong": "\u117B", + "/ko:eu": "\u3161", + "/ko:eueujungseong": "\u1196", + "/ko:eujungseong": "\u1173", + "/ko:euujungseong": "\u1195", + "/ko:filler": "\u3164", + "/ko:fillerchoseong": "\u115F", + "/ko:fillerjungseong": "\u1160", + "/ko:hieuh": "\u314E", + "/ko:hieuhchoseong": "\u1112", + "/ko:hieuhjongseong": "\u11C2", + "/ko:hieuhmieumjongseong": "\u11F7", + "/ko:hieuhnieunjongseong": "\u11F5", + "/ko:hieuhpieupjongseong": "\u11F8", + "/ko:hieuhrieuljongseong": "\u11F6", + "/ko:i": "\u3163", + "/ko:iajungseong": "\u1198", + "/ko:iaraeajungseong": "\u119D", + "/ko:ieujungseong": "\u119C", + "/ko:ieung": "\u3147", + "/ko:ieungchieuchchoseong": "\u1149", + "/ko:ieungchoseong": "\u110B", + "/ko:ieungcieucchoseong": "\u1148", + "/ko:ieungjongseong": "\u11BC", + "/ko:ieungkhieukhjongseong": "\u11EF", + "/ko:ieungkiyeokchoseong": "\u1141", + "/ko:ieungkiyeokjongseong": "\u11EC", + "/ko:ieungmieumchoseong": "\u1143", + "/ko:ieungpansioschoseong": "\u1146", + "/ko:ieungphieuphchoseong": "\u114B", + "/ko:ieungpieupchoseong": "\u1144", + "/ko:ieungsioschoseong": "\u1145", + "/ko:ieungssangkiyeokjongseong": "\u11ED", + "/ko:ieungthieuthchoseong": "\u114A", + "/ko:ieungtikeutchoseong": "\u1142", + "/ko:ijungseong": "\u1175", + "/ko:iojungseong": "\u119A", + "/ko:iujungseong": "\u119B", + "/ko:iyajungseong": "\u1199", + "/ko:kapyeounmieum": "\u3171", + "/ko:kapyeounmieumchoseong": "\u111D", + "/ko:kapyeounmieumjongseong": "\u11E2", + "/ko:kapyeounphieuph": "\u3184", + "/ko:kapyeounphieuphchoseong": "\u1157", + "/ko:kapyeounphieuphjongseong": "\u11F4", + "/ko:kapyeounpieup": "\u3178", + "/ko:kapyeounpieupchoseong": "\u112B", + "/ko:kapyeounpieupjongseong": "\u11E6", + "/ko:kapyeounrieulchoseong": "\u111B", + "/ko:kapyeounssangpieup": "\u3179", + "/ko:kapyeounssangpieupchoseong": "\u112C", + "/ko:khieukh": "\u314B", + "/ko:khieukhchoseong": "\u110F", + "/ko:khieukhjongseong": "\u11BF", + "/ko:kiyeok": "\u3131", + "/ko:kiyeokchieuchjongseong": "\u11FC", + "/ko:kiyeokchoseong": "\u1100", + "/ko:kiyeokhieuhjongseong": "\u11FE", + "/ko:kiyeokjongseong": "\u11A8", + "/ko:kiyeokkhieukhjongseong": "\u11FD", + "/ko:kiyeoknieunjongseong": "\u11FA", + "/ko:kiyeokpieupjongseong": "\u11FB", + "/ko:kiyeokrieuljongseong": "\u11C3", + "/ko:kiyeoksios": "\u3133", + "/ko:kiyeoksiosjongseong": "\u11AA", + "/ko:kiyeoksioskiyeokjongseong": "\u11C4", + "/ko:kiyeoktikeutchoseong": "\u115A", + "/ko:mieum": "\u3141", + "/ko:mieumchieuchjongseong": "\u11E0", + "/ko:mieumchoseong": "\u1106", + "/ko:mieumhieuhjongseong": "\u11E1", + "/ko:mieumjongseong": "\u11B7", + "/ko:mieumkiyeokjongseong": "\u11DA", + "/ko:mieumpansios": "\u3170", + "/ko:mieumpansiosjongseong": "\u11DF", + "/ko:mieumpieup": "\u316E", + "/ko:mieumpieupchoseong": "\u111C", + "/ko:mieumpieupjongseong": "\u11DC", + "/ko:mieumrieuljongseong": "\u11DB", + "/ko:mieumsios": "\u316F", + "/ko:mieumsiosjongseong": "\u11DD", + "/ko:mieumssangsiosjongseong": "\u11DE", + "/ko:nieun": "\u3134", + "/ko:nieunchoseong": "\u1102", + "/ko:nieuncieuc": "\u3135", + "/ko:nieuncieucchoseong": "\u115C", + "/ko:nieuncieucjongseong": "\u11AC", + "/ko:nieunhieuh": "\u3136", + "/ko:nieunhieuhchoseong": "\u115D", + "/ko:nieunhieuhjongseong": "\u11AD", + "/ko:nieunjongseong": "\u11AB", + "/ko:nieunkiyeokchoseong": "\u1113", + "/ko:nieunkiyeokjongseong": "\u11C5", + "/ko:nieunpansios": "\u3168", + "/ko:nieunpansiosjongseong": "\u11C8", + "/ko:nieunpieupchoseong": "\u1116", + "/ko:nieunsios": "\u3167", + "/ko:nieunsioschoseong": "\u115B", + "/ko:nieunsiosjongseong": "\u11C7", + "/ko:nieunthieuthjongseong": "\u11C9", + "/ko:nieuntikeut": "\u3166", + "/ko:nieuntikeutchoseong": "\u1115", + "/ko:nieuntikeutjongseong": "\u11C6", + "/ko:o": "\u3157", + "/ko:o_ejungseong": "\u1180", + "/ko:o_eojungseong": "\u117F", + "/ko:oe": "\u315A", + "/ko:oejungseong": "\u116C", + "/ko:ojungseong": "\u1169", + "/ko:oojungseong": "\u1182", + "/ko:oujungseong": "\u1183", + "/ko:oyaejungseong": "\u11A7", + "/ko:oyajungseong": "\u11A6", + "/ko:oyejungseong": "\u1181", + "/ko:pansios": "\u317F", + "/ko:pansioschoseong": "\u1140", + "/ko:pansiosjongseong": "\u11EB", + "/ko:phieuph": "\u314D", + "/ko:phieuphchoseong": "\u1111", + "/ko:phieuphjongseong": "\u11C1", + "/ko:phieuphpieupchoseong": "\u1156", + "/ko:phieuphpieupjongseong": "\u11F3", + "/ko:pieup": "\u3142", + "/ko:pieupchieuchchoseong": "\u1128", + "/ko:pieupchoseong": "\u1107", + "/ko:pieupcieuc": "\u3176", + "/ko:pieupcieucchoseong": "\u1127", + "/ko:pieuphieuhjongseong": "\u11E5", + "/ko:pieupjongseong": "\u11B8", + "/ko:pieupkiyeok": "\u3172", + "/ko:pieupkiyeokchoseong": "\u111E", + "/ko:pieupnieunchoseong": "\u111F", + "/ko:pieupphieuphchoseong": "\u112A", + "/ko:pieupphieuphjongseong": "\u11E4", + "/ko:pieuprieuljongseong": "\u11E3", + "/ko:pieupsios": "\u3144", + "/ko:pieupsioschoseong": "\u1121", + "/ko:pieupsioscieucchoseong": "\u1126", + "/ko:pieupsiosjongseong": "\u11B9", + "/ko:pieupsioskiyeok": "\u3174", + "/ko:pieupsioskiyeokchoseong": "\u1122", + "/ko:pieupsiospieupchoseong": "\u1124", + "/ko:pieupsiostikeut": "\u3175", + "/ko:pieupsiostikeutchoseong": "\u1123", + "/ko:pieupssangsioschoseong": "\u1125", + "/ko:pieupthieuth": "\u3177", + "/ko:pieupthieuthchoseong": "\u1129", + "/ko:pieuptikeut": "\u3173", + "/ko:pieuptikeutchoseong": "\u1120", + "/ko:rieul": "\u3139", + "/ko:rieulchoseong": "\u1105", + "/ko:rieulhieuh": "\u3140", + "/ko:rieulhieuhchoseong": "\u111A", + "/ko:rieulhieuhjongseong": "\u11B6", + "/ko:rieuljongseong": "\u11AF", + "/ko:rieulkapyeounpieupjongseong": "\u11D5", + "/ko:rieulkhieukhjongseong": "\u11D8", + "/ko:rieulkiyeok": "\u313A", + "/ko:rieulkiyeokjongseong": "\u11B0", + "/ko:rieulkiyeoksios": "\u3169", + "/ko:rieulkiyeoksiosjongseong": "\u11CC", + "/ko:rieulmieum": "\u313B", + "/ko:rieulmieumjongseong": "\u11B1", + "/ko:rieulmieumkiyeokjongseong": "\u11D1", + "/ko:rieulmieumsiosjongseong": "\u11D2", + "/ko:rieulnieunchoseong": "\u1118", + "/ko:rieulnieunjongseong": "\u11CD", + "/ko:rieulpansios": "\u316C", + "/ko:rieulpansiosjongseong": "\u11D7", + "/ko:rieulphieuph": "\u313F", + "/ko:rieulphieuphjongseong": "\u11B5", + "/ko:rieulpieup": "\u313C", + "/ko:rieulpieuphieuhjongseong": "\u11D4", + "/ko:rieulpieupjongseong": "\u11B2", + "/ko:rieulpieupsios": "\u316B", + "/ko:rieulpieupsiosjongseong": "\u11D3", + "/ko:rieulsios": "\u313D", + "/ko:rieulsiosjongseong": "\u11B3", + "/ko:rieulssangsiosjongseong": "\u11D6", + "/ko:rieulthieuth": "\u313E", + "/ko:rieulthieuthjongseong": "\u11B4", + "/ko:rieultikeut": "\u316A", + "/ko:rieultikeuthieuhjongseong": "\u11CF", + "/ko:rieultikeutjongseong": "\u11CE", + "/ko:rieulyeorinhieuh": "\u316D", + "/ko:rieulyeorinhieuhjongseong": "\u11D9", + "/ko:sios": "\u3145", + "/ko:sioschieuchchoseong": "\u1137", + "/ko:sioschoseong": "\u1109", + "/ko:sioscieuc": "\u317E", + "/ko:sioscieucchoseong": "\u1136", + "/ko:sioshieuhchoseong": "\u113B", + "/ko:siosieungchoseong": "\u1135", + "/ko:siosjongseong": "\u11BA", + "/ko:sioskhieukhchoseong": "\u1138", + "/ko:sioskiyeok": "\u317A", + "/ko:sioskiyeokchoseong": "\u112D", + "/ko:sioskiyeokjongseong": "\u11E7", + "/ko:siosmieumchoseong": "\u1131", + "/ko:siosnieun": "\u317B", + "/ko:siosnieunchoseong": "\u112E", + "/ko:siosphieuphchoseong": "\u113A", + "/ko:siospieup": "\u317D", + "/ko:siospieupchoseong": "\u1132", + "/ko:siospieupjongseong": "\u11EA", + "/ko:siospieupkiyeokchoseong": "\u1133", + "/ko:siosrieulchoseong": "\u1130", + "/ko:siosrieuljongseong": "\u11E9", + "/ko:siosssangsioschoseong": "\u1134", + "/ko:siosthieuthchoseong": "\u1139", + "/ko:siostikeut": "\u317C", + "/ko:siostikeutchoseong": "\u112F", + "/ko:siostikeutjongseong": "\u11E8", + "/ko:ssangaraeajungseong": "\u11A2", + "/ko:ssangcieuc": "\u3149", + "/ko:ssangcieucchoseong": "\u110D", + "/ko:ssanghieuh": "\u3185", + "/ko:ssanghieuhchoseong": "\u1158", + "/ko:ssangieung": "\u3180", + "/ko:ssangieungchoseong": "\u1147", + "/ko:ssangieungjongseong": "\u11EE", + "/ko:ssangkiyeok": "\u3132", + "/ko:ssangkiyeokchoseong": "\u1101", + "/ko:ssangkiyeokjongseong": "\u11A9", + "/ko:ssangnieun": "\u3165", + "/ko:ssangnieunchoseong": "\u1114", + "/ko:ssangnieunjongseong": "\u11FF", + "/ko:ssangpieup": "\u3143", + "/ko:ssangpieupchoseong": "\u1108", + "/ko:ssangrieulchoseong": "\u1119", + "/ko:ssangrieuljongseong": "\u11D0", + "/ko:ssangsios": "\u3146", + "/ko:ssangsioschoseong": "\u110A", + "/ko:ssangsiosjongseong": "\u11BB", + "/ko:ssangtikeut": "\u3138", + "/ko:ssangtikeutchoseong": "\u1104", + "/ko:thieuth": "\u314C", + "/ko:thieuthchoseong": "\u1110", + "/ko:thieuthjongseong": "\u11C0", + "/ko:tikeut": "\u3137", + "/ko:tikeutchoseong": "\u1103", + "/ko:tikeutjongseong": "\u11AE", + "/ko:tikeutkiyeokchoseong": "\u1117", + "/ko:tikeutkiyeokjongseong": "\u11CA", + "/ko:tikeutrieulchoseong": "\u115E", + "/ko:tikeutrieuljongseong": "\u11CB", + "/ko:u": "\u315C", + "/ko:uaejungseong": "\u118A", + "/ko:uajungseong": "\u1189", + "/ko:ueo_eujungseong": "\u118B", + "/ko:ujungseong": "\u116E", + "/ko:uujungseong": "\u118D", + "/ko:uyejungseong": "\u118C", + "/ko:wa": "\u3158", + "/ko:wae": "\u3159", + "/ko:waejungseong": "\u116B", + "/ko:wajungseong": "\u116A", + "/ko:we": "\u315E", + "/ko:wejungseong": "\u1170", + "/ko:weo": "\u315D", + "/ko:weojungseong": "\u116F", + "/ko:wi": "\u315F", + "/ko:wijungseong": "\u1171", + "/ko:ya": "\u3151", + "/ko:yae": "\u3152", + "/ko:yaejungseong": "\u1164", + "/ko:yajungseong": "\u1163", + "/ko:yaojungseong": "\u1178", + "/ko:yaujungseong": "\u11A4", + "/ko:yayojungseong": "\u1179", + "/ko:ye": "\u3156", + "/ko:yejungseong": "\u1168", + "/ko:yeo": "\u3155", + "/ko:yeojungseong": "\u1167", + "/ko:yeoojungseong": "\u117D", + "/ko:yeorinhieuh": "\u3186", + "/ko:yeorinhieuhchoseong": "\u1159", + "/ko:yeorinhieuhjongseong": "\u11F9", + "/ko:yeoujungseong": "\u117E", + "/ko:yeoyajungseong": "\u11A5", + "/ko:yesieung": "\u3181", + "/ko:yesieungchoseong": "\u114C", + "/ko:yesieungjongseong": "\u11F0", + "/ko:yesieungpansios": "\u3183", + "/ko:yesieungpansiosjongseong": "\u11F2", + "/ko:yesieungsios": "\u3182", + "/ko:yesieungsiosjongseong": "\u11F1", + "/ko:yi": "\u3162", + "/ko:yijungseong": "\u1174", + "/ko:yiujungseong": "\u1197", + "/ko:yo": "\u315B", + "/ko:yoi": "\u3189", + "/ko:yoijungseong": "\u1188", + "/ko:yojungseong": "\u116D", + "/ko:yoojungseong": "\u1187", + "/ko:yoya": "\u3187", + "/ko:yoyae": "\u3188", + "/ko:yoyaejungseong": "\u1185", + "/ko:yoyajungseong": "\u1184", + "/ko:yoyeojungseong": "\u1186", + "/ko:yu": "\u3160", + "/ko:yuajungseong": "\u118E", + "/ko:yuejungseong": "\u1190", + "/ko:yueojungseong": "\u118F", + "/ko:yui": "\u318C", + "/ko:yuijungseong": "\u1194", + "/ko:yujungseong": "\u1172", + "/ko:yuujungseong": "\u1193", + "/ko:yuye": "\u318B", + "/ko:yuyejungseong": "\u1192", + "/ko:yuyeo": "\u318A", + "/ko:yuyeojungseong": "\u1191", + "/koala": "\u1F428", + "/kobliquestroke": "\uA7A3", + "/kocirclekatakana": "\u32D9", + "/kohiragana": "\u3053", + "/kohmfullwidth": "\u33C0", + "/kohmsquare": "\u33C0", + "/kokaithai": "\u0E01", + "/kokatakana": "\u30B3", + "/kokatakanahalfwidth": "\uFF7A", + "/kooposquare": "\u331E", + "/koppa": "\u03DF", + "/koppaarchaic": "\u03D9", + "/koppacyr": "\u0481", + "/koppacyrillic": "\u0481", + "/koreanstandardsymbol": "\u327F", + "/koroniscmb": "\u0343", + "/korunasquare": "\u331D", + "/kotoideographiccircled": "\u3247", + "/kpafullwidth": "\u33AA", + "/kparen": "\u24A6", + "/kparenthesized": "\u24A6", + "/kpasquare": "\u33AA", + "/kra": "\u0138", + "/ksicyr": "\u046F", + "/ksicyrillic": "\u046F", + "/kstroke": "\uA741", + "/kstrokediagonalstroke": "\uA745", + "/ktfullwidth": "\u33CF", + "/ktsquare": "\u33CF", + "/kturned": "\u029E", + "/kucirclekatakana": "\u32D7", + "/kuhiragana": "\u304F", + "/kukatakana": "\u30AF", + "/kukatakanahalfwidth": "\uFF78", + "/kuroonesquare": "\u331B", + "/kuruzeirosquare": "\u331A", + "/kvfullwidth": "\u33B8", + "/kvsquare": "\u33B8", + "/kwfullwidth": "\u33BE", + "/kwsquare": "\u33BE", + "/kyuriisquare": "\u3312", + "/l": "\u006C", + "/l.inferior": "\u2097", + "/label": "\u1F3F7", + "/labengali": "\u09B2", + "/laborideographiccircled": "\u3298", + "/laborideographicparen": "\u3238", + "/lacute": "\u013A", + "/ladeva": "\u0932", + "/ladyBeetle": "\u1F41E", + "/lagujarati": "\u0AB2", + "/lagurmukhi": "\u0A32", + "/lakkhangyaothai": "\u0E45", + "/lam": "\u0644", + "/lam.fina": "\uFEDE", + "/lam.init": "\uFEDF", + "/lam.init_alef.fina": "\uFEFB", + "/lam.init_alef.medi_hamzaabove.fina": "\uFEF7", + "/lam.init_alef.medi_hamzabelow.fina": "\uFEF9", + "/lam.init_alef.medi_maddaabove.fina": "\uFEF5", + "/lam.init_alefmaksura.fina": "\uFC43", + "/lam.init_hah.fina": "\uFC40", + "/lam.init_hah.medi": "\uFCCA", + "/lam.init_hah.medi_meem.medi": "\uFDB5", + "/lam.init_heh.medi": "\uFCCD", + "/lam.init_jeem.fina": "\uFC3F", + "/lam.init_jeem.medi": "\uFCC9", + "/lam.init_jeem.medi_jeem.medi": "\uFD83", + "/lam.init_jeem.medi_meem.medi": "\uFDBA", + "/lam.init_khah.fina": "\uFC41", + "/lam.init_khah.medi": "\uFCCB", + "/lam.init_khah.medi_meem.medi": "\uFD86", + "/lam.init_meem.fina": "\uFC42", + "/lam.init_meem.medi": "\uFCCC", + "/lam.init_meem.medi_hah.medi": "\uFD88", + "/lam.init_yeh.fina": "\uFC44", + "/lam.isol": "\uFEDD", + "/lam.medi": "\uFEE0", + "/lam.medi_alef.fina": "\uFEFC", + "/lam.medi_alef.medi_hamzaabove.fina": "\uFEF8", + "/lam.medi_alef.medi_hamzabelow.fina": "\uFEFA", + "/lam.medi_alef.medi_maddaabove.fina": "\uFEF6", + "/lam.medi_alefmaksura.fina": "\uFC86", + "/lam.medi_hah.medi_alefmaksura.fina": "\uFD82", + "/lam.medi_hah.medi_meem.fina": "\uFD80", + "/lam.medi_hah.medi_yeh.fina": "\uFD81", + "/lam.medi_jeem.medi_jeem.fina": "\uFD84", + "/lam.medi_jeem.medi_meem.fina": "\uFDBC", + "/lam.medi_jeem.medi_yeh.fina": "\uFDAC", + "/lam.medi_khah.medi_meem.fina": "\uFD85", + "/lam.medi_meem.fina": "\uFC85", + "/lam.medi_meem.medi": "\uFCED", + "/lam.medi_meem.medi_hah.fina": "\uFD87", + "/lam.medi_meem.medi_yeh.fina": "\uFDAD", + "/lam.medi_yeh.fina": "\uFC87", + "/lamBar": "\u076A", + "/lamVabove": "\u06B5", + "/lamalefabove": "\u06D9", + "/lamaleffinalarabic": "\uFEFC", + "/lamalefhamzaabovefinalarabic": "\uFEF8", + "/lamalefhamzaaboveisolatedarabic": "\uFEF7", + "/lamalefhamzabelowfinalarabic": "\uFEFA", + "/lamalefhamzabelowisolatedarabic": "\uFEF9", + "/lamalefisolatedarabic": "\uFEFB", + "/lamalefmaddaabovefinalarabic": "\uFEF6", + "/lamalefmaddaaboveisolatedarabic": "\uFEF5", + "/lamarabic": "\u0644", + "/lambda": "\u03BB", + "/lambdastroke": "\u019B", + "/lamdotabove": "\u06B6", + "/lamed": "\u05DC", + "/lamed:hb": "\u05DC", + "/lameddagesh": "\uFB3C", + "/lameddageshhebrew": "\uFB3C", + "/lamedhebrew": "\u05DC", + "/lamedholam": "\u05DC", + "/lamedholamdagesh": "\u05DC", + "/lamedholamdageshhebrew": "\u05DC", + "/lamedholamhebrew": "\u05DC", + "/lamedwide:hb": "\uFB25", + "/lamedwithdagesh:hb": "\uFB3C", + "/lamfinalarabic": "\uFEDE", + "/lamhahinitialarabic": "\uFCCA", + "/laminitialarabic": "\uFEDF", + "/lamjeeminitialarabic": "\uFCC9", + "/lamkhahinitialarabic": "\uFCCB", + "/lamlamhehisolatedarabic": "\uFDF2", + "/lammedialarabic": "\uFEE0", + "/lammeemhahinitialarabic": "\uFD88", + "/lammeeminitialarabic": "\uFCCC", + "/lammeemjeeminitialarabic": "\uFEDF", + "/lammeemkhahinitialarabic": "\uFEDF", + "/lamthreedotsabove": "\u06B7", + "/lamthreedotsbelow": "\u06B8", + "/lanemergeleftblack": "\u26D8", + "/lanemergeleftwhite": "\u26D9", + "/largeBlueCircle": "\u1F535", + "/largeBlueDiamond": "\u1F537", + "/largeOrangeDiamond": "\u1F536", + "/largeRedCircle": "\u1F534", + "/largecircle": "\u25EF", + "/largetackdown": "\u27D9", + "/largetackup": "\u27D8", + "/lari": "\u20BE", + "/lastQuarterMoon": "\u1F317", + "/lastQuarterMoonFace": "\u1F31C", + "/lastquartermoon": "\u263E", + "/layar": "\uA982", + "/lazysinverted": "\u223E", + "/lbar": "\u019A", + "/lbbar": "\u2114", + "/lbelt": "\u026C", + "/lbeltretroflex": "\uA78E", + "/lbopomofo": "\u310C", + "/lbroken": "\uA747", + "/lcaron": "\u013E", + "/lcedilla": "\u013C", + "/lcircle": "\u24DB", + "/lcircumflexbelow": "\u1E3D", + "/lcommaaccent": "\u013C", + "/lcurl": "\u0234", + "/ldblbar": "\u2C61", + "/ldot": "\u0140", + "/ldotaccent": "\u0140", + "/ldotbelow": "\u1E37", + "/ldotbelowmacron": "\u1E39", + "/leafFlutteringInWind": "\u1F343", + "/ledger": "\u1F4D2", + "/left-pointingMagnifyingGlass": "\u1F50D", + "/leftAngerBubble": "\u1F5EE", + "/leftFiveEighthsBlock": "\u258B", + "/leftHalfBlock": "\u258C", + "/leftHandTelephoneReceiver": "\u1F57B", + "/leftLuggage": "\u1F6C5", + "/leftOneEighthBlock": "\u258F", + "/leftOneQuarterBlock": "\u258E", + "/leftSevenEighthsBlock": "\u2589", + "/leftSpeechBubble": "\u1F5E8", + "/leftThoughtBubble": "\u1F5EC", + "/leftThreeEighthsBlock": "\u258D", + "/leftThreeQuartersBlock": "\u258A", + "/leftWritingHand": "\u1F58E", + "/leftangleabovecmb": "\u031A", + "/leftarrowoverrightarrow": "\u21C6", + "/leftdnheavyrightuplight": "\u2545", + "/leftharpoonoverrightharpoon": "\u21CB", + "/leftheavyrightdnlight": "\u252D", + "/leftheavyrightuplight": "\u2535", + "/leftheavyrightvertlight": "\u253D", + "/leftideographiccircled": "\u32A7", + "/leftlightrightdnheavy": "\u2532", + "/leftlightrightupheavy": "\u253A", + "/leftlightrightvertheavy": "\u254A", + "/lefttackbelowcmb": "\u0318", + "/lefttorightembed": "\u202A", + "/lefttorightisolate": "\u2066", + "/lefttorightmark": "\u200E", + "/lefttorightoverride": "\u202D", + "/leftupheavyrightdnlight": "\u2543", + "/lemon": "\u1F34B", + "/lenis": "\u1FBF", + "/lenisacute": "\u1FCE", + "/lenisgrave": "\u1FCD", + "/lenistilde": "\u1FCF", + "/leo": "\u264C", + "/leopard": "\u1F406", + "/less": "\u003C", + "/lessbutnotequal": "\u2268", + "/lessbutnotequivalent": "\u22E6", + "/lessdot": "\u22D6", + "/lessequal": "\u2264", + "/lessequalorgreater": "\u22DA", + "/lessmonospace": "\uFF1C", + "/lessorequivalent": "\u2272", + "/lessorgreater": "\u2276", + "/lessoverequal": "\u2266", + "/lesssmall": "\uFE64", + "/levelSlider": "\u1F39A", + "/lezh": "\u026E", + "/lfblock": "\u258C", + "/lhacyr": "\u0515", + "/lhookretroflex": "\u026D", + "/libra": "\u264E", + "/ligaturealeflamed:hb": "\uFB4F", + "/ligatureoemod": "\uA7F9", + "/lightCheckMark": "\u1F5F8", + "/lightRail": "\u1F688", + "/lightShade": "\u2591", + "/lightarcdnleft": "\u256E", + "/lightarcdnright": "\u256D", + "/lightarcupleft": "\u256F", + "/lightarcupright": "\u2570", + "/lightdbldashhorz": "\u254C", + "/lightdbldashvert": "\u254E", + "/lightdiagcross": "\u2573", + "/lightdiagupleftdnright": "\u2572", + "/lightdiaguprightdnleft": "\u2571", + "/lightdn": "\u2577", + "/lightdnhorz": "\u252C", + "/lightdnleft": "\u2510", + "/lightdnright": "\u250C", + "/lighthorz": "\u2500", + "/lightleft": "\u2574", + "/lightleftheavyright": "\u257C", + "/lightning": "\u2607", + "/lightningMood": "\u1F5F2", + "/lightningMoodBubble": "\u1F5F1", + "/lightquaddashhorz": "\u2508", + "/lightquaddashvert": "\u250A", + "/lightright": "\u2576", + "/lighttrpldashhorz": "\u2504", + "/lighttrpldashvert": "\u2506", + "/lightup": "\u2575", + "/lightupheavydn": "\u257D", + "/lightuphorz": "\u2534", + "/lightupleft": "\u2518", + "/lightupright": "\u2514", + "/lightvert": "\u2502", + "/lightverthorz": "\u253C", + "/lightvertleft": "\u2524", + "/lightvertright": "\u251C", + "/lineextensionhorizontal": "\u23AF", + "/lineextensionvertical": "\u23D0", + "/linemiddledotvertical": "\u237F", + "/lineseparator": "\u2028", + "/lingsapada": "\uA9C8", + "/link": "\u1F517", + "/linkedPaperclips": "\u1F587", + "/lips": "\u1F5E2", + "/lipstick": "\u1F484", + "/lira": "\u20A4", + "/litre": "\u2113", + "/livretournois": "\u20B6", + "/liwnarmenian": "\u056C", + "/lj": "\u01C9", + "/ljecyr": "\u0459", + "/ljecyrillic": "\u0459", + "/ljekomicyr": "\u0509", + "/ll": "\uF6C0", + "/lladeva": "\u0933", + "/llagujarati": "\u0AB3", + "/llinebelow": "\u1E3B", + "/llladeva": "\u0934", + "/llvocalicbengali": "\u09E1", + "/llvocalicdeva": "\u0961", + "/llvocalicvowelsignbengali": "\u09E3", + "/llvocalicvowelsigndeva": "\u0963", + "/llwelsh": "\u1EFB", + "/lmacrondot": "\u1E39", + "/lmfullwidth": "\u33D0", + "/lmiddletilde": "\u026B", + "/lmonospace": "\uFF4C", + "/lmsquare": "\u33D0", + "/lnfullwidth": "\u33D1", + "/lochulathai": "\u0E2C", + "/lock": "\u1F512", + "/lockInkPen": "\u1F50F", + "/logfullwidth": "\u33D2", + "/logicaland": "\u2227", + "/logicalandarray": "\u22C0", + "/logicalnot": "\u00AC", + "/logicalnotreversed": "\u2310", + "/logicalor": "\u2228", + "/logicalorarray": "\u22C1", + "/lolingthai": "\u0E25", + "/lollipop": "\u1F36D", + "/longdivision": "\u27CC", + "/longovershortmetrical": "\u23D2", + "/longovertwoshortsmetrical": "\u23D4", + "/longs": "\u017F", + "/longs_t": "\uFB05", + "/longsdot": "\u1E9B", + "/longswithdiagonalstroke": "\u1E9C", + "/longswithhighstroke": "\u1E9D", + "/longtackleft": "\u27DE", + "/longtackright": "\u27DD", + "/losslesssquare": "\u1F1A9", + "/loudlyCryingFace": "\u1F62D", + "/loveHotel": "\u1F3E9", + "/loveLetter": "\u1F48C", + "/lowBrightness": "\u1F505", + "/lowasterisk": "\u204E", + "/lowerFiveEighthsBlock": "\u2585", + "/lowerHalfBlock": "\u2584", + "/lowerLeftBallpointPen": "\u1F58A", + "/lowerLeftCrayon": "\u1F58D", + "/lowerLeftFountainPen": "\u1F58B", + "/lowerLeftPaintbrush": "\u1F58C", + "/lowerLeftPencil": "\u1F589", + "/lowerOneEighthBlock": "\u2581", + "/lowerOneQuarterBlock": "\u2582", + "/lowerRightShadowedWhiteCircle": "\u1F53E", + "/lowerSevenEighthsBlock": "\u2587", + "/lowerThreeEighthsBlock": "\u2583", + "/lowerThreeQuartersBlock": "\u2586", + "/lowercornerdotright": "\u27D3", + "/lowerhalfcircle": "\u25E1", + "/lowerhalfcircleinversewhite": "\u25DB", + "/lowerquadrantcirculararcleft": "\u25DF", + "/lowerquadrantcirculararcright": "\u25DE", + "/lowertriangleleft": "\u25FA", + "/lowertriangleleftblack": "\u25E3", + "/lowertriangleright": "\u25FF", + "/lowertrianglerightblack": "\u25E2", + "/lowideographiccircled": "\u32A6", + "/lowlinecenterline": "\uFE4E", + "/lowlinecmb": "\u0332", + "/lowlinedashed": "\uFE4D", + "/lownumeralsign": "\u0375", + "/lowquotedblprime": "\u301F", + "/lozenge": "\u25CA", + "/lozengedividedbyrulehorizontal": "\u27E0", + "/lozengesquare": "\u2311", + "/lparen": "\u24A7", + "/lparenthesized": "\u24A7", + "/lretroflex": "\u026D", + "/ls": "\u02AA", + "/lslash": "\u0142", + "/lsquare": "\u2113", + "/lstroke": "\uA749", + "/lsuperior": "\uF6EE", + "/lsupmod": "\u02E1", + "/lt:Alpha": "\u2C6D", + "/lt:Alphaturned": "\u2C70", + "/lt:Beta": "\uA7B4", + "/lt:Chi": "\uA7B3", + "/lt:Gamma": "\u0194", + "/lt:Iota": "\u0196", + "/lt:Omega": "\uA7B6", + "/lt:Upsilon": "\u01B1", + "/lt:beta": "\uA7B5", + "/lt:delta": "\u1E9F", + "/lt:omega": "\uA7B7", + "/ltshade": "\u2591", + "/lttr:bet": "\u2136", + "/lttr:dalet": "\u2138", + "/lttr:gimel": "\u2137", + "/lttr:gscript": "\u210A", + "/lturned": "\uA781", + "/ltypeopencircuit": "\u2390", + "/luhurpada": "\uA9C5", + "/lum": "\uA772", + "/lungsipada": "\uA9C9", + "/luthai": "\u0E26", + "/lvocalicbengali": "\u098C", + "/lvocalicdeva": "\u090C", + "/lvocalicvowelsignbengali": "\u09E2", + "/lvocalicvowelsigndeva": "\u0962", + "/lxfullwidth": "\u33D3", + "/lxsquare": "\u33D3", + "/lzed": "\u02AB", + "/m": "\u006D", + "/m.inferior": "\u2098", + "/m2fullwidth": "\u33A1", + "/m3fullwidth": "\u33A5", + "/mabengali": "\u09AE", + "/macirclekatakana": "\u32EE", + "/macron": "\u00AF", + "/macronbelowcmb": "\u0331", + "/macroncmb": "\u0304", + "/macronlowmod": "\u02CD", + "/macronmod": "\u02C9", + "/macronmonospace": "\uFFE3", + "/macute": "\u1E3F", + "/madda": "\u0653", + "/maddaabove": "\u06E4", + "/madeva": "\u092E", + "/madyapada": "\uA9C4", + "/mafullwidth": "\u3383", + "/magujarati": "\u0AAE", + "/magurmukhi": "\u0A2E", + "/mahapakhhebrew": "\u05A4", + "/mahapakhlefthebrew": "\u05A4", + "/mahhasquare": "\u3345", + "/mahiragana": "\u307E", + "/mahpach:hb": "\u05A4", + "/maichattawalowleftthai": "\uF895", + "/maichattawalowrightthai": "\uF894", + "/maichattawathai": "\u0E4B", + "/maichattawaupperleftthai": "\uF893", + "/maieklowleftthai": "\uF88C", + "/maieklowrightthai": "\uF88B", + "/maiekthai": "\u0E48", + "/maiekupperleftthai": "\uF88A", + "/maihanakatleftthai": "\uF884", + "/maihanakatthai": "\u0E31", + "/maikurosquare": "\u3343", + "/mairusquare": "\u3344", + "/maitaikhuleftthai": "\uF889", + "/maitaikhuthai": "\u0E47", + "/maitholowleftthai": "\uF88F", + "/maitholowrightthai": "\uF88E", + "/maithothai": "\u0E49", + "/maithoupperleftthai": "\uF88D", + "/maitrilowleftthai": "\uF892", + "/maitrilowrightthai": "\uF891", + "/maitrithai": "\u0E4A", + "/maitriupperleftthai": "\uF890", + "/maiyamokthai": "\u0E46", + "/makatakana": "\u30DE", + "/makatakanahalfwidth": "\uFF8F", + "/male": "\u2642", + "/malefemale": "\u26A5", + "/maleideographiccircled": "\u329A", + "/malestroke": "\u26A6", + "/malestrokemalefemale": "\u26A7", + "/man": "\u1F468", + "/manAndWomanHoldingHands": "\u1F46B", + "/manDancing": "\u1F57A", + "/manGuaPiMao": "\u1F472", + "/manInBusinessSuitLevitating": "\u1F574", + "/manTurban": "\u1F473", + "/manat": "\u20BC", + "/mansShoe": "\u1F45E", + "/mansyonsquare": "\u3347", + "/mantelpieceClock": "\u1F570", + "/mapleLeaf": "\u1F341", + "/maplighthouse": "\u26EF", + "/maqaf:hb": "\u05BE", + "/maqafhebrew": "\u05BE", + "/marchtelegraph": "\u32C2", + "/mark": "\u061C", + "/markerdottedraisedinterpolation": "\u2E07", + "/markerdottedtransposition": "\u2E08", + "/markerraisedinterpolation": "\u2E06", + "/marknoonghunna": "\u0658", + "/marksChapter": "\u1F545", + "/marriage": "\u26AD", + "/mars": "\u2642", + "/marukusquare": "\u3346", + "/masoraCircle:hb": "\u05AF", + "/masoracirclehebrew": "\u05AF", + "/masquare": "\u3383", + "/masumark": "\u303C", + "/math:bowtie": "\u22C8", + "/math:cuberoot": "\u221B", + "/math:fourthroot": "\u221C", + "/maximize": "\u1F5D6", + "/maytelegraph": "\u32C4", + "/mbfullwidth": "\u3386", + "/mbopomofo": "\u3107", + "/mbsmallfullwidth": "\u33D4", + "/mbsquare": "\u33D4", + "/mcircle": "\u24DC", + "/mcubedsquare": "\u33A5", + "/mdot": "\u1E41", + "/mdotaccent": "\u1E41", + "/mdotbelow": "\u1E43", + "/measuredangle": "\u2221", + "/measuredby": "\u225E", + "/meatOnBone": "\u1F356", + "/mecirclekatakana": "\u32F1", + "/medicineideographiccircled": "\u32A9", + "/mediumShade": "\u2592", + "/mediumcircleblack": "\u26AB", + "/mediumcirclewhite": "\u26AA", + "/mediummathematicalspace": "\u205F", + "/mediumsmallcirclewhite": "\u26AC", + "/meem": "\u0645", + "/meem.fina": "\uFEE2", + "/meem.init": "\uFEE3", + "/meem.init_alefmaksura.fina": "\uFC49", + "/meem.init_hah.fina": "\uFC46", + "/meem.init_hah.medi": "\uFCCF", + "/meem.init_hah.medi_jeem.medi": "\uFD89", + "/meem.init_hah.medi_meem.medi": "\uFD8A", + "/meem.init_jeem.fina": "\uFC45", + "/meem.init_jeem.medi": "\uFCCE", + "/meem.init_jeem.medi_hah.medi": "\uFD8C", + "/meem.init_jeem.medi_khah.medi": "\uFD92", + "/meem.init_jeem.medi_meem.medi": "\uFD8D", + "/meem.init_khah.fina": "\uFC47", + "/meem.init_khah.medi": "\uFCD0", + "/meem.init_khah.medi_jeem.medi": "\uFD8E", + "/meem.init_khah.medi_meem.medi": "\uFD8F", + "/meem.init_meem.fina": "\uFC48", + "/meem.init_meem.medi": "\uFCD1", + "/meem.init_yeh.fina": "\uFC4A", + "/meem.isol": "\uFEE1", + "/meem.medi": "\uFEE4", + "/meem.medi_alef.fina": "\uFC88", + "/meem.medi_hah.medi_yeh.fina": "\uFD8B", + "/meem.medi_jeem.medi_yeh.fina": "\uFDC0", + "/meem.medi_khah.medi_yeh.fina": "\uFDB9", + "/meem.medi_meem.fina": "\uFC89", + "/meem.medi_meem.medi_yeh.fina": "\uFDB1", + "/meemDotAbove": "\u0765", + "/meemDotBelow": "\u0766", + "/meemabove": "\u06E2", + "/meemabove.init": "\u06D8", + "/meemarabic": "\u0645", + "/meembelow": "\u06ED", + "/meemfinalarabic": "\uFEE2", + "/meeminitialarabic": "\uFEE3", + "/meemmedialarabic": "\uFEE4", + "/meemmeeminitialarabic": "\uFCD1", + "/meemmeemisolatedarabic": "\uFC48", + "/meetorusquare": "\u334D", + "/megasquare": "\u334B", + "/megatonsquare": "\u334C", + "/mehiragana": "\u3081", + "/meizierasquare": "\u337E", + "/mekatakana": "\u30E1", + "/mekatakanahalfwidth": "\uFF92", + "/melon": "\u1F348", + "/mem": "\u05DE", + "/mem:hb": "\u05DE", + "/memdagesh": "\uFB3E", + "/memdageshhebrew": "\uFB3E", + "/memhebrew": "\u05DE", + "/memo": "\u1F4DD", + "/memwithdagesh:hb": "\uFB3E", + "/menarmenian": "\u0574", + "/menorahNineBranches": "\u1F54E", + "/menpostSindhi": "\u06FE", + "/mens": "\u1F6B9", + "/mepigraphicinverted": "\uA7FD", + "/mercha:hb": "\u05A5", + "/merchaKefulah:hb": "\u05A6", + "/mercury": "\u263F", + "/merkhahebrew": "\u05A5", + "/merkhakefulahebrew": "\u05A6", + "/merkhakefulalefthebrew": "\u05A6", + "/merkhalefthebrew": "\u05A5", + "/metalideographiccircled": "\u328E", + "/metalideographicparen": "\u322E", + "/meteg:hb": "\u05BD", + "/metro": "\u1F687", + "/mgfullwidth": "\u338E", + "/mhook": "\u0271", + "/mhzfullwidth": "\u3392", + "/mhzsquare": "\u3392", + "/micirclekatakana": "\u32EF", + "/microphone": "\u1F3A4", + "/microscope": "\u1F52C", + "/middledotkatakanahalfwidth": "\uFF65", + "/middot": "\u00B7", + "/mieumacirclekorean": "\u3272", + "/mieumaparenkorean": "\u3212", + "/mieumcirclekorean": "\u3264", + "/mieumkorean": "\u3141", + "/mieumpansioskorean": "\u3170", + "/mieumparenkorean": "\u3204", + "/mieumpieupkorean": "\u316E", + "/mieumsioskorean": "\u316F", + "/mihiragana": "\u307F", + "/mikatakana": "\u30DF", + "/mikatakanahalfwidth": "\uFF90", + "/mikuronsquare": "\u3348", + "/milfullwidth": "\u33D5", + "/militaryMedal": "\u1F396", + "/milkyWay": "\u1F30C", + "/mill": "\u20A5", + "/millionscmbcyr": "\u0489", + "/millisecond": "\u2034", + "/millisecondreversed": "\u2037", + "/minibus": "\u1F690", + "/minidisc": "\u1F4BD", + "/minimize": "\u1F5D5", + "/minus": "\u2212", + "/minus.inferior": "\u208B", + "/minus.superior": "\u207B", + "/minusbelowcmb": "\u0320", + "/minuscircle": "\u2296", + "/minusmod": "\u02D7", + "/minusplus": "\u2213", + "/minussignmod": "\u02D7", + "/minustilde": "\u2242", + "/minute": "\u2032", + "/minutereversed": "\u2035", + "/miribaarusquare": "\u334A", + "/mirisquare": "\u3349", + "/misc:baby": "\u1F476", + "/misc:bell": "\u1F514", + "/misc:dash": "\u1F4A8", + "/misc:decimalseparator": "\u2396", + "/misc:diamondblack": "\u2666", + "/misc:diamondwhite": "\u2662", + "/misc:ear": "\u1F442", + "/misc:om": "\u1F549", + "/misc:ring": "\u1F48D", + "/misra": "\u060F", + "/mlfullwidth": "\u3396", + "/mlonglegturned": "\u0270", + "/mlsquare": "\u3396", + "/mlym:a": "\u0D05", + "/mlym:aa": "\u0D06", + "/mlym:aasign": "\u0D3E", + "/mlym:ai": "\u0D10", + "/mlym:aisign": "\u0D48", + "/mlym:anusvarasign": "\u0D02", + "/mlym:archaicii": "\u0D5F", + "/mlym:au": "\u0D14", + "/mlym:aulength": "\u0D57", + "/mlym:ausign": "\u0D4C", + "/mlym:avagrahasign": "\u0D3D", + "/mlym:ba": "\u0D2C", + "/mlym:bha": "\u0D2D", + "/mlym:ca": "\u0D1A", + "/mlym:candrabindusign": "\u0D01", + "/mlym:cha": "\u0D1B", + "/mlym:circularviramasign": "\u0D3C", + "/mlym:combininganusvaraabovesign": "\u0D00", + "/mlym:da": "\u0D26", + "/mlym:date": "\u0D79", + "/mlym:dda": "\u0D21", + "/mlym:ddha": "\u0D22", + "/mlym:dha": "\u0D27", + "/mlym:dotreph": "\u0D4E", + "/mlym:e": "\u0D0E", + "/mlym:ee": "\u0D0F", + "/mlym:eesign": "\u0D47", + "/mlym:eight": "\u0D6E", + "/mlym:esign": "\u0D46", + "/mlym:five": "\u0D6B", + "/mlym:four": "\u0D6A", + "/mlym:ga": "\u0D17", + "/mlym:gha": "\u0D18", + "/mlym:ha": "\u0D39", + "/mlym:i": "\u0D07", + "/mlym:ii": "\u0D08", + "/mlym:iisign": "\u0D40", + "/mlym:isign": "\u0D3F", + "/mlym:ja": "\u0D1C", + "/mlym:jha": "\u0D1D", + "/mlym:ka": "\u0D15", + "/mlym:kchillu": "\u0D7F", + "/mlym:kha": "\u0D16", + "/mlym:la": "\u0D32", + "/mlym:lchillu": "\u0D7D", + "/mlym:lla": "\u0D33", + "/mlym:llchillu": "\u0D7E", + "/mlym:llla": "\u0D34", + "/mlym:lllchillu": "\u0D56", + "/mlym:llvocal": "\u0D61", + "/mlym:llvocalsign": "\u0D63", + "/mlym:lvocal": "\u0D0C", + "/mlym:lvocalsign": "\u0D62", + "/mlym:ma": "\u0D2E", + "/mlym:mchillu": "\u0D54", + "/mlym:na": "\u0D28", + "/mlym:nchillu": "\u0D7B", + "/mlym:nga": "\u0D19", + "/mlym:nine": "\u0D6F", + "/mlym:nna": "\u0D23", + "/mlym:nnchillu": "\u0D7A", + "/mlym:nnna": "\u0D29", + "/mlym:nya": "\u0D1E", + "/mlym:o": "\u0D12", + "/mlym:one": "\u0D67", + "/mlym:oneeighth": "\u0D77", + "/mlym:onefifth": "\u0D5E", + "/mlym:onefortieth": "\u0D59", + "/mlym:onehalf": "\u0D74", + "/mlym:onehundred": "\u0D71", + "/mlym:oneone-hundred-and-sixtieth": "\u0D58", + "/mlym:onequarter": "\u0D73", + "/mlym:onesixteenth": "\u0D76", + "/mlym:onetenth": "\u0D5C", + "/mlym:onethousand": "\u0D72", + "/mlym:onetwentieth": "\u0D5B", + "/mlym:oo": "\u0D13", + "/mlym:oosign": "\u0D4B", + "/mlym:osign": "\u0D4A", + "/mlym:pa": "\u0D2A", + "/mlym:parasign": "\u0D4F", + "/mlym:pha": "\u0D2B", + "/mlym:ra": "\u0D30", + "/mlym:rra": "\u0D31", + "/mlym:rrchillu": "\u0D7C", + "/mlym:rrvocal": "\u0D60", + "/mlym:rrvocalsign": "\u0D44", + "/mlym:rvocal": "\u0D0B", + "/mlym:rvocalsign": "\u0D43", + "/mlym:sa": "\u0D38", + "/mlym:seven": "\u0D6D", + "/mlym:sha": "\u0D36", + "/mlym:six": "\u0D6C", + "/mlym:ssa": "\u0D37", + "/mlym:ta": "\u0D24", + "/mlym:ten": "\u0D70", + "/mlym:tha": "\u0D25", + "/mlym:three": "\u0D69", + "/mlym:threeeightieths": "\u0D5A", + "/mlym:threequarters": "\u0D75", + "/mlym:threesixteenths": "\u0D78", + "/mlym:threetwentieths": "\u0D5D", + "/mlym:tta": "\u0D1F", + "/mlym:ttha": "\u0D20", + "/mlym:ttta": "\u0D3A", + "/mlym:two": "\u0D68", + "/mlym:u": "\u0D09", + "/mlym:usign": "\u0D41", + "/mlym:uu": "\u0D0A", + "/mlym:uusign": "\u0D42", + "/mlym:va": "\u0D35", + "/mlym:verticalbarviramasign": "\u0D3B", + "/mlym:viramasign": "\u0D4D", + "/mlym:visargasign": "\u0D03", + "/mlym:ya": "\u0D2F", + "/mlym:ychillu": "\u0D55", + "/mlym:zero": "\u0D66", + "/mm2fullwidth": "\u339F", + "/mm3fullwidth": "\u33A3", + "/mmcubedsquare": "\u33A3", + "/mmfullwidth": "\u339C", + "/mmonospace": "\uFF4D", + "/mmsquaredsquare": "\u339F", + "/mobilePhone": "\u1F4F1", + "/mobilePhoneOff": "\u1F4F4", + "/mobilePhoneRightwardsArrowAtLeft": "\u1F4F2", + "/mocirclekatakana": "\u32F2", + "/models": "\u22A7", + "/mohiragana": "\u3082", + "/mohmfullwidth": "\u33C1", + "/mohmsquare": "\u33C1", + "/mokatakana": "\u30E2", + "/mokatakanahalfwidth": "\uFF93", + "/molfullwidth": "\u33D6", + "/molsquare": "\u33D6", + "/momathai": "\u0E21", + "/moneyBag": "\u1F4B0", + "/moneyWings": "\u1F4B8", + "/mong:a": "\u1820", + "/mong:aaligali": "\u1887", + "/mong:ahaligali": "\u1897", + "/mong:ang": "\u1829", + "/mong:angsibe": "\u1862", + "/mong:angtodo": "\u184A", + "/mong:anusvaraonealigali": "\u1880", + "/mong:ba": "\u182A", + "/mong:baludaaligali": "\u1885", + "/mong:baludaaligalithree": "\u1886", + "/mong:batodo": "\u184B", + "/mong:bhamanchualigali": "\u18A8", + "/mong:birga": "\u1800", + "/mong:caaligali": "\u188B", + "/mong:camanchualigali": "\u189C", + "/mong:cha": "\u1834", + "/mong:chasibe": "\u1871", + "/mong:chatodo": "\u1852", + "/mong:chi": "\u1842", + "/mong:colon": "\u1804", + "/mong:comma": "\u1802", + "/mong:commamanchu": "\u1808", + "/mong:cyamanchualigali": "\u18A3", + "/mong:da": "\u1833", + "/mong:daaligali": "\u1891", + "/mong:dagalgaaligali": "\u18A9", + "/mong:damarualigali": "\u1882", + "/mong:dasibe": "\u1869", + "/mong:datodo": "\u1851", + "/mong:ddaaligali": "\u188E", + "/mong:ddhamanchualigali": "\u189F", + "/mong:dhamanchualigali": "\u18A1", + "/mong:dzatodo": "\u185C", + "/mong:e": "\u1821", + "/mong:ee": "\u1827", + "/mong:eight": "\u1818", + "/mong:ellipsis": "\u1801", + "/mong:esibe": "\u185D", + "/mong:etodo": "\u1844", + "/mong:fa": "\u1839", + "/mong:famanchu": "\u1876", + "/mong:fasibe": "\u186B", + "/mong:five": "\u1815", + "/mong:four": "\u1814", + "/mong:fourdots": "\u1805", + "/mong:freevariationselectorone": "\u180B", + "/mong:freevariationselectorthree": "\u180D", + "/mong:freevariationselectortwo": "\u180C", + "/mong:ga": "\u182D", + "/mong:gaasibe": "\u186C", + "/mong:gaatodo": "\u1858", + "/mong:gasibe": "\u1864", + "/mong:gatodo": "\u184E", + "/mong:ghamanchualigali": "\u189A", + "/mong:haa": "\u183E", + "/mong:haasibe": "\u186D", + "/mong:haatodo": "\u1859", + "/mong:hasibe": "\u1865", + "/mong:i": "\u1822", + "/mong:ialigali": "\u1888", + "/mong:imanchu": "\u1873", + "/mong:isibe": "\u185E", + "/mong:itodo": "\u1845", + "/mong:iysibe": "\u185F", + "/mong:ja": "\u1835", + "/mong:jasibe": "\u186A", + "/mong:jatodo": "\u1853", + "/mong:jhamanchualigali": "\u189D", + "/mong:jiatodo": "\u185A", + "/mong:ka": "\u183A", + "/mong:kaaligali": "\u1889", + "/mong:kamanchu": "\u1874", + "/mong:kasibe": "\u1863", + "/mong:katodo": "\u1857", + "/mong:kha": "\u183B", + "/mong:la": "\u182F", + "/mong:lha": "\u1840", + "/mong:lhamanchualigali": "\u18AA", + "/mong:longvowelsigntodo": "\u1843", + "/mong:ma": "\u182E", + "/mong:matodo": "\u184F", + "/mong:na": "\u1828", + "/mong:ngaaligali": "\u188A", + "/mong:ngamanchualigali": "\u189B", + "/mong:niatodo": "\u185B", + "/mong:nine": "\u1819", + "/mong:nirugu": "\u180A", + "/mong:nnaaligali": "\u188F", + "/mong:o": "\u1823", + "/mong:oe": "\u1825", + "/mong:oetodo": "\u1848", + "/mong:one": "\u1811", + "/mong:otodo": "\u1846", + "/mong:pa": "\u182B", + "/mong:paaligali": "\u1892", + "/mong:pasibe": "\u1866", + "/mong:patodo": "\u184C", + "/mong:period": "\u1803", + "/mong:periodmanchu": "\u1809", + "/mong:phaaligali": "\u1893", + "/mong:qa": "\u182C", + "/mong:qatodo": "\u184D", + "/mong:ra": "\u1837", + "/mong:raasibe": "\u1870", + "/mong:ramanchu": "\u1875", + "/mong:sa": "\u1830", + "/mong:seven": "\u1817", + "/mong:sha": "\u1831", + "/mong:shasibe": "\u1867", + "/mong:six": "\u1816", + "/mong:softhyphentodo": "\u1806", + "/mong:ssaaligali": "\u1894", + "/mong:ssamanchualigali": "\u18A2", + "/mong:syllableboundarymarkersibe": "\u1807", + "/mong:ta": "\u1832", + "/mong:taaligali": "\u1890", + "/mong:tamanchualigali": "\u18A0", + "/mong:tasibe": "\u1868", + "/mong:tatodo": "\u1850", + "/mong:tatodoaligali": "\u1898", + "/mong:three": "\u1813", + "/mong:tsa": "\u183C", + "/mong:tsasibe": "\u186E", + "/mong:tsatodo": "\u1854", + "/mong:ttaaligali": "\u188C", + "/mong:ttamanchualigali": "\u189E", + "/mong:tthaaligali": "\u188D", + "/mong:two": "\u1812", + "/mong:u": "\u1824", + "/mong:ualigalihalf": "\u18A6", + "/mong:ubadamaaligali": "\u1883", + "/mong:ubadamaaligaliinverted": "\u1884", + "/mong:ue": "\u1826", + "/mong:uesibe": "\u1860", + "/mong:uetodo": "\u1849", + "/mong:usibe": "\u1861", + "/mong:utodo": "\u1847", + "/mong:visargaonealigali": "\u1881", + "/mong:vowelseparator": "\u180E", + "/mong:wa": "\u1838", + "/mong:watodo": "\u1856", + "/mong:ya": "\u1836", + "/mong:yaaligalihalf": "\u18A7", + "/mong:yatodo": "\u1855", + "/mong:za": "\u183D", + "/mong:zaaligali": "\u1896", + "/mong:zamanchualigali": "\u18A5", + "/mong:zasibe": "\u186F", + "/mong:zero": "\u1810", + "/mong:zhaaligali": "\u1895", + "/mong:zhamanchu": "\u1877", + "/mong:zhamanchualigali": "\u18A4", + "/mong:zhasibe": "\u1872", + "/mong:zhatodoaligali": "\u1899", + "/mong:zhi": "\u1841", + "/mong:zra": "\u183F", + "/monkey": "\u1F412", + "/monkeyFace": "\u1F435", + "/monogramyang": "\u268A", + "/monogramyin": "\u268B", + "/monorail": "\u1F69D", + "/monostable": "\u238D", + "/moodBubble": "\u1F5F0", + "/moonViewingCeremony": "\u1F391", + "/moonideographiccircled": "\u328A", + "/moonideographicparen": "\u322A", + "/moonlilithblack": "\u26B8", + "/mosque": "\u1F54C", + "/motorBoat": "\u1F6E5", + "/motorScooter": "\u1F6F5", + "/motorway": "\u1F6E3", + "/mountFuji": "\u1F5FB", + "/mountain": "\u26F0", + "/mountainBicyclist": "\u1F6B5", + "/mountainCableway": "\u1F6A0", + "/mountainRailway": "\u1F69E", + "/mouse": "\u1F401", + "/mouseFace": "\u1F42D", + "/mouth": "\u1F444", + "/movers2fullwidth": "\u33A8", + "/moversfullwidth": "\u33A7", + "/moverssquare": "\u33A7", + "/moverssquaredsquare": "\u33A8", + "/movieCamera": "\u1F3A5", + "/moyai": "\u1F5FF", + "/mpafullwidth": "\u33AB", + "/mparen": "\u24A8", + "/mparenthesized": "\u24A8", + "/mpasquare": "\u33AB", + "/msfullwidth": "\u33B3", + "/mssquare": "\u33B3", + "/msuperior": "\uF6EF", + "/mturned": "\u026F", + "/mu": "\u00B5", + "/mu.math": "\u00B5", + "/mu1": "\u00B5", + "/muafullwidth": "\u3382", + "/muasquare": "\u3382", + "/muchgreater": "\u226B", + "/muchless": "\u226A", + "/mucirclekatakana": "\u32F0", + "/muffullwidth": "\u338C", + "/mufsquare": "\u338C", + "/mugfullwidth": "\u338D", + "/mugreek": "\u03BC", + "/mugsquare": "\u338D", + "/muhiragana": "\u3080", + "/mukatakana": "\u30E0", + "/mukatakanahalfwidth": "\uFF91", + "/mulfullwidth": "\u3395", + "/mulsquare": "\u3395", + "/multimap": "\u22B8", + "/multimapleft": "\u27DC", + "/multipleMusicalNotes": "\u1F3B6", + "/multiply": "\u00D7", + "/multiset": "\u228C", + "/multisetmultiplication": "\u228D", + "/multisetunion": "\u228E", + "/mum": "\uA773", + "/mumfullwidth": "\u339B", + "/mumsquare": "\u339B", + "/munach:hb": "\u05A3", + "/munahhebrew": "\u05A3", + "/munahlefthebrew": "\u05A3", + "/musfullwidth": "\u33B2", + "/mushroom": "\u1F344", + "/musicalKeyboard": "\u1F3B9", + "/musicalKeyboardJacks": "\u1F398", + "/musicalNote": "\u1F3B5", + "/musicalScore": "\u1F3BC", + "/musicalnote": "\u266A", + "/musicalnotedbl": "\u266B", + "/musicflat": "\u266D", + "/musicflatsign": "\u266D", + "/musicnatural": "\u266E", + "/musicsharp": "\u266F", + "/musicsharpsign": "\u266F", + "/mussquare": "\u33B2", + "/muvfullwidth": "\u33B6", + "/muvsquare": "\u33B6", + "/muwfullwidth": "\u33BC", + "/muwsquare": "\u33BC", + "/mvfullwidth": "\u33B7", + "/mvmegafullwidth": "\u33B9", + "/mvmegasquare": "\u33B9", + "/mvsquare": "\u33B7", + "/mwfullwidth": "\u33BD", + "/mwmegafullwidth": "\u33BF", + "/mwmegasquare": "\u33BF", + "/mwsquare": "\u33BD", + "/n": "\u006E", + "/n.inferior": "\u2099", + "/n.superior": "\u207F", + "/nabengali": "\u09A8", + "/nabla": "\u2207", + "/nacirclekatakana": "\u32E4", + "/nacute": "\u0144", + "/nadeva": "\u0928", + "/nafullwidth": "\u3381", + "/nagujarati": "\u0AA8", + "/nagurmukhi": "\u0A28", + "/nahiragana": "\u306A", + "/nailPolish": "\u1F485", + "/naira": "\u20A6", + "/nakatakana": "\u30CA", + "/nakatakanahalfwidth": "\uFF85", + "/nameBadge": "\u1F4DB", + "/nameideographiccircled": "\u3294", + "/nameideographicparen": "\u3234", + "/namurda": "\uA99F", + "/nand": "\u22BC", + "/nanosquare": "\u3328", + "/napostrophe": "\u0149", + "/narrownobreakspace": "\u202F", + "/nasquare": "\u3381", + "/nationalPark": "\u1F3DE", + "/nationaldigitshapes": "\u206E", + "/nbopomofo": "\u310B", + "/nbspace": "\u00A0", + "/ncaron": "\u0148", + "/ncedilla": "\u0146", + "/ncircle": "\u24DD", + "/ncircumflexbelow": "\u1E4B", + "/ncommaaccent": "\u0146", + "/ncurl": "\u0235", + "/ndescender": "\uA791", + "/ndot": "\u1E45", + "/ndotaccent": "\u1E45", + "/ndotbelow": "\u1E47", + "/necirclekatakana": "\u32E7", + "/necktie": "\u1F454", + "/negatedturnstiledblverticalbarright": "\u22AF", + "/nehiragana": "\u306D", + "/neirapproximatelynoractuallyequal": "\u2247", + "/neirasersetnorequalup": "\u2289", + "/neirasubsetnorequal": "\u2288", + "/neirgreaternorequal": "\u2271", + "/neirgreaternorequivalent": "\u2275", + "/neirgreaternorless": "\u2279", + "/neirlessnorequal": "\u2270", + "/neirlessnorequivalent": "\u2274", + "/neirlessnorgreater": "\u2278", + "/nekatakana": "\u30CD", + "/nekatakanahalfwidth": "\uFF88", + "/neptune": "\u2646", + "/neuter": "\u26B2", + "/neutralFace": "\u1F610", + "/newMoon": "\u1F311", + "/newMoonFace": "\u1F31A", + "/newsheqel": "\u20AA", + "/newsheqelsign": "\u20AA", + "/newspaper": "\u1F4F0", + "/newsquare": "\u1F195", + "/nextpage": "\u2398", + "/nffullwidth": "\u338B", + "/nfsquare": "\u338B", + "/ng.fina": "\uFBD4", + "/ng.init": "\uFBD5", + "/ng.isol": "\uFBD3", + "/ng.medi": "\uFBD6", + "/ngabengali": "\u0999", + "/ngadeva": "\u0919", + "/ngagujarati": "\u0A99", + "/ngagurmukhi": "\u0A19", + "/ngalelet": "\uA98A", + "/ngaleletraswadi": "\uA98B", + "/ngoeh": "\u06B1", + "/ngoeh.fina": "\uFB9B", + "/ngoeh.init": "\uFB9C", + "/ngoeh.isol": "\uFB9A", + "/ngoeh.medi": "\uFB9D", + "/ngonguthai": "\u0E07", + "/ngrave": "\u01F9", + "/ngsquare": "\u1F196", + "/nhiragana": "\u3093", + "/nhookleft": "\u0272", + "/nhookretroflex": "\u0273", + "/nicirclekatakana": "\u32E5", + "/nieunacirclekorean": "\u326F", + "/nieunaparenkorean": "\u320F", + "/nieuncieuckorean": "\u3135", + "/nieuncirclekorean": "\u3261", + "/nieunhieuhkorean": "\u3136", + "/nieunkorean": "\u3134", + "/nieunpansioskorean": "\u3168", + "/nieunparenkorean": "\u3201", + "/nieunsioskorean": "\u3167", + "/nieuntikeutkorean": "\u3166", + "/nightStars": "\u1F303", + "/nightideographiccircled": "\u32B0", + "/nihiragana": "\u306B", + "/nikatakana": "\u30CB", + "/nikatakanahalfwidth": "\uFF86", + "/nikhahitleftthai": "\uF899", + "/nikhahitthai": "\u0E4D", + "/nine": "\u0039", + "/nine.inferior": "\u2089", + "/nine.roman": "\u2168", + "/nine.romansmall": "\u2178", + "/nine.superior": "\u2079", + "/ninearabic": "\u0669", + "/ninebengali": "\u09EF", + "/ninecircle": "\u2468", + "/ninecircledbl": "\u24FD", + "/ninecircleinversesansserif": "\u2792", + "/ninecomma": "\u1F10A", + "/ninedeva": "\u096F", + "/ninefar": "\u06F9", + "/ninegujarati": "\u0AEF", + "/ninegurmukhi": "\u0A6F", + "/ninehackarabic": "\u0669", + "/ninehangzhou": "\u3029", + "/nineideographiccircled": "\u3288", + "/nineideographicparen": "\u3228", + "/nineinferior": "\u2089", + "/ninemonospace": "\uFF19", + "/nineoldstyle": "\uF739", + "/nineparen": "\u247C", + "/nineparenthesized": "\u247C", + "/nineperiod": "\u2490", + "/ninepersian": "\u06F9", + "/nineroman": "\u2178", + "/ninesuperior": "\u2079", + "/nineteencircle": "\u2472", + "/nineteencircleblack": "\u24F3", + "/nineteenparen": "\u2486", + "/nineteenparenthesized": "\u2486", + "/nineteenperiod": "\u249A", + "/ninethai": "\u0E59", + "/nj": "\u01CC", + "/njecyr": "\u045A", + "/njecyrillic": "\u045A", + "/njekomicyr": "\u050B", + "/nkatakana": "\u30F3", + "/nkatakanahalfwidth": "\uFF9D", + "/nlegrightlong": "\u019E", + "/nlinebelow": "\u1E49", + "/nlongrightleg": "\u019E", + "/nmbr:oneeighth": "\u215B", + "/nmbr:onefifth": "\u2155", + "/nmbr:onetenth": "\u2152", + "/nmfullwidth": "\u339A", + "/nmonospace": "\uFF4E", + "/nmsquare": "\u339A", + "/nnabengali": "\u09A3", + "/nnadeva": "\u0923", + "/nnagujarati": "\u0AA3", + "/nnagurmukhi": "\u0A23", + "/nnnadeva": "\u0929", + "/noBicycles": "\u1F6B3", + "/noEntrySign": "\u1F6AB", + "/noMobilePhones": "\u1F4F5", + "/noOneUnderEighteen": "\u1F51E", + "/noPedestrians": "\u1F6B7", + "/noPiracy": "\u1F572", + "/noSmoking": "\u1F6AD", + "/nobliquestroke": "\uA7A5", + "/nocirclekatakana": "\u32E8", + "/nodeascending": "\u260A", + "/nodedescending": "\u260B", + "/noentry": "\u26D4", + "/nohiragana": "\u306E", + "/nokatakana": "\u30CE", + "/nokatakanahalfwidth": "\uFF89", + "/nominaldigitshapes": "\u206F", + "/nonPotableWater": "\u1F6B1", + "/nonbreakinghyphen": "\u2011", + "/nonbreakingspace": "\u00A0", + "/nonenthai": "\u0E13", + "/nonuthai": "\u0E19", + "/noon": "\u0646", + "/noon.fina": "\uFEE6", + "/noon.init": "\uFEE7", + "/noon.init_alefmaksura.fina": "\uFC4F", + "/noon.init_hah.fina": "\uFC4C", + "/noon.init_hah.medi": "\uFCD3", + "/noon.init_hah.medi_meem.medi": "\uFD95", + "/noon.init_heh.medi": "\uFCD6", + "/noon.init_jeem.fina": "\uFC4B", + "/noon.init_jeem.medi": "\uFCD2", + "/noon.init_jeem.medi_hah.medi": "\uFDB8", + "/noon.init_jeem.medi_meem.medi": "\uFD98", + "/noon.init_khah.fina": "\uFC4D", + "/noon.init_khah.medi": "\uFCD4", + "/noon.init_meem.fina": "\uFC4E", + "/noon.init_meem.medi": "\uFCD5", + "/noon.init_yeh.fina": "\uFC50", + "/noon.isol": "\uFEE5", + "/noon.medi": "\uFEE8", + "/noon.medi_alefmaksura.fina": "\uFC8E", + "/noon.medi_hah.medi_alefmaksura.fina": "\uFD96", + "/noon.medi_hah.medi_yeh.fina": "\uFDB3", + "/noon.medi_heh.medi": "\uFCEF", + "/noon.medi_jeem.medi_alefmaksura.fina": "\uFD99", + "/noon.medi_jeem.medi_hah.fina": "\uFDBD", + "/noon.medi_jeem.medi_meem.fina": "\uFD97", + "/noon.medi_jeem.medi_yeh.fina": "\uFDC7", + "/noon.medi_meem.fina": "\uFC8C", + "/noon.medi_meem.medi": "\uFCEE", + "/noon.medi_meem.medi_alefmaksura.fina": "\uFD9B", + "/noon.medi_meem.medi_yeh.fina": "\uFD9A", + "/noon.medi_noon.fina": "\uFC8D", + "/noon.medi_reh.fina": "\uFC8A", + "/noon.medi_yeh.fina": "\uFC8F", + "/noon.medi_zain.fina": "\uFC8B", + "/noonSmallTah": "\u0768", + "/noonSmallV": "\u0769", + "/noonTwoDotsBelow": "\u0767", + "/noonabove": "\u06E8", + "/noonarabic": "\u0646", + "/noondotbelow": "\u06B9", + "/noonfinalarabic": "\uFEE6", + "/noonghunna": "\u06BA", + "/noonghunna.fina": "\uFB9F", + "/noonghunna.isol": "\uFB9E", + "/noonghunnaarabic": "\u06BA", + "/noonghunnafinalarabic": "\uFB9F", + "/noonhehinitialarabic": "\uFEE7", + "/nooninitialarabic": "\uFEE7", + "/noonjeeminitialarabic": "\uFCD2", + "/noonjeemisolatedarabic": "\uFC4B", + "/noonmedialarabic": "\uFEE8", + "/noonmeeminitialarabic": "\uFCD5", + "/noonmeemisolatedarabic": "\uFC4E", + "/noonnoonfinalarabic": "\uFC8D", + "/noonring": "\u06BC", + "/noonthreedotsabove": "\u06BD", + "/nor": "\u22BD", + "/nordicmark": "\u20BB", + "/normalfacrsemidirectproductleft": "\u22C9", + "/normalfacrsemidirectproductright": "\u22CA", + "/normalsubgroorequalup": "\u22B4", + "/normalsubgroup": "\u22B2", + "/northeastPointingAirplane": "\u1F6EA", + "/nose": "\u1F443", + "/notalmostequal": "\u2249", + "/notasersetup": "\u2285", + "/notasympticallyequal": "\u2244", + "/notcheckmark": "\u237B", + "/notchedLeftSemicircleThreeDots": "\u1F543", + "/notchedRightSemicircleThreeDots": "\u1F544", + "/notcontains": "\u220C", + "/note": "\u1F5C8", + "/notePad": "\u1F5CA", + "/notePage": "\u1F5C9", + "/notebook": "\u1F4D3", + "/notebookDecorativeCover": "\u1F4D4", + "/notelement": "\u2209", + "/notelementof": "\u2209", + "/notequal": "\u2260", + "/notequivalent": "\u226D", + "/notexistential": "\u2204", + "/notgreater": "\u226F", + "/notgreaternorequal": "\u2271", + "/notgreaternorless": "\u2279", + "/notidentical": "\u2262", + "/notless": "\u226E", + "/notlessnorequal": "\u2270", + "/notnormalsubgroorequalup": "\u22EC", + "/notnormalsubgroup": "\u22EA", + "/notparallel": "\u2226", + "/notprecedes": "\u2280", + "/notsignturned": "\u2319", + "/notsquareimageorequal": "\u22E2", + "/notsquareoriginalorequal": "\u22E3", + "/notsubset": "\u2284", + "/notsucceeds": "\u2281", + "/notsuperset": "\u2285", + "/nottilde": "\u2241", + "/nottosquare": "\u3329", + "/nottrue": "\u22AD", + "/novembertelegraph": "\u32CA", + "/nowarmenian": "\u0576", + "/nparen": "\u24A9", + "/nparenthesized": "\u24A9", + "/nretroflex": "\u0273", + "/nsfullwidth": "\u33B1", + "/nssquare": "\u33B1", + "/nsuperior": "\u207F", + "/ntilde": "\u00F1", + "/nu": "\u03BD", + "/nucirclekatakana": "\u32E6", + "/nuhiragana": "\u306C", + "/nukatakana": "\u30CC", + "/nukatakanahalfwidth": "\uFF87", + "/nuktabengali": "\u09BC", + "/nuktadeva": "\u093C", + "/nuktagujarati": "\u0ABC", + "/nuktagurmukhi": "\u0A3C", + "/num": "\uA774", + "/numbermarkabove": "\u0605", + "/numbersign": "\u0023", + "/numbersignmonospace": "\uFF03", + "/numbersignsmall": "\uFE5F", + "/numeralsign": "\u0374", + "/numeralsigngreek": "\u0374", + "/numeralsignlowergreek": "\u0375", + "/numero": "\u2116", + "/nun": "\u05E0", + "/nun:hb": "\u05E0", + "/nunHafukha:hb": "\u05C6", + "/nundagesh": "\uFB40", + "/nundageshhebrew": "\uFB40", + "/nunhebrew": "\u05E0", + "/nunwithdagesh:hb": "\uFB40", + "/nutAndBolt": "\u1F529", + "/nvfullwidth": "\u33B5", + "/nvsquare": "\u33B5", + "/nwfullwidth": "\u33BB", + "/nwsquare": "\u33BB", + "/nyabengali": "\u099E", + "/nyadeva": "\u091E", + "/nyagujarati": "\u0A9E", + "/nyagurmukhi": "\u0A1E", + "/nyamurda": "\uA998", + "/nyeh": "\u0683", + "/nyeh.fina": "\uFB77", + "/nyeh.init": "\uFB78", + "/nyeh.isol": "\uFB76", + "/nyeh.medi": "\uFB79", + "/o": "\u006F", + "/o.inferior": "\u2092", + "/oacute": "\u00F3", + "/oangthai": "\u0E2D", + "/obarcyr": "\u04E9", + "/obardieresiscyr": "\u04EB", + "/obarred": "\u0275", + "/obarredcyrillic": "\u04E9", + "/obarreddieresiscyrillic": "\u04EB", + "/obelosdotted": "\u2E13", + "/obengali": "\u0993", + "/obopomofo": "\u311B", + "/obreve": "\u014F", + "/observereye": "\u23FF", + "/ocandradeva": "\u0911", + "/ocandragujarati": "\u0A91", + "/ocandravowelsigndeva": "\u0949", + "/ocandravowelsigngujarati": "\u0AC9", + "/ocaron": "\u01D2", + "/ocircle": "\u24DE", + "/ocirclekatakana": "\u32D4", + "/ocircumflex": "\u00F4", + "/ocircumflexacute": "\u1ED1", + "/ocircumflexdotbelow": "\u1ED9", + "/ocircumflexgrave": "\u1ED3", + "/ocircumflexhoi": "\u1ED5", + "/ocircumflexhookabove": "\u1ED5", + "/ocircumflextilde": "\u1ED7", + "/ocr:bowtie": "\u2445", + "/ocr:dash": "\u2448", + "/octagonalSign": "\u1F6D1", + "/octobertelegraph": "\u32C9", + "/octopus": "\u1F419", + "/ocyr": "\u043E", + "/ocyrillic": "\u043E", + "/odblacute": "\u0151", + "/odblgrave": "\u020D", + "/oden": "\u1F362", + "/odeva": "\u0913", + "/odieresis": "\u00F6", + "/odieresiscyr": "\u04E7", + "/odieresiscyrillic": "\u04E7", + "/odieresismacron": "\u022B", + "/odot": "\u022F", + "/odotbelow": "\u1ECD", + "/odotmacron": "\u0231", + "/oe": "\u0153", + "/oe.fina": "\uFBDA", + "/oe.isol": "\uFBD9", + "/oekirghiz": "\u06C5", + "/oekirghiz.fina": "\uFBE1", + "/oekirghiz.isol": "\uFBE0", + "/oekorean": "\u315A", + "/officeBuilding": "\u1F3E2", + "/ogonek": "\u02DB", + "/ogonekcmb": "\u0328", + "/ograve": "\u00F2", + "/ogravedbl": "\u020D", + "/ogujarati": "\u0A93", + "/oharmenian": "\u0585", + "/ohiragana": "\u304A", + "/ohm": "\u2126", + "/ohminverted": "\u2127", + "/ohoi": "\u1ECF", + "/ohookabove": "\u1ECF", + "/ohorn": "\u01A1", + "/ohornacute": "\u1EDB", + "/ohorndotbelow": "\u1EE3", + "/ohorngrave": "\u1EDD", + "/ohornhoi": "\u1EDF", + "/ohornhookabove": "\u1EDF", + "/ohorntilde": "\u1EE1", + "/ohungarumlaut": "\u0151", + "/ohuparen": "\u321E", + "/oi": "\u01A3", + "/oilDrum": "\u1F6E2", + "/oinvertedbreve": "\u020F", + "/ojeonparen": "\u321D", + "/okHandSign": "\u1F44C", + "/okatakana": "\u30AA", + "/okatakanahalfwidth": "\uFF75", + "/okorean": "\u3157", + "/oksquare": "\u1F197", + "/oldKey": "\u1F5DD", + "/oldPersonalComputer": "\u1F5B3", + "/olderMan": "\u1F474", + "/olderWoman": "\u1F475", + "/ole:hb": "\u05AB", + "/olehebrew": "\u05AB", + "/oloop": "\uA74D", + "/olowringinside": "\u2C7A", + "/omacron": "\u014D", + "/omacronacute": "\u1E53", + "/omacrongrave": "\u1E51", + "/omdeva": "\u0950", + "/omega": "\u03C9", + "/omega1": "\u03D6", + "/omegaacute": "\u1F7D", + "/omegaacuteiotasub": "\u1FF4", + "/omegaasper": "\u1F61", + "/omegaasperacute": "\u1F65", + "/omegaasperacuteiotasub": "\u1FA5", + "/omegaaspergrave": "\u1F63", + "/omegaaspergraveiotasub": "\u1FA3", + "/omegaasperiotasub": "\u1FA1", + "/omegaaspertilde": "\u1F67", + "/omegaaspertildeiotasub": "\u1FA7", + "/omegaclosed": "\u0277", + "/omegacyr": "\u0461", + "/omegacyrillic": "\u0461", + "/omegafunc": "\u2375", + "/omegagrave": "\u1F7C", + "/omegagraveiotasub": "\u1FF2", + "/omegaiotasub": "\u1FF3", + "/omegalatinclosed": "\u0277", + "/omegalenis": "\u1F60", + "/omegalenisacute": "\u1F64", + "/omegalenisacuteiotasub": "\u1FA4", + "/omegalenisgrave": "\u1F62", + "/omegalenisgraveiotasub": "\u1FA2", + "/omegalenisiotasub": "\u1FA0", + "/omegalenistilde": "\u1F66", + "/omegalenistildeiotasub": "\u1FA6", + "/omegaroundcyr": "\u047B", + "/omegaroundcyrillic": "\u047B", + "/omegatilde": "\u1FF6", + "/omegatildeiotasub": "\u1FF7", + "/omegatitlocyr": "\u047D", + "/omegatitlocyrillic": "\u047D", + "/omegatonos": "\u03CE", + "/omegaunderlinefunc": "\u2379", + "/omgujarati": "\u0AD0", + "/omicron": "\u03BF", + "/omicronacute": "\u1F79", + "/omicronasper": "\u1F41", + "/omicronasperacute": "\u1F45", + "/omicronaspergrave": "\u1F43", + "/omicrongrave": "\u1F78", + "/omicronlenis": "\u1F40", + "/omicronlenisacute": "\u1F44", + "/omicronlenisgrave": "\u1F42", + "/omicrontonos": "\u03CC", + "/omonospace": "\uFF4F", + "/onExclamationMarkLeftRightArrowAbove": "\u1F51B", + "/oncomingAutomobile": "\u1F698", + "/oncomingBus": "\u1F68D", + "/oncomingFireEngine": "\u1F6F1", + "/oncomingPoliceCar": "\u1F694", + "/oncomingTaxi": "\u1F696", + "/one": "\u0031", + "/one.inferior": "\u2081", + "/one.roman": "\u2160", + "/one.romansmall": "\u2170", + "/oneButtonMouse": "\u1F5AF", + "/onearabic": "\u0661", + "/onebengali": "\u09E7", + "/onecircle": "\u2460", + "/onecircledbl": "\u24F5", + "/onecircleinversesansserif": "\u278A", + "/onecomma": "\u1F102", + "/onedeva": "\u0967", + "/onedotenleader": "\u2024", + "/onedotovertwodots": "\u2E2B", + "/oneeighth": "\u215B", + "/onefar": "\u06F1", + "/onefitted": "\uF6DC", + "/onefraction": "\u215F", + "/onegujarati": "\u0AE7", + "/onegurmukhi": "\u0A67", + "/onehackarabic": "\u0661", + "/onehalf": "\u00BD", + "/onehangzhou": "\u3021", + "/onehundred.roman": "\u216D", + "/onehundred.romansmall": "\u217D", + "/onehundredthousand.roman": "\u2188", + "/onehundredtwentypsquare": "\u1F1A4", + "/oneideographiccircled": "\u3280", + "/oneideographicparen": "\u3220", + "/oneinferior": "\u2081", + "/onemonospace": "\uFF11", + "/oneninth": "\u2151", + "/onenumeratorbengali": "\u09F4", + "/oneoldstyle": "\uF731", + "/oneparen": "\u2474", + "/oneparenthesized": "\u2474", + "/oneperiod": "\u2488", + "/onepersian": "\u06F1", + "/onequarter": "\u00BC", + "/oneroman": "\u2170", + "/oneseventh": "\u2150", + "/onesixth": "\u2159", + "/onesuperior": "\u00B9", + "/onethai": "\u0E51", + "/onethird": "\u2153", + "/onethousand.roman": "\u216F", + "/onethousand.romansmall": "\u217F", + "/onethousandcd.roman": "\u2180", + "/onsusquare": "\u3309", + "/oo": "\uA74F", + "/oogonek": "\u01EB", + "/oogonekmacron": "\u01ED", + "/oogurmukhi": "\u0A13", + "/oomatragurmukhi": "\u0A4B", + "/oomusquare": "\u330A", + "/oopen": "\u0254", + "/oparen": "\u24AA", + "/oparenthesized": "\u24AA", + "/openBook": "\u1F4D6", + "/openFileFolder": "\u1F4C2", + "/openFolder": "\u1F5C1", + "/openHandsSign": "\u1F450", + "/openLock": "\u1F513", + "/openMailboxLoweredFlag": "\u1F4ED", + "/openMailboxRaisedFlag": "\u1F4EC", + "/openbullet": "\u25E6", + "/openheadarrowleft": "\u21FD", + "/openheadarrowleftright": "\u21FF", + "/openheadarrowright": "\u21FE", + "/opensubset": "\u27C3", + "/opensuperset": "\u27C4", + "/ophiuchus": "\u26CE", + "/opposition": "\u260D", + "/opticalDisc": "\u1F4BF", + "/opticalDiscIcon": "\u1F5B8", + "/option": "\u2325", + "/orangeBook": "\u1F4D9", + "/ordfeminine": "\u00AA", + "/ordmasculine": "\u00BA", + "/ordotinside": "\u27C7", + "/original": "\u22B6", + "/ornateleftparenthesis": "\uFD3E", + "/ornaterightparenthesis": "\uFD3F", + "/orthodoxcross": "\u2626", + "/orthogonal": "\u221F", + "/orya:a": "\u0B05", + "/orya:aa": "\u0B06", + "/orya:aasign": "\u0B3E", + "/orya:ai": "\u0B10", + "/orya:ailengthmark": "\u0B56", + "/orya:aisign": "\u0B48", + "/orya:anusvara": "\u0B02", + "/orya:au": "\u0B14", + "/orya:aulengthmark": "\u0B57", + "/orya:ausign": "\u0B4C", + "/orya:avagraha": "\u0B3D", + "/orya:ba": "\u0B2C", + "/orya:bha": "\u0B2D", + "/orya:ca": "\u0B1A", + "/orya:candrabindu": "\u0B01", + "/orya:cha": "\u0B1B", + "/orya:da": "\u0B26", + "/orya:dda": "\u0B21", + "/orya:ddha": "\u0B22", + "/orya:dha": "\u0B27", + "/orya:e": "\u0B0F", + "/orya:eight": "\u0B6E", + "/orya:esign": "\u0B47", + "/orya:five": "\u0B6B", + "/orya:four": "\u0B6A", + "/orya:fractiononeeighth": "\u0B76", + "/orya:fractiononehalf": "\u0B73", + "/orya:fractiononequarter": "\u0B72", + "/orya:fractiononesixteenth": "\u0B75", + "/orya:fractionthreequarters": "\u0B74", + "/orya:fractionthreesixteenths": "\u0B77", + "/orya:ga": "\u0B17", + "/orya:gha": "\u0B18", + "/orya:ha": "\u0B39", + "/orya:i": "\u0B07", + "/orya:ii": "\u0B08", + "/orya:iisign": "\u0B40", + "/orya:isign": "\u0B3F", + "/orya:isshar": "\u0B70", + "/orya:ja": "\u0B1C", + "/orya:jha": "\u0B1D", + "/orya:ka": "\u0B15", + "/orya:kha": "\u0B16", + "/orya:la": "\u0B32", + "/orya:lla": "\u0B33", + "/orya:llvocal": "\u0B61", + "/orya:llvocalsign": "\u0B63", + "/orya:lvocal": "\u0B0C", + "/orya:lvocalsign": "\u0B62", + "/orya:ma": "\u0B2E", + "/orya:na": "\u0B28", + "/orya:nga": "\u0B19", + "/orya:nine": "\u0B6F", + "/orya:nna": "\u0B23", + "/orya:nukta": "\u0B3C", + "/orya:nya": "\u0B1E", + "/orya:o": "\u0B13", + "/orya:one": "\u0B67", + "/orya:osign": "\u0B4B", + "/orya:pa": "\u0B2A", + "/orya:pha": "\u0B2B", + "/orya:ra": "\u0B30", + "/orya:rha": "\u0B5D", + "/orya:rra": "\u0B5C", + "/orya:rrvocal": "\u0B60", + "/orya:rrvocalsign": "\u0B44", + "/orya:rvocal": "\u0B0B", + "/orya:rvocalsign": "\u0B43", + "/orya:sa": "\u0B38", + "/orya:seven": "\u0B6D", + "/orya:sha": "\u0B36", + "/orya:six": "\u0B6C", + "/orya:ssa": "\u0B37", + "/orya:ta": "\u0B24", + "/orya:tha": "\u0B25", + "/orya:three": "\u0B69", + "/orya:tta": "\u0B1F", + "/orya:ttha": "\u0B20", + "/orya:two": "\u0B68", + "/orya:u": "\u0B09", + "/orya:usign": "\u0B41", + "/orya:uu": "\u0B0A", + "/orya:uusign": "\u0B42", + "/orya:va": "\u0B35", + "/orya:virama": "\u0B4D", + "/orya:visarga": "\u0B03", + "/orya:wa": "\u0B71", + "/orya:ya": "\u0B2F", + "/orya:yya": "\u0B5F", + "/orya:zero": "\u0B66", + "/oscript": "\u2134", + "/oshortdeva": "\u0912", + "/oshortvowelsigndeva": "\u094A", + "/oslash": "\u00F8", + "/oslashacute": "\u01FF", + "/osmallhiragana": "\u3049", + "/osmallkatakana": "\u30A9", + "/osmallkatakanahalfwidth": "\uFF6B", + "/ostroke": "\uA74B", + "/ostrokeacute": "\u01FF", + "/osuperior": "\uF6F0", + "/otcyr": "\u047F", + "/otcyrillic": "\u047F", + "/otilde": "\u00F5", + "/otildeacute": "\u1E4D", + "/otildedieresis": "\u1E4F", + "/otildemacron": "\u022D", + "/ou": "\u0223", + "/oubopomofo": "\u3121", + "/ounce": "\u2125", + "/outboxTray": "\u1F4E4", + "/outerjoinfull": "\u27D7", + "/outerjoinleft": "\u27D5", + "/outerjoinright": "\u27D6", + "/outputpassiveup": "\u2392", + "/overlap": "\u1F5D7", + "/overline": "\u203E", + "/overlinecenterline": "\uFE4A", + "/overlinecmb": "\u0305", + "/overlinedashed": "\uFE49", + "/overlinedblwavy": "\uFE4C", + "/overlinewavy": "\uFE4B", + "/overscore": "\u00AF", + "/ovfullwidth": "\u3375", + "/ovowelsignbengali": "\u09CB", + "/ovowelsigndeva": "\u094B", + "/ovowelsigngujarati": "\u0ACB", + "/ox": "\u1F402", + "/p": "\u0070", + "/p.inferior": "\u209A", + "/paampsfullwidth": "\u3380", + "/paampssquare": "\u3380", + "/paasentosquare": "\u332B", + "/paatusquare": "\u332C", + "/pabengali": "\u09AA", + "/pacerek": "\uA989", + "/package": "\u1F4E6", + "/pacute": "\u1E55", + "/padeva": "\u092A", + "/pafullwidth": "\u33A9", + "/page": "\u1F5CF", + "/pageCircledText": "\u1F5DF", + "/pageCurl": "\u1F4C3", + "/pageFacingUp": "\u1F4C4", + "/pagedown": "\u21DF", + "/pager": "\u1F4DF", + "/pages": "\u1F5D0", + "/pageup": "\u21DE", + "/pagoda": "\u1F6D4", + "/pagujarati": "\u0AAA", + "/pagurmukhi": "\u0A2A", + "/pahiragana": "\u3071", + "/paiyannoithai": "\u0E2F", + "/pakatakana": "\u30D1", + "/palatalizationcyrilliccmb": "\u0484", + "/palatcmbcyr": "\u0484", + "/pallas": "\u26B4", + "/palmTree": "\u1F334", + "/palmbranch": "\u2E19", + "/palochkacyr": "\u04CF", + "/palochkacyrillic": "\u04C0", + "/pamurda": "\uA9A6", + "/pandaFace": "\u1F43C", + "/pangkatpada": "\uA9C7", + "/pangkon": "\uA9C0", + "/pangrangkep": "\uA9CF", + "/pansioskorean": "\u317F", + "/panyangga": "\uA980", + "/paperclip": "\u1F4CE", + "/paragraph": "\u00B6", + "/paragraphos": "\u2E0F", + "/paragraphosforked": "\u2E10", + "/paragraphosforkedreversed": "\u2E11", + "/paragraphseparator": "\u2029", + "/parallel": "\u2225", + "/parallelogramblack": "\u25B0", + "/parallelogramwhite": "\u25B1", + "/parenbottom": "\u23DD", + "/parendblleft": "\u2E28", + "/parendblright": "\u2E29", + "/parenextensionleft": "\u239C", + "/parenextensionright": "\u239F", + "/parenflatleft": "\u27EE", + "/parenflatright": "\u27EF", + "/parenhookupleft": "\u239B", + "/parenhookupright": "\u239E", + "/parenleft": "\u0028", + "/parenleft.inferior": "\u208D", + "/parenleft.superior": "\u207D", + "/parenleftaltonearabic": "\uFD3E", + "/parenleftbt": "\uF8ED", + "/parenleftex": "\uF8EC", + "/parenleftinferior": "\u208D", + "/parenleftmonospace": "\uFF08", + "/parenleftsmall": "\uFE59", + "/parenleftsuperior": "\u207D", + "/parenlefttp": "\uF8EB", + "/parenleftvertical": "\uFE35", + "/parenlowerhookleft": "\u239D", + "/parenlowerhookright": "\u23A0", + "/parenright": "\u0029", + "/parenright.inferior": "\u208E", + "/parenright.superior": "\u207E", + "/parenrightaltonearabic": "\uFD3F", + "/parenrightbt": "\uF8F8", + "/parenrightex": "\uF8F7", + "/parenrightinferior": "\u208E", + "/parenrightmonospace": "\uFF09", + "/parenrightsmall": "\uFE5A", + "/parenrightsuperior": "\u207E", + "/parenrighttp": "\uF8F6", + "/parenrightvertical": "\uFE36", + "/parentop": "\u23DC", + "/partalternationmark": "\u303D", + "/partialdiff": "\u2202", + "/partnership": "\u3250", + "/partyPopper": "\u1F389", + "/paseq:hb": "\u05C0", + "/paseqhebrew": "\u05C0", + "/pashta:hb": "\u0599", + "/pashtahebrew": "\u0599", + "/pasquare": "\u33A9", + "/passengerShip": "\u1F6F3", + "/passivedown": "\u2391", + "/passportControl": "\u1F6C2", + "/patah": "\u05B7", + "/patah11": "\u05B7", + "/patah1d": "\u05B7", + "/patah2a": "\u05B7", + "/patah:hb": "\u05B7", + "/patahhebrew": "\u05B7", + "/patahnarrowhebrew": "\u05B7", + "/patahquarterhebrew": "\u05B7", + "/patahwidehebrew": "\u05B7", + "/pawPrints": "\u1F43E", + "/pawnblack": "\u265F", + "/pawnwhite": "\u2659", + "/pazer:hb": "\u05A1", + "/pazerhebrew": "\u05A1", + "/pbopomofo": "\u3106", + "/pcfullwidth": "\u3376", + "/pcircle": "\u24DF", + "/pdot": "\u1E57", + "/pdotaccent": "\u1E57", + "/pe": "\u05E4", + "/pe:hb": "\u05E4", + "/peace": "\u262E", + "/peach": "\u1F351", + "/pear": "\u1F350", + "/pecyr": "\u043F", + "/pecyrillic": "\u043F", + "/pedagesh": "\uFB44", + "/pedageshhebrew": "\uFB44", + "/pedestrian": "\u1F6B6", + "/peezisquare": "\u333B", + "/pefinaldageshhebrew": "\uFB43", + "/peh.fina": "\uFB57", + "/peh.init": "\uFB58", + "/peh.isol": "\uFB56", + "/peh.medi": "\uFB59", + "/peharabic": "\u067E", + "/peharmenian": "\u057A", + "/pehebrew": "\u05E4", + "/peheh": "\u06A6", + "/peheh.fina": "\uFB6F", + "/peheh.init": "\uFB70", + "/peheh.isol": "\uFB6E", + "/peheh.medi": "\uFB71", + "/pehfinalarabic": "\uFB57", + "/pehinitialarabic": "\uFB58", + "/pehiragana": "\u307A", + "/pehmedialarabic": "\uFB59", + "/pehookcyr": "\u04A7", + "/pekatakana": "\u30DA", + "/pemiddlehookcyrillic": "\u04A7", + "/penOverStampedEnvelope": "\u1F586", + "/pengkalconsonant": "\uA9BE", + "/penguin": "\u1F427", + "/penihisquare": "\u3338", + "/pensiveFace": "\u1F614", + "/pensusquare": "\u333A", + "/pentagram": "\u26E4", + "/pentasememetrical": "\u23D9", + "/pepetvowel": "\uA9BC", + "/per": "\u214C", + "/perafehebrew": "\uFB4E", + "/percent": "\u0025", + "/percentarabic": "\u066A", + "/percentmonospace": "\uFF05", + "/percentsmall": "\uFE6A", + "/percussivebidental": "\u02AD", + "/percussivebilabial": "\u02AC", + "/performingArts": "\u1F3AD", + "/period": "\u002E", + "/periodarmenian": "\u0589", + "/periodcentered": "\u00B7", + "/periodhalfwidth": "\uFF61", + "/periodinferior": "\uF6E7", + "/periodmonospace": "\uFF0E", + "/periodsmall": "\uFE52", + "/periodsuperior": "\uF6E8", + "/periodurdu": "\u06D4", + "/perispomenigreekcmb": "\u0342", + "/permanentpaper": "\u267E", + "/permille": "\u0609", + "/perpendicular": "\u22A5", + "/perseveringFace": "\u1F623", + "/personBlondHair": "\u1F471", + "/personBowingDeeply": "\u1F647", + "/personFrowning": "\u1F64D", + "/personRaisingBothHandsInCelebration": "\u1F64C", + "/personWithFoldedHands": "\u1F64F", + "/personWithPoutingFace": "\u1F64E", + "/personalComputer": "\u1F4BB", + "/personball": "\u26F9", + "/perspective": "\u2306", + "/pertenthousandsign": "\u2031", + "/perthousand": "\u2030", + "/peseta": "\u20A7", + "/peso": "\u20B1", + "/pesosquare": "\u3337", + "/petailcyr": "\u0525", + "/pewithdagesh:hb": "\uFB44", + "/pewithrafe:hb": "\uFB4E", + "/pffullwidth": "\u338A", + "/pflourish": "\uA753", + "/pfsquare": "\u338A", + "/phabengali": "\u09AB", + "/phadeva": "\u092B", + "/phagujarati": "\u0AAB", + "/phagurmukhi": "\u0A2B", + "/pharyngealvoicedfricative": "\u0295", + "/phfullwidth": "\u33D7", + "/phi": "\u03C6", + "/phi.math": "\u03D5", + "/phi1": "\u03D5", + "/phieuphacirclekorean": "\u327A", + "/phieuphaparenkorean": "\u321A", + "/phieuphcirclekorean": "\u326C", + "/phieuphkorean": "\u314D", + "/phieuphparenkorean": "\u320C", + "/philatin": "\u0278", + "/phinthuthai": "\u0E3A", + "/phisymbolgreek": "\u03D5", + "/phitailless": "\u2C77", + "/phon:AEsmall": "\u1D01", + "/phon:Aemod": "\u1D2D", + "/phon:Amod": "\u1D2C", + "/phon:Asmall": "\u1D00", + "/phon:Bbarmod": "\u1D2F", + "/phon:Bbarsmall": "\u1D03", + "/phon:Bmod": "\u1D2E", + "/phon:Csmall": "\u1D04", + "/phon:Dmod": "\u1D30", + "/phon:Dsmall": "\u1D05", + "/phon:ENcyrmod": "\u1D78", + "/phon:Elsmallcyr": "\u1D2B", + "/phon:Emod": "\u1D31", + "/phon:Ereversedmod": "\u1D32", + "/phon:Esmall": "\u1D07", + "/phon:Ethsmall": "\u1D06", + "/phon:Ezhsmall": "\u1D23", + "/phon:Gmod": "\u1D33", + "/phon:Hmod": "\u1D34", + "/phon:Imod": "\u1D35", + "/phon:Ismallmod": "\u1DA6", + "/phon:Ismallstroke": "\u1D7B", + "/phon:Istrokesmallmod": "\u1DA7", + "/phon:Jmod": "\u1D36", + "/phon:Jsmall": "\u1D0A", + "/phon:Kmod": "\u1D37", + "/phon:Ksmall": "\u1D0B", + "/phon:Lmod": "\u1D38", + "/phon:Lsmallmod": "\u1DAB", + "/phon:Lsmallstroke": "\u1D0C", + "/phon:Mmod": "\u1D39", + "/phon:Msmall": "\u1D0D", + "/phon:Nmod": "\u1D3A", + "/phon:Nreversedmod": "\u1D3B", + "/phon:Nsmallmod": "\u1DB0", + "/phon:Nsmallreversed": "\u1D0E", + "/phon:OUsmall": "\u1D15", + "/phon:Omod": "\u1D3C", + "/phon:Oopensmall": "\u1D10", + "/phon:Osmall": "\u1D0F", + "/phon:Oumod": "\u1D3D", + "/phon:Pmod": "\u1D3E", + "/phon:Psmall": "\u1D18", + "/phon:Rmod": "\u1D3F", + "/phon:Rsmallreversed": "\u1D19", + "/phon:Rsmallturned": "\u1D1A", + "/phon:Tmod": "\u1D40", + "/phon:Tsmall": "\u1D1B", + "/phon:Umod": "\u1D41", + "/phon:Usmall": "\u1D1C", + "/phon:Usmallmod": "\u1DB8", + "/phon:Usmallstroke": "\u1D7E", + "/phon:Vsmall": "\u1D20", + "/phon:Wmod": "\u1D42", + "/phon:Wsmall": "\u1D21", + "/phon:Zsmall": "\u1D22", + "/phon:aeturned": "\u1D02", + "/phon:aeturnedmod": "\u1D46", + "/phon:ain": "\u1D25", + "/phon:ainmod": "\u1D5C", + "/phon:alphamod": "\u1D45", + "/phon:alpharetroflexhook": "\u1D90", + "/phon:alphaturnedmod": "\u1D9B", + "/phon:amod": "\u1D43", + "/phon:aretroflexhook": "\u1D8F", + "/phon:aturnedmod": "\u1D44", + "/phon:betamod": "\u1D5D", + "/phon:bmiddletilde": "\u1D6C", + "/phon:bmod": "\u1D47", + "/phon:bpalatalhook": "\u1D80", + "/phon:ccurlmod": "\u1D9D", + "/phon:chimod": "\u1D61", + "/phon:cmod": "\u1D9C", + "/phon:deltamod": "\u1D5F", + "/phon:dhooktail": "\u1D91", + "/phon:dmiddletilde": "\u1D6D", + "/phon:dmod": "\u1D48", + "/phon:dotlessjstrokemod": "\u1DA1", + "/phon:dpalatalhook": "\u1D81", + "/phon:emod": "\u1D49", + "/phon:engmod": "\u1D51", + "/phon:eopenmod": "\u1D4B", + "/phon:eopenretroflexhook": "\u1D93", + "/phon:eopenreversedmod": "\u1D9F", + "/phon:eopenreversedretroflexhook": "\u1D94", + "/phon:eopenturned": "\u1D08", + "/phon:eopenturnedmod": "\u1D4C", + "/phon:eretroflexhook": "\u1D92", + "/phon:eshmod": "\u1DB4", + "/phon:eshpalatalhook": "\u1D8B", + "/phon:eshretroflexhook": "\u1D98", + "/phon:ethmod": "\u1D9E", + "/phon:ezhmod": "\u1DBE", + "/phon:ezhretroflexhook": "\u1D9A", + "/phon:fmiddletilde": "\u1D6E", + "/phon:fmod": "\u1DA0", + "/phon:fpalatalhook": "\u1D82", + "/phon:ginsular": "\u1D79", + "/phon:gmod": "\u1D4D", + "/phon:gpalatalhook": "\u1D83", + "/phon:gr:Gammasmall": "\u1D26", + "/phon:gr:Lambdasmall": "\u1D27", + "/phon:gr:Pismall": "\u1D28", + "/phon:gr:Psismall": "\u1D2A", + "/phon:gr:RsmallHO": "\u1D29", + "/phon:gr:betasubscript": "\u1D66", + "/phon:gr:chisubscript": "\u1D6A", + "/phon:gr:gammamod": "\u1D5E", + "/phon:gr:gammasubscript": "\u1D67", + "/phon:gr:phimod": "\u1D60", + "/phon:gr:phisubscript": "\u1D69", + "/phon:gr:rhosubscript": "\u1D68", + "/phon:gscriptmod": "\u1DA2", + "/phon:gturned": "\u1D77", + "/phon:hturnedmod": "\u1DA3", + "/phon:iotamod": "\u1DA5", + "/phon:iotastroke": "\u1D7C", + "/phon:iretroflexhook": "\u1D96", + "/phon:istrokemod": "\u1DA4", + "/phon:isubscript": "\u1D62", + "/phon:iturned": "\u1D09", + "/phon:iturnedmod": "\u1D4E", + "/phon:jcrossedtailmod": "\u1DA8", + "/phon:kmod": "\u1D4F", + "/phon:kpalatalhook": "\u1D84", + "/phon:lpalatalhook": "\u1D85", + "/phon:lpalatalhookmod": "\u1DAA", + "/phon:lretroflexhookmod": "\u1DA9", + "/phon:mhookmod": "\u1DAC", + "/phon:mlonglegturnedmod": "\u1DAD", + "/phon:mmiddletilde": "\u1D6F", + "/phon:mmod": "\u1D50", + "/phon:mpalatalhook": "\u1D86", + "/phon:mturnedmod": "\u1D5A", + "/phon:mturnedsideways": "\u1D1F", + "/phon:nlefthookmod": "\u1DAE", + "/phon:nmiddletilde": "\u1D70", + "/phon:npalatalhook": "\u1D87", + "/phon:nretroflexhookmod": "\u1DAF", + "/phon:obarmod": "\u1DB1", + "/phon:obottomhalf": "\u1D17", + "/phon:obottomhalfmod": "\u1D55", + "/phon:oeturned": "\u1D14", + "/phon:omod": "\u1D52", + "/phon:oopenmod": "\u1D53", + "/phon:oopenretroflexhook": "\u1D97", + "/phon:oopensideways": "\u1D12", + "/phon:osideways": "\u1D11", + "/phon:ostrokesideways": "\u1D13", + "/phon:otophalf": "\u1D16", + "/phon:otophalfmod": "\u1D54", + "/phon:phimod": "\u1DB2", + "/phon:pmiddletilde": "\u1D71", + "/phon:pmod": "\u1D56", + "/phon:ppalatalhook": "\u1D88", + "/phon:pstroke": "\u1D7D", + "/phon:rfishmiddletilde": "\u1D73", + "/phon:rmiddletilde": "\u1D72", + "/phon:rpalatalhook": "\u1D89", + "/phon:rsubscript": "\u1D63", + "/phon:schwamod": "\u1D4A", + "/phon:schwaretroflexhook": "\u1D95", + "/phon:shookmod": "\u1DB3", + "/phon:smiddletilde": "\u1D74", + "/phon:spalatalhook": "\u1D8A", + "/phon:spirantvoicedlaryngeal": "\u1D24", + "/phon:thetamod": "\u1DBF", + "/phon:thstrike": "\u1D7A", + "/phon:tmiddletilde": "\u1D75", + "/phon:tmod": "\u1D57", + "/phon:tpalatalhookmod": "\u1DB5", + "/phon:ubarmod": "\u1DB6", + "/phon:ue": "\u1D6B", + "/phon:umod": "\u1D58", + "/phon:upsilonmod": "\u1DB7", + "/phon:upsilonstroke": "\u1D7F", + "/phon:uretroflexhook": "\u1D99", + "/phon:usideways": "\u1D1D", + "/phon:usidewaysdieresised": "\u1D1E", + "/phon:usidewaysmod": "\u1D59", + "/phon:usubscript": "\u1D64", + "/phon:vhookmod": "\u1DB9", + "/phon:vmod": "\u1D5B", + "/phon:vpalatalhook": "\u1D8C", + "/phon:vsubscript": "\u1D65", + "/phon:vturnedmod": "\u1DBA", + "/phon:xpalatalhook": "\u1D8D", + "/phon:zcurlmod": "\u1DBD", + "/phon:zmiddletilde": "\u1D76", + "/phon:zmod": "\u1DBB", + "/phon:zpalatalhook": "\u1D8E", + "/phon:zretroflexhookmod": "\u1DBC", + "/phook": "\u01A5", + "/phophanthai": "\u0E1E", + "/phophungthai": "\u0E1C", + "/phosamphaothai": "\u0E20", + "/pi": "\u03C0", + "/pi.math": "\u03D6", + "/piasutorusquare": "\u332E", + "/pick": "\u26CF", + "/pidblstruck": "\u213C", + "/pieupacirclekorean": "\u3273", + "/pieupaparenkorean": "\u3213", + "/pieupcieuckorean": "\u3176", + "/pieupcirclekorean": "\u3265", + "/pieupkiyeokkorean": "\u3172", + "/pieupkorean": "\u3142", + "/pieupparenkorean": "\u3205", + "/pieupsioskiyeokkorean": "\u3174", + "/pieupsioskorean": "\u3144", + "/pieupsiostikeutkorean": "\u3175", + "/pieupthieuthkorean": "\u3177", + "/pieuptikeutkorean": "\u3173", + "/pig": "\u1F416", + "/pigFace": "\u1F437", + "/pigNose": "\u1F43D", + "/pihiragana": "\u3074", + "/pikatakana": "\u30D4", + "/pikosquare": "\u3330", + "/pikurusquare": "\u332F", + "/pilcrowsignreversed": "\u204B", + "/pileOfPoo": "\u1F4A9", + "/pill": "\u1F48A", + "/pineDecoration": "\u1F38D", + "/pineapple": "\u1F34D", + "/pisces": "\u2653", + "/piselehpada": "\uA9CC", + "/pistol": "\u1F52B", + "/pisymbolgreek": "\u03D6", + "/pitchfork": "\u22D4", + "/piwrarmenian": "\u0583", + "/placeOfWorship": "\u1F6D0", + "/placeofinterestsign": "\u2318", + "/planck": "\u210E", + "/plancktwopi": "\u210F", + "/plus": "\u002B", + "/plus.inferior": "\u208A", + "/plus.superior": "\u207A", + "/plusbelowcmb": "\u031F", + "/pluscircle": "\u2295", + "/plusminus": "\u00B1", + "/plusmod": "\u02D6", + "/plusmonospace": "\uFF0B", + "/plussignalt:hb": "\uFB29", + "/plussignmod": "\u02D6", + "/plussmall": "\uFE62", + "/plussuperior": "\u207A", + "/pluto": "\u2647", + "/pmfullwidth": "\u33D8", + "/pmonospace": "\uFF50", + "/pmsquare": "\u33D8", + "/pocketCalculator": "\u1F5A9", + "/poeticverse": "\u060E", + "/pohiragana": "\u307D", + "/pointerleftblack": "\u25C4", + "/pointerleftwhite": "\u25C5", + "/pointerrightblack": "\u25BA", + "/pointerrightwhite": "\u25BB", + "/pointingindexdownwhite": "\u261F", + "/pointingindexleftblack": "\u261A", + "/pointingindexleftwhite": "\u261C", + "/pointingindexrightblack": "\u261B", + "/pointingindexrightwhite": "\u261E", + "/pointingindexupwhite": "\u261D", + "/pointingtriangledownheavywhite": "\u26DB", + "/pointosquare": "\u333D", + "/pointring": "\u2E30", + "/pokatakana": "\u30DD", + "/pokrytiecmbcyr": "\u0487", + "/policeCar": "\u1F693", + "/policeCarsRevolvingLight": "\u1F6A8", + "/policeOfficer": "\u1F46E", + "/pondosquare": "\u3340", + "/poodle": "\u1F429", + "/popcorn": "\u1F37F", + "/popdirectionalformatting": "\u202C", + "/popdirectionalisolate": "\u2069", + "/poplathai": "\u0E1B", + "/portableStereo": "\u1F4FE", + "/positionindicator": "\u2316", + "/postalHorn": "\u1F4EF", + "/postalmark": "\u3012", + "/postalmarkface": "\u3020", + "/postbox": "\u1F4EE", + "/potOfFood": "\u1F372", + "/potableWater": "\u1F6B0", + "/pouch": "\u1F45D", + "/poultryLeg": "\u1F357", + "/poutingCatFace": "\u1F63E", + "/poutingFace": "\u1F621", + "/power": "\u23FB", + "/poweron": "\u23FD", + "/poweronoff": "\u23FC", + "/powersleep": "\u23FE", + "/pparen": "\u24AB", + "/pparenthesized": "\u24AB", + "/ppmfullwidth": "\u33D9", + "/prayerBeads": "\u1F4FF", + "/precedes": "\u227A", + "/precedesbutnotequivalent": "\u22E8", + "/precedesorequal": "\u227C", + "/precedesorequivalent": "\u227E", + "/precedesunderrelation": "\u22B0", + "/prescription": "\u211E", + "/preversedepigraphic": "\uA7FC", + "/previouspage": "\u2397", + "/prfullwidth": "\u33DA", + "/primedblmod": "\u02BA", + "/primemod": "\u02B9", + "/primereversed": "\u2035", + "/princess": "\u1F478", + "/printer": "\u1F5A8", + "/printerIcon": "\u1F5B6", + "/printideographiccircled": "\u329E", + "/printscreen": "\u2399", + "/product": "\u220F", + "/prohibitedSign": "\u1F6C7", + "/projective": "\u2305", + "/prolongedkana": "\u30FC", + "/propellor": "\u2318", + "/propersubset": "\u2282", + "/propersuperset": "\u2283", + "/propertyline": "\u214A", + "/proportion": "\u2237", + "/proportional": "\u221D", + "/psfullwidth": "\u33B0", + "/psi": "\u03C8", + "/psicyr": "\u0471", + "/psicyrillic": "\u0471", + "/psilicmbcyr": "\u0486", + "/psilipneumatacyrilliccmb": "\u0486", + "/pssquare": "\u33B0", + "/pstrokedescender": "\uA751", + "/ptail": "\uA755", + "/publicAddressLoudspeaker": "\u1F4E2", + "/puhiragana": "\u3077", + "/pukatakana": "\u30D7", + "/punctuationspace": "\u2008", + "/purpleHeart": "\u1F49C", + "/purse": "\u1F45B", + "/pushpin": "\u1F4CC", + "/putLitterInItsPlace": "\u1F6AE", + "/pvfullwidth": "\u33B4", + "/pvsquare": "\u33B4", + "/pwfullwidth": "\u33BA", + "/pwsquare": "\u33BA", + "/q": "\u0071", + "/qacyr": "\u051B", + "/qadeva": "\u0958", + "/qadma:hb": "\u05A8", + "/qadmahebrew": "\u05A8", + "/qaf": "\u0642", + "/qaf.fina": "\uFED6", + "/qaf.init": "\uFED7", + "/qaf.init_alefmaksura.fina": "\uFC35", + "/qaf.init_hah.fina": "\uFC33", + "/qaf.init_hah.medi": "\uFCC2", + "/qaf.init_meem.fina": "\uFC34", + "/qaf.init_meem.medi": "\uFCC3", + "/qaf.init_meem.medi_hah.medi": "\uFDB4", + "/qaf.init_yeh.fina": "\uFC36", + "/qaf.isol": "\uFED5", + "/qaf.medi": "\uFED8", + "/qaf.medi_alefmaksura.fina": "\uFC7E", + "/qaf.medi_meem.medi_hah.fina": "\uFD7E", + "/qaf.medi_meem.medi_meem.fina": "\uFD7F", + "/qaf.medi_meem.medi_yeh.fina": "\uFDB2", + "/qaf.medi_yeh.fina": "\uFC7F", + "/qaf_lam_alefmaksuraabove": "\u06D7", + "/qafarabic": "\u0642", + "/qafdotabove": "\u06A7", + "/qaffinalarabic": "\uFED6", + "/qafinitialarabic": "\uFED7", + "/qafmedialarabic": "\uFED8", + "/qafthreedotsabove": "\u06A8", + "/qamats": "\u05B8", + "/qamats10": "\u05B8", + "/qamats1a": "\u05B8", + "/qamats1c": "\u05B8", + "/qamats27": "\u05B8", + "/qamats29": "\u05B8", + "/qamats33": "\u05B8", + "/qamats:hb": "\u05B8", + "/qamatsQatan:hb": "\u05C7", + "/qamatsde": "\u05B8", + "/qamatshebrew": "\u05B8", + "/qamatsnarrowhebrew": "\u05B8", + "/qamatsqatanhebrew": "\u05B8", + "/qamatsqatannarrowhebrew": "\u05B8", + "/qamatsqatanquarterhebrew": "\u05B8", + "/qamatsqatanwidehebrew": "\u05B8", + "/qamatsquarterhebrew": "\u05B8", + "/qamatswidehebrew": "\u05B8", + "/qarneFarah:hb": "\u059F", + "/qarneyparahebrew": "\u059F", + "/qbopomofo": "\u3111", + "/qcircle": "\u24E0", + "/qdiagonalstroke": "\uA759", + "/qhook": "\u02A0", + "/qhooktail": "\u024B", + "/qmonospace": "\uFF51", + "/qof": "\u05E7", + "/qof:hb": "\u05E7", + "/qofdagesh": "\uFB47", + "/qofdageshhebrew": "\uFB47", + "/qofhatafpatah": "\u05E7", + "/qofhatafpatahhebrew": "\u05E7", + "/qofhatafsegol": "\u05E7", + "/qofhatafsegolhebrew": "\u05E7", + "/qofhebrew": "\u05E7", + "/qofhiriq": "\u05E7", + "/qofhiriqhebrew": "\u05E7", + "/qofholam": "\u05E7", + "/qofholamhebrew": "\u05E7", + "/qofpatah": "\u05E7", + "/qofpatahhebrew": "\u05E7", + "/qofqamats": "\u05E7", + "/qofqamatshebrew": "\u05E7", + "/qofqubuts": "\u05E7", + "/qofqubutshebrew": "\u05E7", + "/qofsegol": "\u05E7", + "/qofsegolhebrew": "\u05E7", + "/qofsheva": "\u05E7", + "/qofshevahebrew": "\u05E7", + "/qoftsere": "\u05E7", + "/qoftserehebrew": "\u05E7", + "/qofwithdagesh:hb": "\uFB47", + "/qparen": "\u24AC", + "/qparenthesized": "\u24AC", + "/qpdigraph": "\u0239", + "/qstrokedescender": "\uA757", + "/quadarrowdownfunc": "\u2357", + "/quadarrowleftfunc": "\u2347", + "/quadarrowrightfunc": "\u2348", + "/quadarrowupfunc": "\u2350", + "/quadbackslashfunc": "\u2342", + "/quadcaretdownfunc": "\u234C", + "/quadcaretupfunc": "\u2353", + "/quadcirclefunc": "\u233C", + "/quadcolonfunc": "\u2360", + "/quaddelfunc": "\u2354", + "/quaddeltafunc": "\u234D", + "/quaddiamondfunc": "\u233A", + "/quaddividefunc": "\u2339", + "/quadequalfunc": "\u2338", + "/quadfunc": "\u2395", + "/quadgreaterfunc": "\u2344", + "/quadjotfunc": "\u233B", + "/quadlessfunc": "\u2343", + "/quadnotequalfunc": "\u236F", + "/quadquestionfunc": "\u2370", + "/quadrantLowerLeft": "\u2596", + "/quadrantLowerRight": "\u2597", + "/quadrantUpperLeft": "\u2598", + "/quadrantUpperLeftAndLowerLeftAndLowerRight": "\u2599", + "/quadrantUpperLeftAndLowerRight": "\u259A", + "/quadrantUpperLeftAndUpperRightAndLowerLeft": "\u259B", + "/quadrantUpperLeftAndUpperRightAndLowerRight": "\u259C", + "/quadrantUpperRight": "\u259D", + "/quadrantUpperRightAndLowerLeft": "\u259E", + "/quadrantUpperRightAndLowerLeftAndLowerRight": "\u259F", + "/quadrupleminute": "\u2057", + "/quadslashfunc": "\u2341", + "/quarternote": "\u2669", + "/qubuts": "\u05BB", + "/qubuts18": "\u05BB", + "/qubuts25": "\u05BB", + "/qubuts31": "\u05BB", + "/qubuts:hb": "\u05BB", + "/qubutshebrew": "\u05BB", + "/qubutsnarrowhebrew": "\u05BB", + "/qubutsquarterhebrew": "\u05BB", + "/qubutswidehebrew": "\u05BB", + "/queenblack": "\u265B", + "/queenwhite": "\u2655", + "/question": "\u003F", + "/questionarabic": "\u061F", + "/questionarmenian": "\u055E", + "/questiondbl": "\u2047", + "/questiondown": "\u00BF", + "/questiondownsmall": "\uF7BF", + "/questionedequal": "\u225F", + "/questionexclamationmark": "\u2048", + "/questiongreek": "\u037E", + "/questionideographiccircled": "\u3244", + "/questionmonospace": "\uFF1F", + "/questionreversed": "\u2E2E", + "/questionsmall": "\uF73F", + "/quincunx": "\u26BB", + "/quotedbl": "\u0022", + "/quotedblbase": "\u201E", + "/quotedblleft": "\u201C", + "/quotedbllowreversed": "\u2E42", + "/quotedblmonospace": "\uFF02", + "/quotedblprime": "\u301E", + "/quotedblprimereversed": "\u301D", + "/quotedblreversed": "\u201F", + "/quotedblright": "\u201D", + "/quoteleft": "\u2018", + "/quoteleftreversed": "\u201B", + "/quotequadfunc": "\u235E", + "/quotereversed": "\u201B", + "/quoteright": "\u2019", + "/quoterightn": "\u0149", + "/quotesinglbase": "\u201A", + "/quotesingle": "\u0027", + "/quotesinglemonospace": "\uFF07", + "/quoteunderlinefunc": "\u2358", + "/r": "\u0072", + "/raagung": "\uA9AC", + "/raarmenian": "\u057C", + "/rabbit": "\u1F407", + "/rabbitFace": "\u1F430", + "/rabengali": "\u09B0", + "/racingCar": "\u1F3CE", + "/racingMotorcycle": "\u1F3CD", + "/racirclekatakana": "\u32F6", + "/racute": "\u0155", + "/radeva": "\u0930", + "/radfullwidth": "\u33AD", + "/radical": "\u221A", + "/radicalbottom": "\u23B7", + "/radicalex": "\uF8E5", + "/radio": "\u1F4FB", + "/radioButton": "\u1F518", + "/radioactive": "\u2622", + "/radovers2fullwidth": "\u33AF", + "/radoversfullwidth": "\u33AE", + "/radoverssquare": "\u33AE", + "/radoverssquaredsquare": "\u33AF", + "/radsquare": "\u33AD", + "/rafe": "\u05BF", + "/rafe:hb": "\u05BF", + "/rafehebrew": "\u05BF", + "/ragujarati": "\u0AB0", + "/ragurmukhi": "\u0A30", + "/rahiragana": "\u3089", + "/railwayCar": "\u1F683", + "/railwayTrack": "\u1F6E4", + "/rain": "\u26C6", + "/rainbow": "\u1F308", + "/raisedHandFingersSplayed": "\u1F590", + "/raisedHandPartBetweenMiddleAndRingFingers": "\u1F596", + "/raisedmcsign": "\u1F16A", + "/raisedmdsign": "\u1F16B", + "/rakatakana": "\u30E9", + "/rakatakanahalfwidth": "\uFF97", + "/ralowerdiagonalbengali": "\u09F1", + "/ram": "\u1F40F", + "/ramiddlediagonalbengali": "\u09F0", + "/ramshorn": "\u0264", + "/rat": "\u1F400", + "/ratio": "\u2236", + "/ray": "\u0608", + "/rbopomofo": "\u3116", + "/rcaron": "\u0159", + "/rcedilla": "\u0157", + "/rcircle": "\u24E1", + "/rcommaaccent": "\u0157", + "/rdblgrave": "\u0211", + "/rdot": "\u1E59", + "/rdotaccent": "\u1E59", + "/rdotbelow": "\u1E5B", + "/rdotbelowmacron": "\u1E5D", + "/reachideographicparen": "\u3243", + "/recirclekatakana": "\u32F9", + "/recreationalVehicle": "\u1F699", + "/rectangleblack": "\u25AC", + "/rectangleverticalblack": "\u25AE", + "/rectangleverticalwhite": "\u25AF", + "/rectanglewhite": "\u25AD", + "/recycledpaper": "\u267C", + "/recyclefiveplastics": "\u2677", + "/recyclefourplastics": "\u2676", + "/recyclegeneric": "\u267A", + "/recycleoneplastics": "\u2673", + "/recyclepartiallypaper": "\u267D", + "/recyclesevenplastics": "\u2679", + "/recyclesixplastics": "\u2678", + "/recyclethreeplastics": "\u2675", + "/recycletwoplastics": "\u2674", + "/recycleuniversal": "\u2672", + "/recycleuniversalblack": "\u267B", + "/redApple": "\u1F34E", + "/redTriangleDOwn": "\u1F53B", + "/redTriangleUp": "\u1F53A", + "/referencemark": "\u203B", + "/reflexsubset": "\u2286", + "/reflexsuperset": "\u2287", + "/regionalindicatorsymbollettera": "\u1F1E6", + "/regionalindicatorsymbolletterb": "\u1F1E7", + "/regionalindicatorsymbolletterc": "\u1F1E8", + "/regionalindicatorsymbolletterd": "\u1F1E9", + "/regionalindicatorsymbollettere": "\u1F1EA", + "/regionalindicatorsymbolletterf": "\u1F1EB", + "/regionalindicatorsymbolletterg": "\u1F1EC", + "/regionalindicatorsymbolletterh": "\u1F1ED", + "/regionalindicatorsymbolletteri": "\u1F1EE", + "/regionalindicatorsymbolletterj": "\u1F1EF", + "/regionalindicatorsymbolletterk": "\u1F1F0", + "/regionalindicatorsymbolletterl": "\u1F1F1", + "/regionalindicatorsymbolletterm": "\u1F1F2", + "/regionalindicatorsymbollettern": "\u1F1F3", + "/regionalindicatorsymbollettero": "\u1F1F4", + "/regionalindicatorsymbolletterp": "\u1F1F5", + "/regionalindicatorsymbolletterq": "\u1F1F6", + "/regionalindicatorsymbolletterr": "\u1F1F7", + "/regionalindicatorsymbolletters": "\u1F1F8", + "/regionalindicatorsymbollettert": "\u1F1F9", + "/regionalindicatorsymbolletteru": "\u1F1FA", + "/regionalindicatorsymbolletterv": "\u1F1FB", + "/regionalindicatorsymbolletterw": "\u1F1FC", + "/regionalindicatorsymbolletterx": "\u1F1FD", + "/regionalindicatorsymbollettery": "\u1F1FE", + "/regionalindicatorsymbolletterz": "\u1F1FF", + "/registered": "\u00AE", + "/registersans": "\uF8E8", + "/registerserif": "\uF6DA", + "/reh.fina": "\uFEAE", + "/reh.init_superscriptalef.fina": "\uFC5C", + "/reh.isol": "\uFEAD", + "/rehHamzaAbove": "\u076C", + "/rehSmallTahTwoDots": "\u0771", + "/rehStroke": "\u075B", + "/rehTwoDotsVerticallyAbove": "\u076B", + "/rehVabove": "\u0692", + "/rehVbelow": "\u0695", + "/reharabic": "\u0631", + "/reharmenian": "\u0580", + "/rehdotbelow": "\u0694", + "/rehdotbelowdotabove": "\u0696", + "/rehfinalarabic": "\uFEAE", + "/rehfourdotsabove": "\u0699", + "/rehinvertedV": "\u06EF", + "/rehiragana": "\u308C", + "/rehring": "\u0693", + "/rehtwodotsabove": "\u0697", + "/rehyehaleflamarabic": "\u0631", + "/rekatakana": "\u30EC", + "/rekatakanahalfwidth": "\uFF9A", + "/relievedFace": "\u1F60C", + "/religionideographiccircled": "\u32AA", + "/reminderRibbon": "\u1F397", + "/remusquare": "\u3355", + "/rentogensquare": "\u3356", + "/replacementchar": "\uFFFD", + "/replacementcharobj": "\uFFFC", + "/representideographicparen": "\u3239", + "/rerengganleft": "\uA9C1", + "/rerengganright": "\uA9C2", + "/resh": "\u05E8", + "/resh:hb": "\u05E8", + "/reshdageshhebrew": "\uFB48", + "/reshhatafpatah": "\u05E8", + "/reshhatafpatahhebrew": "\u05E8", + "/reshhatafsegol": "\u05E8", + "/reshhatafsegolhebrew": "\u05E8", + "/reshhebrew": "\u05E8", + "/reshhiriq": "\u05E8", + "/reshhiriqhebrew": "\u05E8", + "/reshholam": "\u05E8", + "/reshholamhebrew": "\u05E8", + "/reshpatah": "\u05E8", + "/reshpatahhebrew": "\u05E8", + "/reshqamats": "\u05E8", + "/reshqamatshebrew": "\u05E8", + "/reshqubuts": "\u05E8", + "/reshqubutshebrew": "\u05E8", + "/reshsegol": "\u05E8", + "/reshsegolhebrew": "\u05E8", + "/reshsheva": "\u05E8", + "/reshshevahebrew": "\u05E8", + "/reshtsere": "\u05E8", + "/reshtserehebrew": "\u05E8", + "/reshwide:hb": "\uFB27", + "/reshwithdagesh:hb": "\uFB48", + "/resourceideographiccircled": "\u32AE", + "/resourceideographicparen": "\u323E", + "/response": "\u211F", + "/restideographiccircled": "\u32A1", + "/restideographicparen": "\u3241", + "/restrictedentryoneleft": "\u26E0", + "/restrictedentrytwoleft": "\u26E1", + "/restroom": "\u1F6BB", + "/return": "\u23CE", + "/reversedHandMiddleFingerExtended": "\u1F595", + "/reversedRaisedHandFingersSplayed": "\u1F591", + "/reversedThumbsDownSign": "\u1F593", + "/reversedThumbsUpSign": "\u1F592", + "/reversedVictoryHand": "\u1F594", + "/reversedonehundred.roman": "\u2183", + "/reversedtilde": "\u223D", + "/reversedzecyr": "\u0511", + "/revia:hb": "\u0597", + "/reviahebrew": "\u0597", + "/reviamugrashhebrew": "\u0597", + "/revlogicalnot": "\u2310", + "/revolvingHearts": "\u1F49E", + "/rfishhook": "\u027E", + "/rfishhookreversed": "\u027F", + "/rgravedbl": "\u0211", + "/rhabengali": "\u09DD", + "/rhacyr": "\u0517", + "/rhadeva": "\u095D", + "/rho": "\u03C1", + "/rhoasper": "\u1FE5", + "/rhofunc": "\u2374", + "/rholenis": "\u1FE4", + "/rhook": "\u027D", + "/rhookturned": "\u027B", + "/rhookturnedsuperior": "\u02B5", + "/rhookturnedsupmod": "\u02B5", + "/rhostrokesymbol": "\u03FC", + "/rhosymbol": "\u03F1", + "/rhosymbolgreek": "\u03F1", + "/rhotichookmod": "\u02DE", + "/rial": "\uFDFC", + "/ribbon": "\u1F380", + "/riceBall": "\u1F359", + "/riceCracker": "\u1F358", + "/ricirclekatakana": "\u32F7", + "/rieulacirclekorean": "\u3271", + "/rieulaparenkorean": "\u3211", + "/rieulcirclekorean": "\u3263", + "/rieulhieuhkorean": "\u3140", + "/rieulkiyeokkorean": "\u313A", + "/rieulkiyeoksioskorean": "\u3169", + "/rieulkorean": "\u3139", + "/rieulmieumkorean": "\u313B", + "/rieulpansioskorean": "\u316C", + "/rieulparenkorean": "\u3203", + "/rieulphieuphkorean": "\u313F", + "/rieulpieupkorean": "\u313C", + "/rieulpieupsioskorean": "\u316B", + "/rieulsioskorean": "\u313D", + "/rieulthieuthkorean": "\u313E", + "/rieultikeutkorean": "\u316A", + "/rieulyeorinhieuhkorean": "\u316D", + "/right-pointingMagnifyingGlass": "\u1F50E", + "/rightAngerBubble": "\u1F5EF", + "/rightHalfBlock": "\u2590", + "/rightHandTelephoneReceiver": "\u1F57D", + "/rightOneEighthBlock": "\u2595", + "/rightSpeaker": "\u1F568", + "/rightSpeakerOneSoundWave": "\u1F569", + "/rightSpeakerThreeSoundWaves": "\u1F56A", + "/rightSpeechBubble": "\u1F5E9", + "/rightThoughtBubble": "\u1F5ED", + "/rightangle": "\u221F", + "/rightarrowoverleftarrow": "\u21C4", + "/rightdnheavyleftuplight": "\u2546", + "/rightharpoonoverleftharpoon": "\u21CC", + "/rightheavyleftdnlight": "\u252E", + "/rightheavyleftuplight": "\u2536", + "/rightheavyleftvertlight": "\u253E", + "/rightideographiccircled": "\u32A8", + "/rightlightleftdnheavy": "\u2531", + "/rightlightleftupheavy": "\u2539", + "/rightlightleftvertheavy": "\u2549", + "/righttackbelowcmb": "\u0319", + "/righttoleftembed": "\u202B", + "/righttoleftisolate": "\u2067", + "/righttoleftmark": "\u200F", + "/righttoleftoverride": "\u202E", + "/righttriangle": "\u22BF", + "/rightupheavyleftdnlight": "\u2544", + "/rihiragana": "\u308A", + "/rikatakana": "\u30EA", + "/rikatakanahalfwidth": "\uFF98", + "/ring": "\u02DA", + "/ringbelowcmb": "\u0325", + "/ringcmb": "\u030A", + "/ringequal": "\u2257", + "/ringhalfleft": "\u02BF", + "/ringhalfleftarmenian": "\u0559", + "/ringhalfleftbelowcmb": "\u031C", + "/ringhalfleftcentered": "\u02D3", + "/ringhalfleftcentredmod": "\u02D3", + "/ringhalfleftmod": "\u02BF", + "/ringhalfright": "\u02BE", + "/ringhalfrightbelowcmb": "\u0339", + "/ringhalfrightcentered": "\u02D2", + "/ringhalfrightcentredmod": "\u02D2", + "/ringhalfrightmod": "\u02BE", + "/ringinequal": "\u2256", + "/ringingBell": "\u1F56D", + "/ringlowmod": "\u02F3", + "/ringoperator": "\u2218", + "/rinsular": "\uA783", + "/rinvertedbreve": "\u0213", + "/rirasquare": "\u3352", + "/risingdiagonal": "\u27CB", + "/rittorusquare": "\u3351", + "/rlinebelow": "\u1E5F", + "/rlongleg": "\u027C", + "/rlonglegturned": "\u027A", + "/rmacrondot": "\u1E5D", + "/rmonospace": "\uFF52", + "/rnoon": "\u06BB", + "/rnoon.fina": "\uFBA1", + "/rnoon.init": "\uFBA2", + "/rnoon.isol": "\uFBA0", + "/rnoon.medi": "\uFBA3", + "/roastedSweetPotato": "\u1F360", + "/robliquestroke": "\uA7A7", + "/rocirclekatakana": "\u32FA", + "/rocket": "\u1F680", + "/rohiragana": "\u308D", + "/rokatakana": "\u30ED", + "/rokatakanahalfwidth": "\uFF9B", + "/rolled-upNewspaper": "\u1F5DE", + "/rollerCoaster": "\u1F3A2", + "/rookblack": "\u265C", + "/rookwhite": "\u2656", + "/rooster": "\u1F413", + "/roruathai": "\u0E23", + "/rose": "\u1F339", + "/rosette": "\u1F3F5", + "/roundPushpin": "\u1F4CD", + "/roundedzeroabove": "\u06DF", + "/rowboat": "\u1F6A3", + "/rparen": "\u24AD", + "/rparenthesized": "\u24AD", + "/rrabengali": "\u09DC", + "/rradeva": "\u0931", + "/rragurmukhi": "\u0A5C", + "/rreh": "\u0691", + "/rreh.fina": "\uFB8D", + "/rreh.isol": "\uFB8C", + "/rreharabic": "\u0691", + "/rrehfinalarabic": "\uFB8D", + "/rrotunda": "\uA75B", + "/rrvocalicbengali": "\u09E0", + "/rrvocalicdeva": "\u0960", + "/rrvocalicgujarati": "\u0AE0", + "/rrvocalicvowelsignbengali": "\u09C4", + "/rrvocalicvowelsigndeva": "\u0944", + "/rrvocalicvowelsigngujarati": "\u0AC4", + "/rstroke": "\u024D", + "/rsuperior": "\uF6F1", + "/rsupmod": "\u02B3", + "/rtailturned": "\u2C79", + "/rtblock": "\u2590", + "/rturned": "\u0279", + "/rturnedsuperior": "\u02B4", + "/rturnedsupmod": "\u02B4", + "/ruble": "\u20BD", + "/rucirclekatakana": "\u32F8", + "/rugbyFootball": "\u1F3C9", + "/ruhiragana": "\u308B", + "/rukatakana": "\u30EB", + "/rukatakanahalfwidth": "\uFF99", + "/rum": "\uA775", + "/rumrotunda": "\uA75D", + "/runner": "\u1F3C3", + "/runningShirtSash": "\u1F3BD", + "/rupeemarkbengali": "\u09F2", + "/rupeesignbengali": "\u09F3", + "/rupiah": "\uF6DD", + "/rupiisquare": "\u3353", + "/ruthai": "\u0E24", + "/ruuburusquare": "\u3354", + "/rvocalicbengali": "\u098B", + "/rvocalicdeva": "\u090B", + "/rvocalicgujarati": "\u0A8B", + "/rvocalicvowelsignbengali": "\u09C3", + "/rvocalicvowelsigndeva": "\u0943", + "/rvocalicvowelsigngujarati": "\u0AC3", + "/s": "\u0073", + "/s.inferior": "\u209B", + "/s_t": "\uFB06", + "/sabengali": "\u09B8", + "/sacirclekatakana": "\u32DA", + "/sacute": "\u015B", + "/sacutedotaccent": "\u1E65", + "/sad": "\u0635", + "/sad.fina": "\uFEBA", + "/sad.init": "\uFEBB", + "/sad.init_alefmaksura.fina": "\uFD05", + "/sad.init_hah.fina": "\uFC20", + "/sad.init_hah.medi": "\uFCB1", + "/sad.init_hah.medi_hah.medi": "\uFD65", + "/sad.init_khah.medi": "\uFCB2", + "/sad.init_meem.fina": "\uFC21", + "/sad.init_meem.medi": "\uFCB3", + "/sad.init_meem.medi_meem.medi": "\uFDC5", + "/sad.init_reh.fina": "\uFD0F", + "/sad.init_yeh.fina": "\uFD06", + "/sad.isol": "\uFEB9", + "/sad.medi": "\uFEBC", + "/sad.medi_alefmaksura.fina": "\uFD21", + "/sad.medi_hah.medi_hah.fina": "\uFD64", + "/sad.medi_hah.medi_yeh.fina": "\uFDA9", + "/sad.medi_meem.medi_meem.fina": "\uFD66", + "/sad.medi_reh.fina": "\uFD2B", + "/sad.medi_yeh.fina": "\uFD22", + "/sad_lam_alefmaksuraabove": "\u06D6", + "/sadarabic": "\u0635", + "/sadeva": "\u0938", + "/sadfinalarabic": "\uFEBA", + "/sadinitialarabic": "\uFEBB", + "/sadmedialarabic": "\uFEBC", + "/sadthreedotsabove": "\u069E", + "/sadtwodotsbelow": "\u069D", + "/sagittarius": "\u2650", + "/sagujarati": "\u0AB8", + "/sagurmukhi": "\u0A38", + "/sahiragana": "\u3055", + "/saikurusquare": "\u331F", + "/sailboat": "\u26F5", + "/sakatakana": "\u30B5", + "/sakatakanahalfwidth": "\uFF7B", + "/sakeBottleAndCup": "\u1F376", + "/sallallahoualayhewasallamarabic": "\uFDFA", + "/saltillo": "\uA78C", + "/saltire": "\u2613", + "/samahaprana": "\uA9B0", + "/samekh": "\u05E1", + "/samekh:hb": "\u05E1", + "/samekhdagesh": "\uFB41", + "/samekhdageshhebrew": "\uFB41", + "/samekhhebrew": "\u05E1", + "/samekhwithdagesh:hb": "\uFB41", + "/sampi": "\u03E1", + "/sampiarchaic": "\u0373", + "/samurda": "\uA9AF", + "/samvat": "\u0604", + "/san": "\u03FB", + "/santiimusquare": "\u3320", + "/saraaathai": "\u0E32", + "/saraaethai": "\u0E41", + "/saraaimaimalaithai": "\u0E44", + "/saraaimaimuanthai": "\u0E43", + "/saraamthai": "\u0E33", + "/saraathai": "\u0E30", + "/saraethai": "\u0E40", + "/saraiileftthai": "\uF886", + "/saraiithai": "\u0E35", + "/saraileftthai": "\uF885", + "/saraithai": "\u0E34", + "/saraothai": "\u0E42", + "/saraueeleftthai": "\uF888", + "/saraueethai": "\u0E37", + "/saraueleftthai": "\uF887", + "/sarauethai": "\u0E36", + "/sarauthai": "\u0E38", + "/sarauuthai": "\u0E39", + "/satellite": "\u1F6F0", + "/satelliteAntenna": "\u1F4E1", + "/saturn": "\u2644", + "/saxophone": "\u1F3B7", + "/sbopomofo": "\u3119", + "/scales": "\u2696", + "/scanninehorizontal": "\u23BD", + "/scanonehorizontal": "\u23BA", + "/scansevenhorizontal": "\u23BC", + "/scanthreehorizontal": "\u23BB", + "/scaron": "\u0161", + "/scarondot": "\u1E67", + "/scarondotaccent": "\u1E67", + "/scedilla": "\u015F", + "/school": "\u1F3EB", + "/schoolSatchel": "\u1F392", + "/schoolideographiccircled": "\u3246", + "/schwa": "\u0259", + "/schwa.inferior": "\u2094", + "/schwacyr": "\u04D9", + "/schwacyrillic": "\u04D9", + "/schwadieresiscyr": "\u04DB", + "/schwadieresiscyrillic": "\u04DB", + "/schwahook": "\u025A", + "/scircle": "\u24E2", + "/scircumflex": "\u015D", + "/scommaaccent": "\u0219", + "/scooter": "\u1F6F4", + "/scorpius": "\u264F", + "/screen": "\u1F5B5", + "/scroll": "\u1F4DC", + "/scruple": "\u2108", + "/sdot": "\u1E61", + "/sdotaccent": "\u1E61", + "/sdotbelow": "\u1E63", + "/sdotbelowdotabove": "\u1E69", + "/sdotbelowdotaccent": "\u1E69", + "/seagullbelowcmb": "\u033C", + "/seat": "\u1F4BA", + "/secirclekatakana": "\u32DD", + "/second": "\u2033", + "/secondreversed": "\u2036", + "/secondscreensquare": "\u1F19C", + "/secondtonechinese": "\u02CA", + "/secretideographiccircled": "\u3299", + "/section": "\u00A7", + "/sectionsignhalftop": "\u2E39", + "/sector": "\u2314", + "/seeNoEvilMonkey": "\u1F648", + "/seedling": "\u1F331", + "/seen": "\u0633", + "/seen.fina": "\uFEB2", + "/seen.init": "\uFEB3", + "/seen.init_alefmaksura.fina": "\uFCFB", + "/seen.init_hah.fina": "\uFC1D", + "/seen.init_hah.medi": "\uFCAE", + "/seen.init_hah.medi_jeem.medi": "\uFD5C", + "/seen.init_heh.medi": "\uFD31", + "/seen.init_jeem.fina": "\uFC1C", + "/seen.init_jeem.medi": "\uFCAD", + "/seen.init_jeem.medi_hah.medi": "\uFD5D", + "/seen.init_khah.fina": "\uFC1E", + "/seen.init_khah.medi": "\uFCAF", + "/seen.init_meem.fina": "\uFC1F", + "/seen.init_meem.medi": "\uFCB0", + "/seen.init_meem.medi_hah.medi": "\uFD60", + "/seen.init_meem.medi_jeem.medi": "\uFD61", + "/seen.init_meem.medi_meem.medi": "\uFD63", + "/seen.init_reh.fina": "\uFD0E", + "/seen.init_yeh.fina": "\uFCFC", + "/seen.isol": "\uFEB1", + "/seen.medi": "\uFEB4", + "/seen.medi_alefmaksura.fina": "\uFD17", + "/seen.medi_hah.medi": "\uFD35", + "/seen.medi_heh.medi": "\uFCE8", + "/seen.medi_jeem.medi": "\uFD34", + "/seen.medi_jeem.medi_alefmaksura.fina": "\uFD5E", + "/seen.medi_khah.medi": "\uFD36", + "/seen.medi_khah.medi_alefmaksura.fina": "\uFDA8", + "/seen.medi_khah.medi_yeh.fina": "\uFDC6", + "/seen.medi_meem.medi": "\uFCE7", + "/seen.medi_meem.medi_hah.fina": "\uFD5F", + "/seen.medi_meem.medi_meem.fina": "\uFD62", + "/seen.medi_reh.fina": "\uFD2A", + "/seen.medi_yeh.fina": "\uFD18", + "/seenDigitFourAbove": "\u077D", + "/seenFourDotsAbove": "\u075C", + "/seenInvertedV": "\u077E", + "/seenSmallTahTwoDots": "\u0770", + "/seenTwoDotsVerticallyAbove": "\u076D", + "/seenabove": "\u06DC", + "/seenarabic": "\u0633", + "/seendotbelowdotabove": "\u069A", + "/seenfinalarabic": "\uFEB2", + "/seeninitialarabic": "\uFEB3", + "/seenlow": "\u06E3", + "/seenmedialarabic": "\uFEB4", + "/seenthreedotsbelow": "\u069B", + "/seenthreedotsbelowthreedotsabove": "\u069C", + "/segment": "\u2313", + "/segol": "\u05B6", + "/segol13": "\u05B6", + "/segol1f": "\u05B6", + "/segol2c": "\u05B6", + "/segol:hb": "\u05B6", + "/segolhebrew": "\u05B6", + "/segolnarrowhebrew": "\u05B6", + "/segolquarterhebrew": "\u05B6", + "/segolta:hb": "\u0592", + "/segoltahebrew": "\u0592", + "/segolwidehebrew": "\u05B6", + "/seharmenian": "\u057D", + "/sehiragana": "\u305B", + "/sekatakana": "\u30BB", + "/sekatakanahalfwidth": "\uFF7E", + "/selfideographicparen": "\u3242", + "/semicolon": "\u003B", + "/semicolonarabic": "\u061B", + "/semicolonmonospace": "\uFF1B", + "/semicolonreversed": "\u204F", + "/semicolonsmall": "\uFE54", + "/semicolonunderlinefunc": "\u236E", + "/semidirectproductleft": "\u22CB", + "/semidirectproductright": "\u22CC", + "/semisextile": "\u26BA", + "/semisoftcyr": "\u048D", + "/semivoicedmarkkana": "\u309C", + "/semivoicedmarkkanahalfwidth": "\uFF9F", + "/sentisquare": "\u3322", + "/sentosquare": "\u3323", + "/septembertelegraph": "\u32C8", + "/sersetdblup": "\u22D1", + "/sersetnotequalup": "\u228B", + "/servicemark": "\u2120", + "/sesamedot": "\uFE45", + "/sesquiquadrate": "\u26BC", + "/setminus": "\u2216", + "/seven": "\u0037", + "/seven.inferior": "\u2087", + "/seven.roman": "\u2166", + "/seven.romansmall": "\u2176", + "/seven.superior": "\u2077", + "/sevenarabic": "\u0667", + "/sevenbengali": "\u09ED", + "/sevencircle": "\u2466", + "/sevencircledbl": "\u24FB", + "/sevencircleinversesansserif": "\u2790", + "/sevencomma": "\u1F108", + "/sevendeva": "\u096D", + "/seveneighths": "\u215E", + "/sevenfar": "\u06F7", + "/sevengujarati": "\u0AED", + "/sevengurmukhi": "\u0A6D", + "/sevenhackarabic": "\u0667", + "/sevenhangzhou": "\u3027", + "/sevenideographiccircled": "\u3286", + "/sevenideographicparen": "\u3226", + "/seveninferior": "\u2087", + "/sevenmonospace": "\uFF17", + "/sevenoldstyle": "\uF737", + "/sevenparen": "\u247A", + "/sevenparenthesized": "\u247A", + "/sevenperiod": "\u248E", + "/sevenpersian": "\u06F7", + "/sevenpointonesquare": "\u1F1A1", + "/sevenroman": "\u2176", + "/sevensuperior": "\u2077", + "/seventeencircle": "\u2470", + "/seventeencircleblack": "\u24F1", + "/seventeenparen": "\u2484", + "/seventeenparenthesized": "\u2484", + "/seventeenperiod": "\u2498", + "/seventhai": "\u0E57", + "/seventycirclesquare": "\u324E", + "/sextile": "\u26B9", + "/sfthyphen": "\u00AD", + "/shaarmenian": "\u0577", + "/shabengali": "\u09B6", + "/shacyr": "\u0448", + "/shacyrillic": "\u0448", + "/shaddaAlefIsol": "\uFC63", + "/shaddaDammaIsol": "\uFC61", + "/shaddaDammaMedi": "\uFCF3", + "/shaddaDammatanIsol": "\uFC5E", + "/shaddaFathaIsol": "\uFC60", + "/shaddaFathaMedi": "\uFCF2", + "/shaddaIsol": "\uFE7C", + "/shaddaKasraIsol": "\uFC62", + "/shaddaKasraMedi": "\uFCF4", + "/shaddaKasratanIsol": "\uFC5F", + "/shaddaMedi": "\uFE7D", + "/shaddaarabic": "\u0651", + "/shaddadammaarabic": "\uFC61", + "/shaddadammatanarabic": "\uFC5E", + "/shaddafathaarabic": "\uFC60", + "/shaddafathatanarabic": "\u0651", + "/shaddakasraarabic": "\uFC62", + "/shaddakasratanarabic": "\uFC5F", + "/shade": "\u2592", + "/shadedark": "\u2593", + "/shadelight": "\u2591", + "/shademedium": "\u2592", + "/shadeva": "\u0936", + "/shagujarati": "\u0AB6", + "/shagurmukhi": "\u0A36", + "/shalshelet:hb": "\u0593", + "/shalshelethebrew": "\u0593", + "/shamrock": "\u2618", + "/shavedIce": "\u1F367", + "/shbopomofo": "\u3115", + "/shchacyr": "\u0449", + "/shchacyrillic": "\u0449", + "/sheen": "\u0634", + "/sheen.fina": "\uFEB6", + "/sheen.init": "\uFEB7", + "/sheen.init_alefmaksura.fina": "\uFCFD", + "/sheen.init_hah.fina": "\uFD0A", + "/sheen.init_hah.medi": "\uFD2E", + "/sheen.init_hah.medi_meem.medi": "\uFD68", + "/sheen.init_heh.medi": "\uFD32", + "/sheen.init_jeem.fina": "\uFD09", + "/sheen.init_jeem.medi": "\uFD2D", + "/sheen.init_khah.fina": "\uFD0B", + "/sheen.init_khah.medi": "\uFD2F", + "/sheen.init_meem.fina": "\uFD0C", + "/sheen.init_meem.medi": "\uFD30", + "/sheen.init_meem.medi_khah.medi": "\uFD6B", + "/sheen.init_meem.medi_meem.medi": "\uFD6D", + "/sheen.init_reh.fina": "\uFD0D", + "/sheen.init_yeh.fina": "\uFCFE", + "/sheen.isol": "\uFEB5", + "/sheen.medi": "\uFEB8", + "/sheen.medi_alefmaksura.fina": "\uFD19", + "/sheen.medi_hah.fina": "\uFD26", + "/sheen.medi_hah.medi": "\uFD38", + "/sheen.medi_hah.medi_meem.fina": "\uFD67", + "/sheen.medi_hah.medi_yeh.fina": "\uFDAA", + "/sheen.medi_heh.medi": "\uFCEA", + "/sheen.medi_jeem.fina": "\uFD25", + "/sheen.medi_jeem.medi": "\uFD37", + "/sheen.medi_jeem.medi_yeh.fina": "\uFD69", + "/sheen.medi_khah.fina": "\uFD27", + "/sheen.medi_khah.medi": "\uFD39", + "/sheen.medi_meem.fina": "\uFD28", + "/sheen.medi_meem.medi": "\uFCE9", + "/sheen.medi_meem.medi_khah.fina": "\uFD6A", + "/sheen.medi_meem.medi_meem.fina": "\uFD6C", + "/sheen.medi_reh.fina": "\uFD29", + "/sheen.medi_yeh.fina": "\uFD1A", + "/sheenarabic": "\u0634", + "/sheendotbelow": "\u06FA", + "/sheenfinalarabic": "\uFEB6", + "/sheeninitialarabic": "\uFEB7", + "/sheenmedialarabic": "\uFEB8", + "/sheep": "\u1F411", + "/sheicoptic": "\u03E3", + "/shelfmod": "\u02FD", + "/shelfopenmod": "\u02FE", + "/sheqel": "\u20AA", + "/sheqelhebrew": "\u20AA", + "/sheva": "\u05B0", + "/sheva115": "\u05B0", + "/sheva15": "\u05B0", + "/sheva22": "\u05B0", + "/sheva2e": "\u05B0", + "/sheva:hb": "\u05B0", + "/shevahebrew": "\u05B0", + "/shevanarrowhebrew": "\u05B0", + "/shevaquarterhebrew": "\u05B0", + "/shevawidehebrew": "\u05B0", + "/shhacyr": "\u04BB", + "/shhacyrillic": "\u04BB", + "/shhatailcyr": "\u0527", + "/shield": "\u1F6E1", + "/shimacoptic": "\u03ED", + "/shin": "\u05E9", + "/shin:hb": "\u05E9", + "/shinDot:hb": "\u05C1", + "/shindagesh": "\uFB49", + "/shindageshhebrew": "\uFB49", + "/shindageshshindot": "\uFB2C", + "/shindageshshindothebrew": "\uFB2C", + "/shindageshsindot": "\uFB2D", + "/shindageshsindothebrew": "\uFB2D", + "/shindothebrew": "\u05C1", + "/shinhebrew": "\u05E9", + "/shinshindot": "\uFB2A", + "/shinshindothebrew": "\uFB2A", + "/shinsindot": "\uFB2B", + "/shinsindothebrew": "\uFB2B", + "/shintoshrine": "\u26E9", + "/shinwithdagesh:hb": "\uFB49", + "/shinwithdageshandshinDot:hb": "\uFB2C", + "/shinwithdageshandsinDot:hb": "\uFB2D", + "/shinwithshinDot:hb": "\uFB2A", + "/shinwithsinDot:hb": "\uFB2B", + "/ship": "\u1F6A2", + "/sho": "\u03F8", + "/shoejotupfunc": "\u235D", + "/shoestiledownfunc": "\u2366", + "/shoestileleftfunc": "\u2367", + "/shogipieceblack": "\u2617", + "/shogipiecewhite": "\u2616", + "/shook": "\u0282", + "/shootingStar": "\u1F320", + "/shoppingBags": "\u1F6CD", + "/shoppingTrolley": "\u1F6D2", + "/shortcake": "\u1F370", + "/shortequalsmod": "\uA78A", + "/shortoverlongmetrical": "\u23D3", + "/shoulderedopenbox": "\u237D", + "/shower": "\u1F6BF", + "/shvsquare": "\u1F1AA", + "/sicirclekatakana": "\u32DB", + "/sidewaysBlackDownPointingIndex": "\u1F5A1", + "/sidewaysBlackLeftPointingIndex": "\u1F59A", + "/sidewaysBlackRightPointingIndex": "\u1F59B", + "/sidewaysBlackUpPointingIndex": "\u1F5A0", + "/sidewaysWhiteDownPointingIndex": "\u1F59F", + "/sidewaysWhiteLeftPointingIndex": "\u1F598", + "/sidewaysWhiteRightPointingIndex": "\u1F599", + "/sidewaysWhiteUpPointingIndex": "\u1F59E", + "/sigma": "\u03C3", + "/sigma1": "\u03C2", + "/sigmafinal": "\u03C2", + "/sigmalunatedottedreversedsymbol": "\u037D", + "/sigmalunatedottedsymbol": "\u037C", + "/sigmalunatereversedsymbol": "\u037B", + "/sigmalunatesymbol": "\u03F2", + "/sigmalunatesymbolgreek": "\u03F2", + "/sihiragana": "\u3057", + "/sikatakana": "\u30B7", + "/sikatakanahalfwidth": "\uFF7C", + "/silhouetteOfJapan": "\u1F5FE", + "/siluqhebrew": "\u05BD", + "/siluqlefthebrew": "\u05BD", + "/similar": "\u223C", + "/sinDot:hb": "\u05C2", + "/sindothebrew": "\u05C2", + "/sinewave": "\u223F", + "/sinh:a": "\u0D85", + "/sinh:aa": "\u0D86", + "/sinh:aae": "\u0D88", + "/sinh:aaesign": "\u0DD1", + "/sinh:aasign": "\u0DCF", + "/sinh:ae": "\u0D87", + "/sinh:aesign": "\u0DD0", + "/sinh:ai": "\u0D93", + "/sinh:aisign": "\u0DDB", + "/sinh:anusvara": "\u0D82", + "/sinh:au": "\u0D96", + "/sinh:ausign": "\u0DDE", + "/sinh:ba": "\u0DB6", + "/sinh:bha": "\u0DB7", + "/sinh:ca": "\u0DA0", + "/sinh:cha": "\u0DA1", + "/sinh:da": "\u0DAF", + "/sinh:dda": "\u0DA9", + "/sinh:ddha": "\u0DAA", + "/sinh:dha": "\u0DB0", + "/sinh:e": "\u0D91", + "/sinh:ee": "\u0D92", + "/sinh:eesign": "\u0DDA", + "/sinh:esign": "\u0DD9", + "/sinh:fa": "\u0DC6", + "/sinh:ga": "\u0D9C", + "/sinh:gha": "\u0D9D", + "/sinh:ha": "\u0DC4", + "/sinh:i": "\u0D89", + "/sinh:ii": "\u0D8A", + "/sinh:iisign": "\u0DD3", + "/sinh:isign": "\u0DD2", + "/sinh:ja": "\u0DA2", + "/sinh:jha": "\u0DA3", + "/sinh:jnya": "\u0DA5", + "/sinh:ka": "\u0D9A", + "/sinh:kha": "\u0D9B", + "/sinh:kunddaliya": "\u0DF4", + "/sinh:la": "\u0DBD", + "/sinh:litheight": "\u0DEE", + "/sinh:lithfive": "\u0DEB", + "/sinh:lithfour": "\u0DEA", + "/sinh:lithnine": "\u0DEF", + "/sinh:lithone": "\u0DE7", + "/sinh:lithseven": "\u0DED", + "/sinh:lithsix": "\u0DEC", + "/sinh:liththree": "\u0DE9", + "/sinh:lithtwo": "\u0DE8", + "/sinh:lithzero": "\u0DE6", + "/sinh:lla": "\u0DC5", + "/sinh:llvocal": "\u0D90", + "/sinh:llvocalsign": "\u0DF3", + "/sinh:lvocal": "\u0D8F", + "/sinh:lvocalsign": "\u0DDF", + "/sinh:ma": "\u0DB8", + "/sinh:mba": "\u0DB9", + "/sinh:na": "\u0DB1", + "/sinh:nda": "\u0DB3", + "/sinh:nga": "\u0D9E", + "/sinh:nna": "\u0DAB", + "/sinh:nndda": "\u0DAC", + "/sinh:nnga": "\u0D9F", + "/sinh:nya": "\u0DA4", + "/sinh:nyja": "\u0DA6", + "/sinh:o": "\u0D94", + "/sinh:oo": "\u0D95", + "/sinh:oosign": "\u0DDD", + "/sinh:osign": "\u0DDC", + "/sinh:pa": "\u0DB4", + "/sinh:pha": "\u0DB5", + "/sinh:ra": "\u0DBB", + "/sinh:rrvocal": "\u0D8E", + "/sinh:rrvocalsign": "\u0DF2", + "/sinh:rvocal": "\u0D8D", + "/sinh:rvocalsign": "\u0DD8", + "/sinh:sa": "\u0DC3", + "/sinh:sha": "\u0DC1", + "/sinh:ssa": "\u0DC2", + "/sinh:ta": "\u0DAD", + "/sinh:tha": "\u0DAE", + "/sinh:tta": "\u0DA7", + "/sinh:ttha": "\u0DA8", + "/sinh:u": "\u0D8B", + "/sinh:usign": "\u0DD4", + "/sinh:uu": "\u0D8C", + "/sinh:uusign": "\u0DD6", + "/sinh:va": "\u0DC0", + "/sinh:virama": "\u0DCA", + "/sinh:visarga": "\u0D83", + "/sinh:ya": "\u0DBA", + "/sinologicaldot": "\uA78F", + "/sinsular": "\uA785", + "/siosacirclekorean": "\u3274", + "/siosaparenkorean": "\u3214", + "/sioscieuckorean": "\u317E", + "/sioscirclekorean": "\u3266", + "/sioskiyeokkorean": "\u317A", + "/sioskorean": "\u3145", + "/siosnieunkorean": "\u317B", + "/siosparenkorean": "\u3206", + "/siospieupkorean": "\u317D", + "/siostikeutkorean": "\u317C", + "/siringusquare": "\u3321", + "/six": "\u0036", + "/six.inferior": "\u2086", + "/six.roman": "\u2165", + "/six.romansmall": "\u2175", + "/six.superior": "\u2076", + "/sixPointedStarMiddleDot": "\u1F52F", + "/sixarabic": "\u0666", + "/sixbengali": "\u09EC", + "/sixcircle": "\u2465", + "/sixcircledbl": "\u24FA", + "/sixcircleinversesansserif": "\u278F", + "/sixcomma": "\u1F107", + "/sixdeva": "\u096C", + "/sixdotsvertical": "\u2E3D", + "/sixfar": "\u06F6", + "/sixgujarati": "\u0AEC", + "/sixgurmukhi": "\u0A6C", + "/sixhackarabic": "\u0666", + "/sixhangzhou": "\u3026", + "/sixideographiccircled": "\u3285", + "/sixideographicparen": "\u3225", + "/sixinferior": "\u2086", + "/sixlateform.roman": "\u2185", + "/sixmonospace": "\uFF16", + "/sixoldstyle": "\uF736", + "/sixparen": "\u2479", + "/sixparenthesized": "\u2479", + "/sixperemspace": "\u2006", + "/sixperiod": "\u248D", + "/sixpersian": "\u06F6", + "/sixroman": "\u2175", + "/sixsuperior": "\u2076", + "/sixteencircle": "\u246F", + "/sixteencircleblack": "\u24F0", + "/sixteencurrencydenominatorbengali": "\u09F9", + "/sixteenparen": "\u2483", + "/sixteenparenthesized": "\u2483", + "/sixteenperiod": "\u2497", + "/sixthai": "\u0E56", + "/sixtycirclesquare": "\u324D", + "/sixtypsquare": "\u1F1A3", + "/sjekomicyr": "\u050D", + "/skiAndSkiBoot": "\u1F3BF", + "/skier": "\u26F7", + "/skull": "\u1F480", + "/skullcrossbones": "\u2620", + "/slash": "\u002F", + "/slashbarfunc": "\u233F", + "/slashmonospace": "\uFF0F", + "/sled": "\u1F6F7", + "/sleeping": "\u1F4A4", + "/sleepingAccommodation": "\u1F6CC", + "/sleepingFace": "\u1F634", + "/sleepyFace": "\u1F62A", + "/sleuthOrSpy": "\u1F575", + "/sliceOfPizza": "\u1F355", + "/slightlyFrowningFace": "\u1F641", + "/slightlySmilingFace": "\u1F642", + "/slong": "\u017F", + "/slongdotaccent": "\u1E9B", + "/slope": "\u2333", + "/slotMachine": "\u1F3B0", + "/smallAirplane": "\u1F6E9", + "/smallBlueDiamond": "\u1F539", + "/smallOrangeDiamond": "\u1F538", + "/smallRedTriangleDOwn": "\u1F53D", + "/smallRedTriangleUp": "\u1F53C", + "/smile": "\u2323", + "/smileface": "\u263A", + "/smilingCatFaceWithHeartShapedEyes": "\u1F63B", + "/smilingCatFaceWithOpenMouth": "\u1F63A", + "/smilingFaceWithHalo": "\u1F607", + "/smilingFaceWithHeartShapedEyes": "\u1F60D", + "/smilingFaceWithHorns": "\u1F608", + "/smilingFaceWithOpenMouth": "\u1F603", + "/smilingFaceWithOpenMouthAndColdSweat": "\u1F605", + "/smilingFaceWithOpenMouthAndSmilingEyes": "\u1F604", + "/smilingFaceWithOpenMouthAndTightlyClosedEyes": "\u1F606", + "/smilingFaceWithSmilingEyes": "\u1F60A", + "/smilingFaceWithSunglasses": "\u1F60E", + "/smilingfaceblack": "\u263B", + "/smilingfacewhite": "\u263A", + "/smirkingFace": "\u1F60F", + "/smll:ampersand": "\uFE60", + "/smll:asterisk": "\uFE61", + "/smll:backslash": "\uFE68", + "/smll:braceleft": "\uFE5B", + "/smll:braceright": "\uFE5C", + "/smll:colon": "\uFE55", + "/smll:comma": "\uFE50", + "/smll:dollar": "\uFE69", + "/smll:emdash": "\uFE58", + "/smll:equal": "\uFE66", + "/smll:exclam": "\uFE57", + "/smll:greater": "\uFE65", + "/smll:hyphen": "\uFE63", + "/smll:ideographiccomma": "\uFE51", + "/smll:less": "\uFE64", + "/smll:numbersign": "\uFE5F", + "/smll:parenthesisleft": "\uFE59", + "/smll:parenthesisright": "\uFE5A", + "/smll:percent": "\uFE6A", + "/smll:period": "\uFE52", + "/smll:plus": "\uFE62", + "/smll:question": "\uFE56", + "/smll:semicolon": "\uFE54", + "/smll:tortoiseshellbracketleft": "\uFE5D", + "/smll:tortoiseshellbracketright": "\uFE5E", + "/smoking": "\u1F6AC", + "/smonospace": "\uFF53", + "/snail": "\u1F40C", + "/snake": "\u1F40D", + "/snowboarder": "\u1F3C2", + "/snowcappedMountain": "\u1F3D4", + "/snowman": "\u2603", + "/snowmanblack": "\u26C7", + "/snowmanoutsnow": "\u26C4", + "/sobliquestroke": "\uA7A9", + "/soccerball": "\u26BD", + "/societyideographiccircled": "\u3293", + "/societyideographicparen": "\u3233", + "/socirclekatakana": "\u32DE", + "/sofPasuq:hb": "\u05C3", + "/sofpasuqhebrew": "\u05C3", + "/softIceCream": "\u1F366", + "/softShellFloppyDisk": "\u1F5AC", + "/softcyr": "\u044C", + "/softhyphen": "\u00AD", + "/softsigncyrillic": "\u044C", + "/softwarefunction": "\u2394", + "/sohiragana": "\u305D", + "/sokatakana": "\u30BD", + "/sokatakanahalfwidth": "\uFF7F", + "/soliduslongoverlaycmb": "\u0338", + "/solidusshortoverlaycmb": "\u0337", + "/solidussubsetreversepreceding": "\u27C8", + "/solidussupersetpreceding": "\u27C9", + "/soonRightwardsArrowAbove": "\u1F51C", + "/sorusithai": "\u0E29", + "/sosalathai": "\u0E28", + "/sosothai": "\u0E0B", + "/sossquare": "\u1F198", + "/sosuathai": "\u0E2A", + "/soundcopyright": "\u2117", + "/space": "\u0020", + "/spacehackarabic": "\u0020", + "/spade": "\u2660", + "/spadeblack": "\u2660", + "/spadesuitblack": "\u2660", + "/spadesuitwhite": "\u2664", + "/spadewhite": "\u2664", + "/spaghetti": "\u1F35D", + "/sparen": "\u24AE", + "/sparenthesized": "\u24AE", + "/sparklingHeart": "\u1F496", + "/speakNoEvilMonkey": "\u1F64A", + "/speaker": "\u1F508", + "/speakerCancellationStroke": "\u1F507", + "/speakerOneSoundWave": "\u1F509", + "/speakerThreeSoundWaves": "\u1F50A", + "/speakingHeadInSilhouette": "\u1F5E3", + "/specialideographiccircled": "\u3295", + "/specialideographicparen": "\u3235", + "/speechBalloon": "\u1F4AC", + "/speedboat": "\u1F6A4", + "/spesmilo": "\u20B7", + "/sphericalangle": "\u2222", + "/spider": "\u1F577", + "/spiderWeb": "\u1F578", + "/spiralCalendarPad": "\u1F5D3", + "/spiralNotePad": "\u1F5D2", + "/spiralShell": "\u1F41A", + "/splashingSweat": "\u1F4A6", + "/sportsMedal": "\u1F3C5", + "/spoutingWhale": "\u1F433", + "/sppl:tildevertical": "\u2E2F", + "/squarebelowcmb": "\u033B", + "/squareblack": "\u25A0", + "/squarebracketleftvertical": "\uFE47", + "/squarebracketrightvertical": "\uFE48", + "/squarecap": "\u2293", + "/squarecc": "\u33C4", + "/squarecm": "\u339D", + "/squarecup": "\u2294", + "/squareddotoperator": "\u22A1", + "/squarediagonalcrosshatchfill": "\u25A9", + "/squaredj": "\u1F190", + "/squaredkey": "\u26BF", + "/squaredminus": "\u229F", + "/squaredplus": "\u229E", + "/squaredsaltire": "\u26DD", + "/squaredtimes": "\u22A0", + "/squarefourcorners": "\u26F6", + "/squarehalfleftblack": "\u25E7", + "/squarehalfrightblack": "\u25E8", + "/squarehorizontalfill": "\u25A4", + "/squareimage": "\u228F", + "/squareimageorequal": "\u2291", + "/squareimageornotequal": "\u22E4", + "/squarekg": "\u338F", + "/squarekm": "\u339E", + "/squarekmcapital": "\u33CE", + "/squareln": "\u33D1", + "/squarelog": "\u33D2", + "/squarelowerdiagonalhalfrightblack": "\u25EA", + "/squaremediumblack": "\u25FC", + "/squaremediumwhite": "\u25FB", + "/squaremg": "\u338E", + "/squaremil": "\u33D5", + "/squaremm": "\u339C", + "/squaremsquared": "\u33A1", + "/squareoriginal": "\u2290", + "/squareoriginalorequal": "\u2292", + "/squareoriginalornotequal": "\u22E5", + "/squareorthogonalcrosshatchfill": "\u25A6", + "/squareraised": "\u2E0B", + "/squaresmallblack": "\u25AA", + "/squaresmallmediumblack": "\u25FE", + "/squaresmallmediumwhite": "\u25FD", + "/squaresmallwhite": "\u25AB", + "/squareupperdiagonalhalfleftblack": "\u25E9", + "/squareupperlefttolowerrightfill": "\u25A7", + "/squareupperrighttolowerleftfill": "\u25A8", + "/squareverticalfill": "\u25A5", + "/squarewhite": "\u25A1", + "/squarewhitebisectinglinevertical": "\u25EB", + "/squarewhitelowerquadrantleft": "\u25F1", + "/squarewhitelowerquadrantright": "\u25F2", + "/squarewhiteround": "\u25A2", + "/squarewhiteupperquadrantleft": "\u25F0", + "/squarewhiteupperquadrantright": "\u25F3", + "/squarewhitewithsmallblack": "\u25A3", + "/squarewhitewithsquaresmallblack": "\u25A3", + "/squishquadfunc": "\u2337", + "/srfullwidth": "\u33DB", + "/srsquare": "\u33DB", + "/ssabengali": "\u09B7", + "/ssadeva": "\u0937", + "/ssagujarati": "\u0AB7", + "/ssangcieuckorean": "\u3149", + "/ssanghieuhkorean": "\u3185", + "/ssangieungkorean": "\u3180", + "/ssangkiyeokkorean": "\u3132", + "/ssangnieunkorean": "\u3165", + "/ssangpieupkorean": "\u3143", + "/ssangsioskorean": "\u3146", + "/ssangtikeutkorean": "\u3138", + "/ssuperior": "\uF6F2", + "/ssupmod": "\u02E2", + "/sswashtail": "\u023F", + "/stackedcommadbl": "\u2E49", + "/stadium": "\u1F3DF", + "/staffofaesculapius": "\u2695", + "/staffofhermes": "\u269A", + "/stampedEnvelope": "\u1F583", + "/star": "\u22C6", + "/starblack": "\u2605", + "/starcrescent": "\u262A", + "/stardiaeresisfunc": "\u2363", + "/starequals": "\u225B", + "/staroperator": "\u22C6", + "/staroutlinedwhite": "\u269D", + "/starwhite": "\u2606", + "/station": "\u1F689", + "/statueOfLiberty": "\u1F5FD", + "/steamLocomotive": "\u1F682", + "/steamingBowl": "\u1F35C", + "/stenographicfullstop": "\u2E3C", + "/sterling": "\u00A3", + "/sterlingmonospace": "\uFFE1", + "/stigma": "\u03DB", + "/stiletildefunc": "\u236D", + "/stockChart": "\u1F5E0", + "/stockideographiccircled": "\u3291", + "/stockideographicparen": "\u3231", + "/stopabove": "\u06EB", + "/stopbelow": "\u06EA", + "/straightRuler": "\u1F4CF", + "/straightness": "\u23E4", + "/strawberry": "\u1F353", + "/stresslowtonemod": "\uA721", + "/stresstonemod": "\uA720", + "/strictlyequivalent": "\u2263", + "/strokelongoverlaycmb": "\u0336", + "/strokeshortoverlaycmb": "\u0335", + "/studioMicrophone": "\u1F399", + "/studyideographiccircled": "\u32AB", + "/studyideographicparen": "\u323B", + "/stupa": "\u1F6D3", + "/subscriptalef": "\u0656", + "/subset": "\u2282", + "/subsetdbl": "\u22D0", + "/subsetnotequal": "\u228A", + "/subsetorequal": "\u2286", + "/succeeds": "\u227B", + "/succeedsbutnotequivalent": "\u22E9", + "/succeedsorequal": "\u227D", + "/succeedsorequivalent": "\u227F", + "/succeedsunderrelation": "\u22B1", + "/suchthat": "\u220B", + "/sucirclekatakana": "\u32DC", + "/suhiragana": "\u3059", + "/suitableideographiccircled": "\u329C", + "/sukatakana": "\u30B9", + "/sukatakanahalfwidth": "\uFF7D", + "/sukumendutvowel": "\uA9B9", + "/sukunIsol": "\uFE7E", + "/sukunMedi": "\uFE7F", + "/sukunarabic": "\u0652", + "/sukuvowel": "\uA9B8", + "/summation": "\u2211", + "/summationbottom": "\u23B3", + "/summationdblstruck": "\u2140", + "/summationtop": "\u23B2", + "/sun": "\u263C", + "/sunFace": "\u1F31E", + "/sunbehindcloud": "\u26C5", + "/sunflower": "\u1F33B", + "/sunideographiccircled": "\u3290", + "/sunideographicparen": "\u3230", + "/sunraysblack": "\u2600", + "/sunrayswhite": "\u263C", + "/sunrise": "\u1F305", + "/sunriseOverMountains": "\u1F304", + "/sunsetOverBuildings": "\u1F307", + "/superset": "\u2283", + "/supersetnotequal": "\u228B", + "/supersetorequal": "\u2287", + "/superviseideographiccircled": "\u32AC", + "/superviseideographicparen": "\u323C", + "/surfer": "\u1F3C4", + "/sushi": "\u1F363", + "/suspensionRailway": "\u1F69F", + "/suspensiondbl": "\u2E44", + "/svfullwidth": "\u33DC", + "/svsquare": "\u33DC", + "/swatchtop": "\u23F1", + "/swimmer": "\u1F3CA", + "/swungdash": "\u2053", + "/symbolabovethreedotsabove": "\uFBB6", + "/symbolbelowthreedotsabove": "\uFBB7", + "/symboldotabove": "\uFBB2", + "/symboldotbelow": "\uFBB3", + "/symboldoubleverticalbarbelow": "\uFBBC", + "/symbolfourdotsabove": "\uFBBA", + "/symbolfourdotsbelow": "\uFBBB", + "/symbolpointingabovedownthreedotsabove": "\uFBB8", + "/symbolpointingbelowdownthreedotsabove": "\uFBB9", + "/symbolring": "\uFBBF", + "/symboltahabovesmall": "\uFBC0", + "/symboltahbelowsmall": "\uFBC1", + "/symboltwodotsabove": "\uFBB4", + "/symboltwodotsbelow": "\uFBB5", + "/symboltwodotsverticallyabove": "\uFBBD", + "/symboltwodotsverticallybelow": "\uFBBE", + "/symmetry": "\u232F", + "/synagogue": "\u1F54D", + "/syouwaerasquare": "\u337C", + "/syringe": "\u1F489", + "/t": "\u0074", + "/t-shirt": "\u1F455", + "/t.inferior": "\u209C", + "/tabengali": "\u09A4", + "/tableTennisPaddleAndBall": "\u1F3D3", + "/tacirclekatakana": "\u32DF", + "/tackcircleaboveup": "\u27DF", + "/tackdiaeresisupfunc": "\u2361", + "/tackdown": "\u22A4", + "/tackdownmod": "\u02D5", + "/tackjotdownfunc": "\u234E", + "/tackjotupfunc": "\u2355", + "/tackleft": "\u22A3", + "/tackleftright": "\u27DB", + "/tackoverbarupfunc": "\u2351", + "/tackright": "\u22A2", + "/tackunderlinedownfunc": "\u234A", + "/tackup": "\u22A5", + "/tackupmod": "\u02D4", + "/taco": "\u1F32E", + "/tadeva": "\u0924", + "/tagujarati": "\u0AA4", + "/tagurmukhi": "\u0A24", + "/tah": "\u0637", + "/tah.fina": "\uFEC2", + "/tah.init": "\uFEC3", + "/tah.init_alefmaksura.fina": "\uFCF5", + "/tah.init_hah.fina": "\uFC26", + "/tah.init_hah.medi": "\uFCB8", + "/tah.init_meem.fina": "\uFC27", + "/tah.init_meem.medi": "\uFD33", + "/tah.init_meem.medi_hah.medi": "\uFD72", + "/tah.init_meem.medi_meem.medi": "\uFD73", + "/tah.init_yeh.fina": "\uFCF6", + "/tah.isol": "\uFEC1", + "/tah.medi": "\uFEC4", + "/tah.medi_alefmaksura.fina": "\uFD11", + "/tah.medi_meem.medi": "\uFD3A", + "/tah.medi_meem.medi_hah.fina": "\uFD71", + "/tah.medi_meem.medi_yeh.fina": "\uFD74", + "/tah.medi_yeh.fina": "\uFD12", + "/tahabove": "\u0615", + "/taharabic": "\u0637", + "/tahfinalarabic": "\uFEC2", + "/tahinitialarabic": "\uFEC3", + "/tahiragana": "\u305F", + "/tahmedialarabic": "\uFEC4", + "/tahthreedotsabove": "\u069F", + "/taisyouerasquare": "\u337D", + "/takatakana": "\u30BF", + "/takatakanahalfwidth": "\uFF80", + "/takhallus": "\u0614", + "/talingvowel": "\uA9BA", + "/taml:a": "\u0B85", + "/taml:aa": "\u0B86", + "/taml:aasign": "\u0BBE", + "/taml:ai": "\u0B90", + "/taml:aisign": "\u0BC8", + "/taml:anusvarasign": "\u0B82", + "/taml:asabovesign": "\u0BF8", + "/taml:au": "\u0B94", + "/taml:aulengthmark": "\u0BD7", + "/taml:ausign": "\u0BCC", + "/taml:ca": "\u0B9A", + "/taml:creditsign": "\u0BF7", + "/taml:daysign": "\u0BF3", + "/taml:debitsign": "\u0BF6", + "/taml:e": "\u0B8E", + "/taml:ee": "\u0B8F", + "/taml:eesign": "\u0BC7", + "/taml:eight": "\u0BEE", + "/taml:esign": "\u0BC6", + "/taml:five": "\u0BEB", + "/taml:four": "\u0BEA", + "/taml:ha": "\u0BB9", + "/taml:i": "\u0B87", + "/taml:ii": "\u0B88", + "/taml:iisign": "\u0BC0", + "/taml:isign": "\u0BBF", + "/taml:ja": "\u0B9C", + "/taml:ka": "\u0B95", + "/taml:la": "\u0BB2", + "/taml:lla": "\u0BB3", + "/taml:llla": "\u0BB4", + "/taml:ma": "\u0BAE", + "/taml:monthsign": "\u0BF4", + "/taml:na": "\u0BA8", + "/taml:nga": "\u0B99", + "/taml:nine": "\u0BEF", + "/taml:nna": "\u0BA3", + "/taml:nnna": "\u0BA9", + "/taml:nya": "\u0B9E", + "/taml:o": "\u0B92", + "/taml:om": "\u0BD0", + "/taml:one": "\u0BE7", + "/taml:onehundred": "\u0BF1", + "/taml:onethousand": "\u0BF2", + "/taml:oo": "\u0B93", + "/taml:oosign": "\u0BCB", + "/taml:osign": "\u0BCA", + "/taml:pa": "\u0BAA", + "/taml:ra": "\u0BB0", + "/taml:rra": "\u0BB1", + "/taml:rupeesign": "\u0BF9", + "/taml:sa": "\u0BB8", + "/taml:seven": "\u0BED", + "/taml:sha": "\u0BB6", + "/taml:sign": "\u0BFA", + "/taml:six": "\u0BEC", + "/taml:ssa": "\u0BB7", + "/taml:ta": "\u0BA4", + "/taml:ten": "\u0BF0", + "/taml:three": "\u0BE9", + "/taml:tta": "\u0B9F", + "/taml:two": "\u0BE8", + "/taml:u": "\u0B89", + "/taml:usign": "\u0BC1", + "/taml:uu": "\u0B8A", + "/taml:uusign": "\u0BC2", + "/taml:va": "\u0BB5", + "/taml:viramasign": "\u0BCD", + "/taml:visargasign": "\u0B83", + "/taml:ya": "\u0BAF", + "/taml:yearsign": "\u0BF5", + "/taml:zero": "\u0BE6", + "/tamurda": "\uA9A1", + "/tanabataTree": "\u1F38B", + "/tangerine": "\u1F34A", + "/tapeCartridge": "\u1F5AD", + "/tarungvowel": "\uA9B4", + "/tatweelFathatanAbove": "\uFE71", + "/tatweelarabic": "\u0640", + "/tau": "\u03C4", + "/taurus": "\u2649", + "/tav": "\u05EA", + "/tav:hb": "\u05EA", + "/tavdages": "\uFB4A", + "/tavdagesh": "\uFB4A", + "/tavdageshhebrew": "\uFB4A", + "/tavhebrew": "\u05EA", + "/tavwide:hb": "\uFB28", + "/tavwithdagesh:hb": "\uFB4A", + "/taxi": "\u1F695", + "/tbar": "\u0167", + "/tbopomofo": "\u310A", + "/tcaron": "\u0165", + "/tccurl": "\u02A8", + "/tcedilla": "\u0163", + "/tcheh": "\u0686", + "/tcheh.fina": "\uFB7B", + "/tcheh.init": "\uFB7C", + "/tcheh.isol": "\uFB7A", + "/tcheh.medi": "\uFB7D", + "/tcheharabic": "\u0686", + "/tchehdotabove": "\u06BF", + "/tcheheh": "\u0687", + "/tcheheh.fina": "\uFB7F", + "/tcheheh.init": "\uFB80", + "/tcheheh.isol": "\uFB7E", + "/tcheheh.medi": "\uFB81", + "/tchehfinalarabic": "\uFB7B", + "/tchehinitialarabic": "\uFB7C", + "/tchehmedialarabic": "\uFB7D", + "/tchehmeeminitialarabic": "\uFB7C", + "/tcircle": "\u24E3", + "/tcircumflexbelow": "\u1E71", + "/tcommaaccent": "\u0163", + "/tcurl": "\u0236", + "/tdieresis": "\u1E97", + "/tdot": "\u1E6B", + "/tdotaccent": "\u1E6B", + "/tdotbelow": "\u1E6D", + "/teacupOutHandle": "\u1F375", + "/tear-offCalendar": "\u1F4C6", + "/tecirclekatakana": "\u32E2", + "/tecyr": "\u0442", + "/tecyrillic": "\u0442", + "/tedescendercyrillic": "\u04AD", + "/teh": "\u062A", + "/teh.fina": "\uFE96", + "/teh.init": "\uFE97", + "/teh.init_alefmaksura.fina": "\uFC0F", + "/teh.init_hah.fina": "\uFC0C", + "/teh.init_hah.medi": "\uFCA2", + "/teh.init_hah.medi_jeem.medi": "\uFD52", + "/teh.init_hah.medi_meem.medi": "\uFD53", + "/teh.init_heh.medi": "\uFCA5", + "/teh.init_jeem.fina": "\uFC0B", + "/teh.init_jeem.medi": "\uFCA1", + "/teh.init_jeem.medi_meem.medi": "\uFD50", + "/teh.init_khah.fina": "\uFC0D", + "/teh.init_khah.medi": "\uFCA3", + "/teh.init_khah.medi_meem.medi": "\uFD54", + "/teh.init_meem.fina": "\uFC0E", + "/teh.init_meem.medi": "\uFCA4", + "/teh.init_meem.medi_hah.medi": "\uFD56", + "/teh.init_meem.medi_jeem.medi": "\uFD55", + "/teh.init_meem.medi_khah.medi": "\uFD57", + "/teh.init_yeh.fina": "\uFC10", + "/teh.isol": "\uFE95", + "/teh.medi": "\uFE98", + "/teh.medi_alefmaksura.fina": "\uFC74", + "/teh.medi_hah.medi_jeem.fina": "\uFD51", + "/teh.medi_heh.medi": "\uFCE4", + "/teh.medi_jeem.medi_alefmaksura.fina": "\uFDA0", + "/teh.medi_jeem.medi_yeh.fina": "\uFD9F", + "/teh.medi_khah.medi_alefmaksura.fina": "\uFDA2", + "/teh.medi_khah.medi_yeh.fina": "\uFDA1", + "/teh.medi_meem.fina": "\uFC72", + "/teh.medi_meem.medi": "\uFCE3", + "/teh.medi_meem.medi_alefmaksura.fina": "\uFDA4", + "/teh.medi_meem.medi_yeh.fina": "\uFDA3", + "/teh.medi_noon.fina": "\uFC73", + "/teh.medi_reh.fina": "\uFC70", + "/teh.medi_yeh.fina": "\uFC75", + "/teh.medi_zain.fina": "\uFC71", + "/teharabic": "\u062A", + "/tehdownthreedotsabove": "\u067D", + "/teheh": "\u067F", + "/teheh.fina": "\uFB63", + "/teheh.init": "\uFB64", + "/teheh.isol": "\uFB62", + "/teheh.medi": "\uFB65", + "/tehfinalarabic": "\uFE96", + "/tehhahinitialarabic": "\uFCA2", + "/tehhahisolatedarabic": "\uFC0C", + "/tehinitialarabic": "\uFE97", + "/tehiragana": "\u3066", + "/tehjeeminitialarabic": "\uFCA1", + "/tehjeemisolatedarabic": "\uFC0B", + "/tehmarbuta": "\u0629", + "/tehmarbuta.fina": "\uFE94", + "/tehmarbuta.isol": "\uFE93", + "/tehmarbutaarabic": "\u0629", + "/tehmarbutafinalarabic": "\uFE94", + "/tehmarbutagoal": "\u06C3", + "/tehmedialarabic": "\uFE98", + "/tehmeeminitialarabic": "\uFCA4", + "/tehmeemisolatedarabic": "\uFC0E", + "/tehnoonfinalarabic": "\uFC73", + "/tehring": "\u067C", + "/tekatakana": "\u30C6", + "/tekatakanahalfwidth": "\uFF83", + "/telephone": "\u2121", + "/telephoneOnTopOfModem": "\u1F580", + "/telephoneReceiver": "\u1F4DE", + "/telephoneReceiverPage": "\u1F57C", + "/telephoneblack": "\u260E", + "/telephonerecorder": "\u2315", + "/telephonewhite": "\u260F", + "/telescope": "\u1F52D", + "/television": "\u1F4FA", + "/telishaGedolah:hb": "\u05A0", + "/telishaQetannah:hb": "\u05A9", + "/telishagedolahebrew": "\u05A0", + "/telishaqetanahebrew": "\u05A9", + "/telu:a": "\u0C05", + "/telu:aa": "\u0C06", + "/telu:aasign": "\u0C3E", + "/telu:ai": "\u0C10", + "/telu:ailengthmark": "\u0C56", + "/telu:aisign": "\u0C48", + "/telu:anusvarasign": "\u0C02", + "/telu:au": "\u0C14", + "/telu:ausign": "\u0C4C", + "/telu:avagrahasign": "\u0C3D", + "/telu:ba": "\u0C2C", + "/telu:bha": "\u0C2D", + "/telu:bindusigncandra": "\u0C01", + "/telu:ca": "\u0C1A", + "/telu:cha": "\u0C1B", + "/telu:combiningbinduabovesigncandra": "\u0C00", + "/telu:da": "\u0C26", + "/telu:dda": "\u0C21", + "/telu:ddha": "\u0C22", + "/telu:dha": "\u0C27", + "/telu:dza": "\u0C59", + "/telu:e": "\u0C0E", + "/telu:ee": "\u0C0F", + "/telu:eesign": "\u0C47", + "/telu:eight": "\u0C6E", + "/telu:esign": "\u0C46", + "/telu:five": "\u0C6B", + "/telu:four": "\u0C6A", + "/telu:fractiononeforevenpowersoffour": "\u0C7C", + "/telu:fractiononeforoddpowersoffour": "\u0C79", + "/telu:fractionthreeforevenpowersoffour": "\u0C7E", + "/telu:fractionthreeforoddpowersoffour": "\u0C7B", + "/telu:fractiontwoforevenpowersoffour": "\u0C7D", + "/telu:fractiontwoforoddpowersoffour": "\u0C7A", + "/telu:fractionzeroforoddpowersoffour": "\u0C78", + "/telu:ga": "\u0C17", + "/telu:gha": "\u0C18", + "/telu:ha": "\u0C39", + "/telu:i": "\u0C07", + "/telu:ii": "\u0C08", + "/telu:iisign": "\u0C40", + "/telu:isign": "\u0C3F", + "/telu:ja": "\u0C1C", + "/telu:jha": "\u0C1D", + "/telu:ka": "\u0C15", + "/telu:kha": "\u0C16", + "/telu:la": "\u0C32", + "/telu:lengthmark": "\u0C55", + "/telu:lla": "\u0C33", + "/telu:llla": "\u0C34", + "/telu:llsignvocal": "\u0C63", + "/telu:llvocal": "\u0C61", + "/telu:lsignvocal": "\u0C62", + "/telu:lvocal": "\u0C0C", + "/telu:ma": "\u0C2E", + "/telu:na": "\u0C28", + "/telu:nga": "\u0C19", + "/telu:nine": "\u0C6F", + "/telu:nna": "\u0C23", + "/telu:nya": "\u0C1E", + "/telu:o": "\u0C12", + "/telu:one": "\u0C67", + "/telu:oo": "\u0C13", + "/telu:oosign": "\u0C4B", + "/telu:osign": "\u0C4A", + "/telu:pa": "\u0C2A", + "/telu:pha": "\u0C2B", + "/telu:ra": "\u0C30", + "/telu:rra": "\u0C31", + "/telu:rrra": "\u0C5A", + "/telu:rrsignvocal": "\u0C44", + "/telu:rrvocal": "\u0C60", + "/telu:rsignvocal": "\u0C43", + "/telu:rvocal": "\u0C0B", + "/telu:sa": "\u0C38", + "/telu:seven": "\u0C6D", + "/telu:sha": "\u0C36", + "/telu:six": "\u0C6C", + "/telu:ssa": "\u0C37", + "/telu:ta": "\u0C24", + "/telu:tha": "\u0C25", + "/telu:three": "\u0C69", + "/telu:tsa": "\u0C58", + "/telu:tta": "\u0C1F", + "/telu:ttha": "\u0C20", + "/telu:tuumusign": "\u0C7F", + "/telu:two": "\u0C68", + "/telu:u": "\u0C09", + "/telu:usign": "\u0C41", + "/telu:uu": "\u0C0A", + "/telu:uusign": "\u0C42", + "/telu:va": "\u0C35", + "/telu:viramasign": "\u0C4D", + "/telu:visargasign": "\u0C03", + "/telu:ya": "\u0C2F", + "/telu:zero": "\u0C66", + "/ten.roman": "\u2169", + "/ten.romansmall": "\u2179", + "/tencircle": "\u2469", + "/tencircledbl": "\u24FE", + "/tencirclesquare": "\u3248", + "/tenge": "\u20B8", + "/tenhangzhou": "\u3038", + "/tenideographiccircled": "\u3289", + "/tenideographicparen": "\u3229", + "/tennisRacquetAndBall": "\u1F3BE", + "/tenparen": "\u247D", + "/tenparenthesized": "\u247D", + "/tenperiod": "\u2491", + "/tenroman": "\u2179", + "/tent": "\u26FA", + "/tenthousand.roman": "\u2182", + "/tesh": "\u02A7", + "/tet": "\u05D8", + "/tet:hb": "\u05D8", + "/tetailcyr": "\u04AD", + "/tetdagesh": "\uFB38", + "/tetdageshhebrew": "\uFB38", + "/tethebrew": "\u05D8", + "/tetrasememetrical": "\u23D8", + "/tetsecyr": "\u04B5", + "/tetsecyrillic": "\u04B5", + "/tetwithdagesh:hb": "\uFB38", + "/tevir:hb": "\u059B", + "/tevirhebrew": "\u059B", + "/tevirlefthebrew": "\u059B", + "/thabengali": "\u09A5", + "/thadeva": "\u0925", + "/thagujarati": "\u0AA5", + "/thagurmukhi": "\u0A25", + "/thai:angkhankhu": "\u0E5A", + "/thai:baht": "\u0E3F", + "/thai:bobaimai": "\u0E1A", + "/thai:chochan": "\u0E08", + "/thai:chochang": "\u0E0A", + "/thai:choching": "\u0E09", + "/thai:chochoe": "\u0E0C", + "/thai:dochada": "\u0E0E", + "/thai:dodek": "\u0E14", + "/thai:eight": "\u0E58", + "/thai:five": "\u0E55", + "/thai:fofa": "\u0E1D", + "/thai:fofan": "\u0E1F", + "/thai:fongman": "\u0E4F", + "/thai:four": "\u0E54", + "/thai:hohip": "\u0E2B", + "/thai:honokhuk": "\u0E2E", + "/thai:khokhai": "\u0E02", + "/thai:khokhon": "\u0E05", + "/thai:khokhuat": "\u0E03", + "/thai:khokhwai": "\u0E04", + "/thai:khomut": "\u0E5B", + "/thai:khorakhang": "\u0E06", + "/thai:kokai": "\u0E01", + "/thai:lakkhangyao": "\u0E45", + "/thai:lochula": "\u0E2C", + "/thai:loling": "\u0E25", + "/thai:lu": "\u0E26", + "/thai:maichattawa": "\u0E4B", + "/thai:maiek": "\u0E48", + "/thai:maihan-akat": "\u0E31", + "/thai:maitaikhu": "\u0E47", + "/thai:maitho": "\u0E49", + "/thai:maitri": "\u0E4A", + "/thai:maiyamok": "\u0E46", + "/thai:moma": "\u0E21", + "/thai:ngongu": "\u0E07", + "/thai:nikhahit": "\u0E4D", + "/thai:nine": "\u0E59", + "/thai:nonen": "\u0E13", + "/thai:nonu": "\u0E19", + "/thai:oang": "\u0E2D", + "/thai:one": "\u0E51", + "/thai:paiyannoi": "\u0E2F", + "/thai:phinthu": "\u0E3A", + "/thai:phophan": "\u0E1E", + "/thai:phophung": "\u0E1C", + "/thai:phosamphao": "\u0E20", + "/thai:popla": "\u0E1B", + "/thai:rorua": "\u0E23", + "/thai:ru": "\u0E24", + "/thai:saraa": "\u0E30", + "/thai:saraaa": "\u0E32", + "/thai:saraae": "\u0E41", + "/thai:saraaimaimalai": "\u0E44", + "/thai:saraaimaimuan": "\u0E43", + "/thai:saraam": "\u0E33", + "/thai:sarae": "\u0E40", + "/thai:sarai": "\u0E34", + "/thai:saraii": "\u0E35", + "/thai:sarao": "\u0E42", + "/thai:sarau": "\u0E38", + "/thai:saraue": "\u0E36", + "/thai:sarauee": "\u0E37", + "/thai:sarauu": "\u0E39", + "/thai:seven": "\u0E57", + "/thai:six": "\u0E56", + "/thai:sorusi": "\u0E29", + "/thai:sosala": "\u0E28", + "/thai:soso": "\u0E0B", + "/thai:sosua": "\u0E2A", + "/thai:thanthakhat": "\u0E4C", + "/thai:thonangmontho": "\u0E11", + "/thai:thophuthao": "\u0E12", + "/thai:thothahan": "\u0E17", + "/thai:thothan": "\u0E10", + "/thai:thothong": "\u0E18", + "/thai:thothung": "\u0E16", + "/thai:three": "\u0E53", + "/thai:topatak": "\u0E0F", + "/thai:totao": "\u0E15", + "/thai:two": "\u0E52", + "/thai:wowaen": "\u0E27", + "/thai:yamakkan": "\u0E4E", + "/thai:yoyak": "\u0E22", + "/thai:yoying": "\u0E0D", + "/thai:zero": "\u0E50", + "/thal": "\u0630", + "/thal.fina": "\uFEAC", + "/thal.init_superscriptalef.fina": "\uFC5B", + "/thal.isol": "\uFEAB", + "/thalarabic": "\u0630", + "/thalfinalarabic": "\uFEAC", + "/thanthakhatlowleftthai": "\uF898", + "/thanthakhatlowrightthai": "\uF897", + "/thanthakhatthai": "\u0E4C", + "/thanthakhatupperleftthai": "\uF896", + "/theh": "\u062B", + "/theh.fina": "\uFE9A", + "/theh.init": "\uFE9B", + "/theh.init_alefmaksura.fina": "\uFC13", + "/theh.init_jeem.fina": "\uFC11", + "/theh.init_meem.fina": "\uFC12", + "/theh.init_meem.medi": "\uFCA6", + "/theh.init_yeh.fina": "\uFC14", + "/theh.isol": "\uFE99", + "/theh.medi": "\uFE9C", + "/theh.medi_alefmaksura.fina": "\uFC7A", + "/theh.medi_heh.medi": "\uFCE6", + "/theh.medi_meem.fina": "\uFC78", + "/theh.medi_meem.medi": "\uFCE5", + "/theh.medi_noon.fina": "\uFC79", + "/theh.medi_reh.fina": "\uFC76", + "/theh.medi_yeh.fina": "\uFC7B", + "/theh.medi_zain.fina": "\uFC77", + "/theharabic": "\u062B", + "/thehfinalarabic": "\uFE9A", + "/thehinitialarabic": "\uFE9B", + "/thehmedialarabic": "\uFE9C", + "/thereexists": "\u2203", + "/therefore": "\u2234", + "/thermometer": "\u1F321", + "/theta": "\u03B8", + "/theta.math": "\u03D1", + "/theta1": "\u03D1", + "/thetasymbolgreek": "\u03D1", + "/thieuthacirclekorean": "\u3279", + "/thieuthaparenkorean": "\u3219", + "/thieuthcirclekorean": "\u326B", + "/thieuthkorean": "\u314C", + "/thieuthparenkorean": "\u320B", + "/thinspace": "\u2009", + "/thirteencircle": "\u246C", + "/thirteencircleblack": "\u24ED", + "/thirteenparen": "\u2480", + "/thirteenparenthesized": "\u2480", + "/thirteenperiod": "\u2494", + "/thirtycircle": "\u325A", + "/thirtycirclesquare": "\u324A", + "/thirtyeightcircle": "\u32B3", + "/thirtyfivecircle": "\u325F", + "/thirtyfourcircle": "\u325E", + "/thirtyhangzhou": "\u303A", + "/thirtyninecircle": "\u32B4", + "/thirtyonecircle": "\u325B", + "/thirtysevencircle": "\u32B2", + "/thirtysixcircle": "\u32B1", + "/thirtythreecircle": "\u325D", + "/thirtytwocircle": "\u325C", + "/thonangmonthothai": "\u0E11", + "/thook": "\u01AD", + "/thophuthaothai": "\u0E12", + "/thorn": "\u00FE", + "/thornstroke": "\uA765", + "/thornstrokedescender": "\uA767", + "/thothahanthai": "\u0E17", + "/thothanthai": "\u0E10", + "/thothongthai": "\u0E18", + "/thothungthai": "\u0E16", + "/thoughtBalloon": "\u1F4AD", + "/thousandcyrillic": "\u0482", + "/thousandscyr": "\u0482", + "/thousandsseparator": "\u066C", + "/thousandsseparatorarabic": "\u066C", + "/thousandsseparatorpersian": "\u066C", + "/three": "\u0033", + "/three.inferior": "\u2083", + "/three.roman": "\u2162", + "/three.romansmall": "\u2172", + "/threeButtonMouse": "\u1F5B1", + "/threeNetworkedComputers": "\u1F5A7", + "/threeRaysAbove": "\u1F5E4", + "/threeRaysBelow": "\u1F5E5", + "/threeRaysLeft": "\u1F5E6", + "/threeRaysRight": "\u1F5E7", + "/threeSpeechBubbles": "\u1F5EB", + "/threearabic": "\u0663", + "/threebengali": "\u09E9", + "/threecircle": "\u2462", + "/threecircledbl": "\u24F7", + "/threecircleinversesansserif": "\u278C", + "/threecomma": "\u1F104", + "/threedeva": "\u0969", + "/threedimensionalangle": "\u27C0", + "/threedotpunctuation": "\u2056", + "/threedotsaboveabove": "\u06DB", + "/threedsquare": "\u1F19B", + "/threeeighths": "\u215C", + "/threefar": "\u06F3", + "/threefifths": "\u2157", + "/threegujarati": "\u0AE9", + "/threegurmukhi": "\u0A69", + "/threehackarabic": "\u0663", + "/threehangzhou": "\u3023", + "/threeideographiccircled": "\u3282", + "/threeideographicparen": "\u3222", + "/threeinferior": "\u2083", + "/threelinesconvergingleft": "\u269F", + "/threelinesconvergingright": "\u269E", + "/threemonospace": "\uFF13", + "/threenumeratorbengali": "\u09F6", + "/threeoldstyle": "\uF733", + "/threeparen": "\u2476", + "/threeparenthesized": "\u2476", + "/threeperemspace": "\u2004", + "/threeperiod": "\u248A", + "/threepersian": "\u06F3", + "/threequarters": "\u00BE", + "/threequartersemdash": "\uF6DE", + "/threerightarrows": "\u21F6", + "/threeroman": "\u2172", + "/threesuperior": "\u00B3", + "/threethai": "\u0E53", + "/thumbsDownSign": "\u1F44E", + "/thumbsUpSign": "\u1F44D", + "/thundercloudrain": "\u26C8", + "/thunderstorm": "\u2608", + "/thzfullwidth": "\u3394", + "/thzsquare": "\u3394", + "/tibt:AA": "\u0F60", + "/tibt:a": "\u0F68", + "/tibt:aavowelsign": "\u0F71", + "/tibt:angkhanggyasmark": "\u0F3D", + "/tibt:angkhanggyonmark": "\u0F3C", + "/tibt:astrologicalkhyudpasign": "\u0F18", + "/tibt:astrologicalsdongtshugssign": "\u0F19", + "/tibt:astrologicalsgragcancharrtagssign": "\u0F17", + "/tibt:asubjoined": "\u0FB8", + "/tibt:ba": "\u0F56", + "/tibt:basubjoined": "\u0FA6", + "/tibt:bha": "\u0F57", + "/tibt:bhasubjoined": "\u0FA7", + "/tibt:bkashogyigmgomark": "\u0F0A", + "/tibt:brdarnyingyigmgomdunmainitialmark": "\u0FD3", + "/tibt:brdarnyingyigmgosgabmaclosingmark": "\u0FD4", + "/tibt:bsdusrtagsmark": "\u0F34", + "/tibt:bskashoggimgorgyanmark": "\u0FD0", + "/tibt:bskuryigmgomark": "\u0F09", + "/tibt:ca": "\u0F45", + "/tibt:cangteucantillationsign": "\u0FC2", + "/tibt:caretdzudrtagsbzhimigcanmark": "\u0F36", + "/tibt:caretdzudrtagsmelongcanmark": "\u0F13", + "/tibt:caretyigmgophurshadmamark": "\u0F06", + "/tibt:casubjoined": "\u0F95", + "/tibt:cha": "\u0F46", + "/tibt:chadrtagslogotypesign": "\u0F15", + "/tibt:chasubjoined": "\u0F96", + "/tibt:chemgomark": "\u0F38", + "/tibt:da": "\u0F51", + "/tibt:dasubjoined": "\u0FA1", + "/tibt:dda": "\u0F4C", + "/tibt:ddasubjoined": "\u0F9C", + "/tibt:ddha": "\u0F4D", + "/tibt:ddhasubjoined": "\u0F9D", + "/tibt:delimitertshegbstarmark": "\u0F0C", + "/tibt:dha": "\u0F52", + "/tibt:dhasubjoined": "\u0FA2", + "/tibt:drilbusymbol": "\u0FC4", + "/tibt:dza": "\u0F5B", + "/tibt:dzasubjoined": "\u0FAB", + "/tibt:dzha": "\u0F5C", + "/tibt:dzhasubjoined": "\u0FAC", + "/tibt:eevowelsign": "\u0F7B", + "/tibt:eight": "\u0F28", + "/tibt:evowelsign": "\u0F7A", + "/tibt:five": "\u0F25", + "/tibt:four": "\u0F24", + "/tibt:ga": "\u0F42", + "/tibt:gasubjoined": "\u0F92", + "/tibt:gha": "\u0F43", + "/tibt:ghasubjoined": "\u0F93", + "/tibt:grucanrgyingssign": "\u0F8A", + "/tibt:grumedrgyingssign": "\u0F8B", + "/tibt:gtertshegmark": "\u0F14", + "/tibt:gteryigmgotruncatedamark": "\u0F01", + "/tibt:gteryigmgoumgtertshegmamark": "\u0F03", + "/tibt:gteryigmgoumrnambcadmamark": "\u0F02", + "/tibt:gugrtagsgyasmark": "\u0F3B", + "/tibt:gugrtagsgyonmark": "\u0F3A", + "/tibt:ha": "\u0F67", + "/tibt:halantamark": "\u0F84", + "/tibt:halfeight": "\u0F31", + "/tibt:halffive": "\u0F2E", + "/tibt:halffour": "\u0F2D", + "/tibt:halfnine": "\u0F32", + "/tibt:halfone": "\u0F2A", + "/tibt:halfseven": "\u0F30", + "/tibt:halfsix": "\u0F2F", + "/tibt:halfthree": "\u0F2C", + "/tibt:halftwo": "\u0F2B", + "/tibt:halfzero": "\u0F33", + "/tibt:hasubjoined": "\u0FB7", + "/tibt:heavybeatcantillationsign": "\u0FC0", + "/tibt:iivowelsign": "\u0F73", + "/tibt:intersyllabictshegmark": "\u0F0B", + "/tibt:invertedmchucansign": "\u0F8C", + "/tibt:invertedmchucansubjoinedsign": "\u0F8F", + "/tibt:ivowelsign": "\u0F72", + "/tibt:ja": "\u0F47", + "/tibt:jasubjoined": "\u0F97", + "/tibt:ka": "\u0F40", + "/tibt:kasubjoined": "\u0F90", + "/tibt:kha": "\u0F41", + "/tibt:khasubjoined": "\u0F91", + "/tibt:kka": "\u0F6B", + "/tibt:kssa": "\u0F69", + "/tibt:kssasubjoined": "\u0FB9", + "/tibt:kurukha": "\u0FBE", + "/tibt:kurukhabzhimigcan": "\u0FBF", + "/tibt:la": "\u0F63", + "/tibt:lasubjoined": "\u0FB3", + "/tibt:lcetsacansign": "\u0F88", + "/tibt:lcetsacansubjoinedsign": "\u0F8D", + "/tibt:lcirtagssign": "\u0F86", + "/tibt:leadingmchanrtagsmark": "\u0FD9", + "/tibt:lhagrtagslogotypesign": "\u0F16", + "/tibt:lightbeatcantillationsign": "\u0FC1", + "/tibt:llvocalicvowelsign": "\u0F79", + "/tibt:lvocalicvowelsign": "\u0F78", + "/tibt:ma": "\u0F58", + "/tibt:martshessign": "\u0F3F", + "/tibt:masubjoined": "\u0FA8", + "/tibt:mchucansign": "\u0F89", + "/tibt:mchucansubjoinedsign": "\u0F8E", + "/tibt:mnyamyiggimgorgyanmark": "\u0FD1", + "/tibt:na": "\u0F53", + "/tibt:nasubjoined": "\u0FA3", + "/tibt:nga": "\u0F44", + "/tibt:ngasbzungnyizlamark": "\u0F35", + "/tibt:ngasbzungsgorrtagsmark": "\u0F37", + "/tibt:ngasubjoined": "\u0F94", + "/tibt:nine": "\u0F29", + "/tibt:nna": "\u0F4E", + "/tibt:nnasubjoined": "\u0F9E", + "/tibt:norbubzhikhyilsymbol": "\u0FCC", + "/tibt:norbugsumkhyilsymbol": "\u0FCB", + "/tibt:norbunyiskhyilsymbol": "\u0FCA", + "/tibt:norbusymbol": "\u0FC9", + "/tibt:nya": "\u0F49", + "/tibt:nyasubjoined": "\u0F99", + "/tibt:nyisshadmark": "\u0F0E", + "/tibt:nyistshegmark": "\u0FD2", + "/tibt:nyistshegshadmark": "\u0F10", + "/tibt:nyizlanaadasign": "\u0F82", + "/tibt:omsyllable": "\u0F00", + "/tibt:one": "\u0F21", + "/tibt:oovowelsign": "\u0F7D", + "/tibt:ovowelsign": "\u0F7C", + "/tibt:pa": "\u0F54", + "/tibt:padmagdansymbol": "\u0FC6", + "/tibt:palutamark": "\u0F85", + "/tibt:pasubjoined": "\u0FA4", + "/tibt:pha": "\u0F55", + "/tibt:phasubjoined": "\u0FA5", + "/tibt:phurpasymbol": "\u0FC8", + "/tibt:ra": "\u0F62", + "/tibt:rafixed": "\u0F6A", + "/tibt:rasubjoined": "\u0FB2", + "/tibt:rasubjoinedfixed": "\u0FBC", + "/tibt:rdeldkargcigsign": "\u0F1A", + "/tibt:rdeldkargnyissign": "\u0F1B", + "/tibt:rdeldkargsumsign": "\u0F1C", + "/tibt:rdeldkarrdelnagsign": "\u0F1F", + "/tibt:rdelnaggcigsign": "\u0F1D", + "/tibt:rdelnaggnyissign": "\u0F1E", + "/tibt:rdelnaggsumsign": "\u0FCF", + "/tibt:rdelnagrdeldkarsign": "\u0FCE", + "/tibt:rdorjergyagramsymbol": "\u0FC7", + "/tibt:rdorjesymbol": "\u0FC5", + "/tibt:reversediivowelsign": "\u0F81", + "/tibt:reversedivowelsign": "\u0F80", + "/tibt:rgyagramshadmark": "\u0F12", + "/tibt:rinchenspungsshadmark": "\u0F11", + "/tibt:rjessungarosign": "\u0F7E", + "/tibt:rnambcadsign": "\u0F7F", + "/tibt:rra": "\u0F6C", + "/tibt:rrvocalicvowelsign": "\u0F77", + "/tibt:rvocalicvowelsign": "\u0F76", + "/tibt:sa": "\u0F66", + "/tibt:sasubjoined": "\u0FB6", + "/tibt:sbrulshadmark": "\u0F08", + "/tibt:sbubchalcantillationsign": "\u0FC3", + "/tibt:seven": "\u0F27", + "/tibt:sha": "\u0F64", + "/tibt:shadmark": "\u0F0D", + "/tibt:shasubjoined": "\u0FB4", + "/tibt:six": "\u0F26", + "/tibt:snaldansign": "\u0F83", + "/tibt:ssa": "\u0F65", + "/tibt:ssasubjoined": "\u0FB5", + "/tibt:subjoinedAA": "\u0FB0", + "/tibt:svastileft": "\u0FD6", + "/tibt:svastileftdot": "\u0FD8", + "/tibt:svastiright": "\u0FD5", + "/tibt:svastirightdot": "\u0FD7", + "/tibt:ta": "\u0F4F", + "/tibt:tasubjoined": "\u0F9F", + "/tibt:tha": "\u0F50", + "/tibt:thasubjoined": "\u0FA0", + "/tibt:three": "\u0F23", + "/tibt:trailingmchanrtagsmark": "\u0FDA", + "/tibt:tsa": "\u0F59", + "/tibt:tsaphrumark": "\u0F39", + "/tibt:tsasubjoined": "\u0FA9", + "/tibt:tsha": "\u0F5A", + "/tibt:tshasubjoined": "\u0FAA", + "/tibt:tshegshadmark": "\u0F0F", + "/tibt:tta": "\u0F4A", + "/tibt:ttasubjoined": "\u0F9A", + "/tibt:ttha": "\u0F4B", + "/tibt:tthasubjoined": "\u0F9B", + "/tibt:two": "\u0F22", + "/tibt:uuvowelsign": "\u0F75", + "/tibt:uvowelsign": "\u0F74", + "/tibt:wa": "\u0F5D", + "/tibt:wasubjoined": "\u0FAD", + "/tibt:wasubjoinedfixed": "\u0FBA", + "/tibt:ya": "\u0F61", + "/tibt:yangrtagssign": "\u0F87", + "/tibt:yartshessign": "\u0F3E", + "/tibt:yasubjoined": "\u0FB1", + "/tibt:yasubjoinedfixed": "\u0FBB", + "/tibt:yigmgomdunmainitialmark": "\u0F04", + "/tibt:yigmgosgabmaclosingmark": "\u0F05", + "/tibt:yigmgotshegshadmamark": "\u0F07", + "/tibt:za": "\u0F5F", + "/tibt:zasubjoined": "\u0FAF", + "/tibt:zero": "\u0F20", + "/tibt:zha": "\u0F5E", + "/tibt:zhasubjoined": "\u0FAE", + "/ticirclekatakana": "\u32E0", + "/tickconvavediamondleftwhite": "\u27E2", + "/tickconvavediamondrightwhite": "\u27E3", + "/ticket": "\u1F3AB", + "/tickleftwhitesquare": "\u27E4", + "/tickrightwhitesquare": "\u27E5", + "/tifcha:hb": "\u0596", + "/tiger": "\u1F405", + "/tigerFace": "\u1F42F", + "/tihiragana": "\u3061", + "/tikatakana": "\u30C1", + "/tikatakanahalfwidth": "\uFF81", + "/tikeutacirclekorean": "\u3270", + "/tikeutaparenkorean": "\u3210", + "/tikeutcirclekorean": "\u3262", + "/tikeutkorean": "\u3137", + "/tikeutparenkorean": "\u3202", + "/tilde": "\u02DC", + "/tildebelowcmb": "\u0330", + "/tildecmb": "\u0303", + "/tildecomb": "\u0303", + "/tildediaeresisfunc": "\u2368", + "/tildedotaccent": "\u2E1E", + "/tildedotbelow": "\u2E1F", + "/tildedoublecmb": "\u0360", + "/tildeequalsreversed": "\u22CD", + "/tildelowmod": "\u02F7", + "/tildeoperator": "\u223C", + "/tildeoverlaycmb": "\u0334", + "/tildereversed": "\u223D", + "/tildering": "\u2E1B", + "/tildetpl": "\u224B", + "/tildeverticalcmb": "\u033E", + "/timerclock": "\u23F2", + "/timescircle": "\u2297", + "/tinsular": "\uA787", + "/tipehahebrew": "\u0596", + "/tipehalefthebrew": "\u0596", + "/tippigurmukhi": "\u0A70", + "/tiredFace": "\u1F62B", + "/tironiansignet": "\u204A", + "/tirtatumetespada": "\uA9DE", + "/titlocmbcyr": "\u0483", + "/titlocyrilliccmb": "\u0483", + "/tiwnarmenian": "\u057F", + "/tjekomicyr": "\u050F", + "/tlinebelow": "\u1E6F", + "/tmonospace": "\uFF54", + "/toarmenian": "\u0569", + "/tocirclekatakana": "\u32E3", + "/tocornerarrowNW": "\u21F1", + "/tocornerarrowSE": "\u21F2", + "/tohiragana": "\u3068", + "/toilet": "\u1F6BD", + "/tokatakana": "\u30C8", + "/tokatakanahalfwidth": "\uFF84", + "/tokyoTower": "\u1F5FC", + "/tolongvowel": "\uA9B5", + "/tomato": "\u1F345", + "/tonebarextrahighmod": "\u02E5", + "/tonebarextralowmod": "\u02E9", + "/tonebarhighmod": "\u02E6", + "/tonebarlowmod": "\u02E8", + "/tonebarmidmod": "\u02E7", + "/tonefive": "\u01BD", + "/tonehighbeginmod": "\u02F9", + "/tonehighendmod": "\u02FA", + "/tonelowbeginmod": "\u02FB", + "/tonelowendmod": "\u02FC", + "/tonesix": "\u0185", + "/tonetwo": "\u01A8", + "/tongue": "\u1F445", + "/tonos": "\u0384", + "/tonsquare": "\u3327", + "/topHat": "\u1F3A9", + "/topUpwardsArrowAbove": "\u1F51D", + "/topatakthai": "\u0E0F", + "/tortoiseshellbracketleft": "\u3014", + "/tortoiseshellbracketleftsmall": "\uFE5D", + "/tortoiseshellbracketleftvertical": "\uFE39", + "/tortoiseshellbracketright": "\u3015", + "/tortoiseshellbracketrightsmall": "\uFE5E", + "/tortoiseshellbracketrightvertical": "\uFE3A", + "/totalrunout": "\u2330", + "/totaothai": "\u0E15", + "/tpalatalhook": "\u01AB", + "/tparen": "\u24AF", + "/tparenthesized": "\u24AF", + "/trackball": "\u1F5B2", + "/tractor": "\u1F69C", + "/trademark": "\u2122", + "/trademarksans": "\uF8EA", + "/trademarkserif": "\uF6DB", + "/train": "\u1F686", + "/tram": "\u1F68A", + "/tramCar": "\u1F68B", + "/trapeziumwhite": "\u23E2", + "/tresillo": "\uA72B", + "/tretroflex": "\u0288", + "/tretroflexhook": "\u0288", + "/triagdn": "\u25BC", + "/triaglf": "\u25C4", + "/triagrt": "\u25BA", + "/triagup": "\u25B2", + "/triangleWithRoundedCorners": "\u1F6C6", + "/triangledotupwhite": "\u25EC", + "/triangledownblack": "\u25BC", + "/triangledownsmallblack": "\u25BE", + "/triangledownsmallwhite": "\u25BF", + "/triangledownwhite": "\u25BD", + "/trianglehalfupleftblack": "\u25ED", + "/trianglehalfuprightblack": "\u25EE", + "/triangleleftblack": "\u25C0", + "/triangleleftsmallblack": "\u25C2", + "/triangleleftsmallwhite": "\u25C3", + "/triangleleftwhite": "\u25C1", + "/triangleright": "\u22BF", + "/trianglerightblack": "\u25B6", + "/trianglerightsmallblack": "\u25B8", + "/trianglerightsmallwhite": "\u25B9", + "/trianglerightwhite": "\u25B7", + "/triangleupblack": "\u25B2", + "/triangleupsmallblack": "\u25B4", + "/triangleupsmallwhite": "\u25B5", + "/triangleupwhite": "\u25B3", + "/triangularFlagOnPost": "\u1F6A9", + "/triangularRuler": "\u1F4D0", + "/triangularbullet": "\u2023", + "/tricolon": "\u205D", + "/tricontainingtriwhiteanglesmall": "\u27C1", + "/tridentEmblem": "\u1F531", + "/trigramearth": "\u2637", + "/trigramfire": "\u2632", + "/trigramheaven": "\u2630", + "/trigramlake": "\u2631", + "/trigrammountain": "\u2636", + "/trigramthunder": "\u2633", + "/trigramwater": "\u2635", + "/trigramwind": "\u2634", + "/triplearrowleft": "\u21DA", + "/triplearrowright": "\u21DB", + "/tripledot": "\u061E", + "/trisememetrical": "\u23D7", + "/trns:baby": "\u1F6BC", + "/trolleybus": "\u1F68E", + "/trophy": "\u1F3C6", + "/tropicalDrink": "\u1F379", + "/tropicalFish": "\u1F420", + "/truckblack": "\u26DF", + "/true": "\u22A8", + "/trumpet": "\u1F3BA", + "/ts": "\u02A6", + "/tsadi": "\u05E6", + "/tsadi:hb": "\u05E6", + "/tsadidagesh": "\uFB46", + "/tsadidageshhebrew": "\uFB46", + "/tsadihebrew": "\u05E6", + "/tsadiwithdagesh:hb": "\uFB46", + "/tsecyr": "\u0446", + "/tsecyrillic": "\u0446", + "/tsere": "\u05B5", + "/tsere12": "\u05B5", + "/tsere1e": "\u05B5", + "/tsere2b": "\u05B5", + "/tsere:hb": "\u05B5", + "/tserehebrew": "\u05B5", + "/tserenarrowhebrew": "\u05B5", + "/tserequarterhebrew": "\u05B5", + "/tserewidehebrew": "\u05B5", + "/tshecyr": "\u045B", + "/tshecyrillic": "\u045B", + "/tsinnorit:hb": "\u05AE", + "/tstroke": "\u2C66", + "/tsuperior": "\uF6F3", + "/ttabengali": "\u099F", + "/ttadeva": "\u091F", + "/ttagujarati": "\u0A9F", + "/ttagurmukhi": "\u0A1F", + "/ttamahaprana": "\uA99C", + "/tteh": "\u0679", + "/tteh.fina": "\uFB67", + "/tteh.init": "\uFB68", + "/tteh.isol": "\uFB66", + "/tteh.medi": "\uFB69", + "/tteharabic": "\u0679", + "/tteheh": "\u067A", + "/tteheh.fina": "\uFB5F", + "/tteheh.init": "\uFB60", + "/tteheh.isol": "\uFB5E", + "/tteheh.medi": "\uFB61", + "/ttehfinalarabic": "\uFB67", + "/ttehinitialarabic": "\uFB68", + "/ttehmedialarabic": "\uFB69", + "/tthabengali": "\u09A0", + "/tthadeva": "\u0920", + "/tthagujarati": "\u0AA0", + "/tthagurmukhi": "\u0A20", + "/tturned": "\u0287", + "/tucirclekatakana": "\u32E1", + "/tugrik": "\u20AE", + "/tuhiragana": "\u3064", + "/tukatakana": "\u30C4", + "/tukatakanahalfwidth": "\uFF82", + "/tulip": "\u1F337", + "/tum": "\uA777", + "/turkishlira": "\u20BA", + "/turnedOkHandSign": "\u1F58F", + "/turnedcomma": "\u2E32", + "/turneddagger": "\u2E38", + "/turneddigitthree": "\u218B", + "/turneddigittwo": "\u218A", + "/turnedpiselehpada": "\uA9CD", + "/turnedsemicolon": "\u2E35", + "/turnedshogipieceblack": "\u26CA", + "/turnedshogipiecewhite": "\u26C9", + "/turnstiledblverticalbarright": "\u22AB", + "/turnstileleftrightdbl": "\u27DA", + "/turnstiletplverticalbarright": "\u22AA", + "/turtle": "\u1F422", + "/tusmallhiragana": "\u3063", + "/tusmallkatakana": "\u30C3", + "/tusmallkatakanahalfwidth": "\uFF6F", + "/twelve.roman": "\u216B", + "/twelve.romansmall": "\u217B", + "/twelvecircle": "\u246B", + "/twelvecircleblack": "\u24EC", + "/twelveparen": "\u247F", + "/twelveparenthesized": "\u247F", + "/twelveperiod": "\u2493", + "/twelveroman": "\u217B", + "/twenty-twopointtwosquare": "\u1F1A2", + "/twentycircle": "\u2473", + "/twentycircleblack": "\u24F4", + "/twentycirclesquare": "\u3249", + "/twentyeightcircle": "\u3258", + "/twentyfivecircle": "\u3255", + "/twentyfourcircle": "\u3254", + "/twentyhangzhou": "\u5344", + "/twentyninecircle": "\u3259", + "/twentyonecircle": "\u3251", + "/twentyparen": "\u2487", + "/twentyparenthesized": "\u2487", + "/twentyperiod": "\u249B", + "/twentysevencircle": "\u3257", + "/twentysixcircle": "\u3256", + "/twentythreecircle": "\u3253", + "/twentytwocircle": "\u3252", + "/twistedRightwardsArrows": "\u1F500", + "/two": "\u0032", + "/two.inferior": "\u2082", + "/two.roman": "\u2161", + "/two.romansmall": "\u2171", + "/twoButtonMouse": "\u1F5B0", + "/twoHearts": "\u1F495", + "/twoMenHoldingHands": "\u1F46C", + "/twoSpeechBubbles": "\u1F5EA", + "/twoWomenHoldingHands": "\u1F46D", + "/twoarabic": "\u0662", + "/twoasterisksalignedvertically": "\u2051", + "/twobengali": "\u09E8", + "/twocircle": "\u2461", + "/twocircledbl": "\u24F6", + "/twocircleinversesansserif": "\u278B", + "/twocomma": "\u1F103", + "/twodeva": "\u0968", + "/twodotenleader": "\u2025", + "/twodotleader": "\u2025", + "/twodotleadervertical": "\uFE30", + "/twodotpunctuation": "\u205A", + "/twodotsoveronedot": "\u2E2A", + "/twofar": "\u06F2", + "/twofifths": "\u2156", + "/twogujarati": "\u0AE8", + "/twogurmukhi": "\u0A68", + "/twohackarabic": "\u0662", + "/twohangzhou": "\u3022", + "/twoideographiccircled": "\u3281", + "/twoideographicparen": "\u3221", + "/twoinferior": "\u2082", + "/twoksquare": "\u1F19D", + "/twomonospace": "\uFF12", + "/twonumeratorbengali": "\u09F5", + "/twooldstyle": "\uF732", + "/twoparen": "\u2475", + "/twoparenthesized": "\u2475", + "/twoperiod": "\u2489", + "/twopersian": "\u06F2", + "/tworoman": "\u2171", + "/twoshortsjoinedmetrical": "\u23D6", + "/twoshortsoverlongmetrical": "\u23D5", + "/twostroke": "\u01BB", + "/twosuperior": "\u00B2", + "/twothai": "\u0E52", + "/twothirds": "\u2154", + "/twowayleftwaytrafficblack": "\u26D6", + "/twowayleftwaytrafficwhite": "\u26D7", + "/tz": "\uA729", + "/u": "\u0075", + "/u.fina": "\uFBD8", + "/u.isol": "\uFBD7", + "/uacute": "\u00FA", + "/uacutedblcyr": "\u04F3", + "/ubar": "\u0289", + "/ubengali": "\u0989", + "/ubopomofo": "\u3128", + "/ubracketleft": "\u2E26", + "/ubracketright": "\u2E27", + "/ubreve": "\u016D", + "/ucaron": "\u01D4", + "/ucircle": "\u24E4", + "/ucirclekatakana": "\u32D2", + "/ucircumflex": "\u00FB", + "/ucircumflexbelow": "\u1E77", + "/ucyr": "\u0443", + "/ucyrillic": "\u0443", + "/udattadeva": "\u0951", + "/udblacute": "\u0171", + "/udblgrave": "\u0215", + "/udeva": "\u0909", + "/udieresis": "\u00FC", + "/udieresisacute": "\u01D8", + "/udieresisbelow": "\u1E73", + "/udieresiscaron": "\u01DA", + "/udieresiscyr": "\u04F1", + "/udieresiscyrillic": "\u04F1", + "/udieresisgrave": "\u01DC", + "/udieresismacron": "\u01D6", + "/udotbelow": "\u1EE5", + "/ugrave": "\u00F9", + "/ugravedbl": "\u0215", + "/ugujarati": "\u0A89", + "/ugurmukhi": "\u0A09", + "/uhamza": "\u0677", + "/uhamza.isol": "\uFBDD", + "/uhdsquare": "\u1F1AB", + "/uhiragana": "\u3046", + "/uhoi": "\u1EE7", + "/uhookabove": "\u1EE7", + "/uhorn": "\u01B0", + "/uhornacute": "\u1EE9", + "/uhorndotbelow": "\u1EF1", + "/uhorngrave": "\u1EEB", + "/uhornhoi": "\u1EED", + "/uhornhookabove": "\u1EED", + "/uhorntilde": "\u1EEF", + "/uhungarumlaut": "\u0171", + "/uhungarumlautcyrillic": "\u04F3", + "/uighurkazakhkirghizalefmaksura.init": "\uFBE8", + "/uighurkazakhkirghizalefmaksura.medi": "\uFBE9", + "/uighurkirghizyeh.init_hamzaabove.medi_alefmaksura.fina": "\uFBF9", + "/uighurkirghizyeh.init_hamzaabove.medi_alefmaksura.medi": "\uFBFB", + "/uighurkirghizyeh.medi_hamzaabove.medi_alefmaksura.fina": "\uFBFA", + "/uinvertedbreve": "\u0217", + "/ukatakana": "\u30A6", + "/ukatakanahalfwidth": "\uFF73", + "/ukcyr": "\u0479", + "/ukcyrillic": "\u0479", + "/ukorean": "\u315C", + "/um": "\uA778", + "/umacron": "\u016B", + "/umacroncyr": "\u04EF", + "/umacroncyrillic": "\u04EF", + "/umacrondieresis": "\u1E7B", + "/umatragurmukhi": "\u0A41", + "/umbrella": "\u2602", + "/umbrellaonground": "\u26F1", + "/umbrellaraindrops": "\u2614", + "/umonospace": "\uFF55", + "/unamusedFace": "\u1F612", + "/unaspiratedmod": "\u02ED", + "/underscore": "\u005F", + "/underscorecenterline": "\uFE4E", + "/underscoredashed": "\uFE4D", + "/underscoredbl": "\u2017", + "/underscoremonospace": "\uFF3F", + "/underscorevertical": "\uFE33", + "/underscorewavy": "\uFE4F", + "/underscorewavyvertical": "\uFE34", + "/undertie": "\u203F", + "/undo": "\u238C", + "/union": "\u222A", + "/unionarray": "\u22C3", + "/uniondbl": "\u22D3", + "/universal": "\u2200", + "/unmarriedpartnership": "\u26AF", + "/uogonek": "\u0173", + "/uonsquare": "\u3306", + "/upPointingAirplane": "\u1F6E7", + "/upPointingMilitaryAirplane": "\u1F6E6", + "/upPointingSmallAirplane": "\u1F6E8", + "/uparen": "\u24B0", + "/uparenthesized": "\u24B0", + "/uparrowleftofdownarrow": "\u21C5", + "/upblock": "\u2580", + "/updblhorzsng": "\u2568", + "/updblleftsng": "\u255C", + "/updblrightsng": "\u2559", + "/upheavydnhorzlight": "\u2540", + "/upheavyhorzlight": "\u2538", + "/upheavyleftdnlight": "\u2526", + "/upheavyleftlight": "\u251A", + "/upheavyrightdnlight": "\u251E", + "/upheavyrightlight": "\u2516", + "/uplightdnhorzheavy": "\u2548", + "/uplighthorzheavy": "\u2537", + "/uplightleftdnheavy": "\u252A", + "/uplightleftheavy": "\u2519", + "/uplightrightdnheavy": "\u2522", + "/uplightrightheavy": "\u2515", + "/upperHalfBlock": "\u2580", + "/upperOneEighthBlock": "\u2594", + "/upperRightShadowedWhiteCircle": "\u1F53F", + "/upperdothebrew": "\u05C4", + "/upperhalfcircle": "\u25E0", + "/upperhalfcircleinversewhite": "\u25DA", + "/upperquadrantcirculararcleft": "\u25DC", + "/upperquadrantcirculararcright": "\u25DD", + "/uppertriangleleft": "\u25F8", + "/uppertriangleleftblack": "\u25E4", + "/uppertriangleright": "\u25F9", + "/uppertrianglerightblack": "\u25E5", + "/upsideDownFace": "\u1F643", + "/upsilon": "\u03C5", + "/upsilonacute": "\u1F7B", + "/upsilonasper": "\u1F51", + "/upsilonasperacute": "\u1F55", + "/upsilonaspergrave": "\u1F53", + "/upsilonaspertilde": "\u1F57", + "/upsilonbreve": "\u1FE0", + "/upsilondieresis": "\u03CB", + "/upsilondieresisacute": "\u1FE3", + "/upsilondieresisgrave": "\u1FE2", + "/upsilondieresistilde": "\u1FE7", + "/upsilondieresistonos": "\u03B0", + "/upsilongrave": "\u1F7A", + "/upsilonlatin": "\u028A", + "/upsilonlenis": "\u1F50", + "/upsilonlenisacute": "\u1F54", + "/upsilonlenisgrave": "\u1F52", + "/upsilonlenistilde": "\u1F56", + "/upsilontilde": "\u1FE6", + "/upsilontonos": "\u03CD", + "/upsilonwithmacron": "\u1FE1", + "/upsnghorzdbl": "\u2567", + "/upsngleftdbl": "\u255B", + "/upsngrightdbl": "\u2558", + "/uptackbelowcmb": "\u031D", + "/uptackmod": "\u02D4", + "/upwithexclamationmarksquare": "\u1F199", + "/uragurmukhi": "\u0A73", + "/uranus": "\u2645", + "/uring": "\u016F", + "/ushortcyr": "\u045E", + "/ushortcyrillic": "\u045E", + "/usmallhiragana": "\u3045", + "/usmallkatakana": "\u30A5", + "/usmallkatakanahalfwidth": "\uFF69", + "/usmod": "\uA770", + "/ustraightcyr": "\u04AF", + "/ustraightcyrillic": "\u04AF", + "/ustraightstrokecyr": "\u04B1", + "/ustraightstrokecyrillic": "\u04B1", + "/utilde": "\u0169", + "/utildeacute": "\u1E79", + "/utildebelow": "\u1E75", + "/uubengali": "\u098A", + "/uudeva": "\u090A", + "/uugujarati": "\u0A8A", + "/uugurmukhi": "\u0A0A", + "/uumatragurmukhi": "\u0A42", + "/uuvowelsignbengali": "\u09C2", + "/uuvowelsigndeva": "\u0942", + "/uuvowelsigngujarati": "\u0AC2", + "/uvowelsignbengali": "\u09C1", + "/uvowelsigndeva": "\u0941", + "/uvowelsigngujarati": "\u0AC1", + "/v": "\u0076", + "/vadeva": "\u0935", + "/vagujarati": "\u0AB5", + "/vagurmukhi": "\u0A35", + "/vakatakana": "\u30F7", + "/vanedownfunc": "\u2356", + "/vaneleftfunc": "\u2345", + "/vanerightfunc": "\u2346", + "/vaneupfunc": "\u234F", + "/varikajudeospanish:hb": "\uFB1E", + "/vav": "\u05D5", + "/vav:hb": "\u05D5", + "/vav_vav:hb": "\u05F0", + "/vav_yod:hb": "\u05F1", + "/vavdagesh": "\uFB35", + "/vavdagesh65": "\uFB35", + "/vavdageshhebrew": "\uFB35", + "/vavhebrew": "\u05D5", + "/vavholam": "\uFB4B", + "/vavholamhebrew": "\uFB4B", + "/vavvavhebrew": "\u05F0", + "/vavwithdagesh:hb": "\uFB35", + "/vavwithholam:hb": "\uFB4B", + "/vavyodhebrew": "\u05F1", + "/vcircle": "\u24E5", + "/vcurl": "\u2C74", + "/vdiagonalstroke": "\uA75F", + "/vdotbelow": "\u1E7F", + "/ve.fina": "\uFBDF", + "/ve.isol": "\uFBDE", + "/ve:abovetonecandra": "\u1CF4", + "/ve:anusvaraantargomukhasign": "\u1CE9", + "/ve:anusvarabahirgomukhasign": "\u1CEA", + "/ve:anusvarasignlong": "\u1CEF", + "/ve:anusvaraubhayatomukhasign": "\u1CF1", + "/ve:anusvaravamagomukhasign": "\u1CEB", + "/ve:anusvaravamagomukhawithtailsign": "\u1CEC", + "/ve:ardhavisargasign": "\u1CF2", + "/ve:atharvaindependentsvaritatone": "\u1CE1", + "/ve:atikramasign": "\u1CF7", + "/ve:belowtonecandra": "\u1CD8", + "/ve:dotbelowtone": "\u1CDD", + "/ve:hexiformanusvarasignlong": "\u1CEE", + "/ve:jihvamuliyasign": "\u1CF5", + "/ve:karshanatone": "\u1CD0", + "/ve:kathakaanudattatone": "\u1CDC", + "/ve:nihshvasasign": "\u1CD3", + "/ve:prenkhatone": "\u1CD2", + "/ve:rigkashmiriindependentsvaritatone": "\u1CE0", + "/ve:ringabovetone": "\u1CF8", + "/ve:ringabovetonedbl": "\u1CF9", + "/ve:rotatedardhavisargasign": "\u1CF3", + "/ve:rthanganusvarasignlong": "\u1CF0", + "/ve:sharatone": "\u1CD1", + "/ve:svaritatonedbl": "\u1CDA", + "/ve:svaritatonetpl": "\u1CDB", + "/ve:threedotsbelowtone": "\u1CDF", + "/ve:tiryaksign": "\u1CED", + "/ve:twodotsbelowtone": "\u1CDE", + "/ve:upadhmaniyasign": "\u1CF6", + "/ve:visargaanudattasign": "\u1CE5", + "/ve:visargaanudattasignreversed": "\u1CE6", + "/ve:visargaanudattawithtailsign": "\u1CE8", + "/ve:visargasvaritasign": "\u1CE2", + "/ve:visargaudattasign": "\u1CE3", + "/ve:visargaudattasignreversed": "\u1CE4", + "/ve:visargaudattawithtailsign": "\u1CE7", + "/ve:yajuraggravatedindependentsvaritatone": "\u1CD5", + "/ve:yajurindependentsvaritatone": "\u1CD6", + "/ve:yajurkathakaindependentsvaritaschroedertone": "\u1CD9", + "/ve:yajurkathakaindependentsvaritatone": "\u1CD7", + "/ve:yajurmidlinesvaritasign": "\u1CD4", + "/vecyr": "\u0432", + "/vecyrillic": "\u0432", + "/veh": "\u06A4", + "/veh.fina": "\uFB6B", + "/veh.init": "\uFB6C", + "/veh.isol": "\uFB6A", + "/veh.medi": "\uFB6D", + "/veharabic": "\u06A4", + "/vehfinalarabic": "\uFB6B", + "/vehinitialarabic": "\uFB6C", + "/vehmedialarabic": "\uFB6D", + "/vekatakana": "\u30F9", + "/vend": "\uA769", + "/venus": "\u2640", + "/versicle": "\u2123", + "/vert:bracketwhiteleft": "\uFE17", + "/vert:brakcetwhiteright": "\uFE18", + "/vert:colon": "\uFE13", + "/vert:comma": "\uFE10", + "/vert:ellipsishor": "\uFE19", + "/vert:exclam": "\uFE15", + "/vert:ideographiccomma": "\uFE11", + "/vert:ideographicfullstop": "\uFE12", + "/vert:question": "\uFE16", + "/vert:semicolon": "\uFE14", + "/vertdblhorzsng": "\u256B", + "/vertdblleftsng": "\u2562", + "/vertdblrightsng": "\u255F", + "/vertheavyhorzlight": "\u2542", + "/vertheavyleftlight": "\u2528", + "/vertheavyrightlight": "\u2520", + "/verticalTrafficLight": "\u1F6A6", + "/verticalbar": "\u007C", + "/verticalbardbl": "\u2016", + "/verticalbarhorizontalstroke": "\u27CA", + "/verticalbarwhitearrowonpedestalup": "\u21ED", + "/verticalfourdots": "\u205E", + "/verticalideographiciterationmark": "\u303B", + "/verticalkanarepeatmark": "\u3031", + "/verticalkanarepeatmarklowerhalf": "\u3035", + "/verticalkanarepeatmarkupperhalf": "\u3033", + "/verticalkanarepeatwithvoicedsoundmark": "\u3032", + "/verticalkanarepeatwithvoicedsoundmarkupperhalf": "\u3034", + "/verticallineabovecmb": "\u030D", + "/verticallinebelowcmb": "\u0329", + "/verticallinelowmod": "\u02CC", + "/verticallinemod": "\u02C8", + "/verticalmalestroke": "\u26A8", + "/verticalsdbltrokearrowleft": "\u21FA", + "/verticalsdbltrokearrowleftright": "\u21FC", + "/verticalsdbltrokearrowright": "\u21FB", + "/verticalstrokearrowleft": "\u21F7", + "/verticalstrokearrowleftright": "\u21F9", + "/verticalstrokearrowright": "\u21F8", + "/vertlighthorzheavy": "\u253F", + "/vertlightleftheavy": "\u2525", + "/vertlightrightheavy": "\u251D", + "/vertsnghorzdbl": "\u256A", + "/vertsngleftdbl": "\u2561", + "/vertsngrightdbl": "\u255E", + "/verymuchgreater": "\u22D9", + "/verymuchless": "\u22D8", + "/vesta": "\u26B6", + "/vewarmenian": "\u057E", + "/vhook": "\u028B", + "/vibrationMode": "\u1F4F3", + "/videoCamera": "\u1F4F9", + "/videoGame": "\u1F3AE", + "/videocassette": "\u1F4FC", + "/viewdatasquare": "\u2317", + "/vikatakana": "\u30F8", + "/violin": "\u1F3BB", + "/viramabengali": "\u09CD", + "/viramadeva": "\u094D", + "/viramagujarati": "\u0ACD", + "/virgo": "\u264D", + "/visargabengali": "\u0983", + "/visargadeva": "\u0903", + "/visargagujarati": "\u0A83", + "/visigothicz": "\uA763", + "/vmonospace": "\uFF56", + "/voarmenian": "\u0578", + "/vodsquare": "\u1F1AC", + "/voicediterationhiragana": "\u309E", + "/voicediterationkatakana": "\u30FE", + "/voicedmarkkana": "\u309B", + "/voicedmarkkanahalfwidth": "\uFF9E", + "/voicingmod": "\u02EC", + "/vokatakana": "\u30FA", + "/volapukae": "\uA79B", + "/volapukoe": "\uA79D", + "/volapukue": "\uA79F", + "/volcano": "\u1F30B", + "/volleyball": "\u1F3D0", + "/vovermfullwidth": "\u33DE", + "/vowelVabove": "\u065A", + "/voweldotbelow": "\u065C", + "/vowelinvertedVabove": "\u065B", + "/vparen": "\u24B1", + "/vparenthesized": "\u24B1", + "/vrighthook": "\u2C71", + "/vssquare": "\u1F19A", + "/vtilde": "\u1E7D", + "/vturned": "\u028C", + "/vuhiragana": "\u3094", + "/vukatakana": "\u30F4", + "/vwelsh": "\u1EFD", + "/vy": "\uA761", + "/w": "\u0077", + "/wacirclekatakana": "\u32FB", + "/wacute": "\u1E83", + "/waekorean": "\u3159", + "/wahiragana": "\u308F", + "/wakatakana": "\u30EF", + "/wakatakanahalfwidth": "\uFF9C", + "/wakorean": "\u3158", + "/waningCrescentMoon": "\u1F318", + "/waningGibbousMoon": "\u1F316", + "/warning": "\u26A0", + "/wasmallhiragana": "\u308E", + "/wasmallkatakana": "\u30EE", + "/wastebasket": "\u1F5D1", + "/watch": "\u231A", + "/waterBuffalo": "\u1F403", + "/waterCloset": "\u1F6BE", + "/waterWave": "\u1F30A", + "/waterideographiccircled": "\u328C", + "/waterideographicparen": "\u322C", + "/watermelon": "\u1F349", + "/wattosquare": "\u3357", + "/wavedash": "\u301C", + "/wavingBlackFlag": "\u1F3F4", + "/wavingHandSign": "\u1F44B", + "/wavingWhiteFlag": "\u1F3F3", + "/wavydash": "\u3030", + "/wavyhamzabelow": "\u065F", + "/wavyline": "\u2307", + "/wavyunderscorevertical": "\uFE34", + "/waw": "\u0648", + "/waw.fina": "\uFEEE", + "/waw.isol": "\uFEED", + "/wawDigitThreeAbove": "\u0779", + "/wawDigitTwoAbove": "\u0778", + "/wawarabic": "\u0648", + "/wawdotabove": "\u06CF", + "/wawfinalarabic": "\uFEEE", + "/wawhamza": "\u0624", + "/wawhamza.fina": "\uFE86", + "/wawhamza.isol": "\uFE85", + "/wawhamzaabovearabic": "\u0624", + "/wawhamzaabovefinalarabic": "\uFE86", + "/wawhighhamza": "\u0676", + "/wawring": "\u06C4", + "/wawsmall": "\u06E5", + "/wawtwodotsabove": "\u06CA", + "/waxingCrescentMoon": "\u1F312", + "/waxingGibbousMoon": "\u1F314", + "/wbfullwidth": "\u33DD", + "/wbsquare": "\u33DD", + "/wcircle": "\u24E6", + "/wcircumflex": "\u0175", + "/wcsquare": "\u1F14F", + "/wcsquareblack": "\u1F18F", + "/wdieresis": "\u1E85", + "/wdot": "\u1E87", + "/wdotaccent": "\u1E87", + "/wdotbelow": "\u1E89", + "/wearyCatFace": "\u1F640", + "/wearyFace": "\u1F629", + "/wecirclekatakana": "\u32FD", + "/wecyr": "\u051D", + "/wedding": "\u1F492", + "/wehiragana": "\u3091", + "/weierstrass": "\u2118", + "/weightLifter": "\u1F3CB", + "/wekatakana": "\u30F1", + "/wekorean": "\u315E", + "/weokorean": "\u315D", + "/westsyriaccross": "\u2670", + "/wgrave": "\u1E81", + "/whale": "\u1F40B", + "/wheelchair": "\u267F", + "/wheelofdharma": "\u2638", + "/whiteDownPointingBackhandIndex": "\u1F447", + "/whiteDownPointingLeftHandIndex": "\u1F597", + "/whiteFlower": "\u1F4AE", + "/whiteHardShellFloppyDisk": "\u1F5AB", + "/whiteLatinCross": "\u1F546", + "/whiteLeftPointingBackhandIndex": "\u1F448", + "/whitePennant": "\u1F3F1", + "/whiteRightPointingBackhandIndex": "\u1F449", + "/whiteSquareButton": "\u1F533", + "/whiteSun": "\u1F323", + "/whiteSunBehindCloud": "\u1F325", + "/whiteSunBehindCloudRain": "\u1F326", + "/whiteSunSmallCloud": "\u1F324", + "/whiteTouchtoneTelephone": "\u1F57E", + "/whiteUpPointingBackhandIndex": "\u1F446", + "/whitearrowdown": "\u21E9", + "/whitearrowfromwallright": "\u21F0", + "/whitearrowleft": "\u21E6", + "/whitearrowonpedestalup": "\u21EB", + "/whitearrowright": "\u21E8", + "/whitearrowup": "\u21E7", + "/whitearrowupdown": "\u21F3", + "/whitearrowupfrombar": "\u21EA", + "/whitebullet": "\u25E6", + "/whitecircle": "\u25CB", + "/whitecircleinverse": "\u25D9", + "/whitecornerbracketleft": "\u300E", + "/whitecornerbracketleftvertical": "\uFE43", + "/whitecornerbracketright": "\u300F", + "/whitecornerbracketrightvertical": "\uFE44", + "/whitedblarrowonpedestalup": "\u21EF", + "/whitedblarrowup": "\u21EE", + "/whitediamond": "\u25C7", + "/whitediamondcontainingblacksmalldiamond": "\u25C8", + "/whitedownpointingsmalltriangle": "\u25BF", + "/whitedownpointingtriangle": "\u25BD", + "/whiteleftpointingsmalltriangle": "\u25C3", + "/whiteleftpointingtriangle": "\u25C1", + "/whitelenticularbracketleft": "\u3016", + "/whitelenticularbracketright": "\u3017", + "/whiterightpointingsmalltriangle": "\u25B9", + "/whiterightpointingtriangle": "\u25B7", + "/whitesesamedot": "\uFE46", + "/whitesmallsquare": "\u25AB", + "/whitesmilingface": "\u263A", + "/whitesquare": "\u25A1", + "/whitesquarebracketleft": "\u301A", + "/whitesquarebracketright": "\u301B", + "/whitestar": "\u2606", + "/whitetelephone": "\u260F", + "/whitetortoiseshellbracketleft": "\u3018", + "/whitetortoiseshellbracketright": "\u3019", + "/whiteuppointingsmalltriangle": "\u25B5", + "/whiteuppointingtriangle": "\u25B3", + "/whook": "\u2C73", + "/wicirclekatakana": "\u32FC", + "/wigglylinevertical": "\u2E3E", + "/wignyan": "\uA983", + "/wihiragana": "\u3090", + "/wikatakana": "\u30F0", + "/wikorean": "\u315F", + "/windBlowingFace": "\u1F32C", + "/windChime": "\u1F390", + "/windupada": "\uA9C6", + "/wineGlass": "\u1F377", + "/winkingFace": "\u1F609", + "/wiredKeyboard": "\u1F5AE", + "/wmonospace": "\uFF57", + "/wocirclekatakana": "\u32FE", + "/wohiragana": "\u3092", + "/wokatakana": "\u30F2", + "/wokatakanahalfwidth": "\uFF66", + "/wolfFace": "\u1F43A", + "/woman": "\u1F469", + "/womanBunnyEars": "\u1F46F", + "/womansBoots": "\u1F462", + "/womansClothes": "\u1F45A", + "/womansHat": "\u1F452", + "/womansSandal": "\u1F461", + "/womens": "\u1F6BA", + "/won": "\u20A9", + "/wonmonospace": "\uFFE6", + "/woodideographiccircled": "\u328D", + "/woodideographicparen": "\u322D", + "/wordjoiner": "\u2060", + "/wordseparatormiddledot": "\u2E31", + "/worldMap": "\u1F5FA", + "/worriedFace": "\u1F61F", + "/wowaenthai": "\u0E27", + "/wparen": "\u24B2", + "/wparenthesized": "\u24B2", + "/wrappedPresent": "\u1F381", + "/wreathproduct": "\u2240", + "/wrench": "\u1F527", + "/wring": "\u1E98", + "/wsuperior": "\u02B7", + "/wsupmod": "\u02B7", + "/wturned": "\u028D", + "/wulumelikvowel": "\uA9B7", + "/wuluvowel": "\uA9B6", + "/wynn": "\u01BF", + "/x": "\u0078", + "/x.inferior": "\u2093", + "/xabovecmb": "\u033D", + "/xatailcyr": "\u04B3", + "/xbopomofo": "\u3112", + "/xcircle": "\u24E7", + "/xdieresis": "\u1E8D", + "/xdot": "\u1E8B", + "/xdotaccent": "\u1E8B", + "/xeharmenian": "\u056D", + "/xi": "\u03BE", + "/xmonospace": "\uFF58", + "/xor": "\u22BB", + "/xparen": "\u24B3", + "/xparenthesized": "\u24B3", + "/xsuperior": "\u02E3", + "/xsupmod": "\u02E3", + "/y": "\u0079", + "/yaadosquare": "\u334E", + "/yaarusquare": "\u334F", + "/yabengali": "\u09AF", + "/yacirclekatakana": "\u32F3", + "/yacute": "\u00FD", + "/yacyr": "\u044F", + "/yadeva": "\u092F", + "/yaecyr": "\u0519", + "/yaekorean": "\u3152", + "/yagujarati": "\u0AAF", + "/yagurmukhi": "\u0A2F", + "/yahiragana": "\u3084", + "/yakatakana": "\u30E4", + "/yakatakanahalfwidth": "\uFF94", + "/yakorean": "\u3151", + "/yamakkanthai": "\u0E4E", + "/yangtonemod": "\u02EB", + "/yasmallhiragana": "\u3083", + "/yasmallkatakana": "\u30E3", + "/yasmallkatakanahalfwidth": "\uFF6C", + "/yatcyr": "\u0463", + "/yatcyrillic": "\u0463", + "/ycircle": "\u24E8", + "/ycircumflex": "\u0177", + "/ydieresis": "\u00FF", + "/ydot": "\u1E8F", + "/ydotaccent": "\u1E8F", + "/ydotbelow": "\u1EF5", + "/yeh": "\u064A", + "/yeh.fina": "\uFEF2", + "/yeh.init": "\uFEF3", + "/yeh.init_alefmaksura.fina": "\uFC59", + "/yeh.init_hah.fina": "\uFC56", + "/yeh.init_hah.medi": "\uFCDB", + "/yeh.init_hamzaabove.medi_ae.fina": "\uFBEC", + "/yeh.init_hamzaabove.medi_alef.fina": "\uFBEA", + "/yeh.init_hamzaabove.medi_alefmaksura.fina": "\uFC03", + "/yeh.init_hamzaabove.medi_e.fina": "\uFBF6", + "/yeh.init_hamzaabove.medi_e.medi": "\uFBF8", + "/yeh.init_hamzaabove.medi_hah.fina": "\uFC01", + "/yeh.init_hamzaabove.medi_hah.medi": "\uFC98", + "/yeh.init_hamzaabove.medi_heh.medi": "\uFC9B", + "/yeh.init_hamzaabove.medi_jeem.fina": "\uFC00", + "/yeh.init_hamzaabove.medi_jeem.medi": "\uFC97", + "/yeh.init_hamzaabove.medi_khah.medi": "\uFC99", + "/yeh.init_hamzaabove.medi_meem.fina": "\uFC02", + "/yeh.init_hamzaabove.medi_meem.medi": "\uFC9A", + "/yeh.init_hamzaabove.medi_oe.fina": "\uFBF2", + "/yeh.init_hamzaabove.medi_u.fina": "\uFBF0", + "/yeh.init_hamzaabove.medi_waw.fina": "\uFBEE", + "/yeh.init_hamzaabove.medi_yeh.fina": "\uFC04", + "/yeh.init_hamzaabove.medi_yu.fina": "\uFBF4", + "/yeh.init_heh.medi": "\uFCDE", + "/yeh.init_jeem.fina": "\uFC55", + "/yeh.init_jeem.medi": "\uFCDA", + "/yeh.init_khah.fina": "\uFC57", + "/yeh.init_khah.medi": "\uFCDC", + "/yeh.init_meem.fina": "\uFC58", + "/yeh.init_meem.medi": "\uFCDD", + "/yeh.init_meem.medi_meem.medi": "\uFD9D", + "/yeh.init_yeh.fina": "\uFC5A", + "/yeh.isol": "\uFEF1", + "/yeh.medi": "\uFEF4", + "/yeh.medi_alefmaksura.fina": "\uFC95", + "/yeh.medi_hah.medi_yeh.fina": "\uFDAE", + "/yeh.medi_hamzaabove.medi_ae.fina": "\uFBED", + "/yeh.medi_hamzaabove.medi_alef.fina": "\uFBEB", + "/yeh.medi_hamzaabove.medi_alefmaksura.fina": "\uFC68", + "/yeh.medi_hamzaabove.medi_e.fina": "\uFBF7", + "/yeh.medi_hamzaabove.medi_heh.medi": "\uFCE0", + "/yeh.medi_hamzaabove.medi_meem.fina": "\uFC66", + "/yeh.medi_hamzaabove.medi_meem.medi": "\uFCDF", + "/yeh.medi_hamzaabove.medi_noon.fina": "\uFC67", + "/yeh.medi_hamzaabove.medi_oe.fina": "\uFBF3", + "/yeh.medi_hamzaabove.medi_reh.fina": "\uFC64", + "/yeh.medi_hamzaabove.medi_u.fina": "\uFBF1", + "/yeh.medi_hamzaabove.medi_waw.fina": "\uFBEF", + "/yeh.medi_hamzaabove.medi_yeh.fina": "\uFC69", + "/yeh.medi_hamzaabove.medi_yu.fina": "\uFBF5", + "/yeh.medi_hamzaabove.medi_zain.fina": "\uFC65", + "/yeh.medi_heh.medi": "\uFCF1", + "/yeh.medi_jeem.medi_yeh.fina": "\uFDAF", + "/yeh.medi_meem.fina": "\uFC93", + "/yeh.medi_meem.medi": "\uFCF0", + "/yeh.medi_meem.medi_meem.fina": "\uFD9C", + "/yeh.medi_meem.medi_yeh.fina": "\uFDB0", + "/yeh.medi_noon.fina": "\uFC94", + "/yeh.medi_reh.fina": "\uFC91", + "/yeh.medi_yeh.fina": "\uFC96", + "/yeh.medi_zain.fina": "\uFC92", + "/yehBarreeDigitThreeAbove": "\u077B", + "/yehBarreeDigitTwoAbove": "\u077A", + "/yehVabove": "\u06CE", + "/yehabove": "\u06E7", + "/yeharabic": "\u064A", + "/yehbarree": "\u06D2", + "/yehbarree.fina": "\uFBAF", + "/yehbarree.isol": "\uFBAE", + "/yehbarreearabic": "\u06D2", + "/yehbarreefinalarabic": "\uFBAF", + "/yehbarreehamza": "\u06D3", + "/yehbarreehamza.fina": "\uFBB1", + "/yehbarreehamza.isol": "\uFBB0", + "/yehfarsi": "\u06CC", + "/yehfarsi.fina": "\uFBFD", + "/yehfarsi.init": "\uFBFE", + "/yehfarsi.isol": "\uFBFC", + "/yehfarsi.medi": "\uFBFF", + "/yehfarsiinvertedV": "\u063D", + "/yehfarsithreedotsabove": "\u063F", + "/yehfarsitwodotsabove": "\u063E", + "/yehfinalarabic": "\uFEF2", + "/yehhamza": "\u0626", + "/yehhamza.fina": "\uFE8A", + "/yehhamza.init": "\uFE8B", + "/yehhamza.isol": "\uFE89", + "/yehhamza.medi": "\uFE8C", + "/yehhamzaabovearabic": "\u0626", + "/yehhamzaabovefinalarabic": "\uFE8A", + "/yehhamzaaboveinitialarabic": "\uFE8B", + "/yehhamzaabovemedialarabic": "\uFE8C", + "/yehhighhamza": "\u0678", + "/yehinitialarabic": "\uFEF3", + "/yehmedialarabic": "\uFEF4", + "/yehmeeminitialarabic": "\uFCDD", + "/yehmeemisolatedarabic": "\uFC58", + "/yehnoonfinalarabic": "\uFC94", + "/yehsmall": "\u06E6", + "/yehtail": "\u06CD", + "/yehthreedotsbelow": "\u06D1", + "/yehthreedotsbelowarabic": "\u06D1", + "/yekorean": "\u3156", + "/yellowHeart": "\u1F49B", + "/yen": "\u00A5", + "/yenmonospace": "\uFFE5", + "/yeokorean": "\u3155", + "/yeorinhieuhkorean": "\u3186", + "/yerachBenYomo:hb": "\u05AA", + "/yerahbenyomohebrew": "\u05AA", + "/yerahbenyomolefthebrew": "\u05AA", + "/yericyrillic": "\u044B", + "/yerudieresiscyrillic": "\u04F9", + "/yesieungkorean": "\u3181", + "/yesieungpansioskorean": "\u3183", + "/yesieungsioskorean": "\u3182", + "/yetiv:hb": "\u059A", + "/yetivhebrew": "\u059A", + "/ygrave": "\u1EF3", + "/yhoi": "\u1EF7", + "/yhook": "\u01B4", + "/yhookabove": "\u1EF7", + "/yiarmenian": "\u0575", + "/yicyrillic": "\u0457", + "/yikorean": "\u3162", + "/yintonemod": "\u02EA", + "/yinyang": "\u262F", + "/yiwnarmenian": "\u0582", + "/ylongcyr": "\u044B", + "/ylongdieresiscyr": "\u04F9", + "/yloop": "\u1EFF", + "/ymacron": "\u0233", + "/ymonospace": "\uFF59", + "/yocirclekatakana": "\u32F5", + "/yod": "\u05D9", + "/yod:hb": "\u05D9", + "/yod_yod:hb": "\u05F2", + "/yod_yod_patah:hb": "\uFB1F", + "/yoddagesh": "\uFB39", + "/yoddageshhebrew": "\uFB39", + "/yodhebrew": "\u05D9", + "/yodwithdagesh:hb": "\uFB39", + "/yodwithhiriq:hb": "\uFB1D", + "/yodyodhebrew": "\u05F2", + "/yodyodpatahhebrew": "\uFB1F", + "/yogh": "\u021D", + "/yohiragana": "\u3088", + "/yoikorean": "\u3189", + "/yokatakana": "\u30E8", + "/yokatakanahalfwidth": "\uFF96", + "/yokorean": "\u315B", + "/yosmallhiragana": "\u3087", + "/yosmallkatakana": "\u30E7", + "/yosmallkatakanahalfwidth": "\uFF6E", + "/yot": "\u03F3", + "/yotgreek": "\u03F3", + "/yoyaekorean": "\u3188", + "/yoyakorean": "\u3187", + "/yoyakthai": "\u0E22", + "/yoyingthai": "\u0E0D", + "/yparen": "\u24B4", + "/yparenthesized": "\u24B4", + "/ypogegrammeni": "\u037A", + "/ypogegrammenigreekcmb": "\u0345", + "/yr": "\u01A6", + "/yring": "\u1E99", + "/ystroke": "\u024F", + "/ysuperior": "\u02B8", + "/ysupmod": "\u02B8", + "/ytilde": "\u1EF9", + "/yturned": "\u028E", + "/yu.fina": "\uFBDC", + "/yu.isol": "\uFBDB", + "/yuansquare": "\u3350", + "/yucirclekatakana": "\u32F4", + "/yucyr": "\u044E", + "/yuhiragana": "\u3086", + "/yuikorean": "\u318C", + "/yukatakana": "\u30E6", + "/yukatakanahalfwidth": "\uFF95", + "/yukirghiz": "\u06C9", + "/yukirghiz.fina": "\uFBE3", + "/yukirghiz.isol": "\uFBE2", + "/yukorean": "\u3160", + "/yukrcyr": "\u0457", + "/yusbigcyr": "\u046B", + "/yusbigcyrillic": "\u046B", + "/yusbigiotifiedcyr": "\u046D", + "/yusbigiotifiedcyrillic": "\u046D", + "/yuslittlecyr": "\u0467", + "/yuslittlecyrillic": "\u0467", + "/yuslittleiotifiedcyr": "\u0469", + "/yuslittleiotifiedcyrillic": "\u0469", + "/yusmallhiragana": "\u3085", + "/yusmallkatakana": "\u30E5", + "/yusmallkatakanahalfwidth": "\uFF6D", + "/yuyekorean": "\u318B", + "/yuyeokorean": "\u318A", + "/yyabengali": "\u09DF", + "/yyadeva": "\u095F", + "/z": "\u007A", + "/zaarmenian": "\u0566", + "/zacute": "\u017A", + "/zadeva": "\u095B", + "/zagurmukhi": "\u0A5B", + "/zah": "\u0638", + "/zah.fina": "\uFEC6", + "/zah.init": "\uFEC7", + "/zah.init_meem.fina": "\uFC28", + "/zah.init_meem.medi": "\uFCB9", + "/zah.isol": "\uFEC5", + "/zah.medi": "\uFEC8", + "/zah.medi_meem.medi": "\uFD3B", + "/zaharabic": "\u0638", + "/zahfinalarabic": "\uFEC6", + "/zahinitialarabic": "\uFEC7", + "/zahiragana": "\u3056", + "/zahmedialarabic": "\uFEC8", + "/zain": "\u0632", + "/zain.fina": "\uFEB0", + "/zain.isol": "\uFEAF", + "/zainabove": "\u0617", + "/zainarabic": "\u0632", + "/zainfinalarabic": "\uFEB0", + "/zakatakana": "\u30B6", + "/zaqefGadol:hb": "\u0595", + "/zaqefQatan:hb": "\u0594", + "/zaqefgadolhebrew": "\u0595", + "/zaqefqatanhebrew": "\u0594", + "/zarqa:hb": "\u0598", + "/zarqahebrew": "\u0598", + "/zayin": "\u05D6", + "/zayin:hb": "\u05D6", + "/zayindagesh": "\uFB36", + "/zayindageshhebrew": "\uFB36", + "/zayinhebrew": "\u05D6", + "/zayinwithdagesh:hb": "\uFB36", + "/zbopomofo": "\u3117", + "/zcaron": "\u017E", + "/zcircle": "\u24E9", + "/zcircumflex": "\u1E91", + "/zcurl": "\u0291", + "/zdescender": "\u2C6C", + "/zdot": "\u017C", + "/zdotaccent": "\u017C", + "/zdotbelow": "\u1E93", + "/zecyr": "\u0437", + "/zecyrillic": "\u0437", + "/zedescendercyrillic": "\u0499", + "/zedieresiscyr": "\u04DF", + "/zedieresiscyrillic": "\u04DF", + "/zehiragana": "\u305C", + "/zekatakana": "\u30BC", + "/zero": "\u0030", + "/zero.inferior": "\u2080", + "/zero.superior": "\u2070", + "/zeroarabic": "\u0660", + "/zerobengali": "\u09E6", + "/zerocircle": "\u24EA", + "/zerocircleblack": "\u24FF", + "/zerocomma": "\u1F101", + "/zerodeva": "\u0966", + "/zerofar": "\u06F0", + "/zerofullstop": "\u1F100", + "/zerogujarati": "\u0AE6", + "/zerogurmukhi": "\u0A66", + "/zerohackarabic": "\u0660", + "/zeroinferior": "\u2080", + "/zeromonospace": "\uFF10", + "/zerooldstyle": "\uF730", + "/zeropersian": "\u06F0", + "/zerosquareabove": "\u06E0", + "/zerosuperior": "\u2070", + "/zerothai": "\u0E50", + "/zerothirds": "\u2189", + "/zerowidthjoiner": "\uFEFF", + "/zerowidthnobreakspace": "\uFEFF", + "/zerowidthnonjoiner": "\u200C", + "/zerowidthspace": "\u200B", + "/zeta": "\u03B6", + "/zetailcyr": "\u0499", + "/zhbopomofo": "\u3113", + "/zhearmenian": "\u056A", + "/zhebrevecyr": "\u04C2", + "/zhebrevecyrillic": "\u04C2", + "/zhecyr": "\u0436", + "/zhecyrillic": "\u0436", + "/zhedescendercyrillic": "\u0497", + "/zhedieresiscyr": "\u04DD", + "/zhedieresiscyrillic": "\u04DD", + "/zhetailcyr": "\u0497", + "/zhook": "\u0225", + "/zihiragana": "\u3058", + "/zikatakana": "\u30B8", + "/zildefunc": "\u236C", + "/zinorhebrew": "\u05AE", + "/zjekomicyr": "\u0505", + "/zlinebelow": "\u1E95", + "/zmonospace": "\uFF5A", + "/znotationbagmembership": "\u22FF", + "/zohiragana": "\u305E", + "/zokatakana": "\u30BE", + "/zparen": "\u24B5", + "/zparenthesized": "\u24B5", + "/zretroflex": "\u0290", + "/zretroflexhook": "\u0290", + "/zstroke": "\u01B6", + "/zswashtail": "\u0240", + "/zuhiragana": "\u305A", + "/zukatakana": "\u30BA", + "/zwarakay": "\u0659", + # manually added from + # https://github.com/serviceprototypinglab/latex-pdfa/blob/master/glyphtounicode-cmr.tex + "/angbracketleftBig": "\u28E8", + "/angbracketleftBigg": "\u27E8", + "/angbracketleftbig": "\u27E8", + "/angbracketleftbigg": "\u27E8", + "/angbracketrightBig": "\u27E9", + "/angbracketrightBigg": "\u27E9", + "/angbracketrightbig": "\u27E9", + "/angbracketrightbigg": "\u27E9", + "/arrowbt": "\u2193", + "/arrowdblbt": "\u21D3", + "/arrowdbltp": "\u21D1", + "/arrowhookleft": "\u21AA", + "/arrowhookright": "\u21A9", + "/arrowtp": "\u2191", + # diff : "/arrowvertex": "\u23D0", + "/arrowvertexdbl": "\uED12", + "/backslashBig": "\u005C", + "/backslashBigg": "\u005C", + "/backslashbig": "\u005C", + "/backslashbigg": "\u005C", + # diff : "/braceex": "\u23AA", + "/bracehtipdownleft": "\uED17", + "/bracehtipdownright": "\uED18", + "/bracehtipupleft": "\uED19", + "/bracehtipupright": "\uED1A", + "/braceleftBig": "\u007B", + "/braceleftBigg": "\u007B", + "/braceleftbig": "\u007B", + "/braceleftbigg": "\u007B", + # diff : "/braceleftbt": "\u23A9", + # diff : "/braceleftmid": "\u23A8", + # diff : "/bracelefttp": "\u23A7", + "/bracerightBig": "\u007D", + "/bracerightBigg": "\u007D", + "/bracerightbig": "\u007D", + "/bracerightbigg": "\u007D", + # diff : "/bracerightbt": "\u23AD", + # diff : "/bracerightmid": "\u23AC", + # diff : "/bracerighttp": "\u23AB", + "/bracketleftBig": "\u005B", + "/bracketleftBigg": "\u005B", + "/bracketleftbig": "\u005B", + "/bracketleftbigg": "\u005B", + # diff : "/bracketleftbt": "\u23A3", + # diff : "/bracketleftex": "\u23A2", + # diff : "/bracketlefttp": "\u23A1", + "/bracketrightBig": "\u005D", + "/bracketrightBigg": "\u005D", + "/bracketrightbig": "\u005D", + "/bracketrightbigg": "\u005D", + # diff : "/bracketrightbt": "\u23A6", + # diff : "/bracketrightex": "\u23A5", + # diff : "/bracketrighttp": "\u23A4", + "/ceilingleftBig": "\u2308", + "/ceilingleftBigg": "\u2308", + "/ceilingleftbig": "\u2308", + "/ceilingleftbigg": "\u2308", + "/ceilingrightBig": "\u2309", + "/ceilingrightBigg": "\u2309", + "/ceilingrightbig": "\u2309", + "/ceilingrightbigg": "\u2309", + "/circledotdisplay": "\u2A00", + "/circledottext": "\u2A00", + "/circlemultiplydisplay": "\u2A02", + "/circlemultiplytext": "\u2A02", + "/circleplusdisplay": "\u2A01", + "/circleplustext": "\u2A01", + "/contintegraldisplay": "\u222E", + "/contintegraltext": "\u222E", + "/coproductdisplay": "\u2210", + "/coproducttext": "\u2210", + "/floorleftBig": "\u230A", + "/floorleftBigg": "\u230A", + "/floorleftbig": "\u230A", + "/floorleftbigg": "\u230A", + "/floorrightBig": "\u230B", + "/floorrightBigg": "\u230B", + "/floorrightbig": "\u230B", + "/floorrightbigg": "\u230B", + "/hatwide": "\u02C6", + "/hatwider": "\u02C6", + "/hatwidest": "\u02C6", + "/integraldisplay": "\u222B", + "/integraltext": "\u222B", + "/intersectiondisplay": "\u22C2", + "/intersectiontext": "\u22C2", + "/logicalanddisplay": "\u22C0", + "/logicalandtext": "\u22C0", + "/logicalordisplay": "\u22C1", + "/logicalortext": "\u22C1", + "/mapsto": "\u21A6", + "/parenleftBig": "\u0028", + "/parenleftBigg": "\u0028", + "/parenleftbig": "\u0028", + "/parenleftbigg": "\u0028", + # diff : "/parenleftbt": "\u239D", + # diff : "/parenleftex": "\u239C", + # diff : "/parenlefttp": "\u239B", + "/parenrightBig": "\u0029", + "/parenrightBigg": "\u0029", + "/parenrightbig": "\u0029", + "/parenrightbigg": "\u0029", + # diff : "/parenrightbt": "\u23A0", + # diff : "/parenrightex": "\u239F", + # diff : "/parenrighttp": "\u239E", + "/productdisplay": "\u220F", + "/producttext": "\u220F", + "/radicalBig": "\u221A", + "/radicalBigg": "\u221A", + "/radicalbig": "\u221A", + "/radicalbigg": "\u221A", + "/radicalbt": "\u221A", + "/radicaltp": "\uED6A", + "/radicalvertex": "\uED6B", + "/slashBig": "\u002F", + "/slashBigg": "\u002F", + "/slashbig": "\u002F", + "/slashbigg": "\u002F", + "/summationdisplay": "\u2211", + "/summationtext": "\u2211", + "/tie": "\u2040", + "/tildewide": "\u02DC", + "/tildewider": "\u02DC", + "/tildewidest": "\u02DC", + "/uniondisplay": "\u22C3", + "/unionmultidisplay": "\u2A04", + "/unionmultitext": "\u2A04", + "/unionsqdisplay": "\u2A06", + "/unionsqtext": "\u2A06", + "/uniontext": "\u22C3", + "/vextenddouble": "\uED79", + "/vextendsingle": "\u23D0", + "/a1": "\u25C1", + "/a2": "\u22B4", + "/a3": "\u25B7", + "/a4": "\u22B5", + "/a40": "\u02C2", + "/a41": "\u02C3", + "/a42": "\u2303", + "/a43": "\u2304", + "/a48": "\u2127", + "/a49": "\u22C8", + "/a50": "\u25A1", + "/a51": "\u25C7", + "/a58": "\u2053", + "/a59": "\u219D", + "/a60": "\u228F", + "/a61": "\u2290", + "/d0": "\u2199", + "/d1": "\u2199", + "/d2": "\u2199", + "/d3": "\u2199", + "/d4": "\u2199", + "/d5": "\u2199", + "/d6": "\u2199", + "/d7": "\u2193", + "/d8": "\u2193", + "/d9": "\u2193", + "/d10": "\u2193", + "/d11": "\u2193", + "/d12": "\u2193", + "/d13": "\u2193", + "/d14": "\u2193", + "/d15": "\u2193", + "/d16": "\u2193", + "/d17": "\u2193", + "/d18": "\u2193", + "/d19": "\u2193", + "/d20": "\u2193", + "/d21": "\u2193", + "/d22": "\u2193", + "/d23": "\u2193", + "/d24": "\u2198", + "/d25": "\u2198", + "/d26": "\u2198", + "/d27": "\u2198", + "/d28": "\u2198", + "/d29": "\u2198", + "/d30": "\u2198", + "/d31": "\u2198", + "/d32": "\u2198", + "/d33": "\u2198", + "/d34": "\u2198", + "/d35": "\u2198", + "/d36": "\u2198", + "/d37": "\u2198", + "/d38": "\u2198", + "/d39": "\u2192", + "/d40": "\u2192", + "/d41": "\u2192", + "/d42": "\u2192", + "/d43": "\u2192", + "/d44": "\u2192", + "/d45": "\u2192", + "/d46": "\u2192", + "/d47": "\u2192", + "/d48": "\u2192", + "/d49": "\u2192", + "/d50": "\u2192", + "/d51": "\u2192", + "/d52": "\u2192", + "/d53": "\u2192", + "/d54": "\u2192", + "/d55": "\u2192", + "/d56": "\u2197", + "/d57": "\u2197", + "/d58": "\u2197", + "/d59": "\u2197", + "/d60": "\u2197", + "/d61": "\u2197", + "/d62": "\u2197", + "/d63": "\u2197", + "/d64": "\u2197", + "/d65": "\u2197", + "/d66": "\u2197", + "/d67": "\u2197", + "/d68": "\u2197", + "/d69": "\u2197", + "/d70": "\u2197", + "/d71": "\u2191", + "/d72": "\u2191", + "/d73": "\u2191", + "/d74": "\u2191", + "/d75": "\u2191", + "/d76": "\u2191", + "/d77": "\u2191", + "/d78": "\u2191", + "/d79": "\u2191", + "/d80": "\u2191", + "/d81": "\u2191", + "/d82": "\u2191", + "/d83": "\u2191", + "/d84": "\u2191", + "/d85": "\u2191", + "/d86": "\u2191", + "/d87": "\u2191", + "/d88": "\u2196", + "/d89": "\u2196", + "/d90": "\u2196", + "/d91": "\u2196", + "/d92": "\u2196", + "/d93": "\u2196", + "/d94": "\u2196", + "/d95": "\u2196", + "/d96": "\u2196", + "/d97": "\u2196", + "/d98": "\u2196", + "/d99": "\u2196", + "/d100": "\u2196", + "/d101": "\u2196", + "/d102": "\u2196", + "/d103": "\u2190", + "/d104": "\u2190", + "/d105": "\u2190", + "/d106": "\u2190", + "/d107": "\u2190", + "/d108": "\u2190", + "/d109": "\u2190", + "/d110": "\u2190", + "/d111": "\u2190", + "/d112": "\u2190", + "/d113": "\u2190", + "/d114": "\u2190", + "/d115": "\u2190", + "/d116": "\u2190", + "/d117": "\u2190", + "/d118": "\u2190", + "/d119": "\u2190", + "/d120": "\u2199", + "/d121": "\u2199", + "/d122": "\u2199", + "/d123": "\u2199", + "/d124": "\u2199", + "/d125": "\u2199", + "/d126": "\u2199", + "/d127": "\u2199", + # manually added from + # https://github.com/kohler/lcdf-typetools/blob/master/texglyphlist.txt + "/Ifractur": "\u2111", + "/FFsmall": "\uF766", + "/FFIsmall": "\uF766", + "/FFLsmall": "\uF766", + "/FIsmall": "\uF766", + "/FLsmall": "\uF766", + # diff : "/Germandbls": "\u0053", + "/Germandblssmall": "\uF773", + "/Ng": "\u014A", + "/Rfractur": "\u211C", + "/SS": "\u0053", + "/SSsmall": "\uF773", + "/altselector": "\uD802", + "/angbracketleft": "\u27E8", + "/angbracketright": "\u27E9", + "/arrowbothv": "\u2195", + "/arrowdblbothv": "\u21D5", + "/arrowleftbothalf": "\u21BD", + "/arrowlefttophalf": "\u21BC", + "/arrownortheast": "\u2197", + "/arrownorthwest": "\u2196", + "/arrowrightbothalf": "\u21C1", + "/arrowrighttophalf": "\u21C0", + "/arrowsoutheast": "\u2198", + "/arrowsouthwest": "\u2199", + "/ascendercompwordmark": "\uD80A", + "/asteriskcentered": "\u2217", + "/bardbl": "\u2225", + "/capitalcompwordmark": "\uD809", + "/circlecopyrt": "\u20DD", + "/circledivide": "\u2298", + "/circleminus": "\u2296", + "/coproduct": "\u2A3F", + "/ct": "\u0063", + "/cwm": "\u200C", + "/dblbracketleft": "\u27E6", + "/dblbracketright": "\u27E7", + # diff : "/diamond": "\u2662", + "/diamondmath": "\u22C4", + # diff : "/dotlessj": "\u0237", + "/emptyslot": "\uD801", + "/epsilon1": "\u03F5", + "/epsiloninv": "\u03F6", + "/equivasymptotic": "\u224D", + "/flat": "\u266D", + "/follows": "\u227B", + "/followsequal": "\u2AB0", + "/followsorcurly": "\u227D", + "/greatermuch": "\u226B", + # diff : "/heart": "\u2661", + "/interrobangdown": "\u2E18", + "/intersectionsq": "\u2293", + "/latticetop": "\u22A4", + "/lessmuch": "\u226A", + "/longdbls": "\u017F", + "/longsh": "\u017F", + "/longsi": "\u017F", + "/longsl": "\u017F", + "/longst": "\uFB05", + "/lscript": "\u2113", + "/natural": "\u266E", + "/negationslash": "\u0338", + "/ng": "\u014B", + "/owner": "\u220B", + "/pertenthousand": "\u2031", + # diff : "/phi": "\u03D5", + # diff : "/phi1": "\u03C6", + "/pi1": "\u03D6", + "/precedesequal": "\u2AAF", + "/precedesorcurly": "\u227C", + "/prime": "\u2032", + "/rho1": "\u03F1", + "/ringfitted": "\uD80D", + "/sharp": "\u266F", + "/similarequal": "\u2243", + "/slurabove": "\u2322", + "/slurbelow": "\u2323", + "/st": "\uFB06", + "/subsetsqequal": "\u2291", + "/supersetsqequal": "\u2292", + "/triangle": "\u25B3", + "/triangleinv": "\u25BD", + "/triangleleft": "\u25C1", + # diff : "/triangleright": "\u25B7", + "/turnstileleft": "\u22A2", + "/turnstileright": "\u22A3", + "/twelveudash": "\uD80C", + "/unionmulti": "\u228E", + "/unionsq": "\u2294", + "/vector": "\u20D7", + "/visualspace": "\u2423", + "/Dbar": "\u0110", + "/compwordmark": "\u200C", + "/dbar": "\u0111", + "/rangedash": "\u2013", + "/hyphenchar": "\u002D", + "/punctdash": "\u2014", + "/visiblespace": "\u2423", + "/Yen": "\u00A5", + "/anticlockwise": "\u27F2", + "/arrowparrleftright": "\u21C6", + "/arrowparrrightleft": "\u21C4", + "/arrowtailleft": "\u21A2", + "/arrowtailright": "\u21A3", + "/arrowtripleleft": "\u21DA", + "/arrowtripleright": "\u21DB", + "/check": "\u2713", + "/circleR": "\u00AE", + "/circleS": "\u24C8", + "/circleasterisk": "\u229B", + "/circleequal": "\u229C", + "/circlering": "\u229A", + "/clockwise": "\u27F3", + "/curlyleft": "\u21AB", + "/curlyright": "\u21AC", + "/dblarrowdwn": "\u21CA", + "/dblarrowheadleft": "\u219E", + "/dblarrowheadright": "\u21A0", + # diff : "/dblarrowup": "\u21C8", + "/defines": "\u225C", + "/diamondsolid": "\u2666", + "/difference": "\u224F", + "/downfall": "\u22CE", + "/equaldotleftright": "\u2252", + "/equaldotrightleft": "\u2253", + "/equalorfollows": "\u22DF", + # diff : "/equalorgreater": "\u2A96", + # diff : "/equalorless": "\u2A95", + "/equalsdots": "\u2251", + "/followsorequal": "\u227F", + "/forcesbar": "\u22AA", + # diff : "/fork": "\u22D4", + "/geomequivalent": "\u224E", + "/greaterdbleqlless": "\u2A8C", + "/greaterdblequal": "\u2267", + "/greaterlessequal": "\u22DB", + "/greaterorapproxeql": "\u2A86", + "/greaterorequalslant": "\u2A7E", + "/greaterorsimilar": "\u2273", + "/harpoondownleft": "\u21C3", + "/harpoondownright": "\u21C2", + "/harpoonleftright": "\u21CC", + "/harpoonrightleft": "\u21CB", + "/harpoonupleft": "\u21BF", + "/harpoonupright": "\u21BE", + "/intercal": "\u22BA", + "/lessdbleqlgreater": "\u2A8B", + "/lessdblequal": "\u2266", + "/lessequalgreater": "\u22DA", + "/lessorapproxeql": "\u2A85", + "/lessorequalslant": "\u2A7D", + "/lessorsimilar": "\u2272", + "/maltesecross": "\u2720", + "/multiopenleft": "\u22CB", + "/multiopenright": "\u22CC", + "/orunderscore": "\u22BB", + "/perpcorrespond": "\u2A5E", + # diff : "/precedesorequal": "\u227E", + "/primereverse": "\u2035", + "/revasymptequal": "\u22CD", + "/revsimilar": "\u223D", + "/rightanglene": "\u231D", + "/rightanglenw": "\u231C", + "/rightanglese": "\u231F", + "/rightanglesw": "\u231E", + "/satisfies": "\u22A8", + "/shiftleft": "\u21B0", + "/shiftright": "\u21B1", + "/square": "\u25A1", + "/squaredot": "\u22A1", + "/squareminus": "\u229F", + "/squaremultiply": "\u22A0", + "/squareplus": "\u229E", + "/squaresolid": "\u25A0", + "/squiggleleftright": "\u21AD", + "/squiggleright": "\u21DD", + "/subsetdblequal": "\u2AC5", + "/supersetdbl": "\u22D1", + "/supersetdblequal": "\u2AC6", + "/triangledownsld": "\u25BC", + "/triangleleftequal": "\u22B4", + "/triangleleftsld": "\u25C0", + "/trianglerightequal": "\u22B5", + "/trianglerightsld": "\u25B6", + "/trianglesolid": "\u25B2", + "/uprise": "\u22CF", + # diff : "/Digamma": "\u1D7C", + "/Finv": "\u2132", + "/Gmir": "\u2141", + "/Omegainv": "\u2127", + "/approxorequal": "\u224A", + "/archleftdown": "\u21B6", + "/archrightdown": "\u21B7", + "/beth": "\u2136", + "/daleth": "\u2138", + "/dividemultiply": "\u22C7", + "/downslope": "\u29F9", + "/equalorsimilar": "\u2242", + "/follownotdbleqv": "\u2ABA", + "/follownotslnteql": "\u2AB6", + "/followornoteqvlnt": "\u22E9", + "/greaternotdblequal": "\u2A8A", + "/greaternotequal": "\u2A88", + "/greaterornotdbleql": "\u2269", + "/greaterornotequal": "\u2269", + "/integerdivide": "\u2216", + "/lessnotdblequal": "\u2A89", + "/lessnotequal": "\u2A87", + "/lessornotdbleql": "\u2268", + "/lessornotequal": "\u2268", + "/multicloseleft": "\u22C9", + "/multicloseright": "\u22CA", + "/notapproxequal": "\u2247", + "/notarrowboth": "\u21AE", + "/notarrowleft": "\u219A", + "/notarrowright": "\u219B", + "/notbar": "\u2224", + "/notdblarrowboth": "\u21CE", + "/notdblarrowleft": "\u21CD", + "/notdblarrowright": "\u21CF", + "/notfollows": "\u2281", + "/notfollowsoreql": "\u2AB0", + "/notforces": "\u22AE", + "/notforcesextra": "\u22AF", + "/notgreaterdblequal": "\u2267", + "/notgreaterequal": "\u2271", + "/notgreaterorslnteql": "\u2A7E", + "/notlessdblequal": "\u2266", + "/notlessequal": "\u2270", + "/notlessorslnteql": "\u2A7D", + "/notprecedesoreql": "\u2AAF", + "/notsatisfies": "\u22AD", + "/notsimilar": "\u2241", + "/notsubseteql": "\u2288", + "/notsubsetordbleql": "\u2AC5", + "/notsubsetoreql": "\u228A", + "/notsuperseteql": "\u2289", + "/notsupersetordbleql": "\u2AC6", + "/notsupersetoreql": "\u228B", + "/nottriangeqlleft": "\u22EC", + "/nottriangeqlright": "\u22ED", + "/nottriangleleft": "\u22EA", + "/nottriangleright": "\u22EB", + "/notturnstile": "\u22AC", + "/planckover2pi": "\u210F", + "/planckover2pi1": "\u210F", + "/precedenotdbleqv": "\u2AB9", + "/precedenotslnteql": "\u2AB5", + "/precedeornoteqvlnt": "\u22E8", + "/subsetnoteql": "\u228A", + "/subsetornotdbleql": "\u2ACB", + "/supersetnoteql": "\u228B", + "/supersetornotdbleql": "\u2ACC", + "/upslope": "\u29F8", +} + + +def _complete() -> None: + for i in range(256): + adobe_glyphs[f"/a{i}"] = chr(i) + adobe_glyphs["/.notdef"] = "□" + + +_complete() diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/core_font_metrics.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/core_font_metrics.py new file mode 100644 index 0000000000000000000000000000000000000000..f086ef7a5155332de371f9e97e4982cb5a5a21f9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/core_font_metrics.py @@ -0,0 +1,4483 @@ +# This file is based upon the 14 core AFM files provided by Adobe/Macromedia at +# https://download.macromedia.com/pub/developer/opentype/tech-notes/Core14_AFMs.zip +# The original copyright follows: +# +# ----------------------------------------------------------------------------------------------- +# Core 14 AFM Files - ReadMe +# +# This file and the 14 PostScript(R) AFM files it accompanies may be used, copied, and +# distributed for any purpose and without charge, with or without modification, provided that all +# copyright notices are retained; that the AFM files are not distributed without this file; that +# all modifications to this file or any of the AFM files are prominently noted in the modified +# file(s); and that this paragraph is not modified. Adobe Systems has no responsibility or +# obligation to support the use of the AFM files. +# ----------------------------------------------------------------------------------------------- + + +from pypdf._font import CoreFontMetrics, FontDescriptor + +CORE_FONT_METRICS: dict[str, CoreFontMetrics] = { + # Generated from Courier.afm + # Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. + "Courier": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier", + family="Courier", + weight="Medium", + ascent=629, + descent=-157, + cap_height=562, + x_height=426, + italic_angle=0, + flags=33, + bbox=(-23.0, -250.0, 715.0, 805.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Courier-Bold.afm + # Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved. + "Courier-Bold": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier-Bold", + family="Courier", + weight="Bold", + ascent=629, + descent=-157, + cap_height=562, + x_height=439, + italic_angle=0, + flags=33, + bbox=(-113.0, -250.0, 749.0, 801.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Courier-BoldOblique.afm + # Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved. + "Courier-BoldOblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier-BoldOblique", + family="Courier", + weight="Bold", + ascent=629, + descent=-157, + cap_height=562, + x_height=439, + italic_angle=-12, + flags=97, + bbox=(-57.0, -250.0, 869.0, 801.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Courier-Oblique.afm + # Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. + "Courier-Oblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Courier-Oblique", + family="Courier", + weight="Medium", + ascent=629, + descent=-157, + cap_height=562, + x_height=426, + italic_angle=-12, + flags=97, + bbox=(-27.0, -250.0, 849.0, 805.0), + ), + character_widths={ + " ": 600, + "default": 600, + "!": 600, + '"': 600, + "#": 600, + "$": 600, + "%": 600, + "&": 600, + "\u2019": 600, + "(": 600, + ")": 600, + "*": 600, + "+": 600, + ",": 600, + "-": 600, + ".": 600, + "/": 600, + "0": 600, + "1": 600, + "2": 600, + "3": 600, + "4": 600, + "5": 600, + "6": 600, + "7": 600, + "8": 600, + "9": 600, + ":": 600, + ";": 600, + "<": 600, + "=": 600, + ">": 600, + "?": 600, + "@": 600, + "A": 600, + "B": 600, + "C": 600, + "D": 600, + "E": 600, + "F": 600, + "G": 600, + "H": 600, + "I": 600, + "J": 600, + "K": 600, + "L": 600, + "M": 600, + "N": 600, + "O": 600, + "P": 600, + "Q": 600, + "R": 600, + "S": 600, + "T": 600, + "U": 600, + "V": 600, + "W": 600, + "X": 600, + "Y": 600, + "Z": 600, + "[": 600, + "\\": 600, + "]": 600, + "^": 600, + "_": 600, + "\u2018": 600, + "a": 600, + "b": 600, + "c": 600, + "d": 600, + "e": 600, + "f": 600, + "g": 600, + "h": 600, + "i": 600, + "j": 600, + "k": 600, + "l": 600, + "m": 600, + "n": 600, + "o": 600, + "p": 600, + "q": 600, + "r": 600, + "s": 600, + "t": 600, + "u": 600, + "v": 600, + "w": 600, + "x": 600, + "y": 600, + "z": 600, + "{": 600, + "|": 600, + "}": 600, + "~": 600, + "\xa1": 600, + "\xa2": 600, + "\xa3": 600, + "\u2044": 600, + "\xa5": 600, + "\u0192": 600, + "\xa7": 600, + "\xa4": 600, + "'": 600, + "\u201c": 600, + "\xab": 600, + "\u2039": 600, + "\u203a": 600, + "\ufb01": 600, + "\ufb02": 600, + "\u2013": 600, + "\u2020": 600, + "\u2021": 600, + "\xb7": 600, + "\xb6": 600, + "\u2022": 600, + "\u201a": 600, + "\u201e": 600, + "\u201d": 600, + "\xbb": 600, + "\u2026": 600, + "\u2030": 600, + "\xbf": 600, + "`": 600, + "\xb4": 600, + "\u02c6": 600, + "\u02dc": 600, + "\xaf": 600, + "\u02d8": 600, + "\u02d9": 600, + "\xa8": 600, + "\u02da": 600, + "\xb8": 600, + "\u02dd": 600, + "\u02db": 600, + "\u02c7": 600, + "\u2014": 600, + "\xc6": 600, + "\xaa": 600, + "\u0141": 600, + "\xd8": 600, + "\u0152": 600, + "\xba": 600, + "\xe6": 600, + "\u0131": 600, + "\u0142": 600, + "\xf8": 600, + "\u0153": 600, + "\xdf": 600, + "\xcf": 600, + "\xe9": 600, + "\u0103": 600, + "\u0171": 600, + "\u011b": 600, + "\u0178": 600, + "\xf7": 600, + "\xdd": 600, + "\xc2": 600, + "\xe1": 600, + "\xdb": 600, + "\xfd": 600, + "\u0219": 600, + "\xea": 600, + "\u016e": 600, + "\xdc": 600, + "\u0105": 600, + "\xda": 600, + "\u0173": 600, + "\xcb": 600, + "\u0110": 600, + "\uf6c3": 600, + "\xa9": 600, + "\u0112": 600, + "\u010d": 600, + "\xe5": 600, + "\u0145": 600, + "\u013a": 600, + "\xe0": 600, + "\u0162": 600, + "\u0106": 600, + "\xe3": 600, + "\u0116": 600, + "\u0161": 600, + "\u015f": 600, + "\xed": 600, + "\u25ca": 600, + "\u0158": 600, + "\u0122": 600, + "\xfb": 600, + "\xe2": 600, + "\u0100": 600, + "\u0159": 600, + "\xe7": 600, + "\u017b": 600, + "\xde": 600, + "\u014c": 600, + "\u0154": 600, + "\u015a": 600, + "\u010f": 600, + "\u016a": 600, + "\u016f": 600, + "\xb3": 600, + "\xd2": 600, + "\xc0": 600, + "\u0102": 600, + "\xd7": 600, + "\xfa": 600, + "\u0164": 600, + "\u2202": 600, + "\xff": 600, + "\u0143": 600, + "\xee": 600, + "\xca": 600, + "\xe4": 600, + "\xeb": 600, + "\u0107": 600, + "\u0144": 600, + "\u016b": 600, + "\u0147": 600, + "\xcd": 600, + "\xb1": 600, + "\xa6": 600, + "\xae": 600, + "\u011e": 600, + "\u0130": 600, + "\u2211": 600, + "\xc8": 600, + "\u0155": 600, + "\u014d": 600, + "\u0179": 600, + "\u017d": 600, + "\u2265": 600, + "\xd0": 600, + "\xc7": 600, + "\u013c": 600, + "\u0165": 600, + "\u0119": 600, + "\u0172": 600, + "\xc1": 600, + "\xc4": 600, + "\xe8": 600, + "\u017a": 600, + "\u012f": 600, + "\xd3": 600, + "\xf3": 600, + "\u0101": 600, + "\u015b": 600, + "\xef": 600, + "\xd4": 600, + "\xd9": 600, + "\u2206": 600, + "\xfe": 600, + "\xb2": 600, + "\xd6": 600, + "\xb5": 600, + "\xec": 600, + "\u0151": 600, + "\u0118": 600, + "\u0111": 600, + "\xbe": 600, + "\u015e": 600, + "\u013e": 600, + "\u0136": 600, + "\u0139": 600, + "\u2122": 600, + "\u0117": 600, + "\xcc": 600, + "\u012a": 600, + "\u013d": 600, + "\xbd": 600, + "\u2264": 600, + "\xf4": 600, + "\xf1": 600, + "\u0170": 600, + "\xc9": 600, + "\u0113": 600, + "\u011f": 600, + "\xbc": 600, + "\u0160": 600, + "\u0218": 600, + "\u0150": 600, + "\xb0": 600, + "\xf2": 600, + "\u010c": 600, + "\xf9": 600, + "\u221a": 600, + "\u010e": 600, + "\u0157": 600, + "\xd1": 600, + "\xf5": 600, + "\u0156": 600, + "\u013b": 600, + "\xc3": 600, + "\u0104": 600, + "\xc5": 600, + "\xd5": 600, + "\u017c": 600, + "\u011a": 600, + "\u012e": 600, + "\u0137": 600, + "\u2212": 600, + "\xce": 600, + "\u0148": 600, + "\u0163": 600, + "\xac": 600, + "\xf6": 600, + "\xfc": 600, + "\u2260": 600, + "\u0123": 600, + "\xf0": 600, + "\u017e": 600, + "\u0146": 600, + "\xb9": 600, + "\u012b": 600, + "\u20ac": 600, + }, + ), + # Generated from Helvetica.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica", + family="Helvetica", + weight="Medium", + ascent=718, + descent=-207, + cap_height=718, + x_height=523, + italic_angle=0, + flags=32, + bbox=(-166.0, -225.0, 1000.0, 931.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 278, + '"': 355, + "#": 556, + "$": 556, + "%": 889, + "&": 667, + "\u2019": 222, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 278, + ";": 278, + "<": 584, + "=": 584, + ">": 584, + "?": 556, + "@": 1015, + "A": 667, + "B": 667, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 500, + "K": 667, + "L": 556, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 278, + "\\": 278, + "]": 278, + "^": 469, + "_": 556, + "\u2018": 222, + "a": 556, + "b": 556, + "c": 500, + "d": 556, + "e": 556, + "f": 278, + "g": 556, + "h": 556, + "i": 222, + "j": 222, + "k": 500, + "l": 222, + "m": 833, + "n": 556, + "o": 556, + "p": 556, + "q": 556, + "r": 333, + "s": 500, + "t": 278, + "u": 556, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 500, + "{": 334, + "|": 260, + "}": 334, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 191, + "\u201c": 333, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 500, + "\ufb02": 500, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 537, + "\u2022": 350, + "\u201a": 222, + "\u201e": 333, + "\u201d": 333, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 556, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 222, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 556, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 667, + "\xe1": 556, + "\xdb": 722, + "\xfd": 500, + "\u0219": 500, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 500, + "\xe5": 556, + "\u0145": 722, + "\u013a": 222, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 500, + "\u015f": 500, + "\xed": 278, + "\u25ca": 471, + "\u0158": 722, + "\u0122": 778, + "\xfb": 556, + "\xe2": 556, + "\u0100": 667, + "\u0159": 333, + "\xe7": 500, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 643, + "\u016a": 722, + "\u016f": 556, + "\xb3": 333, + "\xd2": 778, + "\xc0": 667, + "\u0102": 667, + "\xd7": 584, + "\xfa": 556, + "\u0164": 611, + "\u2202": 476, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 500, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 260, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 333, + "\u014d": 556, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 222, + "\u0165": 317, + "\u0119": 556, + "\u0172": 722, + "\xc1": 667, + "\xc4": 667, + "\xe8": 556, + "\u017a": 500, + "\u012f": 222, + "\xd3": 778, + "\xf3": 556, + "\u0101": 556, + "\u015b": 500, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 556, + "\xb2": 333, + "\xd6": 778, + "\xb5": 556, + "\xec": 278, + "\u0151": 556, + "\u0118": 667, + "\u0111": 556, + "\xbe": 834, + "\u015e": 667, + "\u013e": 299, + "\u0136": 667, + "\u0139": 556, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 556, + "\xbd": 834, + "\u2264": 549, + "\xf4": 556, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 556, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 556, + "\u010c": 722, + "\xf9": 556, + "\u221a": 453, + "\u010e": 722, + "\u0157": 333, + "\xd1": 722, + "\xf5": 556, + "\u0156": 722, + "\u013b": 556, + "\xc3": 667, + "\u0104": 667, + "\xc5": 667, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 500, + "\u2212": 584, + "\xce": 278, + "\u0148": 556, + "\u0163": 278, + "\xac": 584, + "\xf6": 556, + "\xfc": 556, + "\u2260": 549, + "\u0123": 556, + "\xf0": 556, + "\u017e": 500, + "\u0146": 556, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Helvetica-Bold.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica-Bold": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica-Bold", + family="Helvetica", + weight="Bold", + ascent=718, + descent=-207, + cap_height=718, + x_height=532, + italic_angle=0, + flags=32, + bbox=(-170.0, -228.0, 1003.0, 962.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 333, + '"': 474, + "#": 556, + "$": 556, + "%": 889, + "&": 722, + "\u2019": 278, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 333, + ";": 333, + "<": 584, + "=": 584, + ">": 584, + "?": 611, + "@": 975, + "A": 722, + "B": 722, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 556, + "K": 722, + "L": 611, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 584, + "_": 556, + "\u2018": 278, + "a": 556, + "b": 611, + "c": 556, + "d": 611, + "e": 556, + "f": 333, + "g": 611, + "h": 611, + "i": 278, + "j": 278, + "k": 556, + "l": 278, + "m": 889, + "n": 611, + "o": 611, + "p": 611, + "q": 611, + "r": 389, + "s": 556, + "t": 333, + "u": 611, + "v": 556, + "w": 778, + "x": 556, + "y": 556, + "z": 500, + "{": 389, + "|": 280, + "}": 389, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 238, + "\u201c": 500, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 611, + "\ufb02": 611, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 556, + "\u2022": 350, + "\u201a": 278, + "\u201e": 500, + "\u201d": 500, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 611, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 278, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 611, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 722, + "\xe1": 556, + "\xdb": 722, + "\xfd": 556, + "\u0219": 556, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 611, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 556, + "\xe5": 556, + "\u0145": 722, + "\u013a": 278, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 556, + "\u015f": 556, + "\xed": 278, + "\u25ca": 494, + "\u0158": 722, + "\u0122": 778, + "\xfb": 611, + "\xe2": 556, + "\u0100": 722, + "\u0159": 389, + "\xe7": 556, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 743, + "\u016a": 722, + "\u016f": 611, + "\xb3": 333, + "\xd2": 778, + "\xc0": 722, + "\u0102": 722, + "\xd7": 584, + "\xfa": 611, + "\u0164": 611, + "\u2202": 494, + "\xff": 556, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 556, + "\u0144": 611, + "\u016b": 611, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 280, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 389, + "\u014d": 611, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 278, + "\u0165": 389, + "\u0119": 556, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 556, + "\u017a": 500, + "\u012f": 278, + "\xd3": 778, + "\xf3": 611, + "\u0101": 556, + "\u015b": 556, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 611, + "\xb2": 333, + "\xd6": 778, + "\xb5": 611, + "\xec": 278, + "\u0151": 611, + "\u0118": 667, + "\u0111": 611, + "\xbe": 834, + "\u015e": 667, + "\u013e": 400, + "\u0136": 722, + "\u0139": 611, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 611, + "\xbd": 834, + "\u2264": 549, + "\xf4": 611, + "\xf1": 611, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 611, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 611, + "\u010c": 722, + "\xf9": 611, + "\u221a": 549, + "\u010e": 722, + "\u0157": 389, + "\xd1": 722, + "\xf5": 611, + "\u0156": 722, + "\u013b": 611, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 556, + "\u2212": 584, + "\xce": 278, + "\u0148": 611, + "\u0163": 333, + "\xac": 584, + "\xf6": 611, + "\xfc": 611, + "\u2260": 549, + "\u0123": 611, + "\xf0": 611, + "\u017e": 500, + "\u0146": 611, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Helvetica-BoldOblique.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica-BoldOblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica-BoldOblique", + family="Helvetica", + weight="Bold", + ascent=718, + descent=-207, + cap_height=718, + x_height=532, + italic_angle=-12, + flags=96, + bbox=(-174.0, -228.0, 1114.0, 962.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 333, + '"': 474, + "#": 556, + "$": 556, + "%": 889, + "&": 722, + "\u2019": 278, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 333, + ";": 333, + "<": 584, + "=": 584, + ">": 584, + "?": 611, + "@": 975, + "A": 722, + "B": 722, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 556, + "K": 722, + "L": 611, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 584, + "_": 556, + "\u2018": 278, + "a": 556, + "b": 611, + "c": 556, + "d": 611, + "e": 556, + "f": 333, + "g": 611, + "h": 611, + "i": 278, + "j": 278, + "k": 556, + "l": 278, + "m": 889, + "n": 611, + "o": 611, + "p": 611, + "q": 611, + "r": 389, + "s": 556, + "t": 333, + "u": 611, + "v": 556, + "w": 778, + "x": 556, + "y": 556, + "z": 500, + "{": 389, + "|": 280, + "}": 389, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 238, + "\u201c": 500, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 611, + "\ufb02": 611, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 556, + "\u2022": 350, + "\u201a": 278, + "\u201e": 500, + "\u201d": 500, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 611, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 278, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 611, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 722, + "\xe1": 556, + "\xdb": 722, + "\xfd": 556, + "\u0219": 556, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 611, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 556, + "\xe5": 556, + "\u0145": 722, + "\u013a": 278, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 556, + "\u015f": 556, + "\xed": 278, + "\u25ca": 494, + "\u0158": 722, + "\u0122": 778, + "\xfb": 611, + "\xe2": 556, + "\u0100": 722, + "\u0159": 389, + "\xe7": 556, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 743, + "\u016a": 722, + "\u016f": 611, + "\xb3": 333, + "\xd2": 778, + "\xc0": 722, + "\u0102": 722, + "\xd7": 584, + "\xfa": 611, + "\u0164": 611, + "\u2202": 494, + "\xff": 556, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 556, + "\u0144": 611, + "\u016b": 611, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 280, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 389, + "\u014d": 611, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 278, + "\u0165": 389, + "\u0119": 556, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 556, + "\u017a": 500, + "\u012f": 278, + "\xd3": 778, + "\xf3": 611, + "\u0101": 556, + "\u015b": 556, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 611, + "\xb2": 333, + "\xd6": 778, + "\xb5": 611, + "\xec": 278, + "\u0151": 611, + "\u0118": 667, + "\u0111": 611, + "\xbe": 834, + "\u015e": 667, + "\u013e": 400, + "\u0136": 722, + "\u0139": 611, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 611, + "\xbd": 834, + "\u2264": 549, + "\xf4": 611, + "\xf1": 611, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 611, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 611, + "\u010c": 722, + "\xf9": 611, + "\u221a": 549, + "\u010e": 722, + "\u0157": 389, + "\xd1": 722, + "\xf5": 611, + "\u0156": 722, + "\u013b": 611, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 556, + "\u2212": 584, + "\xce": 278, + "\u0148": 611, + "\u0163": 333, + "\xac": 584, + "\xf6": 611, + "\xfc": 611, + "\u2260": 549, + "\u0123": 611, + "\xf0": 611, + "\u017e": 500, + "\u0146": 611, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Helvetica-Oblique.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved. + # Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Helvetica-Oblique": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Helvetica-Oblique", + family="Helvetica", + weight="Medium", + ascent=718, + descent=-207, + cap_height=718, + x_height=523, + italic_angle=-12, + flags=96, + bbox=(-170.0, -225.0, 1116.0, 931.0), + ), + character_widths={ + " ": 278, + "default": 556, + "!": 278, + '"': 355, + "#": 556, + "$": 556, + "%": 889, + "&": 667, + "\u2019": 222, + "(": 333, + ")": 333, + "*": 389, + "+": 584, + ",": 278, + "-": 333, + ".": 278, + "/": 278, + "0": 556, + "1": 556, + "2": 556, + "3": 556, + "4": 556, + "5": 556, + "6": 556, + "7": 556, + "8": 556, + "9": 556, + ":": 278, + ";": 278, + "<": 584, + "=": 584, + ">": 584, + "?": 556, + "@": 1015, + "A": 667, + "B": 667, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 722, + "I": 278, + "J": 500, + "K": 667, + "L": 556, + "M": 833, + "N": 722, + "O": 778, + "P": 667, + "Q": 778, + "R": 722, + "S": 667, + "T": 611, + "U": 722, + "V": 667, + "W": 944, + "X": 667, + "Y": 667, + "Z": 611, + "[": 278, + "\\": 278, + "]": 278, + "^": 469, + "_": 556, + "\u2018": 222, + "a": 556, + "b": 556, + "c": 500, + "d": 556, + "e": 556, + "f": 278, + "g": 556, + "h": 556, + "i": 222, + "j": 222, + "k": 500, + "l": 222, + "m": 833, + "n": 556, + "o": 556, + "p": 556, + "q": 556, + "r": 333, + "s": 500, + "t": 278, + "u": 556, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 500, + "{": 334, + "|": 260, + "}": 334, + "~": 584, + "\xa1": 333, + "\xa2": 556, + "\xa3": 556, + "\u2044": 167, + "\xa5": 556, + "\u0192": 556, + "\xa7": 556, + "\xa4": 556, + "'": 191, + "\u201c": 333, + "\xab": 556, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 500, + "\ufb02": 500, + "\u2013": 556, + "\u2020": 556, + "\u2021": 556, + "\xb7": 278, + "\xb6": 537, + "\u2022": 350, + "\u201a": 222, + "\u201e": 333, + "\u201d": 333, + "\xbb": 556, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 611, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 370, + "\u0141": 556, + "\xd8": 778, + "\u0152": 1000, + "\xba": 365, + "\xe6": 889, + "\u0131": 278, + "\u0142": 222, + "\xf8": 611, + "\u0153": 944, + "\xdf": 611, + "\xcf": 278, + "\xe9": 556, + "\u0103": 556, + "\u0171": 556, + "\u011b": 556, + "\u0178": 667, + "\xf7": 584, + "\xdd": 667, + "\xc2": 667, + "\xe1": 556, + "\xdb": 722, + "\xfd": 500, + "\u0219": 500, + "\xea": 556, + "\u016e": 722, + "\xdc": 722, + "\u0105": 556, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 737, + "\u0112": 667, + "\u010d": 500, + "\xe5": 556, + "\u0145": 722, + "\u013a": 222, + "\xe0": 556, + "\u0162": 611, + "\u0106": 722, + "\xe3": 556, + "\u0116": 667, + "\u0161": 500, + "\u015f": 500, + "\xed": 278, + "\u25ca": 471, + "\u0158": 722, + "\u0122": 778, + "\xfb": 556, + "\xe2": 556, + "\u0100": 667, + "\u0159": 333, + "\xe7": 500, + "\u017b": 611, + "\xde": 667, + "\u014c": 778, + "\u0154": 722, + "\u015a": 667, + "\u010f": 643, + "\u016a": 722, + "\u016f": 556, + "\xb3": 333, + "\xd2": 778, + "\xc0": 667, + "\u0102": 667, + "\xd7": 584, + "\xfa": 556, + "\u0164": 611, + "\u2202": 476, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 556, + "\xeb": 556, + "\u0107": 500, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 278, + "\xb1": 584, + "\xa6": 260, + "\xae": 737, + "\u011e": 778, + "\u0130": 278, + "\u2211": 600, + "\xc8": 667, + "\u0155": 333, + "\u014d": 556, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 222, + "\u0165": 317, + "\u0119": 556, + "\u0172": 722, + "\xc1": 667, + "\xc4": 667, + "\xe8": 556, + "\u017a": 500, + "\u012f": 222, + "\xd3": 778, + "\xf3": 556, + "\u0101": 556, + "\u015b": 500, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 556, + "\xb2": 333, + "\xd6": 778, + "\xb5": 556, + "\xec": 278, + "\u0151": 556, + "\u0118": 667, + "\u0111": 556, + "\xbe": 834, + "\u015e": 667, + "\u013e": 299, + "\u0136": 667, + "\u0139": 556, + "\u2122": 1000, + "\u0117": 556, + "\xcc": 278, + "\u012a": 278, + "\u013d": 556, + "\xbd": 834, + "\u2264": 549, + "\xf4": 556, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 556, + "\u011f": 556, + "\xbc": 834, + "\u0160": 667, + "\u0218": 667, + "\u0150": 778, + "\xb0": 400, + "\xf2": 556, + "\u010c": 722, + "\xf9": 556, + "\u221a": 453, + "\u010e": 722, + "\u0157": 333, + "\xd1": 722, + "\xf5": 556, + "\u0156": 722, + "\u013b": 556, + "\xc3": 667, + "\u0104": 667, + "\xc5": 667, + "\xd5": 778, + "\u017c": 500, + "\u011a": 667, + "\u012e": 278, + "\u0137": 500, + "\u2212": 584, + "\xce": 278, + "\u0148": 556, + "\u0163": 278, + "\xac": 584, + "\xf6": 556, + "\xfc": 556, + "\u2260": 549, + "\u0123": 556, + "\xf0": 556, + "\u017e": 500, + "\u0146": 556, + "\xb9": 333, + "\u012b": 278, + "\u20ac": 556, + }, + ), + # Generated from Symbol.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved. + "Symbol": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Symbol", + family="Symbol", + weight="Medium", + ascent=0.0, + descent=0.0, + cap_height=0.0, + x_height=0.0, + italic_angle=0, + flags=4, + bbox=(-180.0, -293.0, 1090.0, 1010.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + "\u2200": 713, + "#": 500, + "\u2203": 549, + "%": 833, + "&": 778, + "\u220b": 439, + "(": 333, + ")": 333, + "\u2217": 500, + "+": 549, + ",": 250, + "\u2212": 549, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 278, + ";": 278, + "<": 549, + "=": 549, + ">": 549, + "?": 444, + "\u2245": 549, + "\u0391": 722, + "\u0392": 667, + "\u03a7": 722, + "\u2206": 612, + "\u0395": 611, + "\u03a6": 763, + "\u0393": 603, + "\u0397": 722, + "\u0399": 333, + "\u03d1": 631, + "\u039a": 722, + "\u039b": 686, + "\u039c": 889, + "\u039d": 722, + "\u039f": 722, + "\u03a0": 768, + "\u0398": 741, + "\u03a1": 556, + "\u03a3": 592, + "\u03a4": 611, + "\u03a5": 690, + "\u03c2": 439, + "\u2126": 768, + "\u039e": 645, + "\u03a8": 795, + "\u0396": 611, + "[": 333, + "\u2234": 863, + "]": 333, + "\u22a5": 658, + "_": 500, + "\uf8e5": 500, + "\u03b1": 631, + "\u03b2": 549, + "\u03c7": 549, + "\u03b4": 494, + "\u03b5": 439, + "\u03c6": 521, + "\u03b3": 411, + "\u03b7": 603, + "\u03b9": 329, + "\u03d5": 603, + "\u03ba": 549, + "\u03bb": 549, + "\xb5": 576, + "\u03bd": 521, + "\u03bf": 549, + "\u03c0": 549, + "\u03b8": 521, + "\u03c1": 549, + "\u03c3": 603, + "\u03c4": 439, + "\u03c5": 576, + "\u03d6": 713, + "\u03c9": 686, + "\u03be": 493, + "\u03c8": 686, + "\u03b6": 494, + "{": 480, + "|": 200, + "}": 480, + "\u223c": 549, + "\u20ac": 750, + "\u03d2": 620, + "\u2032": 247, + "\u2264": 549, + "\u2044": 167, + "\u221e": 713, + "\u0192": 500, + "\u2663": 753, + "\u2666": 753, + "\u2665": 753, + "\u2660": 753, + "\u2194": 1042, + "\u2190": 987, + "\u2191": 603, + "\u2192": 987, + "\u2193": 603, + "\xb0": 400, + "\xb1": 549, + "\u2033": 411, + "\u2265": 549, + "\xd7": 549, + "\u221d": 713, + "\u2202": 494, + "\u2022": 460, + "\xf7": 549, + "\u2260": 549, + "\u2261": 549, + "\u2248": 549, + "\u2026": 1000, + "\uf8e6": 603, + "\uf8e7": 1000, + "\u21b5": 658, + "\u2135": 823, + "\u2111": 686, + "\u211c": 795, + "\u2118": 987, + "\u2297": 768, + "\u2295": 768, + "\u2205": 823, + "\u2229": 768, + "\u222a": 768, + "\u2283": 713, + "\u2287": 713, + "\u2284": 713, + "\u2282": 713, + "\u2286": 713, + "\u2208": 713, + "\u2209": 713, + "\u2220": 768, + "\u2207": 713, + "\uf6da": 790, + "\uf6d9": 790, + "\uf6db": 890, + "\u220f": 823, + "\u221a": 549, + "\u22c5": 250, + "\xac": 713, + "\u2227": 603, + "\u2228": 603, + "\u21d4": 1042, + "\u21d0": 987, + "\u21d1": 603, + "\u21d2": 987, + "\u21d3": 603, + "\u25ca": 494, + "\u2329": 329, + "\uf8e8": 790, + "\uf8e9": 790, + "\uf8ea": 786, + "\u2211": 713, + "\uf8eb": 384, + "\uf8ec": 384, + "\uf8ed": 384, + "\uf8ee": 384, + "\uf8ef": 384, + "\uf8f0": 384, + "\uf8f1": 494, + "\uf8f2": 494, + "\uf8f3": 494, + "\uf8f4": 494, + "\u232a": 329, + "\u222b": 274, + "\u2320": 686, + "\uf8f5": 686, + "\u2321": 686, + "\uf8f6": 384, + "\uf8f7": 384, + "\uf8f8": 384, + "\uf8f9": 384, + "\uf8fa": 384, + "\uf8fb": 384, + "\uf8fc": 494, + "\uf8fd": 494, + "\uf8fe": 494, + "\uf8ff": 790, + }, + ), + # Generated from Times-Bold.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-Bold": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-Bold", + family="Times", + weight="Bold", + ascent=683, + descent=-217, + cap_height=676, + x_height=461, + italic_angle=0, + flags=34, + bbox=(-168.0, -218.0, 1000.0, 935.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + '"': 555, + "#": 500, + "$": 500, + "%": 1000, + "&": 833, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 570, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 333, + ";": 333, + "<": 570, + "=": 570, + ">": 570, + "?": 500, + "@": 930, + "A": 722, + "B": 667, + "C": 722, + "D": 722, + "E": 667, + "F": 611, + "G": 778, + "H": 778, + "I": 389, + "J": 500, + "K": 778, + "L": 667, + "M": 944, + "N": 722, + "O": 778, + "P": 611, + "Q": 778, + "R": 722, + "S": 556, + "T": 667, + "U": 722, + "V": 722, + "W": 1000, + "X": 722, + "Y": 722, + "Z": 667, + "[": 333, + "\\": 278, + "]": 333, + "^": 581, + "_": 500, + "\u2018": 333, + "a": 500, + "b": 556, + "c": 444, + "d": 556, + "e": 444, + "f": 333, + "g": 500, + "h": 556, + "i": 278, + "j": 333, + "k": 556, + "l": 278, + "m": 833, + "n": 556, + "o": 500, + "p": 556, + "q": 556, + "r": 444, + "s": 389, + "t": 333, + "u": 556, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 444, + "{": 394, + "|": 220, + "}": 394, + "~": 520, + "\xa1": 333, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 278, + "\u201c": 500, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 556, + "\ufb02": 556, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 540, + "\u2022": 350, + "\u201a": 333, + "\u201e": 500, + "\u201d": 500, + "\xbb": 500, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 500, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 1000, + "\xaa": 300, + "\u0141": 667, + "\xd8": 778, + "\u0152": 1000, + "\xba": 330, + "\xe6": 722, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 722, + "\xdf": 556, + "\xcf": 389, + "\xe9": 444, + "\u0103": 500, + "\u0171": 556, + "\u011b": 444, + "\u0178": 722, + "\xf7": 570, + "\xdd": 722, + "\xc2": 722, + "\xe1": 500, + "\xdb": 722, + "\xfd": 500, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 500, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 747, + "\u0112": 667, + "\u010d": 444, + "\xe5": 500, + "\u0145": 722, + "\u013a": 278, + "\xe0": 500, + "\u0162": 667, + "\u0106": 722, + "\xe3": 500, + "\u0116": 667, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 494, + "\u0158": 722, + "\u0122": 778, + "\xfb": 556, + "\xe2": 500, + "\u0100": 722, + "\u0159": 444, + "\xe7": 444, + "\u017b": 667, + "\xde": 611, + "\u014c": 778, + "\u0154": 722, + "\u015a": 556, + "\u010f": 672, + "\u016a": 722, + "\u016f": 556, + "\xb3": 300, + "\xd2": 778, + "\xc0": 722, + "\u0102": 722, + "\xd7": 570, + "\xfa": 556, + "\u0164": 667, + "\u2202": 494, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 500, + "\xeb": 444, + "\u0107": 444, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 389, + "\xb1": 570, + "\xa6": 220, + "\xae": 747, + "\u011e": 778, + "\u0130": 389, + "\u2211": 600, + "\xc8": 667, + "\u0155": 444, + "\u014d": 500, + "\u0179": 667, + "\u017d": 667, + "\u2265": 549, + "\xd0": 722, + "\xc7": 722, + "\u013c": 278, + "\u0165": 416, + "\u0119": 444, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 444, + "\u017a": 444, + "\u012f": 278, + "\xd3": 778, + "\xf3": 500, + "\u0101": 500, + "\u015b": 389, + "\xef": 278, + "\xd4": 778, + "\xd9": 722, + "\u2206": 612, + "\xfe": 556, + "\xb2": 300, + "\xd6": 778, + "\xb5": 556, + "\xec": 278, + "\u0151": 500, + "\u0118": 667, + "\u0111": 556, + "\xbe": 750, + "\u015e": 556, + "\u013e": 394, + "\u0136": 778, + "\u0139": 667, + "\u2122": 1000, + "\u0117": 444, + "\xcc": 389, + "\u012a": 389, + "\u013d": 667, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 556, + "\u0218": 556, + "\u0150": 778, + "\xb0": 400, + "\xf2": 500, + "\u010c": 722, + "\xf9": 556, + "\u221a": 549, + "\u010e": 722, + "\u0157": 444, + "\xd1": 722, + "\xf5": 500, + "\u0156": 722, + "\u013b": 667, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 778, + "\u017c": 444, + "\u011a": 667, + "\u012e": 389, + "\u0137": 556, + "\u2212": 570, + "\xce": 389, + "\u0148": 556, + "\u0163": 333, + "\xac": 570, + "\xf6": 500, + "\xfc": 556, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 444, + "\u0146": 556, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from Times-BoldItalic.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-BoldItalic": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-BoldItalic", + family="Times", + weight="Bold", + ascent=683, + descent=-217, + cap_height=669, + x_height=462, + italic_angle=-15, + flags=98, + bbox=(-200.0, -218.0, 996.0, 921.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 389, + '"': 555, + "#": 500, + "$": 500, + "%": 833, + "&": 778, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 570, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 333, + ";": 333, + "<": 570, + "=": 570, + ">": 570, + "?": 500, + "@": 832, + "A": 667, + "B": 667, + "C": 667, + "D": 722, + "E": 667, + "F": 667, + "G": 722, + "H": 778, + "I": 389, + "J": 500, + "K": 667, + "L": 611, + "M": 889, + "N": 722, + "O": 722, + "P": 611, + "Q": 722, + "R": 667, + "S": 556, + "T": 611, + "U": 722, + "V": 667, + "W": 889, + "X": 667, + "Y": 611, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 570, + "_": 500, + "\u2018": 333, + "a": 500, + "b": 500, + "c": 444, + "d": 500, + "e": 444, + "f": 333, + "g": 500, + "h": 556, + "i": 278, + "j": 278, + "k": 500, + "l": 278, + "m": 778, + "n": 556, + "o": 500, + "p": 500, + "q": 500, + "r": 389, + "s": 389, + "t": 278, + "u": 556, + "v": 444, + "w": 667, + "x": 500, + "y": 444, + "z": 389, + "{": 348, + "|": 220, + "}": 348, + "~": 570, + "\xa1": 389, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 278, + "\u201c": 500, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 556, + "\ufb02": 556, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 500, + "\u2022": 350, + "\u201a": 333, + "\u201e": 500, + "\u201d": 500, + "\xbb": 500, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 500, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 944, + "\xaa": 266, + "\u0141": 611, + "\xd8": 722, + "\u0152": 944, + "\xba": 300, + "\xe6": 722, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 722, + "\xdf": 500, + "\xcf": 389, + "\xe9": 444, + "\u0103": 500, + "\u0171": 556, + "\u011b": 444, + "\u0178": 611, + "\xf7": 570, + "\xdd": 611, + "\xc2": 667, + "\xe1": 500, + "\xdb": 722, + "\xfd": 444, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 500, + "\xda": 722, + "\u0173": 556, + "\xcb": 667, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 747, + "\u0112": 667, + "\u010d": 444, + "\xe5": 500, + "\u0145": 722, + "\u013a": 278, + "\xe0": 500, + "\u0162": 611, + "\u0106": 667, + "\xe3": 500, + "\u0116": 667, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 494, + "\u0158": 667, + "\u0122": 722, + "\xfb": 556, + "\xe2": 500, + "\u0100": 667, + "\u0159": 389, + "\xe7": 444, + "\u017b": 611, + "\xde": 611, + "\u014c": 722, + "\u0154": 667, + "\u015a": 556, + "\u010f": 608, + "\u016a": 722, + "\u016f": 556, + "\xb3": 300, + "\xd2": 722, + "\xc0": 667, + "\u0102": 667, + "\xd7": 570, + "\xfa": 556, + "\u0164": 611, + "\u2202": 494, + "\xff": 444, + "\u0143": 722, + "\xee": 278, + "\xca": 667, + "\xe4": 500, + "\xeb": 444, + "\u0107": 444, + "\u0144": 556, + "\u016b": 556, + "\u0147": 722, + "\xcd": 389, + "\xb1": 570, + "\xa6": 220, + "\xae": 747, + "\u011e": 722, + "\u0130": 389, + "\u2211": 600, + "\xc8": 667, + "\u0155": 389, + "\u014d": 500, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 667, + "\u013c": 278, + "\u0165": 366, + "\u0119": 444, + "\u0172": 722, + "\xc1": 667, + "\xc4": 667, + "\xe8": 444, + "\u017a": 389, + "\u012f": 278, + "\xd3": 722, + "\xf3": 500, + "\u0101": 500, + "\u015b": 389, + "\xef": 278, + "\xd4": 722, + "\xd9": 722, + "\u2206": 612, + "\xfe": 500, + "\xb2": 300, + "\xd6": 722, + "\xb5": 576, + "\xec": 278, + "\u0151": 500, + "\u0118": 667, + "\u0111": 500, + "\xbe": 750, + "\u015e": 556, + "\u013e": 382, + "\u0136": 667, + "\u0139": 611, + "\u2122": 1000, + "\u0117": 444, + "\xcc": 389, + "\u012a": 389, + "\u013d": 611, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 556, + "\u0170": 722, + "\xc9": 667, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 556, + "\u0218": 556, + "\u0150": 722, + "\xb0": 400, + "\xf2": 500, + "\u010c": 667, + "\xf9": 556, + "\u221a": 549, + "\u010e": 722, + "\u0157": 389, + "\xd1": 722, + "\xf5": 500, + "\u0156": 667, + "\u013b": 611, + "\xc3": 667, + "\u0104": 667, + "\xc5": 667, + "\xd5": 722, + "\u017c": 389, + "\u011a": 667, + "\u012e": 389, + "\u0137": 500, + "\u2212": 606, + "\xce": 389, + "\u0148": 556, + "\u0163": 278, + "\xac": 606, + "\xf6": 500, + "\xfc": 556, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 389, + "\u0146": 556, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from Times-Italic.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-Italic": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-Italic", + family="Times", + weight="Medium", + ascent=683, + descent=-217, + cap_height=653, + x_height=441, + italic_angle=-15.5, + flags=98, + bbox=(-169.0, -217.0, 1010.0, 883.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + '"': 420, + "#": 500, + "$": 500, + "%": 833, + "&": 778, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 675, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 333, + ";": 333, + "<": 675, + "=": 675, + ">": 675, + "?": 500, + "@": 920, + "A": 611, + "B": 611, + "C": 667, + "D": 722, + "E": 611, + "F": 611, + "G": 722, + "H": 722, + "I": 333, + "J": 444, + "K": 667, + "L": 556, + "M": 833, + "N": 667, + "O": 722, + "P": 611, + "Q": 722, + "R": 611, + "S": 500, + "T": 556, + "U": 722, + "V": 611, + "W": 833, + "X": 611, + "Y": 556, + "Z": 556, + "[": 389, + "\\": 278, + "]": 389, + "^": 422, + "_": 500, + "\u2018": 333, + "a": 500, + "b": 500, + "c": 444, + "d": 500, + "e": 444, + "f": 278, + "g": 500, + "h": 500, + "i": 278, + "j": 278, + "k": 444, + "l": 278, + "m": 722, + "n": 500, + "o": 500, + "p": 500, + "q": 500, + "r": 389, + "s": 389, + "t": 278, + "u": 500, + "v": 444, + "w": 667, + "x": 444, + "y": 444, + "z": 389, + "{": 400, + "|": 275, + "}": 400, + "~": 541, + "\xa1": 389, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 214, + "\u201c": 556, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 500, + "\ufb02": 500, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 523, + "\u2022": 350, + "\u201a": 333, + "\u201e": 556, + "\u201d": 556, + "\xbb": 500, + "\u2026": 889, + "\u2030": 1000, + "\xbf": 500, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 889, + "\xc6": 889, + "\xaa": 276, + "\u0141": 556, + "\xd8": 722, + "\u0152": 944, + "\xba": 310, + "\xe6": 667, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 667, + "\xdf": 500, + "\xcf": 333, + "\xe9": 444, + "\u0103": 500, + "\u0171": 500, + "\u011b": 444, + "\u0178": 556, + "\xf7": 675, + "\xdd": 556, + "\xc2": 611, + "\xe1": 500, + "\xdb": 722, + "\xfd": 444, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 500, + "\xda": 722, + "\u0173": 500, + "\xcb": 611, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 760, + "\u0112": 611, + "\u010d": 444, + "\xe5": 500, + "\u0145": 667, + "\u013a": 278, + "\xe0": 500, + "\u0162": 556, + "\u0106": 667, + "\xe3": 500, + "\u0116": 611, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 471, + "\u0158": 611, + "\u0122": 722, + "\xfb": 500, + "\xe2": 500, + "\u0100": 611, + "\u0159": 389, + "\xe7": 444, + "\u017b": 556, + "\xde": 611, + "\u014c": 722, + "\u0154": 611, + "\u015a": 500, + "\u010f": 544, + "\u016a": 722, + "\u016f": 500, + "\xb3": 300, + "\xd2": 722, + "\xc0": 611, + "\u0102": 611, + "\xd7": 675, + "\xfa": 500, + "\u0164": 556, + "\u2202": 476, + "\xff": 444, + "\u0143": 667, + "\xee": 278, + "\xca": 611, + "\xe4": 500, + "\xeb": 444, + "\u0107": 444, + "\u0144": 500, + "\u016b": 500, + "\u0147": 667, + "\xcd": 333, + "\xb1": 675, + "\xa6": 275, + "\xae": 760, + "\u011e": 722, + "\u0130": 333, + "\u2211": 600, + "\xc8": 611, + "\u0155": 389, + "\u014d": 500, + "\u0179": 556, + "\u017d": 556, + "\u2265": 549, + "\xd0": 722, + "\xc7": 667, + "\u013c": 278, + "\u0165": 300, + "\u0119": 444, + "\u0172": 722, + "\xc1": 611, + "\xc4": 611, + "\xe8": 444, + "\u017a": 389, + "\u012f": 278, + "\xd3": 722, + "\xf3": 500, + "\u0101": 500, + "\u015b": 389, + "\xef": 278, + "\xd4": 722, + "\xd9": 722, + "\u2206": 612, + "\xfe": 500, + "\xb2": 300, + "\xd6": 722, + "\xb5": 500, + "\xec": 278, + "\u0151": 500, + "\u0118": 611, + "\u0111": 500, + "\xbe": 750, + "\u015e": 500, + "\u013e": 300, + "\u0136": 667, + "\u0139": 556, + "\u2122": 980, + "\u0117": 444, + "\xcc": 333, + "\u012a": 333, + "\u013d": 611, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 500, + "\u0170": 722, + "\xc9": 611, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 500, + "\u0218": 500, + "\u0150": 722, + "\xb0": 400, + "\xf2": 500, + "\u010c": 667, + "\xf9": 500, + "\u221a": 453, + "\u010e": 722, + "\u0157": 389, + "\xd1": 667, + "\xf5": 500, + "\u0156": 611, + "\u013b": 556, + "\xc3": 611, + "\u0104": 611, + "\xc5": 611, + "\xd5": 722, + "\u017c": 389, + "\u011a": 611, + "\u012e": 333, + "\u0137": 444, + "\u2212": 675, + "\xce": 333, + "\u0148": 500, + "\u0163": 278, + "\xac": 675, + "\xf6": 500, + "\xfc": 500, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 389, + "\u0146": 500, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from Times-Roman.afm + # Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights + # Reserved. Times is a trademark of Linotype-Hell AG and/or its subsidiaries. + "Times-Roman": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="Times-Roman", + family="Times", + weight="Roman", + ascent=683, + descent=-217, + cap_height=662, + x_height=450, + italic_angle=0, + flags=34, + bbox=(-168.0, -218.0, 1000.0, 898.0), + ), + character_widths={ + " ": 250, + "default": 500, + "!": 333, + '"': 408, + "#": 500, + "$": 500, + "%": 833, + "&": 778, + "\u2019": 333, + "(": 333, + ")": 333, + "*": 500, + "+": 564, + ",": 250, + "-": 333, + ".": 250, + "/": 278, + "0": 500, + "1": 500, + "2": 500, + "3": 500, + "4": 500, + "5": 500, + "6": 500, + "7": 500, + "8": 500, + "9": 500, + ":": 278, + ";": 278, + "<": 564, + "=": 564, + ">": 564, + "?": 444, + "@": 921, + "A": 722, + "B": 667, + "C": 667, + "D": 722, + "E": 611, + "F": 556, + "G": 722, + "H": 722, + "I": 333, + "J": 389, + "K": 722, + "L": 611, + "M": 889, + "N": 722, + "O": 722, + "P": 556, + "Q": 722, + "R": 667, + "S": 556, + "T": 611, + "U": 722, + "V": 722, + "W": 944, + "X": 722, + "Y": 722, + "Z": 611, + "[": 333, + "\\": 278, + "]": 333, + "^": 469, + "_": 500, + "\u2018": 333, + "a": 444, + "b": 500, + "c": 444, + "d": 500, + "e": 444, + "f": 333, + "g": 500, + "h": 500, + "i": 278, + "j": 278, + "k": 500, + "l": 278, + "m": 778, + "n": 500, + "o": 500, + "p": 500, + "q": 500, + "r": 333, + "s": 389, + "t": 278, + "u": 500, + "v": 500, + "w": 722, + "x": 500, + "y": 500, + "z": 444, + "{": 480, + "|": 200, + "}": 480, + "~": 541, + "\xa1": 333, + "\xa2": 500, + "\xa3": 500, + "\u2044": 167, + "\xa5": 500, + "\u0192": 500, + "\xa7": 500, + "\xa4": 500, + "'": 180, + "\u201c": 444, + "\xab": 500, + "\u2039": 333, + "\u203a": 333, + "\ufb01": 556, + "\ufb02": 556, + "\u2013": 500, + "\u2020": 500, + "\u2021": 500, + "\xb7": 250, + "\xb6": 453, + "\u2022": 350, + "\u201a": 333, + "\u201e": 444, + "\u201d": 444, + "\xbb": 500, + "\u2026": 1000, + "\u2030": 1000, + "\xbf": 444, + "`": 333, + "\xb4": 333, + "\u02c6": 333, + "\u02dc": 333, + "\xaf": 333, + "\u02d8": 333, + "\u02d9": 333, + "\xa8": 333, + "\u02da": 333, + "\xb8": 333, + "\u02dd": 333, + "\u02db": 333, + "\u02c7": 333, + "\u2014": 1000, + "\xc6": 889, + "\xaa": 276, + "\u0141": 611, + "\xd8": 722, + "\u0152": 889, + "\xba": 310, + "\xe6": 667, + "\u0131": 278, + "\u0142": 278, + "\xf8": 500, + "\u0153": 722, + "\xdf": 500, + "\xcf": 333, + "\xe9": 444, + "\u0103": 444, + "\u0171": 500, + "\u011b": 444, + "\u0178": 722, + "\xf7": 564, + "\xdd": 722, + "\xc2": 722, + "\xe1": 444, + "\xdb": 722, + "\xfd": 500, + "\u0219": 389, + "\xea": 444, + "\u016e": 722, + "\xdc": 722, + "\u0105": 444, + "\xda": 722, + "\u0173": 500, + "\xcb": 611, + "\u0110": 722, + "\uf6c3": 250, + "\xa9": 760, + "\u0112": 611, + "\u010d": 444, + "\xe5": 444, + "\u0145": 722, + "\u013a": 278, + "\xe0": 444, + "\u0162": 611, + "\u0106": 667, + "\xe3": 444, + "\u0116": 611, + "\u0161": 389, + "\u015f": 389, + "\xed": 278, + "\u25ca": 471, + "\u0158": 667, + "\u0122": 722, + "\xfb": 500, + "\xe2": 444, + "\u0100": 722, + "\u0159": 333, + "\xe7": 444, + "\u017b": 611, + "\xde": 556, + "\u014c": 722, + "\u0154": 667, + "\u015a": 556, + "\u010f": 588, + "\u016a": 722, + "\u016f": 500, + "\xb3": 300, + "\xd2": 722, + "\xc0": 722, + "\u0102": 722, + "\xd7": 564, + "\xfa": 500, + "\u0164": 611, + "\u2202": 476, + "\xff": 500, + "\u0143": 722, + "\xee": 278, + "\xca": 611, + "\xe4": 444, + "\xeb": 444, + "\u0107": 444, + "\u0144": 500, + "\u016b": 500, + "\u0147": 722, + "\xcd": 333, + "\xb1": 564, + "\xa6": 200, + "\xae": 760, + "\u011e": 722, + "\u0130": 333, + "\u2211": 600, + "\xc8": 611, + "\u0155": 333, + "\u014d": 500, + "\u0179": 611, + "\u017d": 611, + "\u2265": 549, + "\xd0": 722, + "\xc7": 667, + "\u013c": 278, + "\u0165": 326, + "\u0119": 444, + "\u0172": 722, + "\xc1": 722, + "\xc4": 722, + "\xe8": 444, + "\u017a": 444, + "\u012f": 278, + "\xd3": 722, + "\xf3": 500, + "\u0101": 444, + "\u015b": 389, + "\xef": 278, + "\xd4": 722, + "\xd9": 722, + "\u2206": 612, + "\xfe": 500, + "\xb2": 300, + "\xd6": 722, + "\xb5": 500, + "\xec": 278, + "\u0151": 500, + "\u0118": 611, + "\u0111": 500, + "\xbe": 750, + "\u015e": 556, + "\u013e": 344, + "\u0136": 722, + "\u0139": 611, + "\u2122": 980, + "\u0117": 444, + "\xcc": 333, + "\u012a": 333, + "\u013d": 611, + "\xbd": 750, + "\u2264": 549, + "\xf4": 500, + "\xf1": 500, + "\u0170": 722, + "\xc9": 611, + "\u0113": 444, + "\u011f": 500, + "\xbc": 750, + "\u0160": 556, + "\u0218": 556, + "\u0150": 722, + "\xb0": 400, + "\xf2": 500, + "\u010c": 667, + "\xf9": 500, + "\u221a": 453, + "\u010e": 722, + "\u0157": 333, + "\xd1": 722, + "\xf5": 500, + "\u0156": 667, + "\u013b": 611, + "\xc3": 722, + "\u0104": 722, + "\xc5": 722, + "\xd5": 722, + "\u017c": 444, + "\u011a": 611, + "\u012e": 333, + "\u0137": 500, + "\u2212": 564, + "\xce": 333, + "\u0148": 500, + "\u0163": 278, + "\xac": 564, + "\xf6": 500, + "\xfc": 500, + "\u2260": 549, + "\u0123": 500, + "\xf0": 500, + "\u017e": 444, + "\u0146": 500, + "\xb9": 300, + "\u012b": 278, + "\u20ac": 500, + }, + ), + # Generated from ZapfDingbats.afm + # Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems Incorporated. All Rights Reserved. + # ITC Zapf Dingbats is a registered trademark of International Typeface Corporation. + "ZapfDingbats": CoreFontMetrics( + font_descriptor=FontDescriptor( + name="ZapfDingbats", + family="ZapfDingbats", + weight="Medium", + ascent=0.0, + descent=0.0, + cap_height=0.0, + x_height=0.0, + italic_angle=0, + flags=4, + bbox=(-1.0, -143.0, 981.0, 820.0), + ), + character_widths={ + " ": 790, + "default": 1580, + "\x01": 974, + "\x02": 961, + "\xca": 974, + "\x03": 980, + "\x04": 719, + "\x05": 789, + "w": 790, + "v": 791, + "u": 690, + "\x0b": 960, + "\x0c": 939, + "\r": 549, + "\x0e": 855, + "\x0f": 911, + "\x10": 933, + "i": 911, + "\x11": 945, + "\x12": 974, + "\x13": 755, + "\x14": 846, + "\x15": 762, + "\x16": 761, + "\x17": 571, + "\x18": 677, + "\x19": 763, + "\x1a": 760, + "\x1b": 759, + "\x1c": 754, + "\x06": 494, + "\x07": 552, + "\x08": 537, + "\t": 577, + "\n": 692, + "\x1d": 786, + "\x1e": 788, + "\x1f": 788, + "!": 793, + '"': 794, + "#": 816, + "$": 823, + "%": 789, + "&": 841, + "'": 823, + "(": 833, + ")": 816, + "*": 831, + "+": 923, + ",": 744, + "-": 723, + ".": 749, + "/": 790, + "0": 792, + "1": 695, + "2": 776, + "3": 768, + "4": 792, + "5": 759, + "6": 707, + "7": 708, + "8": 682, + "9": 701, + ":": 826, + ";": 815, + "<": 789, + "=": 789, + ">": 707, + "?": 687, + "@": 696, + "A": 689, + "B": 786, + "C": 787, + "D": 713, + "E": 791, + "F": 785, + "G": 791, + "H": 873, + "I": 761, + "J": 762, + "\xcb": 762, + "K": 759, + "\xcc": 759, + "L": 892, + "M": 892, + "N": 788, + "O": 784, + "Q": 438, + "R": 138, + "S": 277, + "T": 415, + "a": 392, + "b": 392, + "c": 668, + "d": 668, + "Y": 390, + "Z": 390, + "]": 317, + "^": 317, + "[": 276, + "\\": 276, + "\xcd": 509, + "U": 509, + "\xce": 410, + "V": 410, + "W": 234, + "X": 234, + "_": 334, + "`": 334, + "e": 732, + "f": 544, + "g": 544, + "h": 910, + "j": 667, + "k": 760, + "l": 760, + "p": 776, + "o": 595, + "n": 694, + "m": 626, + "x": 788, + "y": 788, + "z": 788, + "{": 788, + "|": 788, + "}": 788, + "~": 788, + "\x7f": 788, + "\x80": 788, + "\x81": 788, + "\x82": 788, + "\x83": 788, + "\x84": 788, + "\x85": 788, + "\x86": 788, + "\x87": 788, + "\x88": 788, + "\x89": 788, + "\x8a": 788, + "\x8b": 788, + "\x8c": 788, + "\x8d": 788, + "\x8e": 788, + "\x8f": 788, + "\x90": 788, + "\x91": 788, + "\x92": 788, + "\x93": 788, + "\x94": 788, + "\x95": 788, + "\x96": 788, + "\x97": 788, + "\x98": 788, + "\x99": 788, + "\x9a": 788, + "\x9b": 788, + "\x9c": 788, + "\x9d": 788, + "\x9e": 788, + "\x9f": 788, + "\xa0": 894, + "\xa1": 838, + "\xa3": 1016, + "\xa4": 458, + "\xc4": 748, + "\xa5": 924, + "\xc0": 748, + "\xa6": 918, + "\xa7": 927, + "\xa8": 928, + "\xa9": 928, + "\xaa": 834, + "\xab": 873, + "\xac": 828, + "\xad": 924, + "\xa2": 924, + "\xae": 917, + "\xaf": 930, + "\xb0": 931, + "\xb1": 463, + "\xb2": 883, + "\xb3": 836, + "\xc1": 836, + "\xb4": 867, + "\xc7": 867, + "\xb5": 696, + "\xc8": 696, + "\xb6": 874, + "\xc9": 874, + "\xb7": 760, + "\xb8": 946, + "\xc5": 771, + "\xb9": 865, + "\xc2": 771, + "\xc6": 888, + "\xba": 967, + "\xc3": 888, + "\xbb": 831, + "\xbc": 873, + "\xbd": 927, + "\xbe": 970, + "\xbf": 918, + }, + ), +} + + +# Add aliases per table H.3 on pp. 1109-1110 of the PDF 1.7 reference +CORE_FONT_METRICS["Arial"] = CORE_FONT_METRICS["Helvetica"] +CORE_FONT_METRICS["Arial,Italic"] = CORE_FONT_METRICS["Helvetica-Oblique"] +CORE_FONT_METRICS["Arial,Bold"] = CORE_FONT_METRICS["Helvetica-Bold"] +CORE_FONT_METRICS["Arial,BoldItalic"] = CORE_FONT_METRICS["Helvetica-BoldOblique"] +CORE_FONT_METRICS["CourierNew"] = CORE_FONT_METRICS["Courier"] +CORE_FONT_METRICS["CourierNew,Italic"] = CORE_FONT_METRICS["Courier-Oblique"] +CORE_FONT_METRICS["CourierNew,Bold"] = CORE_FONT_METRICS["Courier-Bold"] +CORE_FONT_METRICS["CourierNew,BoldItalic"] = CORE_FONT_METRICS["Courier-BoldOblique"] +CORE_FONT_METRICS["TimesNewRoman"] = CORE_FONT_METRICS["Times-Roman"] +CORE_FONT_METRICS["TimesNewRoman,Italic"] = CORE_FONT_METRICS["Times-Italic"] +CORE_FONT_METRICS["TimesNewRoman,Bold"] = CORE_FONT_METRICS["Times-Bold"] +CORE_FONT_METRICS["TimesNewRoman,BoldItalic"] = CORE_FONT_METRICS["Times-BoldItalic"] diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/pdfdoc.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/pdfdoc.py new file mode 100644 index 0000000000000000000000000000000000000000..306357a59c4d9a0fd846bb52e5b6774d82c6ae51 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/pdfdoc.py @@ -0,0 +1,264 @@ +# PDFDocEncoding Character Set: Table D.2 of PDF Reference 1.7 +# C.1 Predefined encodings sorted by character name of another PDF reference +# Some indices have '\u0000' although they should have something else: +# 22: should be '\u0017' +_pdfdoc_encoding = [ + "\u0000", + "\u0001", + "\u0002", + "\u0003", + "\u0004", + "\u0005", + "\u0006", + "\u0007", # 0 - 7 + "\u0008", + "\u0009", + "\u000a", + "\u000b", + "\u000c", + "\u000d", + "\u000e", + "\u000f", # 8 - 15 + "\u0010", + "\u0011", + "\u0012", + "\u0013", + "\u0014", + "\u0015", + "\u0000", + "\u0017", # 16 - 23 + "\u02d8", + "\u02c7", + "\u02c6", + "\u02d9", + "\u02dd", + "\u02db", + "\u02da", + "\u02dc", # 24 - 31 + "\u0020", + "\u0021", + "\u0022", + "\u0023", + "\u0024", + "\u0025", + "\u0026", + "\u0027", # 32 - 39 + "\u0028", + "\u0029", + "\u002a", + "\u002b", + "\u002c", + "\u002d", + "\u002e", + "\u002f", # 40 - 47 + "\u0030", + "\u0031", + "\u0032", + "\u0033", + "\u0034", + "\u0035", + "\u0036", + "\u0037", # 48 - 55 + "\u0038", + "\u0039", + "\u003a", + "\u003b", + "\u003c", + "\u003d", + "\u003e", + "\u003f", # 56 - 63 + "\u0040", + "\u0041", + "\u0042", + "\u0043", + "\u0044", + "\u0045", + "\u0046", + "\u0047", # 64 - 71 + "\u0048", + "\u0049", + "\u004a", + "\u004b", + "\u004c", + "\u004d", + "\u004e", + "\u004f", # 72 - 79 + "\u0050", + "\u0051", + "\u0052", + "\u0053", + "\u0054", + "\u0055", + "\u0056", + "\u0057", # 80 - 87 + "\u0058", + "\u0059", + "\u005a", + "\u005b", + "\u005c", + "\u005d", + "\u005e", + "\u005f", # 88 - 95 + "\u0060", + "\u0061", + "\u0062", + "\u0063", + "\u0064", + "\u0065", + "\u0066", + "\u0067", # 96 - 103 + "\u0068", + "\u0069", + "\u006a", + "\u006b", + "\u006c", + "\u006d", + "\u006e", + "\u006f", # 104 - 111 + "\u0070", + "\u0071", + "\u0072", + "\u0073", + "\u0074", + "\u0075", + "\u0076", + "\u0077", # 112 - 119 + "\u0078", + "\u0079", + "\u007a", + "\u007b", + "\u007c", + "\u007d", + "\u007e", + "\u0000", # 120 - 127 + "\u2022", + "\u2020", + "\u2021", + "\u2026", + "\u2014", + "\u2013", + "\u0192", + "\u2044", # 128 - 135 + "\u2039", + "\u203a", + "\u2212", + "\u2030", + "\u201e", + "\u201c", + "\u201d", + "\u2018", # 136 - 143 + "\u2019", + "\u201a", + "\u2122", + "\ufb01", + "\ufb02", + "\u0141", + "\u0152", + "\u0160", # 144 - 151 + "\u0178", + "\u017d", + "\u0131", + "\u0142", + "\u0153", + "\u0161", + "\u017e", + "\u0000", # 152 - 159 + "\u20ac", + "\u00a1", + "\u00a2", + "\u00a3", + "\u00a4", + "\u00a5", + "\u00a6", + "\u00a7", # 160 - 167 + "\u00a8", + "\u00a9", + "\u00aa", + "\u00ab", + "\u00ac", + "\u0000", + "\u00ae", + "\u00af", # 168 - 175 + "\u00b0", + "\u00b1", + "\u00b2", + "\u00b3", + "\u00b4", + "\u00b5", + "\u00b6", + "\u00b7", # 176 - 183 + "\u00b8", + "\u00b9", + "\u00ba", + "\u00bb", + "\u00bc", + "\u00bd", + "\u00be", + "\u00bf", # 184 - 191 + "\u00c0", + "\u00c1", + "\u00c2", + "\u00c3", + "\u00c4", + "\u00c5", + "\u00c6", + "\u00c7", # 192 - 199 + "\u00c8", + "\u00c9", + "\u00ca", + "\u00cb", + "\u00cc", + "\u00cd", + "\u00ce", + "\u00cf", # 200 - 207 + "\u00d0", + "\u00d1", + "\u00d2", + "\u00d3", + "\u00d4", + "\u00d5", + "\u00d6", + "\u00d7", # 208 - 215 + "\u00d8", + "\u00d9", + "\u00da", + "\u00db", + "\u00dc", + "\u00dd", + "\u00de", + "\u00df", # 216 - 223 + "\u00e0", + "\u00e1", + "\u00e2", + "\u00e3", + "\u00e4", + "\u00e5", + "\u00e6", + "\u00e7", # 224 - 231 + "\u00e8", + "\u00e9", + "\u00ea", + "\u00eb", + "\u00ec", + "\u00ed", + "\u00ee", + "\u00ef", # 232 - 239 + "\u00f0", + "\u00f1", + "\u00f2", + "\u00f3", + "\u00f4", + "\u00f5", + "\u00f6", + "\u00f7", # 240 - 247 + "\u00f8", + "\u00f9", + "\u00fa", + "\u00fb", + "\u00fc", + "\u00fd", + "\u00fe", + "\u00ff", # 248 - 255 +] + +assert len(_pdfdoc_encoding) == 256 diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/std.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/std.py new file mode 100644 index 0000000000000000000000000000000000000000..a6057ff3c7a90e9c31389d2bab1bd0f6058ad724 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/std.py @@ -0,0 +1,258 @@ +_std_encoding = [ + "\x00", + "\x01", + "\x02", + "\x03", + "\x04", + "\x05", + "\x06", + "\x07", + "\x08", + "\t", + "\n", + "\x0b", + "\x0c", + "\r", + "\x0e", + "\x0f", + "\x10", + "\x11", + "\x12", + "\x13", + "\x14", + "\x15", + "\x16", + "\x17", + "\x18", + "\x19", + "\x1a", + "\x1b", + "\x1c", + "\x1d", + "\x1e", + "\x1f", + " ", + "!", + '"', + "#", + "$", + "%", + "&", + "’", + "(", + ")", + "*", + "+", + ",", + "-", + ".", + "/", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + ":", + ";", + "<", + "=", + ">", + "?", + "@", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "[", + "\\", + "]", + "^", + "_", + "‘", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "{", + "|", + "}", + "~", + "\x7f", + "\x80", + "\x81", + "\x82", + "\x83", + "\x84", + "\x85", + "\x86", + "\x87", + "\x88", + "\x89", + "\x8a", + "\x8b", + "\x8c", + "\x8d", + "\x8e", + "\x8f", + "\x90", + "\x91", + "\x92", + "\x93", + "\x94", + "\x95", + "\x96", + "\x97", + "\x98", + "\x99", + "\x9a", + "\x9b", + "\x9c", + "\x9d", + "\x9e", + "\x9f", + "\xa0", + "¡", + "¢", + "£", + "⁄", + "¥", + "ƒ", + "§", + "¤", + "'", + "“", + "«", + "‹", + "›", + "fi", + "fl", + "°", + "–", + "†", + "‡", + "·", + "µ", + "¶", + "•", + "‚", + "„", + "”", + "»", + "…", + "‰", + "¾", + "¿", + "À", + "`", + "´", + "ˆ", + "˜", + "¯", + "˘", + "˙", + "¨", + "É", + "˚", + "¸", + "Ì", + "˝", + "˛", + "ˇ", + "—", + "Ñ", + "Ò", + "Ó", + "Ô", + "Õ", + "Ö", + "×", + "Ø", + "Ù", + "Ú", + "Û", + "Ü", + "Ý", + "Þ", + "ß", + "à", + "Æ", + "â", + "ª", + "ä", + "å", + "æ", + "ç", + "Ł", + "Ø", + "Œ", + "º", + "ì", + "í", + "î", + "ï", + "ð", + "æ", + "ò", + "ó", + "ô", + "ı", + "ö", + "÷", + "ł", + "ø", + "œ", + "ß", + "ü", + "ý", + "þ", + "ÿ", +] diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/symbol.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/symbol.py new file mode 100644 index 0000000000000000000000000000000000000000..4c0d680ff242a475d3f48916ad6b7998b30ff76a --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/symbol.py @@ -0,0 +1,260 @@ +# manually generated from https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt +_symbol_encoding = [ + "\u0000", + "\u0001", + "\u0002", + "\u0003", + "\u0004", + "\u0005", + "\u0006", + "\u0007", + "\u0008", + "\u0009", + "\u000A", + "\u000B", + "\u000C", + "\u000D", + "\u000E", + "\u000F", + "\u0010", + "\u0011", + "\u0012", + "\u0013", + "\u0014", + "\u0015", + "\u0016", + "\u0017", + "\u0018", + "\u0019", + "\u001A", + "\u001B", + "\u001C", + "\u001D", + "\u001E", + "\u001F", + "\u0020", + "\u0021", + "\u2200", + "\u0023", + "\u2203", + "\u0025", + "\u0026", + "\u220B", + "\u0028", + "\u0029", + "\u2217", + "\u002B", + "\u002C", + "\u2212", + "\u002E", + "\u002F", + "\u0030", + "\u0031", + "\u0032", + "\u0033", + "\u0034", + "\u0035", + "\u0036", + "\u0037", + "\u0038", + "\u0039", + "\u003A", + "\u003B", + "\u003C", + "\u003D", + "\u003E", + "\u003F", + "\u2245", + "\u0391", + "\u0392", + "\u03A7", + "\u0394", + "\u0395", + "\u03A6", + "\u0393", + "\u0397", + "\u0399", + "\u03D1", + "\u039A", + "\u039B", + "\u039C", + "\u039D", + "\u039F", + "\u03A0", + "\u0398", + "\u03A1", + "\u03A3", + "\u03A4", + "\u03A5", + "\u03C2", + "\u03A9", + "\u039E", + "\u03A8", + "\u0396", + "\u005B", + "\u2234", + "\u005D", + "\u22A5", + "\u005F", + "\uF8E5", + "\u03B1", + "\u03B2", + "\u03C7", + "\u03B4", + "\u03B5", + "\u03C6", + "\u03B3", + "\u03B7", + "\u03B9", + "\u03D5", + "\u03BA", + "\u03BB", + "\u00B5", + "\u03BD", + "\u03BF", + "\u03C0", + "\u03B8", + "\u03C1", + "\u03C3", + "\u03C4", + "\u03C5", + "\u03D6", + "\u03C9", + "\u03BE", + "\u03C8", + "\u03B6", + "\u007B", + "\u007C", + "\u007D", + "\u223C", + "\u007F", + "\u0080", + "\u0081", + "\u0082", + "\u0083", + "\u0084", + "\u0085", + "\u0086", + "\u0087", + "\u0088", + "\u0089", + "\u008A", + "\u008B", + "\u008C", + "\u008D", + "\u008E", + "\u008F", + "\u0090", + "\u0091", + "\u0092", + "\u0093", + "\u0094", + "\u0095", + "\u0096", + "\u0097", + "\u0098", + "\u0099", + "\u009A", + "\u009B", + "\u009C", + "\u009D", + "\u009E", + "\u009F", + "\u20AC", + "\u03D2", + "\u2032", + "\u2264", + "\u2044", + "\u221E", + "\u0192", + "\u2663", + "\u2666", + "\u2665", + "\u2660", + "\u2194", + "\u2190", + "\u2191", + "\u2192", + "\u2193", + "\u00B0", + "\u00B1", + "\u2033", + "\u2265", + "\u00D7", + "\u221D", + "\u2202", + "\u2022", + "\u00F7", + "\u2260", + "\u2261", + "\u2248", + "\u2026", + "\uF8E6", + "\uF8E7", + "\u21B5", + "\u2135", + "\u2111", + "\u211C", + "\u2118", + "\u2297", + "\u2295", + "\u2205", + "\u2229", + "\u222A", + "\u2283", + "\u2287", + "\u2284", + "\u2282", + "\u2286", + "\u2208", + "\u2209", + "\u2220", + "\u2207", + "\uF6DA", + "\uF6D9", + "\uF6DB", + "\u220F", + "\u221A", + "\u22C5", + "\u00AC", + "\u2227", + "\u2228", + "\u21D4", + "\u21D0", + "\u21D1", + "\u21D2", + "\u21D3", + "\u25CA", + "\u2329", + "\uF8E8", + "\uF8E9", + "\uF8EA", + "\u2211", + "\uF8EB", + "\uF8EC", + "\uF8ED", + "\uF8EE", + "\uF8EF", + "\uF8F0", + "\uF8F1", + "\uF8F2", + "\uF8F3", + "\uF8F4", + "\u00F0", + "\u232A", + "\u222B", + "\u2320", + "\uF8F5", + "\u2321", + "\uF8F6", + "\uF8F7", + "\uF8F8", + "\uF8F9", + "\uF8FA", + "\uF8FB", + "\uF8FC", + "\uF8FD", + "\uF8FE", + "\u00FF", +] +assert len(_symbol_encoding) == 256 diff --git a/python/user_packages/Python313/site-packages/pypdf/_codecs/zapfding.py b/python/user_packages/Python313/site-packages/pypdf/_codecs/zapfding.py new file mode 100644 index 0000000000000000000000000000000000000000..9b6cdbcc0bca199f3eb8cca9e2cc7fe6001a34fb --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_codecs/zapfding.py @@ -0,0 +1,261 @@ +# manually generated from https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/zdingbat.txt + +_zapfding_encoding = [ + "\u0000", + "\u0001", + "\u0002", + "\u0003", + "\u0004", + "\u0005", + "\u0006", + "\u0007", + "\u0008", + "\u0009", + "\u000A", + "\u000B", + "\u000C", + "\u000D", + "\u000E", + "\u000F", + "\u0010", + "\u0011", + "\u0012", + "\u0013", + "\u0014", + "\u0015", + "\u0016", + "\u0017", + "\u0018", + "\u0019", + "\u001A", + "\u001B", + "\u001C", + "\u001D", + "\u001E", + "\u001F", + "\u0020", + "\u2701", + "\u2702", + "\u2703", + "\u2704", + "\u260E", + "\u2706", + "\u2707", + "\u2708", + "\u2709", + "\u261B", + "\u261E", + "\u270C", + "\u270D", + "\u270E", + "\u270F", + "\u2710", + "\u2711", + "\u2712", + "\u2713", + "\u2714", + "\u2715", + "\u2716", + "\u2717", + "\u2718", + "\u2719", + "\u271A", + "\u271B", + "\u271C", + "\u271D", + "\u271E", + "\u271F", + "\u2720", + "\u2721", + "\u2722", + "\u2723", + "\u2724", + "\u2725", + "\u2726", + "\u2727", + "\u2605", + "\u2729", + "\u272A", + "\u272B", + "\u272C", + "\u272D", + "\u272E", + "\u272F", + "\u2730", + "\u2731", + "\u2732", + "\u2733", + "\u2734", + "\u2735", + "\u2736", + "\u2737", + "\u2738", + "\u2739", + "\u273A", + "\u273B", + "\u273C", + "\u273D", + "\u273E", + "\u273F", + "\u2740", + "\u2741", + "\u2742", + "\u2743", + "\u2744", + "\u2745", + "\u2746", + "\u2747", + "\u2748", + "\u2749", + "\u274A", + "\u274B", + "\u25CF", + "\u274D", + "\u25A0", + "\u274F", + "\u2750", + "\u2751", + "\u2752", + "\u25B2", + "\u25BC", + "\u25C6", + "\u2756", + "\u25D7", + "\u2758", + "\u2759", + "\u275A", + "\u275B", + "\u275C", + "\u275D", + "\u275E", + "\u007F", + "\uF8D7", + "\uF8D8", + "\uF8D9", + "\uF8DA", + "\uF8DB", + "\uF8DC", + "\uF8DD", + "\uF8DE", + "\uF8DF", + "\uF8E0", + "\uF8E1", + "\uF8E2", + "\uF8E3", + "\uF8E4", + "\u008E", + "\u008F", + "\u0090", + "\u0091", + "\u0092", + "\u0093", + "\u0094", + "\u0095", + "\u0096", + "\u0097", + "\u0098", + "\u0099", + "\u009A", + "\u009B", + "\u009C", + "\u009D", + "\u009E", + "\u009F", + "\u00A0", + "\u2761", + "\u2762", + "\u2763", + "\u2764", + "\u2765", + "\u2766", + "\u2767", + "\u2663", + "\u2666", + "\u2665", + "\u2660", + "\u2460", + "\u2461", + "\u2462", + "\u2463", + "\u2464", + "\u2465", + "\u2466", + "\u2467", + "\u2468", + "\u2469", + "\u2776", + "\u2777", + "\u2778", + "\u2779", + "\u277A", + "\u277B", + "\u277C", + "\u277D", + "\u277E", + "\u277F", + "\u2780", + "\u2781", + "\u2782", + "\u2783", + "\u2784", + "\u2785", + "\u2786", + "\u2787", + "\u2788", + "\u2789", + "\u278A", + "\u278B", + "\u278C", + "\u278D", + "\u278E", + "\u278F", + "\u2790", + "\u2791", + "\u2792", + "\u2793", + "\u2794", + "\u2192", + "\u2194", + "\u2195", + "\u2798", + "\u2799", + "\u279A", + "\u279B", + "\u279C", + "\u279D", + "\u279E", + "\u279F", + "\u27A0", + "\u27A1", + "\u27A2", + "\u27A3", + "\u27A4", + "\u27A5", + "\u27A6", + "\u27A7", + "\u27A8", + "\u27A9", + "\u27AA", + "\u27AB", + "\u27AC", + "\u27AD", + "\u27AE", + "\u27AF", + "\u00F0", + "\u27B1", + "\u27B2", + "\u27B3", + "\u27B4", + "\u27B5", + "\u27B6", + "\u27B7", + "\u27B8", + "\u27B9", + "\u27BA", + "\u27BB", + "\u27BC", + "\u27BD", + "\u27BE", + "\u00FF", +] +assert len(_zapfding_encoding) == 256 diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__init__.py b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0cc63af94fd44e67cac24890b73c3a12a0c497bd --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__init__.py @@ -0,0 +1,80 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from pypdf._crypt_providers._base import CryptBase, CryptIdentity + +try: + from pypdf._crypt_providers._cryptography import ( + CryptAES, + CryptRC4, + aes_cbc_decrypt, + aes_cbc_encrypt, + aes_ecb_decrypt, + aes_ecb_encrypt, + crypt_provider, + rc4_decrypt, + rc4_encrypt, + ) +except ImportError: + try: + from pypdf._crypt_providers._pycryptodome import ( # type: ignore + CryptAES, + CryptRC4, + aes_cbc_decrypt, + aes_cbc_encrypt, + aes_ecb_decrypt, + aes_ecb_encrypt, + crypt_provider, + rc4_decrypt, + rc4_encrypt, + ) + except ImportError: + from pypdf._crypt_providers._fallback import ( # type: ignore + CryptAES, + CryptRC4, + aes_cbc_decrypt, + aes_cbc_encrypt, + aes_ecb_decrypt, + aes_ecb_encrypt, + crypt_provider, + rc4_decrypt, + rc4_encrypt, + ) + +__all__ = [ + "CryptAES", + "CryptBase", + "CryptIdentity", + "CryptRC4", + "aes_cbc_decrypt", + "aes_cbc_encrypt", + "aes_ecb_decrypt", + "aes_ecb_encrypt", + "crypt_provider", + "rc4_decrypt", + "rc4_encrypt", +] diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8770d5f8615def9c1c201410baeeb6a10118b105 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_base.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..225fd644d34e2e118a6469d0552add0d37dcfa80 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_cryptography.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_cryptography.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..544f6c7750921e7e03e600a557d179473f698e68 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_cryptography.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_fallback.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_fallback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e141dd7d9cc1c4973586ceea49bd2300158a94c Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_fallback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_pycryptodome.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_pycryptodome.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a5dffb9b28b83207aa0941a62816cdea0b0cbfe Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/__pycache__/_pycryptodome.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_base.py b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..d66dd4c2667723da4be677945388da7d1f07901f --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_base.py @@ -0,0 +1,38 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +class CryptBase: + def encrypt(self, data: bytes) -> bytes: # pragma: no cover + return data + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: # pragma: no cover + return data + + +class CryptIdentity(CryptBase): + pass diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_cryptography.py b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_cryptography.py new file mode 100644 index 0000000000000000000000000000000000000000..f929337b34de7bb350f499d8bd3ceb5834a549f1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_cryptography.py @@ -0,0 +1,133 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import secrets + +from cryptography import __version__ +from cryptography.hazmat.primitives.ciphers.algorithms import AES +from cryptography.hazmat.primitives.padding import PKCS7 + +from pypdf._utils import logger_warning +from pypdf.errors import PdfStreamError + +try: + # 43.0.0 - https://cryptography.io/en/latest/changelog/#v43-0-0 + from cryptography.hazmat.decrepit.ciphers.algorithms import ARC4 +except ImportError: + from cryptography.hazmat.primitives.ciphers.algorithms import ARC4 +from cryptography.hazmat.primitives.ciphers.base import Cipher +from cryptography.hazmat.primitives.ciphers.modes import CBC, ECB + +from pypdf._crypt_providers._base import CryptBase + +crypt_provider = ("cryptography", __version__) + + +class CryptRC4(CryptBase): + def __init__(self, key: bytes) -> None: + self.cipher = Cipher(ARC4(key), mode=None) + + def encrypt(self, data: bytes) -> bytes: + encryptor = self.cipher.encryptor() + return encryptor.update(data) + encryptor.finalize() + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + decryptor = self.cipher.decryptor() + return decryptor.update(data) + decryptor.finalize() + + +class CryptAES(CryptBase): + def __init__(self, key: bytes) -> None: + self.alg = AES(key) + + def encrypt(self, data: bytes) -> bytes: + iv = secrets.token_bytes(16) + padder = PKCS7(128).padder() + padded_data = padder.update(data) + padder.finalize() + + cipher = Cipher(self.alg, CBC(iv)) + encryptor = cipher.encryptor() + return iv + encryptor.update(padded_data) + encryptor.finalize() + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + iv = data[:16] + data = data[16:] + # for empty encrypted data + if not data: + return data + + if not strict and len(data) % 16 != 0: + logger_warning("Adding missing padding.", src=__name__) + padder = PKCS7(128).padder() + data = padder.update(data) + padder.finalize() + + cipher = Cipher(self.alg, CBC(iv)) + decryptor = cipher.decryptor() + try: + padded_data = decryptor.update(data) + decryptor.finalize() + except ValueError as exception: + # Only raised in strict mode. Non-strict mode fixes padding. + raise PdfStreamError(exception) + + unpadder = PKCS7(128).unpadder() + try: + return unpadder.update(padded_data) + unpadder.finalize() + except ValueError as exception: + if strict: + raise PdfStreamError(exception) + logger_warning(f"Ignoring padding error: {exception}", src=__name__) + return padded_data[: -padded_data[-1]] + + +def rc4_encrypt(key: bytes, data: bytes) -> bytes: + encryptor = Cipher(ARC4(key), mode=None).encryptor() + return encryptor.update(data) + encryptor.finalize() + + +def rc4_decrypt(key: bytes, data: bytes) -> bytes: + decryptor = Cipher(ARC4(key), mode=None).decryptor() + return decryptor.update(data) + decryptor.finalize() + + +def aes_ecb_encrypt(key: bytes, data: bytes) -> bytes: + encryptor = Cipher(AES(key), mode=ECB()).encryptor() + return encryptor.update(data) + encryptor.finalize() + + +def aes_ecb_decrypt(key: bytes, data: bytes) -> bytes: + decryptor = Cipher(AES(key), mode=ECB()).decryptor() + return decryptor.update(data) + decryptor.finalize() + + +def aes_cbc_encrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + encryptor = Cipher(AES(key), mode=CBC(iv)).encryptor() + return encryptor.update(data) + encryptor.finalize() + + +def aes_cbc_decrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + decryptor = Cipher(AES(key), mode=CBC(iv)).decryptor() + return decryptor.update(data) + decryptor.finalize() diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_fallback.py b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_fallback.py new file mode 100644 index 0000000000000000000000000000000000000000..2b7d3275fd6c0fce04de8df7a316087350a02373 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_fallback.py @@ -0,0 +1,93 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from pypdf._crypt_providers._base import CryptBase +from pypdf.errors import DependencyError + +_DEPENDENCY_ERROR_STR = "cryptography>=3.1 is required for AES algorithm" + + +crypt_provider = ("local_crypt_fallback", "0.0.0") + + +class CryptRC4(CryptBase): + def __init__(self, key: bytes) -> None: + self.s = bytearray(range(256)) + j = 0 + for i in range(256): + j = (j + self.s[i] + key[i % len(key)]) % 256 + self.s[i], self.s[j] = self.s[j], self.s[i] + + def encrypt(self, data: bytes) -> bytes: + s = bytearray(self.s) + out = [0 for _ in range(len(data))] + i, j = 0, 0 + for k in range(len(data)): + i = (i + 1) % 256 + j = (j + s[i]) % 256 + s[i], s[j] = s[j], s[i] + x = s[(s[i] + s[j]) % 256] + out[k] = data[k] ^ x + return bytes(out) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + return self.encrypt(data) + + +class CryptAES(CryptBase): + def __init__(self, key: bytes) -> None: + pass + + def encrypt(self, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def rc4_encrypt(key: bytes, data: bytes) -> bytes: + return CryptRC4(key).encrypt(data) + + +def rc4_decrypt(key: bytes, data: bytes) -> bytes: + return CryptRC4(key).decrypt(data) + + +def aes_ecb_encrypt(key: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def aes_ecb_decrypt(key: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def aes_cbc_encrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) + + +def aes_cbc_decrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + raise DependencyError(_DEPENDENCY_ERROR_STR) diff --git a/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_pycryptodome.py b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_pycryptodome.py new file mode 100644 index 0000000000000000000000000000000000000000..cdef70cb578570f3cf5e1fa3122a0995f960256a --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_crypt_providers/_pycryptodome.py @@ -0,0 +1,110 @@ +# Copyright (c) 2023, exiledkingcc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import secrets + +from Crypto import __version__ +from Crypto.Cipher import AES, ARC4 +from Crypto.Util.Padding import pad, unpad + +from pypdf._crypt_providers._base import CryptBase +from pypdf._utils import logger_warning +from pypdf.errors import PdfStreamError + +crypt_provider = ("pycryptodome", __version__) + + +class CryptRC4(CryptBase): + def __init__(self, key: bytes) -> None: + self.key = key + + def encrypt(self, data: bytes) -> bytes: + return ARC4.ARC4Cipher(self.key).encrypt(data) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + return ARC4.ARC4Cipher(self.key).decrypt(data) + + +class CryptAES(CryptBase): + def __init__(self, key: bytes) -> None: + self.key = key + + def encrypt(self, data: bytes) -> bytes: + iv = secrets.token_bytes(16) + padded_data = pad(data, 16) + aes = AES.new(self.key, AES.MODE_CBC, iv) + return iv + aes.encrypt(padded_data) + + def decrypt(self, data: bytes, *, strict: bool = True) -> bytes: + iv = data[:16] + data = data[16:] + # for empty encrypted data + if not data: + return data + + if not strict and len(data) % 16 != 0: + logger_warning("Adding missing padding.", src=__name__) + data = pad(data, 16) + + aes = AES.new(self.key, AES.MODE_CBC, iv) + try: + padded_data = aes.decrypt(data) + except ValueError as exception: + # Only raised in strict mode. Non-strict mode fixes padding. + raise PdfStreamError(exception) + + try: + return unpad(padded_data, 16) + except ValueError as exception: + if strict: + raise PdfStreamError(exception) + logger_warning(f"Ignoring padding error: {exception}", src=__name__) + return padded_data[: -padded_data[-1]] + + +def rc4_encrypt(key: bytes, data: bytes) -> bytes: + return ARC4.ARC4Cipher(key).encrypt(data) + + +def rc4_decrypt(key: bytes, data: bytes) -> bytes: + return ARC4.ARC4Cipher(key).decrypt(data) + + +def aes_ecb_encrypt(key: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_ECB).encrypt(data) + + +def aes_ecb_decrypt(key: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_ECB).decrypt(data) + + +def aes_cbc_encrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_CBC, iv).encrypt(data) + + +def aes_cbc_decrypt(key: bytes, iv: bytes, data: bytes) -> bytes: + return AES.new(key, AES.MODE_CBC, iv).decrypt(data) diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__init__.py b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fd51c243acb8b621f2c0f2f8f4c2657278d13ade --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__init__.py @@ -0,0 +1,245 @@ +""" +Code related to text extraction. + +Some parts are still in _page.py. In doubt, they will stay there. +""" + +import math +from typing import Any, Callable, Optional, Union + +from .._font import Font +from ..generic import DictionaryObject, TextStringObject, encode_pdfdocencoding + +CUSTOM_RTL_MIN: int = -1 +CUSTOM_RTL_MAX: int = -1 +CUSTOM_RTL_SPECIAL_CHARS: list[int] = [] +LAYOUT_NEW_BT_GROUP_SPACE_WIDTHS: int = 5 + + +class OrientationNotFoundError(Exception): + pass + + +def set_custom_rtl( + _min: Union[str, int, None] = None, + _max: Union[str, int, None] = None, + specials: Union[str, list[int], None] = None, +) -> tuple[int, int, list[int]]: + """ + Change the Right-To-Left and special characters custom parameters. + + Args: + _min: The new minimum value for the range of custom characters that + will be written right to left. + If set to ``None``, the value will not be changed. + If set to an integer or string, it will be converted to its ASCII code. + The default value is -1, which sets no additional range to be converted. + _max: The new maximum value for the range of custom characters that will + be written right to left. + If set to ``None``, the value will not be changed. + If set to an integer or string, it will be converted to its ASCII code. + The default value is -1, which sets no additional range to be converted. + specials: The new list of special characters to be inserted in the + current insertion order. + If set to ``None``, the current value will not be changed. + If set to a string, it will be converted to a list of ASCII codes. + The default value is an empty list. + + Returns: + A tuple containing the new values for ``CUSTOM_RTL_MIN``, + ``CUSTOM_RTL_MAX``, and ``CUSTOM_RTL_SPECIAL_CHARS``. + + """ + global CUSTOM_RTL_MIN, CUSTOM_RTL_MAX, CUSTOM_RTL_SPECIAL_CHARS + if isinstance(_min, int): + CUSTOM_RTL_MIN = _min + elif isinstance(_min, str): + CUSTOM_RTL_MIN = ord(_min) + if isinstance(_max, int): + CUSTOM_RTL_MAX = _max + elif isinstance(_max, str): + CUSTOM_RTL_MAX = ord(_max) + if isinstance(specials, str): + CUSTOM_RTL_SPECIAL_CHARS = [ord(x) for x in specials] + elif isinstance(specials, list): + CUSTOM_RTL_SPECIAL_CHARS = specials + return CUSTOM_RTL_MIN, CUSTOM_RTL_MAX, CUSTOM_RTL_SPECIAL_CHARS + + +def mult(m: list[float], n: list[float]) -> list[float]: + return [ + m[0] * n[0] + m[1] * n[2], + m[0] * n[1] + m[1] * n[3], + m[2] * n[0] + m[3] * n[2], + m[2] * n[1] + m[3] * n[3], + m[4] * n[0] + m[5] * n[2] + n[4], + m[4] * n[1] + m[5] * n[3] + n[5], + ] + + +def orient(m: list[float]) -> int: + if m[3] > 1e-6: + return 0 + if m[3] < -1e-6: + return 180 + if m[1] > 0: + return 90 + return 270 + + +def crlf_space_check( + text: str, + cmtm_prev: tuple[list[float], list[float]], + cmtm_matrix: tuple[list[float], list[float]], + memo_cmtm: tuple[list[float], list[float]], + font_resource: Optional[DictionaryObject], + orientations: tuple[int, ...], + output: str, + font_size: float, + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]], + str_widths: float, + spacewidth: float, + str_height: float, +) -> tuple[str, str, list[float], list[float]]: + cm_prev = cmtm_prev[0] + tm_prev = cmtm_prev[1] + cm_matrix = cmtm_matrix[0] + tm_matrix = cmtm_matrix[1] + memo_cm = memo_cmtm[0] + memo_tm = memo_cmtm[1] + + m_prev = mult(tm_prev, cm_prev) + m = mult(tm_matrix, cm_matrix) + orientation = orient(m) + delta_x = m[4] - m_prev[4] + delta_y = m[5] - m_prev[5] + # Table 108 of the 1.7 reference ("Text positioning operators") + scale_prev_x = math.sqrt(tm_prev[0]**2 + tm_prev[1]**2) + scale_prev_y = math.sqrt(tm_prev[2]**2 + tm_prev[3]**2) + scale_y = math.sqrt(tm_matrix[2]**2 + tm_matrix[3]**2) + cm_prev = m + + if orientation not in orientations: + raise OrientationNotFoundError + if orientation in (0, 180): + moved_height: float = delta_y + moved_width: float = delta_x + elif orientation in (90, 270): + moved_height = delta_x + moved_width = delta_y + try: + if abs(moved_height) > 0.8 * min(str_height * scale_prev_y, font_size * scale_y): + if (output + text)[-1] != "\n": + output += text + "\n" + if visitor_text is not None: + visitor_text( + text + "\n", + memo_cm, + memo_tm, + font_resource, + font_size, + ) + text = "" + elif ( + (moved_width >= (spacewidth + str_widths) * scale_prev_x) + and (output + text)[-1] != " " + ): + text += " " + except Exception: + pass + tm_prev = tm_matrix.copy() + cm_prev = cm_matrix.copy() + return text, output, cm_prev, tm_prev + + +def get_text_operands( + operands: list[Union[str, TextStringObject]], + cm_matrix: list[float], + tm_matrix: list[float], + font: Font, + orientations: tuple[int, ...] +) -> tuple[str, bool]: + t: str = "" + is_str_operands = False + m = mult(tm_matrix, cm_matrix) + orientation = orient(m) + if orientation in orientations and len(operands) > 0: + if isinstance(operands[0], str): + t = operands[0] + is_str_operands = True + else: + t = "" + tt: bytes = ( + encode_pdfdocencoding(operands[0]) + if isinstance(operands[0], str) + else operands[0] + ) + if isinstance(font.encoding, str): + try: + t = tt.decode(font.encoding, "surrogatepass") # apply str encoding + except Exception: + # the data does not match the expectation, + # we use the alternative ; + # text extraction may not be good + t = tt.decode( + "utf-16-be" if font.encoding == "charmap" else "charmap", + "surrogatepass", + ) # apply str encoding + else: # apply dict encoding + t = "".join( + [font.encoding[x] if x in font.encoding else bytes((x,)).decode() for x in tt] + ) + return (t, is_str_operands) + + +def get_display_str( + text: str, + cm_matrix: list[float], + tm_matrix: list[float], + font_resource: Optional[DictionaryObject], + font: Font, + text_operands: str, + font_size: float, + rtl_dir: bool, + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]] +) -> tuple[str, bool, float]: + # "\u0590 - \u08FF \uFB50 - \uFDFF" + widths: float = 0.0 + for x in [font.character_map.get(x, x) for x in text_operands]: + # x can be a sequence of bytes ; ex: habibi.pdf + if len(x) == 1: + xx = ord(x) + else: + xx = 1 + # fmt: off + if ( + # cases where the current inserting order is kept + (xx <= 0x2F) # punctuations but... + or 0x3A <= xx <= 0x40 # numbers (x30-39) + or 0x2000 <= xx <= 0x206F # upper punctuations.. + or 0x20A0 <= xx <= 0x21FF # but (numbers) indices/exponents + or xx in CUSTOM_RTL_SPECIAL_CHARS # customized.... + ): + text = x + text if rtl_dir else text + x + elif ( # right-to-left characters set + 0x0590 <= xx <= 0x08FF + or 0xFB1D <= xx <= 0xFDFF + or 0xFE70 <= xx <= 0xFEFF + or CUSTOM_RTL_MIN <= xx <= CUSTOM_RTL_MAX + ): + if not rtl_dir: + rtl_dir = True + if visitor_text is not None: + visitor_text(text, cm_matrix, tm_matrix, font_resource, font_size) + text = "" + text = x + text + else: # left-to-right + if rtl_dir: + rtl_dir = False + if visitor_text is not None: + visitor_text(text, cm_matrix, tm_matrix, font_resource, font_size) + text = "" + text = text + x + widths += font.space_width if x == " " else font.text_width(x) + # fmt: on + return text, rtl_dir, widths diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..030e675beafabf0fcbf86e9bb6cfe6abd71ce0ad Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__pycache__/_text_extractor.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__pycache__/_text_extractor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a079f24672895865e2e43675af9eed89f458933 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/__pycache__/_text_extractor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__init__.py b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d3151600e9bc1029a6d85c2bc9e53e9e36fd07df --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__init__.py @@ -0,0 +1,16 @@ +"""Layout mode text extraction extension for pypdf""" +from ..._font import Font +from ._fixed_width_page import ( + fixed_char_width, + fixed_width_page, + text_show_operations, + y_coordinate_groups, +) + +__all__ = [ + "Font", + "fixed_char_width", + "fixed_width_page", + "text_show_operations", + "y_coordinate_groups", +] diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7494ac7d671899181a4026a5854321591bffb7d0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_fixed_width_page.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_fixed_width_page.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5468e6320d54b0b74938d4a2b6a27193fb3af413 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_fixed_width_page.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_text_state_manager.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_text_state_manager.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f834f014f1fb4b24b9c5c1ff74d16f702fbe681 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_text_state_manager.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_text_state_params.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_text_state_params.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..26b3a16e02469f04fd821a2ad5ae10e8ae8b5267 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/__pycache__/_text_state_params.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_fixed_width_page.py b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_fixed_width_page.py new file mode 100644 index 0000000000000000000000000000000000000000..48f654ebb4c680494bdab5c17582e632f1e3ab54 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_fixed_width_page.py @@ -0,0 +1,400 @@ +"""Extract PDF text preserving the layout of the source PDF""" + +from collections.abc import Iterator +from itertools import groupby +from math import ceil +from pathlib import Path +from typing import Any, Literal, Optional, TypedDict + +from ..._font import Font +from ..._utils import logger_warning +from .. import LAYOUT_NEW_BT_GROUP_SPACE_WIDTHS +from ._text_state_manager import TextStateManager +from ._text_state_params import TextStateParams + + +class BTGroup(TypedDict): + """ + Dict describing a line of text rendered within a BT/ET operator pair. + If multiple text show operations render text on the same line, the text + will be combined into a single BTGroup dict. + + Keys: + tx: x coordinate of first character in BTGroup + ty: y coordinate of first character in BTGroup + font_size: nominal font size + font_height: effective font height + text: rendered text + displaced_tx: x coordinate of last character in BTGroup + flip_sort: -1 if page is upside down, else 1 + """ + + tx: float + ty: float + font_size: float + font_height: float + text: str + displaced_tx: float + flip_sort: Literal[-1, 1] + + +def bt_group(tj_op: TextStateParams, rendered_text: str, dispaced_tx: float) -> BTGroup: + """ + BTGroup constructed from a TextStateParams instance, rendered text, and + displaced tx value. + + Args: + tj_op (TextStateParams): TextStateParams instance + rendered_text (str): rendered text + dispaced_tx (float): x coordinate of last character in BTGroup + + """ + return BTGroup( + tx=tj_op.tx, + ty=tj_op.ty, + font_size=tj_op.font_size, + font_height=tj_op.font_height, + text=rendered_text, + displaced_tx=dispaced_tx, + flip_sort=-1 if tj_op.flip_vertical else 1, + ) + + +def recurs_to_target_op( + ops: Iterator[tuple[list[Any], bytes]], + text_state_mgr: TextStateManager, + end_target: Literal[b"Q", b"ET"], + fonts: dict[str, Font], + strip_rotated: bool = True, +) -> tuple[list[BTGroup], list[TextStateParams]]: + """ + Recurse operators between BT/ET and/or q/Q operators managing the transform + stack and capturing text positioning and rendering data. + + Args: + ops: iterator of operators in content stream + text_state_mgr: a TextStateManager instance + end_target: Either b"Q" (ends b"q" op) or b"ET" (ends b"BT" op) + fonts: font dictionary as returned by PageObject._layout_mode_fonts() + + Returns: + tuple: list of BTGroup dicts + list of TextStateParams dataclass instances. + + """ + # 1 entry per line of text rendered within each BT/ET operation. + bt_groups: list[BTGroup] = [] + + # 1 entry per text show operator (Tj/TJ/'/") + tj_ops: list[TextStateParams] = [] + + if end_target == b"Q": + # add new q level. cm's added at this level will be popped at next b'Q' + text_state_mgr.add_q() + + for operands, op in ops: + # The loop is broken by the end target, or exits normally when there are no more ops. + if op == end_target: + if op == b"Q": + text_state_mgr.remove_q() + if op == b"ET": + if not tj_ops: + return bt_groups, tj_ops + _text = "" + bt_idx = 0 # idx of first tj in this bt group + last_displaced_tx = tj_ops[bt_idx].displaced_tx + last_ty = tj_ops[bt_idx].ty + for _idx, _tj in enumerate( + tj_ops + ): # ... build text from new Tj operators + if strip_rotated and _tj.rotated: + continue + if not _tj.font.interpretable: # generates warning + continue + # if the y position of the text is greater than the font height, assume + # the text is on a new line and start a new group + if abs(_tj.ty - last_ty) > _tj.font_height: + if _text.strip(): + bt_groups.append( + bt_group(tj_ops[bt_idx], _text, last_displaced_tx) + ) + bt_idx = _idx + _text = "" + + # if the x position of the text is less than the last x position by + # more than 5 spaces widths, assume the text order should be flipped + # and start a new group + if ( + last_displaced_tx - _tj.tx + > _tj.space_tx * LAYOUT_NEW_BT_GROUP_SPACE_WIDTHS + ): + if _text.strip(): + bt_groups.append( + bt_group(tj_ops[bt_idx], _text, last_displaced_tx) + ) + bt_idx = _idx + last_displaced_tx = _tj.displaced_tx + _text = "" + + # calculate excess x translation based on ending tx of previous Tj. + # multiply by bool (_idx != bt_idx) to ensure spaces aren't double + # applied to the first tj of a BTGroup in fixed_width_page(). + excess_tx = round(_tj.tx - last_displaced_tx, 3) * (_idx != bt_idx) + # space_tx could be 0 if either Tz or font_size was 0 for this _tj. + spaces = int(excess_tx // _tj.space_tx) if _tj.space_tx else 0 + new_text = f'{" " * spaces}{_tj.txt}' + + last_ty = _tj.ty + _text = f"{_text}{new_text}" + last_displaced_tx = _tj.displaced_tx + if _text: + bt_groups.append(bt_group(tj_ops[bt_idx], _text, last_displaced_tx)) + text_state_mgr.reset_tm() + break + if op == b"q": + bts, tjs = recurs_to_target_op( + ops, text_state_mgr, b"Q", fonts, strip_rotated + ) + bt_groups.extend(bts) + tj_ops.extend(tjs) + elif op == b"cm": + text_state_mgr.add_cm(*operands) + elif op == b"BT": + bts, tjs = recurs_to_target_op( + ops, text_state_mgr, b"ET", fonts, strip_rotated + ) + bt_groups.extend(bts) + tj_ops.extend(tjs) + elif op == b"Tj": + tj_ops.append(text_state_mgr.text_state_params(operands[0])) + elif op == b"TJ": + _tj = text_state_mgr.text_state_params() + for tj_op in operands[0]: + if isinstance(tj_op, bytes): + _tj = text_state_mgr.text_state_params(tj_op) + tj_ops.append(_tj) + else: + text_state_mgr.add_trm(_tj.displacement_matrix(td_offset=tj_op)) + elif op == b"'": + text_state_mgr.reset_trm() + text_state_mgr.add_tm([0, -text_state_mgr.TL]) + tj_ops.append(text_state_mgr.text_state_params(operands[0])) + elif op == b'"': + text_state_mgr.reset_trm() + text_state_mgr.set_state_param(b"Tw", operands[0]) + text_state_mgr.set_state_param(b"Tc", operands[1]) + text_state_mgr.add_tm([0, -text_state_mgr.TL]) + tj_ops.append(text_state_mgr.text_state_params(operands[2])) + elif op in (b"Td", b"Tm", b"TD", b"T*"): + text_state_mgr.reset_trm() + if op == b"Tm": + text_state_mgr.reset_tm() + elif op == b"TD": + text_state_mgr.set_state_param(b"TL", -operands[1]) + elif op == b"T*": + operands = [0, -text_state_mgr.TL] + text_state_mgr.add_tm(operands) + elif op == b"Tf": + text_state_mgr.set_font(fonts[operands[0]], operands[1]) + else: # handle Tc, Tw, Tz, TL, and Ts operators + text_state_mgr.set_state_param(op, operands) + else: + logger_warning( + f"Unbalanced target operations, expected {end_target!r}.", + __name__, + ) + return bt_groups, tj_ops + + +def y_coordinate_groups( + bt_groups: list[BTGroup], debug_path: Optional[Path] = None +) -> dict[int, list[BTGroup]]: + """ + Group text operations by rendered y coordinate, i.e. the line number. + + Args: + bt_groups: list of dicts as returned by text_show_operations() + debug_path (Path, optional): Path to a directory for saving debug output. + + Returns: + Dict[int, List[BTGroup]]: dict of lists of text rendered by each BT operator + keyed by y coordinate + + """ + ty_groups = { + ty: sorted(grp, key=lambda x: x["tx"]) + for ty, grp in groupby( + bt_groups, key=lambda bt_grp: int(bt_grp["ty"] * bt_grp["flip_sort"]) + ) + } + # combine groups whose y coordinates differ by less than the effective font height + # (accounts for mixed fonts and other minor oddities) + last_ty = next(iter(ty_groups)) + last_txs = {int(_t["tx"]) for _t in ty_groups[last_ty] if _t["text"].strip()} + for ty in list(ty_groups)[1:]: + fsz = min(ty_groups[_y][0]["font_height"] for _y in (ty, last_ty)) + txs = {int(_t["tx"]) for _t in ty_groups[ty] if _t["text"].strip()} + # prevent merge if both groups are rendering in the same x position. + no_text_overlap = not (txs & last_txs) + offset_less_than_font_height = abs(ty - last_ty) < fsz + if no_text_overlap and offset_less_than_font_height: + ty_groups[last_ty] = sorted( + ty_groups.pop(ty) + ty_groups[last_ty], key=lambda x: x["tx"] + ) + last_txs |= txs + else: + last_ty = ty + last_txs = txs + if debug_path: # pragma: no cover + import json # noqa: PLC0415 + + debug_path.joinpath("bt_groups.json").write_text( + json.dumps(ty_groups, indent=2, default=str), "utf-8" + ) + return ty_groups + + +def text_show_operations( + ops: Iterator[tuple[list[Any], bytes]], + fonts: dict[str, Font], + strip_rotated: bool = True, + debug_path: Optional[Path] = None, +) -> list[BTGroup]: + """ + Extract text from BT/ET operator pairs. + + Args: + ops (Iterator[Tuple[List, bytes]]): iterator of operators in content stream + fonts (Dict[str, Font]): font dictionary + strip_rotated: Removes text if rotated w.r.t. to the page. Defaults to True. + debug_path (Path, optional): Path to a directory for saving debug output. + + Returns: + List[BTGroup]: list of dicts of text rendered by each BT operator + + """ + state_mgr = TextStateManager() # transformation stack manager + bt_groups: list[BTGroup] = [] # BT operator dict + tj_ops: list[TextStateParams] = [] # Tj/TJ operator data + for operands, op in ops: + if op in (b"BT", b"q"): + bts, tjs = recurs_to_target_op( + ops, state_mgr, b"ET" if op == b"BT" else b"Q", fonts, strip_rotated + ) + bt_groups.extend(bts) + tj_ops.extend(tjs) + elif op == b"Tf": + state_mgr.set_font(fonts[operands[0]], operands[1]) + else: # set Tc, Tw, Tz, TL, and Ts if required. ignores all other ops + state_mgr.set_state_param(op, operands) + + if any(tj.rotated for tj in tj_ops): + if strip_rotated: + logger_warning( + "Rotated text discovered. Output will be incomplete.", __name__ + ) + else: + logger_warning( + "Rotated text discovered. Layout will be degraded.", __name__ + ) + if not all(tj.font.interpretable for tj in tj_ops): + logger_warning( + "PDF contains an uninterpretable font. Output will be incomplete.", __name__ + ) + + # left align the data, i.e. decrement all tx values by min(tx) + min_x = min((x["tx"] for x in bt_groups), default=0.0) + bt_groups = [ + dict(ogrp, tx=ogrp["tx"] - min_x, displaced_tx=ogrp["displaced_tx"] - min_x) # type: ignore[misc] + for ogrp in sorted( + bt_groups, key=lambda x: (x["ty"] * x["flip_sort"], -x["tx"]), reverse=True + ) + ] + + if debug_path: # pragma: no cover + import json # noqa: PLC0415 + + debug_path.joinpath("bts.json").write_text( + json.dumps(bt_groups, indent=2, default=str), "utf-8" + ) + debug_path.joinpath("tjs.json").write_text( + json.dumps( + tj_ops, indent=2, default=lambda x: getattr(x, "to_dict", str)(x) + ), + "utf-8", + ) + return bt_groups + + +def fixed_char_width(bt_groups: list[BTGroup], scale_weight: float = 1.25) -> float: + """ + Calculate average character width weighted by the length of the rendered + text in each sample for conversion to fixed-width layout. + + Args: + bt_groups (List[BTGroup]): List of dicts of text rendered by each + BT operator + + Returns: + float: fixed character width + + """ + char_widths = [] + for _bt in bt_groups: + _len = len(_bt["text"]) * scale_weight + char_widths.append(((_bt["displaced_tx"] - _bt["tx"]) / _len, _len)) + return sum(_w * _l for _w, _l in char_widths) / sum(_l for _, _l in char_widths) + + +def fixed_width_page( + ty_groups: dict[int, list[BTGroup]], char_width: float, space_vertically: bool, font_height_weight: float +) -> str: + """ + Generate page text from text operations grouped by rendered y coordinate. + + Args: + ty_groups: dict of text show ops as returned by y_coordinate_groups() + char_width: fixed character width + space_vertically: include blank lines inferred from y distance + font height. + font_height_weight: multiplier for font height when calculating blank lines. + + Returns: + str: page text in a fixed width format that closely adheres to the rendered + layout in the source pdf. + + """ + lines: list[str] = [] + last_y_coord = 0 + table = str.maketrans(dict.fromkeys(range(14, 32), " ")) + for y_coord, line_data in ty_groups.items(): + if space_vertically and lines: + fh = line_data[0]["font_height"] + blank_lines = 0 if fh == 0 else ( + int(abs(y_coord - last_y_coord) / (fh * font_height_weight)) - 1 + ) + lines.extend([""] * blank_lines) + + line_parts = [] # It uses a list to construct the line, avoiding string concatenation. + current_len = 0 # Track the size with int instead of len(str) overhead. + last_disp = 0.0 + for bt_op in line_data: + tx = bt_op["tx"] + offset = int(tx // char_width) + needed_spaces = offset - current_len + if needed_spaces > 0 and ceil(last_disp) < int(tx): + padding = " " * needed_spaces + line_parts.append(padding) + current_len += needed_spaces + + raw_text = bt_op["text"] + text = raw_text.translate(table) + line_parts.append(text) + current_len += len(text) + last_disp = bt_op["displaced_tx"] + + full_line = "".join(line_parts).rstrip() + if full_line.strip() or (space_vertically and lines): + lines.append(full_line) + + last_y_coord = y_coord + + return "\n".join(lines) diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_text_state_manager.py b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_text_state_manager.py new file mode 100644 index 0000000000000000000000000000000000000000..03f1c139b74f4cfeb778b94454d8a6a7e501ddb3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_text_state_manager.py @@ -0,0 +1,221 @@ +"""manage the PDF transform stack during "layout" mode text extraction""" + +from collections import ChainMap, Counter +from collections import ChainMap as ChainMapType +from collections import Counter as CounterType +from collections.abc import MutableMapping +from typing import Any, Union + +from ..._font import Font +from ...errors import PdfReadError +from .. import mult +from ._text_state_params import TextStateParams + +TextStateManagerChainMapType = ChainMapType[Union[int, str], Union[float, bool]] +TextStateManagerDictType = MutableMapping[Union[int, str], Union[float, bool]] + + +class TextStateManager: + """ + Tracks the current text state including cm/tm/trm transformation matrices. + + Attributes: + transform_stack (ChainMap): ChainMap of cm/tm transformation matrices + q_queue (Counter[int]): Counter of q operators + q_depth (List[int]): list of q operator nesting levels + Tc (float): character spacing + Tw (float): word spacing + Tz (int): horizontal scaling + TL (float): leading + Ts (float): text rise + font (Font): font object + font_size (int | float): font size + + """ + + def __init__(self) -> None: + self.transform_stack: TextStateManagerChainMapType = ChainMap( + self.new_transform() + ) + self.q_queue: CounterType[int] = Counter() + self.q_depth = [0] + self.Tc: float = 0.0 + self.Tw: float = 0.0 + self.Tz: float = 100.0 + self.TL: float = 0.0 + self.Ts: float = 0.0 + self.font_stack: list[tuple[Union[Font, None], Union[int, float]]] = [] + self.font: Union[Font, None] = None + self.font_size: Union[int, float] = 0 + + def set_state_param(self, op: bytes, value: Union[float, list[Any]]) -> None: + """ + Set a text state parameter. Supports Tc, Tz, Tw, TL, and Ts operators. + + Args: + op: operator read from PDF stream as bytes. No action is taken + for unsupported operators (see supported operators above). + value (float | List[Any]): new parameter value. If a list, + value[0] is used. + + """ + if op not in [b"Tc", b"Tz", b"Tw", b"TL", b"Ts"]: + return + self.__setattr__(op.decode(), value[0] if isinstance(value, list) else value) + + def set_font(self, font: Font, size: float) -> None: + """ + Set the current font and font_size. + + Args: + font (Font): a layout mode Font + size (float): font size + + """ + self.font = font + self.font_size = size + + def text_state_params(self, value: Union[bytes, str] = "") -> TextStateParams: + """ + Create a TextStateParams instance to display a text string. Type[bytes] values + will be decoded implicitly. + + Args: + value (str | bytes): text to associate with the captured state. + + Raises: + PdfReadError: if font not set (no Tf operator in incoming pdf content stream) + + Returns: + TextStateParams: current text state parameters + + """ + if not isinstance(self.font, Font): + raise PdfReadError( + "font not set: is PDF missing a Tf operator?" + ) # pragma: no cover + if isinstance(value, bytes): + try: + if isinstance(self.font.encoding, str): + txt = value.decode(self.font.encoding, "surrogatepass") + else: + txt = "".join( + self.font.encoding[x] + if x in self.font.encoding + else bytes((x,)).decode() + for x in value + ) + except (UnicodeEncodeError, UnicodeDecodeError): + txt = value.decode("utf-8", "replace") + txt = "".join( + self.font.character_map.get(x, x) for x in txt + ) + else: + txt = value + return TextStateParams( + txt, + self.font, + self.font_size, + self.Tc, + self.Tw, + self.Tz, + self.TL, + self.Ts, + self.effective_transform, + ) + + @staticmethod + def raw_transform( + _a: float = 1.0, + _b: float = 0.0, + _c: float = 0.0, + _d: float = 1.0, + _e: float = 0.0, + _f: float = 0.0, + ) -> TextStateManagerDictType: + """Only a/b/c/d/e/f matrix params""" + return dict(zip(range(6), map(float, (_a, _b, _c, _d, _e, _f)))) + + @staticmethod + def new_transform( + _a: float = 1.0, + _b: float = 0.0, + _c: float = 0.0, + _d: float = 1.0, + _e: float = 0.0, + _f: float = 0.0, + is_text: bool = False, + is_render: bool = False, + ) -> TextStateManagerDictType: + """Standard a/b/c/d/e/f matrix params + 'is_text' and 'is_render' keys""" + result = TextStateManager.raw_transform(_a, _b, _c, _d, _e, _f) + result.update({"is_text": is_text, "is_render": is_render}) + return result + + def reset_tm(self) -> TextStateManagerChainMapType: + """Clear all transforms from chainmap having is_text==True or is_render==True""" + while ( + self.transform_stack.maps[0]["is_text"] + or self.transform_stack.maps[0]["is_render"] + ): + self.transform_stack = self.transform_stack.parents + return self.transform_stack + + def reset_trm(self) -> TextStateManagerChainMapType: + """Clear all transforms from chainmap having is_render==True""" + while self.transform_stack.maps[0]["is_render"]: + self.transform_stack = self.transform_stack.parents + return self.transform_stack + + def remove_q(self) -> TextStateManagerChainMapType: + """Rewind to stack prior state after closing a 'q' with internal 'cm' ops""" + self.font, self.font_size = self.font_stack.pop(-1) + self.transform_stack = self.reset_tm() + self.transform_stack.maps = self.transform_stack.maps[ + self.q_queue.pop(self.q_depth.pop(), 0) : + ] + return self.transform_stack + + def add_q(self) -> None: + """Add another level to q_queue""" + self.font_stack.append((self.font, self.font_size)) + self.q_depth.append(len(self.q_depth)) + + def add_cm(self, *args: Any) -> TextStateManagerChainMapType: + """Concatenate an additional transform matrix""" + self.transform_stack = self.reset_tm() + self.q_queue.update(self.q_depth[-1:]) + self.transform_stack = self.transform_stack.new_child(self.new_transform(*args)) + return self.transform_stack + + def _complete_matrix(self, operands: list[float]) -> list[float]: + """Adds a, b, c, and d to an "e/f only" operand set (e.g Td)""" + if len(operands) == 2: # this is a Td operator or equivalent + operands = [1.0, 0.0, 0.0, 1.0, *operands] + return operands + + def add_tm(self, operands: list[float]) -> TextStateManagerChainMapType: + """Append a text transform matrix""" + self.transform_stack = self.transform_stack.new_child( + self.new_transform( # type: ignore[misc] + *self._complete_matrix(operands), is_text=True # type: ignore[arg-type] + ) + ) + return self.transform_stack + + def add_trm(self, operands: list[float]) -> TextStateManagerChainMapType: + """Append a text rendering transform matrix""" + self.transform_stack = self.transform_stack.new_child( + self.new_transform( # type: ignore[misc] + *self._complete_matrix(operands), is_text=True, is_render=True # type: ignore[arg-type] + ) + ) + return self.transform_stack + + @property + def effective_transform(self) -> list[float]: + """Current effective transform accounting for cm, tm, and trm transforms""" + eff_transform = [*self.transform_stack.maps[0].values()] + for transform in self.transform_stack.maps[1:]: + eff_transform = mult(eff_transform, transform) # type: ignore[arg-type] # dict has int keys 0-5 + return eff_transform diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_text_state_params.py b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_text_state_params.py new file mode 100644 index 0000000000000000000000000000000000000000..5203f12733f4b97dcb025e9f0366c4ae8dd54b68 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_layout_mode/_text_state_params.py @@ -0,0 +1,135 @@ +"""A dataclass that captures the CTM and Text State for a tj operation""" + +import math +from dataclasses import dataclass, field +from typing import Any, Union + +from ..._font import Font +from .. import mult, orient + + +@dataclass +class TextStateParams: + """ + Text state parameters and operator values for a single text value in a + TJ or Tj PDF operation. + + Attributes: + txt (str): the text to be rendered. + font (Font): font object + font_size (int | float): font size + Tc (float): character spacing. Defaults to 0.0. + Tw (float): word spacing. Defaults to 0.0. + Tz (float): horizontal scaling. Defaults to 100.0. + TL (float): leading, vertical displacement between text lines. Defaults to 0.0. + Ts (float): text rise. Used for super/subscripts. Defaults to 0.0. + transform (List[float]): effective transformation matrix. + tx (float): x cood of rendered text, i.e. self.transform[4] + ty (float): y cood of rendered text. May differ from self.transform[5] per self.Ts. + displaced_tx (float): x coord immediately following rendered text + space_tx (float): tx for a space character + font_height (float): effective font height accounting for CTM + flip_vertical (bool): True if y axis has been inverted (i.e. if self.transform[3] < 0.) + rotated (bool): True if the text orientation is rotated with respect to the page. + + """ + + txt: str + font: Font + font_size: Union[int, float] + Tc: float = 0.0 + Tw: float = 0.0 + Tz: float = 100.0 + TL: float = 0.0 + Ts: float = 0.0 + transform: list[float] = field( + default_factory=lambda: [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + ) + tx: float = field(default=0.0, init=False) + ty: float = field(default=0.0, init=False) + displaced_tx: float = field(default=0.0, init=False) + space_tx: float = field(default=0.0, init=False) + font_height: float = field(default=0.0, init=False) + flip_vertical: bool = field(default=False, init=False) + rotated: bool = field(default=False, init=False) + + def __post_init__(self) -> None: + if orient(self.transform) in (90, 270): + self.transform = mult( + [1.0, -self.transform[1], -self.transform[2], 1.0, 0.0, 0.0], + self.transform, + ) + self.rotated = True + # self.transform[0] AND self.transform[3] < 0 indicates true rotation. + # If only self.transform[3] < 0, the y coords are simply inverted. + if orient(self.transform) == 180 and self.transform[0] < -1e-6: + self.transform = mult([-1.0, 0.0, 0.0, -1.0, 0.0, 0.0], self.transform) + self.rotated = True + self.displaced_tx = self.displaced_transform()[4] + self.tx = self.transform[4] + self.ty = self.render_transform()[5] + self.space_tx = round(self.word_tx(" "), 3) + if self.space_tx < 1e-6: + # if the " " char is assigned 0 width (e.g. for fine tuned spacing + # with TJ int operators a la crazyones.pdf), calculate space_tx as + # a td_offset of -1 * font.space_width where font.space_width is + # the space_width calculated in _font.py. + self.space_tx = round(self.word_tx("", -self.font.space_width), 3) + self.font_height = self.font_size * math.sqrt( + self.transform[1] ** 2 + self.transform[3] ** 2 + ) + # flip_vertical handles PDFs generated by Microsoft Word's "publish" command. + self.flip_vertical = self.transform[3] < -1e-6 # inverts y axis + + def font_size_matrix(self) -> list[float]: + """Font size matrix""" + return [ + self.font_size * (self.Tz / 100.0), + 0.0, + 0.0, + self.font_size, + 0.0, + self.Ts, + ] + + def displaced_transform(self) -> list[float]: + """Effective transform matrix after text has been rendered.""" + return mult(self.displacement_matrix(), self.transform) + + def render_transform(self) -> list[float]: + """Effective transform matrix accounting for font size, Tz, and Ts.""" + return mult(self.font_size_matrix(), self.transform) + + def displacement_matrix( + self, word: Union[str, None] = None, td_offset: float = 0.0 + ) -> list[float]: + """ + Text displacement matrix + + Args: + word (str, optional): Defaults to None in which case self.txt displacement is + returned. + td_offset (float, optional): translation applied by TD operator. Defaults to 0.0. + + """ + word = word if word is not None else self.txt + return [1.0, 0.0, 0.0, 1.0, self.word_tx(word, td_offset), 0.0] + + def word_tx(self, word: str, td_offset: float = 0.0) -> float: + """Horizontal text displacement for any word according this text state""" + width: float = 0.0 + for char in word: + if char == " ": + width += self.font.space_width + else: + width += self.font.text_width(char) + return ( + (self.font_size * ((width - td_offset) / 1000.0)) + + self.Tc + + word.count(" ") * self.Tw + ) * (self.Tz / 100.0) + + @staticmethod + def to_dict(inst: "TextStateParams") -> dict[str, Any]: + """Dataclass to dict for json.dumps serialization""" + return {k: getattr(inst, k) for k in inst.__dataclass_fields__ if k != "font"} diff --git a/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_text_extractor.py b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_text_extractor.py new file mode 100644 index 0000000000000000000000000000000000000000..866f1fdbf346acd469efa3ca0e6f6124547987ea --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/_text_extraction/_text_extractor.py @@ -0,0 +1,350 @@ +# Copyright (c) 2006, Mathieu Fenniak +# Copyright (c) 2007, Ashish Kulkarni +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import math +from typing import Any, Callable, Optional, Union + +from .._font import Font, FontDescriptor +from ..generic import DictionaryObject, TextStringObject +from . import OrientationNotFoundError, crlf_space_check, get_display_str, get_text_operands, mult + + +class TextExtraction: + """ + A class to handle PDF text extraction operations. + + This class encapsulates all the state and operations needed for extracting + text from PDF content streams, replacing the nested functions and nonlocal + variables in the original implementation. + """ + + def __init__(self) -> None: + self._font_width_maps: dict[str, tuple[dict[Any, float], str, float]] = {} + + # Text extraction state variables + self.cm_matrix: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.tm_matrix: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.cm_stack: list[ + tuple[ + list[float], + Optional[DictionaryObject], + Font, + float, + float, + float, + float, + ] + ] = [] + + # Store the last modified matrices; can be an intermediate position + self.cm_prev: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.tm_prev: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + # Store the position at the beginning of building the text + self.memo_cm: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.memo_tm: list[float] = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + self.char_scale = 1.0 + self.space_scale = 1.0 + self._space_width: float = 500.0 # will be set correctly at first Tf + self._actual_str_size: dict[str, float] = { + "str_widths": 0.0, + "str_height": 0.0, + } # will be set to string length calculation result + self.TL = 0.0 + self.font_size = 12.0 # init just in case of + + # Text extraction variables + self.text: str = "" + self.output: str = "" + self.rtl_dir: bool = False # right-to-left + self.font_resource: Optional[DictionaryObject] = None + self.font = Font( + name = "NotInitialized", + sub_type="Unknown", + encoding="charmap", + font_descriptor=FontDescriptor(), + ) + self.orientations: tuple[int, ...] = (0, 90, 180, 270) + self.visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]] = None + self.font_resources: dict[str, DictionaryObject] = {} + self.fonts: dict[str, Font] = {} + + self.operation_handlers = { + b"BT": self._handle_bt, + b"ET": self._handle_et, + b"q": self._handle_save_graphics_state, + b"Q": self._handle_restore_graphics_state, + b"cm": self._handle_cm, + b"Tz": self._handle_tz, + b"Tw": self._handle_tw, + b"TL": self._handle_tl, + b"Tf": self._handle_tf, + b"Td": self._handle_td, + b"Tm": self._handle_tm, + b"T*": self._handle_t_star, + b"Tj": self._handle_tj_operation, + } + + def initialize_extraction( + self, + orientations: tuple[int, ...] = (0, 90, 180, 270), + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]] = None, + font_resources: Optional[dict[str, DictionaryObject]] = None, + fonts: Optional[dict[str, Font]] = None + ) -> None: + """Initialize the extractor with extraction parameters.""" + self.orientations = orientations + self.visitor_text = visitor_text + self.font_resources = font_resources or {} + self.fonts = fonts or {} + + # Reset state + self.text = "" + self.output = "" + self.rtl_dir = False + + def compute_str_widths(self, str_widths: float) -> float: + return str_widths / 1000 + + def process_operation(self, operator: bytes, operands: list[Any]) -> None: + if operator in self.operation_handlers: + handler = self.operation_handlers[operator] + str_widths = handler(operands) + + # Post-process operations that affect text positioning + if operator in {b"Td", b"Tm", b"T*", b"Tj"}: + self._post_process_text_operation(str_widths or 0.0) + + def _post_process_text_operation(self, str_widths: float) -> None: + """Handle common post-processing for text positioning operations.""" + try: + self.text, self.output, self.cm_prev, self.tm_prev = crlf_space_check( + self.text, + (self.cm_prev, self.tm_prev), + (self.cm_matrix, self.tm_matrix), + (self.memo_cm, self.memo_tm), + self.font_resource, + self.orientations, + self.output, + self.font_size, + self.visitor_text, + str_widths, + self.compute_str_widths(self.font_size * self._space_width), + self._actual_str_size["str_height"], + ) + if self.text == "": + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + except OrientationNotFoundError: + pass + + def _handle_tj( + self, + text: str, + operands: list[Union[str, TextStringObject]], + cm_matrix: list[float], + tm_matrix: list[float], + font_resource: Optional[DictionaryObject], + font: Font, + orientations: tuple[int, ...], + font_size: float, + rtl_dir: bool, + visitor_text: Optional[Callable[[Any, Any, Any, Any, Any], None]], + actual_str_size: dict[str, float], + ) -> tuple[str, bool, dict[str, float]]: + text_operands, is_str_operands = get_text_operands( + operands, cm_matrix, tm_matrix, font, orientations + ) + if is_str_operands: + text += text_operands + font_widths = sum([font.space_width if x == " " else font.text_width(x) for x in text_operands]) + else: + text, rtl_dir, font_widths = get_display_str( + text, + cm_matrix, + tm_matrix, # text matrix + font_resource, + font, + text_operands, + font_size, + rtl_dir, + visitor_text, + ) + actual_str_size["str_widths"] += font_widths * font_size + actual_str_size["str_height"] = font_size + return text, rtl_dir, actual_str_size + + def _flush_text(self) -> None: + """Flush accumulated text to output and call visitor if present.""" + self.output += self.text + if self.visitor_text is not None: + self.visitor_text(self.text, self.memo_cm, self.memo_tm, self.font_resource, self.font_size) + self.text = "" + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + + # Operation handlers + + def _handle_bt(self, operands: list[Any]) -> None: + """Handle BT (Begin Text) operation - Table 5.4 page 405.""" + self.tm_matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self._flush_text() + + def _handle_et(self, operands: list[Any]) -> None: + """Handle ET (End Text) operation - Table 5.4 page 405.""" + self._flush_text() + + def _handle_save_graphics_state(self, operands: list[Any]) -> None: + """Handle q (Save graphics state) operation - Table 4.7 page 219.""" + self.cm_stack.append( + ( + self.cm_matrix, + self.font_resource, + self.font, + self.font_size, + self.char_scale, + self.space_scale, + self.TL, + ) + ) + + def _handle_restore_graphics_state(self, operands: list[Any]) -> None: + """Handle Q (Restore graphics state) operation - Table 4.7 page 219.""" + try: + ( + self.cm_matrix, + self.font_resource, + self.font, + self.font_size, + self.char_scale, + self.space_scale, + self.TL, + ) = self.cm_stack.pop() + except Exception: + self.cm_matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + + def _handle_cm(self, operands: list[Any]) -> None: + """Handle cm (Modify current matrix) operation - Table 4.7 page 219.""" + self.output += self.text + if self.visitor_text is not None: + self.visitor_text(self.text, self.memo_cm, self.memo_tm, self.font_resource, self.font_size) + self.text = "" + try: + self.cm_matrix = mult([float(operand) for operand in operands[:6]], self.cm_matrix) + except Exception: + self.cm_matrix = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0] + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + + def _handle_tz(self, operands: list[Any]) -> None: + """Handle Tz (Set horizontal text scaling) operation - Table 5.2 page 398.""" + self.char_scale = float(operands[0]) / 100 if operands else 1.0 + + def _handle_tw(self, operands: list[Any]) -> None: + """Handle Tw (Set word spacing) operation - Table 5.2 page 398.""" + self.space_scale = 1.0 + float(operands[0] if operands else 0.0) + + def _handle_tl(self, operands: list[Any]) -> None: + """Handle TL (Set Text Leading) operation - Table 5.2 page 398.""" + scale_x = math.sqrt(self.tm_matrix[0] ** 2 + self.tm_matrix[2] ** 2) + self.TL = float(operands[0] if operands else 0.0) * self.font_size * scale_x + + def _handle_tf(self, operands: list[Any]) -> None: + """Handle Tf (Set font size) operation - Table 5.2 page 398.""" + if self.text != "": + self.output += self.text # .translate(cmap) + if self.visitor_text is not None: + self.visitor_text(self.text, self.memo_cm, self.memo_tm, self.font_resource, self.font_size) + self.text = "" + self.memo_cm = self.cm_matrix.copy() + self.memo_tm = self.tm_matrix.copy() + try: + self.font_resource = self.font_resources[operands[0]] + self.font = self.fonts[operands[0]] + except KeyError: # font not found + self.font_resource = None + font_descriptor = FontDescriptor() + self.font = Font( + "Unknown", + space_width=250, + encoding=dict.fromkeys(range(256), "�"), + font_descriptor=font_descriptor, + character_map={}, + ) + + self._space_width = self.font.space_width / 2 # Actually the width of _half_ a space... + try: + self.font_size = float(operands[1]) + except Exception: + pass # keep previous size + + def _handle_td(self, operands: list[Any]) -> float: + """Handle Td (Move text position) operation - Table 5.5 page 406.""" + # A special case is a translating only tm: + # tm = [1, 0, 0, 1, e, f] + # i.e. tm[4] += tx, tm[5] += ty. + tx, ty = float(operands[0]), float(operands[1]) + self.tm_matrix[4] += tx * self.tm_matrix[0] + ty * self.tm_matrix[2] + self.tm_matrix[5] += tx * self.tm_matrix[1] + ty * self.tm_matrix[3] + str_widths = self.compute_str_widths(self._actual_str_size["str_widths"]) + self._actual_str_size["str_widths"] = 0.0 + return str_widths + + def _handle_tm(self, operands: list[Any]) -> float: + """Handle Tm (Set text matrix) operation - Table 5.5 page 406.""" + self.tm_matrix = [float(operand) for operand in operands[:6]] + str_widths = self.compute_str_widths(self._actual_str_size["str_widths"]) + self._actual_str_size["str_widths"] = 0.0 + return str_widths + + def _handle_t_star(self, operands: list[Any]) -> float: + """Handle T* (Move to next line) operation - Table 5.5 page 406.""" + self.tm_matrix[4] -= self.TL * self.tm_matrix[2] + self.tm_matrix[5] -= self.TL * self.tm_matrix[3] + str_widths = self.compute_str_widths(self._actual_str_size["str_widths"]) + self._actual_str_size["str_widths"] = 0.0 + return str_widths + + def _handle_tj_operation(self, operands: list[Any]) -> float: + """Handle Tj (Show text) operation - Table 5.5 page 406.""" + self.text, self.rtl_dir, self._actual_str_size = self._handle_tj( + self.text, + operands, + self.cm_matrix, + self.tm_matrix, + self.font_resource, + self.font, + self.orientations, + self.font_size, + self.rtl_dir, + self.visitor_text, + self._actual_str_size, + ) + return 0.0 # str_widths will be handled in post-processing diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/__init__.py b/python/user_packages/Python313/site-packages/pypdf/annotations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..44ed1dab5cacdfc7dbc9c07605e164e757a927b5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/annotations/__init__.py @@ -0,0 +1,42 @@ +""" +PDF specifies several annotation types which pypdf makes available here. + +The names of the annotations and their attributes do not reflect the names in +the specification in all cases. For example, the PDF standard defines a +'Square' annotation that does not actually need to be square. For this reason, +pypdf calls it 'Rectangle'. + +At their core, all annotation types are DictionaryObjects. That means if pypdf +does not implement a feature, users can easily extend the given functionality. +""" + + +from ._base import NO_FLAGS, AnnotationDictionary +from ._markup_annotations import ( + Ellipse, + FreeText, + Highlight, + Line, + MarkupAnnotation, + Polygon, + PolyLine, + Rectangle, + Text, +) +from ._non_markup_annotations import Link, Popup + +__all__ = [ + "NO_FLAGS", + "AnnotationDictionary", + "Ellipse", + "FreeText", + "Highlight", + "Line", + "Link", + "MarkupAnnotation", + "PolyLine", + "Polygon", + "Popup", + "Rectangle", + "Text", +] diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c368fe972c6a5739512fcb557a58bef78bb7e17 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_base.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fc2ed321730d1877346d82f18ece90a6973579de Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_markup_annotations.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_markup_annotations.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..822d44590f745d16658d5972a16c6f902239b193 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_markup_annotations.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_non_markup_annotations.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_non_markup_annotations.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1bd133ad4126c79fabbec523d52667b9700452fc Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/annotations/__pycache__/_non_markup_annotations.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/_base.py b/python/user_packages/Python313/site-packages/pypdf/annotations/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..7731b18682b898a4f5b312d69e07df7df3494100 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/annotations/_base.py @@ -0,0 +1,29 @@ +from abc import ABC + +from ..constants import AnnotationFlag +from ..generic import NameObject, NumberObject +from ..generic._data_structures import DictionaryObject + + +class AnnotationDictionary(DictionaryObject, ABC): + def __init__(self) -> None: + super().__init__() + + from ..generic._base import NameObject # noqa: PLC0415 + + # /Rect should not be added here as Polygon and PolyLine can automatically set it + self[NameObject("/Type")] = NameObject("/Annot") + # The flags were NOT added to the constructor on purpose: + # We expect that most users don't want to change the default. + # If they do, they can use the property. The default is 0. + + @property + def flags(self) -> AnnotationFlag: + return AnnotationFlag(self.get(NameObject("/F"), 0)) + + @flags.setter + def flags(self, value: AnnotationFlag) -> None: + self[NameObject("/F")] = NumberObject(value) + + +NO_FLAGS = AnnotationFlag(0) diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/_markup_annotations.py b/python/user_packages/Python313/site-packages/pypdf/annotations/_markup_annotations.py new file mode 100644 index 0000000000000000000000000000000000000000..25eb0dfc48cc776513d27ca38e0a9a5c42602281 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/annotations/_markup_annotations.py @@ -0,0 +1,351 @@ +import sys +import uuid +from abc import ABC +from typing import Any, Literal, Optional, Union + +from ..constants import AnnotationFlag +from ..generic import ArrayObject, DictionaryObject +from ..generic._base import ( + BooleanObject, + FloatObject, + IndirectObject, + NameObject, + NumberObject, + TextStringObject, +) +from ..generic._rectangle import RectangleObject +from ..generic._utils import hex_to_rgb +from ._base import NO_FLAGS, AnnotationDictionary + +if sys.version_info[:2] >= (3, 10): + from typing import TypeAlias +else: + # PEP 613 introduced typing.TypeAlias with Python 3.10 + # For older Python versions, the backport typing_extensions is necessary: + from typing_extensions import TypeAlias + + +Vertex: TypeAlias = tuple[float, float] + + +def _get_bounding_rectangle(vertices: list[Vertex]) -> RectangleObject: + x_min, y_min = vertices[0][0], vertices[0][1] + x_max, y_max = vertices[0][0], vertices[0][1] + for x, y in vertices: + x_min = min(x_min, x) + y_min = min(y_min, y) + x_max = max(x_max, x) + y_max = max(y_max, y) + return RectangleObject((x_min, y_min, x_max, y_max)) + + +class MarkupAnnotation(AnnotationDictionary, ABC): + """ + Base class for all markup annotations. + + Args: + title_bar: Text to be displayed in the title bar of the annotation; + by convention this is the name of the author + in_reply_to: The annotation that this annotation is "in reply to" + (PDF 1.5). Can be either an annotation (previously added using + :meth:`~pypdf.PdfWriter.add_annotation`) or a reference to the + target annotation. + reply_type: The relationship between this annotation and the one + specified by ``in_reply_to``. Either ``"R"`` (a reply, default) + or ``"Group"`` (grouped with the parent annotation). Raises + ``ValueError`` if a non-default value is provided without + ``in_reply_to``. + annotation_name: A text string uniquely identifying this annotation + among all annotations on its page. Automatically generated when + ``in_reply_to`` is set and no name is provided. Raises + ``ValueError`` if provided without ``in_reply_to``. + + """ + + def __init__( + self, + *, + title_bar: Optional[str] = None, + in_reply_to: Optional[Union[DictionaryObject, IndirectObject]] = None, + reply_type: Literal["R", "Group"] = "R", + annotation_name: Optional[str] = None, + ) -> None: + if title_bar is not None: + self[NameObject("/T")] = TextStringObject(title_bar) + if annotation_name is not None and in_reply_to is None: + raise ValueError( + "annotation_name is only supported when in_reply_to is set" + ) + if reply_type != "R" and in_reply_to is None: + raise ValueError( + "reply_type is only meaningful when in_reply_to is set" + ) + if in_reply_to is not None: + if isinstance(in_reply_to, IndirectObject): + ref: IndirectObject = in_reply_to + else: + indirect_ref = getattr(in_reply_to, "indirect_reference", None) + if not isinstance(indirect_ref, IndirectObject): + raise ValueError( + "in_reply_to must be a registered annotation " + "(added via writer.add_annotation() first)" + ) + ref = indirect_ref + self[NameObject("/IRT")] = ref + self[NameObject("/RT")] = NameObject(f"/{reply_type}") + if annotation_name is None: + annotation_name = str(uuid.uuid4()) + self[NameObject("/NM")] = TextStringObject(annotation_name) + + +class Text(MarkupAnnotation): + """ + A text annotation. + + Args: + rect: array of four integers ``[xLL, yLL, xUR, yUR]`` + specifying the clickable rectangular area + text: The text that is added to the document + open: + flags: + + """ + + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + text: str, + open: bool = False, + flags: int = NO_FLAGS, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self[NameObject("/Subtype")] = NameObject("/Text") + self[NameObject("/Rect")] = RectangleObject(rect) + self[NameObject("/Contents")] = TextStringObject(text) + self[NameObject("/Open")] = BooleanObject(open) + self[NameObject("/Flags")] = NumberObject(flags) + + +class FreeText(MarkupAnnotation): + """A FreeText annotation""" + + def __init__( + self, + *, + text: str, + rect: Union[RectangleObject, tuple[float, float, float, float]], + font: str = "Helvetica", + bold: bool = False, + italic: bool = False, + font_size: str = "14pt", + font_color: str = "000000", + border_color: Optional[str] = "000000", + background_color: Optional[str] = "ffffff", + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self[NameObject("/Subtype")] = NameObject("/FreeText") + self[NameObject("/Rect")] = RectangleObject(rect) + + # Table 225 of the 1.7 reference ("CSS2 style attributes used in rich text strings") + font_str = "font: " + if italic: + font_str = f"{font_str}italic " + else: + font_str = f"{font_str}normal " + if bold: + font_str = f"{font_str}bold " + else: + font_str = f"{font_str}normal " + font_str = f"{font_str}{font_size} {font}" + font_str = f"{font_str};text-align:left;color:#{font_color}" + + default_appearance_string = "" + if border_color: + for st in hex_to_rgb(border_color): + default_appearance_string = f"{default_appearance_string}{st} " + default_appearance_string = f"{default_appearance_string}rg" + + self.update( + { + NameObject("/Subtype"): NameObject("/FreeText"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/Contents"): TextStringObject(text), + # font size color + NameObject("/DS"): TextStringObject(font_str), + NameObject("/DA"): TextStringObject(default_appearance_string), + } + ) + if border_color is None: + # Border Style + self[NameObject("/BS")] = DictionaryObject( + { + # width of 0 means no border + NameObject("/W"): NumberObject(0) + } + ) + if background_color is not None: + self[NameObject("/C")] = ArrayObject( + [FloatObject(n) for n in hex_to_rgb(background_color)] + ) + + +class Line(MarkupAnnotation): + def __init__( + self, + p1: Vertex, + p2: Vertex, + rect: Union[RectangleObject, tuple[float, float, float, float]], + text: str = "", + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Subtype"): NameObject("/Line"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/L"): ArrayObject( + [ + FloatObject(p1[0]), + FloatObject(p1[1]), + FloatObject(p2[0]), + FloatObject(p2[1]), + ] + ), + NameObject("/LE"): ArrayObject( + [ + NameObject("/None"), + NameObject("/None"), + ] + ), + NameObject("/IC"): ArrayObject( + [ + FloatObject(0.5), + FloatObject(0.5), + FloatObject(0.5), + ] + ), + NameObject("/Contents"): TextStringObject(text), + } + ) + + +class PolyLine(MarkupAnnotation): + def __init__( + self, + vertices: list[Vertex], + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + if len(vertices) == 0: + raise ValueError("A polyline needs at least 1 vertex with two coordinates") + coord_list = [] + for x, y in vertices: + coord_list.append(NumberObject(x)) + coord_list.append(NumberObject(y)) + self.update( + { + NameObject("/Subtype"): NameObject("/PolyLine"), + NameObject("/Vertices"): ArrayObject(coord_list), + NameObject("/Rect"): RectangleObject(_get_bounding_rectangle(vertices)), + } + ) + + +class Rectangle(MarkupAnnotation): + def __init__( + self, + rect: Union[RectangleObject, tuple[float, float, float, float]], + *, + interior_color: Optional[str] = None, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Square"), + NameObject("/Rect"): RectangleObject(rect), + } + ) + + if interior_color: + self[NameObject("/IC")] = ArrayObject( + [FloatObject(n) for n in hex_to_rgb(interior_color)] + ) + + +class Highlight(MarkupAnnotation): + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + quad_points: ArrayObject, + highlight_color: str = "ff0000", + printing: bool = False, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Subtype"): NameObject("/Highlight"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/QuadPoints"): quad_points, + NameObject("/C"): ArrayObject( + [FloatObject(n) for n in hex_to_rgb(highlight_color)] + ), + } + ) + if printing: + self.flags = AnnotationFlag.PRINT + + +class Ellipse(MarkupAnnotation): + def __init__( + self, + rect: Union[RectangleObject, tuple[float, float, float, float]], + *, + interior_color: Optional[str] = None, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Circle"), + NameObject("/Rect"): RectangleObject(rect), + } + ) + + if interior_color: + self[NameObject("/IC")] = ArrayObject( + [FloatObject(n) for n in hex_to_rgb(interior_color)] + ) + + +class Polygon(MarkupAnnotation): + def __init__( + self, + vertices: list[tuple[float, float]], + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + if len(vertices) == 0: + raise ValueError("A polygon needs at least 1 vertex with two coordinates") + + coord_list = [] + for x, y in vertices: + coord_list.append(NumberObject(x)) + coord_list.append(NumberObject(y)) + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Polygon"), + NameObject("/Vertices"): ArrayObject(coord_list), + NameObject("/IT"): NameObject("/PolygonCloud"), + NameObject("/Rect"): RectangleObject(_get_bounding_rectangle(vertices)), + } + ) diff --git a/python/user_packages/Python313/site-packages/pypdf/annotations/_non_markup_annotations.py b/python/user_packages/Python313/site-packages/pypdf/annotations/_non_markup_annotations.py new file mode 100644 index 0000000000000000000000000000000000000000..144546094f2a8b0499073342410c3b0185db08f2 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/annotations/_non_markup_annotations.py @@ -0,0 +1,106 @@ +from typing import TYPE_CHECKING, Any, Optional, Union + +from ..generic._base import ( + BooleanObject, + NameObject, + NumberObject, + TextStringObject, +) +from ..generic._data_structures import ArrayObject, DictionaryObject +from ..generic._fit import DEFAULT_FIT, Fit +from ..generic._rectangle import RectangleObject +from ._base import AnnotationDictionary + + +class Link(AnnotationDictionary): + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + border: Optional[ArrayObject] = None, + url: Optional[str] = None, + target_page_index: Optional[int] = None, + fit: Fit = DEFAULT_FIT, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + if TYPE_CHECKING: + from ..types import BorderArrayType # noqa: PLC0415 + + is_external = url is not None + is_internal = target_page_index is not None + if not is_external and not is_internal: + raise ValueError( + "Either 'url' or 'target_page_index' have to be provided. Both were None." + ) + if is_external and is_internal: + raise ValueError( + "Either 'url' or 'target_page_index' have to be provided. " + f"{url=}, {target_page_index=}" + ) + + border_arr: BorderArrayType + if border is not None: + border_arr = [NumberObject(n) for n in border[:3]] + if len(border) == 4: + dash_pattern = ArrayObject([NumberObject(n) for n in border[3]]) + border_arr.append(dash_pattern) + else: + border_arr = [NumberObject(0)] * 3 + + self.update( + { + NameObject("/Type"): NameObject("/Annot"), + NameObject("/Subtype"): NameObject("/Link"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/Border"): ArrayObject(border_arr), + } + ) + if is_external: + self[NameObject("/A")] = DictionaryObject( + { + NameObject("/S"): NameObject("/URI"), + NameObject("/Type"): NameObject("/Action"), + NameObject("/URI"): TextStringObject(url), + } + ) + if is_internal: + # This needs to be updated later! + dest_deferred = DictionaryObject( + { + "target_page_index": NumberObject(target_page_index), + "fit": NameObject(fit.fit_type), + "fit_args": fit.fit_args, + } + ) + self[NameObject("/Dest")] = dest_deferred + + +class Popup(AnnotationDictionary): + def __init__( + self, + *, + rect: Union[RectangleObject, tuple[float, float, float, float]], + parent: Optional[DictionaryObject] = None, + open: bool = False, + **kwargs: Any, + ) -> None: + super().__init__(**kwargs) + self.update( + { + NameObject("/Subtype"): NameObject("/Popup"), + NameObject("/Rect"): RectangleObject(rect), + NameObject("/Open"): BooleanObject(open), + } + ) + if parent: + # This needs to be an indirect object + try: + self[NameObject("/Parent")] = parent.indirect_reference + except AttributeError: + from .._utils import logger_warning # noqa: PLC0415 + + logger_warning( + "Unregistered Parent object : No Parent field set", + __name__, + ) diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__init__.py b/python/user_packages/Python313/site-packages/pypdf/generic/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bde1628fb7a02f9dab04666123c1f3d8bdeeb94b --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/__init__.py @@ -0,0 +1,115 @@ +# Copyright (c) 2006, Mathieu Fenniak +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +"""Implementation of generic PDF objects (dictionary, number, string, ...).""" +__author__ = "Mathieu Fenniak" +__author_email__ = "biziqe@mathieu.fenniak.net" + +from ..constants import OutlineFontFlag +from ._base import ( + BooleanObject, + ByteStringObject, + FloatObject, + IndirectObject, + NameObject, + NullObject, + NumberObject, + PdfObject, + TextStringObject, + encode_pdfdocencoding, + is_null_or_none, +) +from ._data_structures import ( + ArrayObject, + ContentStream, + DecodedStreamObject, + Destination, + DictionaryObject, + EncodedStreamObject, + Field, + StreamObject, + TreeObject, + read_object, +) +from ._files import EmbeddedFile +from ._fit import Fit +from ._link import DirectReferenceLink, NamedReferenceLink, ReferenceLink, extract_links +from ._outline import OutlineItem +from ._rectangle import RectangleObject +from ._utils import ( + create_string_object, + decode_pdfdocencoding, + hex_to_rgb, + read_hex_string_from_stream, + read_string_from_stream, +) +from ._viewerpref import ViewerPreferences + +PAGE_FIT = Fit.fit() + + +__all__ = [ + "PAGE_FIT", + "ArrayObject", + "BooleanObject", + "ByteStringObject", + "ContentStream", + "DecodedStreamObject", + "Destination", + "DictionaryObject", + "DirectReferenceLink", + "EmbeddedFile", + "EncodedStreamObject", + "Field", + "Fit", + "FloatObject", + "IndirectObject", + "NameObject", + "NamedReferenceLink", + "NullObject", + "NumberObject", + "OutlineFontFlag", + "OutlineItem", + "PdfObject", + "RectangleObject", + "ReferenceLink", + "StreamObject", + "TextStringObject", + "TreeObject", + "ViewerPreferences", + # Utility functions + "create_string_object", + "decode_pdfdocencoding", + "encode_pdfdocencoding", + "extract_links", + "hex_to_rgb", + "is_null_or_none", + "read_hex_string_from_stream", + # Data structures core functions + "read_object", + "read_string_from_stream", +] diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f9ca024527e5a21f7031311865477278d6bbc757 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_appearance_stream.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_appearance_stream.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34ee8d001f66945d603a8d637090ff534edb616f Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_appearance_stream.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_base.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_base.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a7a96901bfe205bc721fa950516d7eccd58920c Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_base.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_data_structures.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_data_structures.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e35e3dde05546f69c64490e102bca34ebfd6fb93 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_data_structures.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_files.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_files.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..506c8af5783b5f2add40366b21d84ef1f3aa40c4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_files.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_fit.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_fit.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..192c83ae79849608819d09b80713c6cb1cb5ed59 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_fit.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_image_inline.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_image_inline.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65c9528d33db40b00154c04d58d10408eb01e324 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_image_inline.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_image_xobject.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_image_xobject.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b439a9c3f30cae098f853529d529ccc2b8d4364 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_image_xobject.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_link.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_link.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49d1cec8eed73a3d3cc525b3b80cee5bdd7bacd1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_link.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_outline.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_outline.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5669da35e0c47978ed5dd13c39b3484dc8cf094 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_outline.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_rectangle.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_rectangle.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e952035699bcc7ff1c00f47d603f67843995f4f Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_rectangle.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f7adb7edb683f0111c2e50abc74800e96d387c48 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_viewerpref.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_viewerpref.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0220fdffa0d616f6204528ccb8be5ba4dd37a79 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypdf/generic/__pycache__/_viewerpref.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_appearance_stream.py b/python/user_packages/Python313/site-packages/pypdf/generic/_appearance_stream.py new file mode 100644 index 0000000000000000000000000000000000000000..cee5c79ec7955175cfb357c3f53801de68f7f568 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_appearance_stream.py @@ -0,0 +1,589 @@ +import re +from dataclasses import dataclass +from enum import IntEnum +from typing import Any, Optional, Union, cast + +from .._codecs import fill_from_encoding +from .._codecs.core_font_metrics import CORE_FONT_METRICS +from .._font import Font +from .._utils import logger_warning +from ..constants import AnnotationDictionaryAttributes, BorderStyles, FieldDictionaryAttributes +from ..generic import ( + DecodedStreamObject, + DictionaryObject, + NameObject, + NumberObject, + RectangleObject, +) +from ..generic._base import ByteStringObject, TextStringObject, is_null_or_none + +DEFAULT_FONT_SIZE_IN_MULTILINE = 12 + + +@dataclass +class BaseStreamConfig: + """A container representing the basic layout of an appearance stream.""" + rectangle: Union[RectangleObject, tuple[float, float, float, float]] = (0.0, 0.0, 0.0, 0.0) + border_width: int = 1 # The width of the border in points + border_style: str = BorderStyles.SOLID + + +class BaseStreamAppearance(DecodedStreamObject): + """A class representing the very base of an appearance stream, that is, a rectangle and a border.""" + + def __init__(self, layout: Optional[BaseStreamConfig] = None) -> None: + """ + Takes the appearance stream layout as an argument. + + Args: + layout: The basic layout parameters. + """ + super().__init__() + self._layout = layout or BaseStreamConfig() + self[NameObject("/Type")] = NameObject("/XObject") + self[NameObject("/Subtype")] = NameObject("/Form") + self[NameObject("/BBox")] = RectangleObject(self._layout.rectangle) + + +class TextAlignment(IntEnum): + """Defines the alignment options for text within a form field's appearance stream.""" + + LEFT = 0 + CENTER = 1 + RIGHT = 2 + + +class TextStreamAppearance(BaseStreamAppearance): + """ + A class representing the appearance stream for a text-based form field. + + This class generates the content stream (the `ap_stream_data`) that dictates + how text is rendered within a form field's bounding box. It handles properties + like font, font size, color, multiline text, and text selection highlighting. + """ + + def _scale_text( + self, + font: Font, + font_size: float, + leading_factor: float, + field_width: float, + field_height: float, + text: str, + min_font_size: float, + font_size_step: float = 0.2 + ) -> tuple[list[tuple[float, str]], float]: + """ + Takes a piece of text and scales it to field_width or field_height, given font_name + and font_size. Wraps text where necessary. + + Args: + font: The font to be used. + font_size: The font size in points. + leading_factor: The line distance. + field_width: The width of the field in which to fit the text. + field_height: The height of the field in which to fit the text. + text: The text to fit with the field. + min_font_size: The minimum font size at which to scale the text. + font_size_step: The amount by which to decrement font size per step while scaling. + + Returns: + The text in the form of list of tuples, each tuple containing the length of a line + and its contents, and the font_size for these lines and lengths. + """ + orig_text = text + paragraphs = text.replace("\n", "\r").split("\r") + wrapped_lines = [] + current_line_words: list[str] = [] + current_line_width: float = 0 + space_width = font.space_width * font_size / 1000 + for paragraph in paragraphs: + if not paragraph.strip(): + wrapped_lines.append((0.0, "")) + continue + words = paragraph.split(" ") + for i, word in enumerate(words): + word_width = font.text_width(word) * font_size / 1000 + test_width = current_line_width + word_width + (space_width if i else 0) + if test_width > field_width and current_line_words: + wrapped_lines.append((current_line_width, " ".join(current_line_words))) + current_line_words = [word] + current_line_width = word_width + elif not current_line_words and word_width > field_width: + wrapped_lines.append((word_width, word)) + current_line_words = [] + current_line_width = 0 + else: + if current_line_words: + current_line_width += space_width + current_line_words.append(word) + current_line_width += word_width + if current_line_words: + wrapped_lines.append((current_line_width, " ".join(current_line_words))) + current_line_words = [] + current_line_width = 0 + # Estimate total height. + estimated_total_height = font_size + (len(wrapped_lines) - 1) * leading_factor * font_size + if estimated_total_height > field_height: + # Text overflows height; Retry with smaller font size. + new_font_size = font_size - font_size_step + if new_font_size >= min_font_size: + return self._scale_text( + font, + new_font_size, + leading_factor, + field_width, + field_height, + orig_text, + min_font_size, + font_size_step + ) + return wrapped_lines, round(font_size, 1) + + def _generate_appearance_stream_data( + self, + text: str, + selection: Union[list[str], None], + font: Font, + font_glyph_byte_map: Optional[dict[str, bytes]] = None, + font_name: str = "/Helv", + font_size: float = 0.0, + font_color: str = "0 g", + is_multiline: bool = False, + alignment: TextAlignment = TextAlignment.LEFT, + is_comb: bool = False, + max_length: Optional[int] = None + ) -> bytes: + """ + Generates the raw bytes of the PDF appearance stream for a text field. + + This private method assembles the PDF content stream operators to draw + the provided text within the specified rectangle. It handles text positioning, + font application, color, and special formatting like selected text. + + Args: + text: The text to be rendered in the form field. + selection: An optional list of strings that should be highlighted as selected. + font: The font to use. + font_glyph_byte_map: An optional dictionary mapping characters to their + byte representation for glyph encoding. + font_name: The name of the font resource to use (e.g., "/Helv"). + font_size: The font size. If 0, it is automatically calculated + based on whether the field is multiline or not. + font_color: The color to apply to the font, represented as a PDF + graphics state string (e.g., "0 g" for black). + is_multiline: A boolean indicating if the text field is multiline. + alignment: Text alignment, can be TextAlignment.LEFT, .RIGHT, or .CENTER. + is_comb: Boolean that designates fixed-length fields, where every character + fills one "cell", such as in a postcode. + max_length: Used if is_comb is set. The maximum number of characters for a fixed- + length field. + + Returns: + A byte string containing the PDF content stream data. + + """ + rectangle = self._layout.rectangle + font_glyph_byte_map = font_glyph_byte_map or {} + if isinstance(rectangle, tuple): + rectangle = RectangleObject(rectangle) + leading_factor = (font.font_descriptor.bbox[3] - font.font_descriptor.bbox[1]) / 1000.0 + + # Set margins based on border width and style, but never less than 1 point + factor = 2 if self._layout.border_style in {"/B", "/I"} else 1 + margin = max(self._layout.border_width * factor, 1) + field_height = rectangle.height - 2 * margin + field_width = rectangle.width - 4 * margin + + # If font_size is 0, apply the logic for multiline or large-as-possible font + if font_size == 0: + min_font_size = 4.0 # The mininum font size + if selection: # Don't wrap text when dealing with a /Ch field, in order to prevent problems + is_multiline = False # with matching "selection" with "line" later on. + if is_multiline: + font_size = DEFAULT_FONT_SIZE_IN_MULTILINE + lines, font_size = self._scale_text( + font, + font_size, + leading_factor, + field_width, + field_height, + text, + min_font_size + ) + else: + max_vertical_size = field_height / leading_factor + text_width_unscaled = font.text_width(text) / 1000 + max_horizontal_size = field_width / (text_width_unscaled or 1) + font_size = round(max(min(max_vertical_size, max_horizontal_size), min_font_size), 1) + lines = [(text_width_unscaled * font_size, text)] + elif is_comb: + if max_length and len(text) > max_length: + logger_warning ( + f"Length of text {text} exceeds maximum length ({max_length}) of field, input truncated.", + __name__ + ) + # We act as if each character is one line, because we draw it separately later on + lines = [( + font.text_width(char) * font_size / 1000, + char + ) for index, char in enumerate(text) if index < (max_length or len(text))] + else: + lines = [( + font.text_width(line) * font_size / 1000, + line + ) for line in text.replace("\n", "\r").split("\r")] + + # Set the vertical offset + if is_multiline: + y_offset = rectangle.height + margin - font.font_descriptor.bbox[3] * font_size / 1000.0 + else: + y_offset = margin + ((field_height - font.font_descriptor.ascent * font_size / 1000) / 2) + default_appearance = f"{font_name} {font_size} Tf {font_color}" + + ap_stream = ( + f"q\n/Tx BMC \nq\n{2 * margin} {margin} {field_width} {field_height} " + f"re\nW\nBT\n{default_appearance}\n" + ).encode() + current_x_pos: float = 0 # Initial virtual position within the text object. + + for line_number, (line_width, line) in enumerate(lines): + if selection and line in selection: + # Might be improved, but cannot find how to get fill working => replaced with lined box + ap_stream += ( + f"1 {y_offset - (line_number * font_size * leading_factor) - 1} " + f"{rectangle.width - 2} {font_size + 2} re\n" + f"0.5 0.5 0.5 rg s\n{default_appearance}\n" + ).encode() + + # Calculate the desired absolute starting X for the current line + desired_abs_x_start: float = 0 + if is_comb and max_length: + # Calculate the width of a cell for one character + cell_width = rectangle.width / max_length + # Space from the left edge of the cell to the character's baseline start + # line_width here is the *actual* character width in points for the single character 'line' + centering_offset_in_cell = (cell_width - line_width) / 2 + # Absolute start X = (Cell Index, i.e., line_number * Cell Width) + Centering Offset + desired_abs_x_start = (line_number * cell_width) + centering_offset_in_cell + elif alignment == TextAlignment.RIGHT: + desired_abs_x_start = rectangle.width - margin * 2 - line_width + elif alignment == TextAlignment.CENTER: + desired_abs_x_start = (rectangle.width - line_width) / 2 + else: # Left aligned; default + desired_abs_x_start = margin * 2 + # Calculate x_rel_offset: how much to move from the current_x_pos + # to reach the desired_abs_x_start. + x_rel_offset = desired_abs_x_start - current_x_pos + + # Y-offset: + y_rel_offset: float = 0 + if line_number == 0: + y_rel_offset = y_offset # Initial vertical position + elif is_comb: + y_rel_offset = 0.0 # DO NOT move vertically for subsequent characters + else: + y_rel_offset = - font_size * leading_factor # Move down by line height + + # Td is a relative translation (Tx and Ty). + # It updates the current text position. + ap_stream += f"{x_rel_offset} {y_rel_offset} Td\n".encode() + # Update current_x_pos based on the Td operation for the next iteration. + # This is the X position where the *current line* will start. + current_x_pos = desired_abs_x_start + + encoded_line: list[bytes] = [ + font_glyph_byte_map.get(c, c.encode("utf-16-be")) for c in line + ] + if any(len(c) >= 2 for c in encoded_line): + ap_stream += b"<" + (b"".join(encoded_line)).hex().encode() + b"> Tj\n" + else: + ap_stream += b"(" + b"".join(encoded_line) + b") Tj\n" + ap_stream += b"ET\nQ\nEMC\nQ\n" + return ap_stream + + def __init__( + self, + layout: Optional[BaseStreamConfig] = None, + text: str = "", + selection: Optional[list[str]] = None, + font_resource: Optional[DictionaryObject] = None, + font_name: str = "/Helv", + font_size: float = 0.0, + font_color: str = "0 g", + is_multiline: bool = False, + alignment: TextAlignment = TextAlignment.LEFT, + is_comb: bool = False, + max_length: Optional[int] = None + ) -> None: + """ + Initializes a TextStreamAppearance object. + + This constructor creates a new PDF stream object configured as an XObject + of subtype Form. It uses the `_appearance_stream_data` method to generate + the content for the stream. + + Args: + layout: The basic layout parameters. + text: The text to be rendered in the form field. + selection: An optional list of strings that should be highlighted as selected. + font_resource: An optional variable that represents a PDF font dictionary. + font_name: The name of the font resource, e.g., "/Helv". + font_size: The font size. If 0, it's auto-calculated. + font_color: The font color string. + is_multiline: A boolean indicating if the text field is multiline. + alignment: Text alignment, can be TextAlignment.LEFT, .RIGHT, or .CENTER. + is_comb: Boolean that designates fixed-length fields, where every character + fills one "cell", such as in a postcode. + max_length: Used if is_comb is set. The maximum number of characters for a fixed- + length field. + + """ + super().__init__(layout) + + # If a font resource was added, get the font character map + if font_resource: + font = Font.from_font_resource(font_resource) + else: + logger_warning(f"Font dictionary for {font_name} not found; defaulting to Helvetica.", __name__) + font_name = "/Helv" + core_font_metrics = CORE_FONT_METRICS["Helvetica"] + font = Font( + name="Helvetica", + character_map={}, + encoding=dict(zip(range(256), fill_from_encoding("cp1252"))), # WinAnsiEncoding + sub_type="Type1", + font_descriptor=core_font_metrics.font_descriptor, + character_widths=core_font_metrics.character_widths + ) + font_resource = font.as_font_resource() + + # Check whether the font resource is able to encode the text value. + encodable = True + try: + if isinstance(font.encoding, str): + text.encode(font.encoding, "surrogatepass") + else: + supported_chars = set(font.encoding.values()) + if any(char not in supported_chars for char in text): + encodable = False + # We should add a final check against the character_map (CMap) of the font, + # but we don't appear to have PDF forms with such fonts, so we skip this for + # now. + + except UnicodeEncodeError: + encodable = False + + if not encodable: + logger_warning( + f"Text string '{text}' contains characters not supported by font encoding. " + "This may result in text corruption. " + "Consider calling writer.update_page_form_field_values with auto_regenerate=True.", + __name__ + ) + + font_glyph_byte_map: dict[str, bytes] + if isinstance(font.encoding, str): + font_glyph_byte_map = { + v: k.encode(font.encoding) for k, v in font.character_map.items() + } + else: + font_glyph_byte_map = {v: bytes((k,)) for k, v in font.encoding.items()} + font_encoding_rev = {v: bytes((k,)) for k, v in font.encoding.items()} + for key, value in font.character_map.items(): + font_glyph_byte_map[value] = font_encoding_rev.get(key, key) + + ap_stream_data = self._generate_appearance_stream_data( + text, + selection, + font, + font_glyph_byte_map, + font_name=font_name, + font_size=font_size, + font_color=font_color, + is_multiline=is_multiline, + alignment=alignment, + is_comb=is_comb, + max_length=max_length + ) + + self.set_data(ByteStringObject(ap_stream_data)) + self[NameObject("/Length")] = NumberObject(len(ap_stream_data)) + # Update Resources with font information + self[NameObject("/Resources")] = DictionaryObject({ + NameObject("/Font"): DictionaryObject({ + NameObject(font_name): getattr(font_resource, "indirect_reference", font_resource) + }) + }) + + @staticmethod + def _find_annotation_font_resource( + font_name: str, + annotation: DictionaryObject, + acro_form: DictionaryObject + ) -> tuple[str, DictionaryObject]: + # Try to find a resource dictionary for the font by examining the annotation and, if that fails, + # the AcroForm resources dictionary + acro_form_resources: Any = cast( + DictionaryObject, + annotation.get_inherited( + "/DR", + acro_form.get("/DR", DictionaryObject()), + ), + ) + acro_form_font_resources = acro_form_resources.get("/Font", DictionaryObject()) + font_resource = acro_form_font_resources.get(font_name, None) + + # Normally, we should have found a font resource by now. However, when a user has provided a specific + # font name, we may not have found the associated font resource among the AcroForm resources. Also, in + # case of the 14 Adobe Core fonts, we may be expected to construct a font resource ourselves. + if is_null_or_none(font_resource): + if font_name.removeprefix("/") not in CORE_FONT_METRICS: + # Default to Helvetica if we haven't found a font resource and cannot construct one ourselves. + logger_warning(f"Font dictionary for {font_name} not found; defaulting to Helvetica.", __name__) + font_name = "/Helvetica" + core_font_metrics = CORE_FONT_METRICS[font_name.removeprefix("/")] + font_resource = Font( + name=font_name.removeprefix("/"), + character_map={}, + encoding=dict(zip(range(256), fill_from_encoding("cp1252"))), # WinAnsiEncoding + sub_type="Type1", + font_descriptor=core_font_metrics.font_descriptor, + character_widths=core_font_metrics.character_widths + ).as_font_resource() + + return font_name, font_resource + + @classmethod + def from_text_annotation( + cls, + acro_form: DictionaryObject, # _root_object[CatalogDictionary.ACRO_FORM]) + field: DictionaryObject, + annotation: DictionaryObject, + user_font_name: str = "", + user_font_size: float = -1, + ) -> "TextStreamAppearance": + """ + Creates a TextStreamAppearance object from a text field annotation. + + This class method is a factory for creating a `TextStreamAppearance` + instance by extracting all necessary information (bounding box, font, + text content, etc.) from the PDF field and annotation dictionaries. + It respects inheritance for properties like default appearance (`/DA`). + + Args: + acro_form: The root AcroForm dictionary from the PDF catalog. + field: The field dictionary object. + annotation: The widget annotation dictionary object associated with the field. + user_font_name: An optional user-provided font name to override the + default. Defaults to an empty string. + user_font_size: An optional user-provided font size to override the + default. A value of -1 indicates no override. + + Returns: + A new `TextStreamAppearance` instance configured for the given field. + + """ + # Calculate rectangle dimensions + _rectangle = cast(RectangleObject, annotation[AnnotationDictionaryAttributes.Rect]) + rectangle = RectangleObject((0, 0, abs(_rectangle[2] - _rectangle[0]), abs(_rectangle[3] - _rectangle[1]))) + + # Get default appearance dictionary from annotation + default_appearance = annotation.get_inherited( + AnnotationDictionaryAttributes.DA, + acro_form.get(AnnotationDictionaryAttributes.DA, None), + ) + if not default_appearance: + # Create a default appearance if none was found in the annotation + default_appearance = TextStringObject("/Helv 0 Tf 0 g") + else: + default_appearance = default_appearance.get_object() + + # Retrieve field text and selected values + field_flags = field.get(FieldDictionaryAttributes.Ff, 0) + if ( + field.get(FieldDictionaryAttributes.FT, "/Tx") == "/Ch" and + field_flags & FieldDictionaryAttributes.FfBits.Combo == 0 + ): + text = "\n".join(annotation.get_inherited(FieldDictionaryAttributes.Opt, [])) + selection = field.get("/V", []) + if not isinstance(selection, list): + selection = [selection] + else: # /Tx + text = field.get("/V", "") + selection = [] + + # Escape parentheses (PDF 1.7 reference, table 3.2, Literal Strings) + text = text.replace("\\", "\\\\").replace("(", r"\(").replace(")", r"\)") + + # Derive font name, size and color from the default appearance. Also set + # user-provided font name and font size in the default appearance, if given. + # For a font name, this presumes that we can find an associated font resource + # dictionary. Uses the variable font_properties as an intermediate. + # As per the PDF spec: + # "At a minimum, the string [that is, default_appearance] shall include a Tf (text + # font) operator along with its two operands, font and size" (Section 12.7.4.3 + # "Variable text" of the PDF 2.0 specification). + font_properties = [prop for prop in re.split(r"\s", default_appearance) if prop] + font_name = font_properties.pop(font_properties.index("Tf") - 2) + font_size = float(font_properties.pop(font_properties.index("Tf") - 1)) + font_properties.remove("Tf") + font_color = " ".join(font_properties) + # Determine the font name to use, prioritizing the user's input + if user_font_name: + font_name = user_font_name + # Determine the font size to use, prioritizing the user's input + if user_font_size > 0: + font_size = user_font_size + + font_name, font_resource = cls._find_annotation_font_resource(font_name, annotation, acro_form) + + # Retrieve formatting information + is_comb = False + max_length = None + if field_flags & FieldDictionaryAttributes.FfBits.Comb: + is_comb = True + max_length = annotation.get("/MaxLen") + is_multiline = False + if field_flags & FieldDictionaryAttributes.FfBits.Multiline: + is_multiline = True + alignment = field.get("/Q", TextAlignment.LEFT) + border_width = 1 + border_style = BorderStyles.SOLID + if "/BS" in field: + border_width = cast(DictionaryObject, field["/BS"]).get("/W", border_width) + border_style = cast(DictionaryObject, field["/BS"]).get("/S", border_style) + + # Create the TextStreamAppearance instance + layout = BaseStreamConfig(rectangle=rectangle, border_width=border_width, border_style=border_style) + new_appearance_stream = cls( + layout, + text, + selection, + font_resource, + font_name=font_name, + font_size=font_size, + font_color=font_color, + is_multiline=is_multiline, + alignment=alignment, + is_comb=is_comb, + max_length=max_length + ) + + if AnnotationDictionaryAttributes.AP in annotation: + for key, value in ( + cast(DictionaryObject, annotation[AnnotationDictionaryAttributes.AP]).get("/N", {}).items() + ): + if key in {"/BBox", "/Length", "/Subtype", "/Type", "/Filter"}: + continue + # Don't overwrite font resources added by TextAppearanceStream.__init__ + if key == "/Resources": + if "/Font" not in value: + value.get_object()[NameObject("/Font")] = DictionaryObject() + value["/Font"].get_object()[NameObject(font_name)] = getattr( + font_resource, "indirect_reference", font_resource + ) + else: + new_appearance_stream[key] = value + + return new_appearance_stream diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_base.py b/python/user_packages/Python313/site-packages/pypdf/generic/_base.py new file mode 100644 index 0000000000000000000000000000000000000000..975e2e12b98c804329ac589b93cfd5a5a5fe2023 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_base.py @@ -0,0 +1,953 @@ +# Copyright (c) 2006, Mathieu Fenniak +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +import binascii +import codecs +import hashlib +import re +import sys +from collections.abc import Sequence +from math import log10 +from struct import iter_unpack +from typing import Any, Callable, ClassVar, Optional, Union, cast + +if sys.version_info[:2] >= (3, 10): + from typing import TypeGuard +else: + from typing_extensions import TypeGuard # PEP 647 + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +from .._codecs import _pdfdoc_encoding_rev +from .._protocols import PdfObjectProtocol, PdfWriterProtocol +from .._utils import ( + StreamType, + classproperty, + deprecation_no_replacement, + deprecation_with_replacement, + logger_warning, + read_non_whitespace, + read_until_regex, +) +from ..errors import STREAM_TRUNCATED_PREMATURELY, PdfReadError, PdfStreamError + +__author__ = "Mathieu Fenniak" +__author_email__ = "biziqe@mathieu.fenniak.net" + + +class PdfObject(PdfObjectProtocol): + # function for calculating a hash value + hash_func: Callable[..., "hashlib._Hash"] = hashlib.sha1 + indirect_reference: Optional["IndirectObject"] + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + raise NotImplementedError( + f"{self.__class__.__name__} does not implement .hash_bin() so far" + ) + + def hash_value_data(self) -> bytes: + return f"{self}".encode() + + def hash_value(self) -> bytes: + return ( + f"{self.__class__.__name__}:" + f"{self.hash_func(self.hash_value_data()).hexdigest()}" + ).encode() + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "PdfObject": + """ + Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter) + without ensuring links. This is used in clone_document_from_root with incremental = True. + + Args: + pdf_dest: Target to clone to. + + Returns: + The cloned PdfObject + + """ + return self.clone(pdf_dest) + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "PdfObject": + """ + Clone object into pdf_dest (PdfWriterProtocol which is an interface for PdfWriter). + + By default, this method will call ``_reference_clone`` (see ``_reference``). + + + Args: + pdf_dest: Target to clone to. + force_duplicate: By default, if the object has already been cloned and referenced, + the copy will be returned; when ``True``, a new copy will be created. + (Default value = ``False``) + ignore_fields: List/tuple of field names (for dictionaries) that will be ignored + during cloning (applies to children duplication as well). If fields are to be + considered for a limited number of levels, you have to add it as integer, for + example ``[1,"/B","/TOTO"]`` means that ``"/B"`` will be ignored at the first + level only but ``"/TOTO"`` on all levels. + + Returns: + The cloned PdfObject + + """ + raise NotImplementedError( + f"{self.__class__.__name__} does not implement .clone so far" + ) + + def _reference_clone( + self, clone: "PdfObject", pdf_dest: PdfWriterProtocol, force_duplicate: bool = False + ) -> "PdfObject": + """ + Reference the object within the _objects of pdf_dest only if + indirect_reference attribute exists (which means the objects was + already identified in xref/xobjstm) if object has been already + referenced do nothing. + + Args: + clone: + pdf_dest: + + Returns: + The clone + + """ + try: + if ( + not force_duplicate + and clone.indirect_reference is not None + and clone.indirect_reference.pdf == pdf_dest + ): + return clone + except Exception: + pass + # if hasattr(clone, "indirect_reference"): + try: + ind = self.indirect_reference + except AttributeError: + return clone + if ( + pdf_dest.incremental + and ind is not None + and ind.pdf == pdf_dest._reader + and ind.idnum <= len(pdf_dest._objects) + ): + i = ind.idnum + else: + i = len(pdf_dest._objects) + 1 + if ind is not None: + if id(ind.pdf) not in pdf_dest._id_translated: + pdf_dest._id_translated[id(ind.pdf)] = {} + pdf_dest._id_translated[id(ind.pdf)]["PreventGC"] = ind.pdf # type: ignore[index] + if ( + not force_duplicate + and ind.idnum in pdf_dest._id_translated[id(ind.pdf)] + ): + obj = pdf_dest.get_object( + pdf_dest._id_translated[id(ind.pdf)][ind.idnum] + ) + assert isinstance(obj, PdfObject), "mypy" + return obj + pdf_dest._id_translated[id(ind.pdf)][ind.idnum] = i + try: + pdf_dest._objects[i - 1] = clone + except IndexError: + pdf_dest._objects.append(clone) + i = len(pdf_dest._objects) + clone.indirect_reference = IndirectObject(i, 0, pdf_dest) + return clone + + def get_object(self) -> Optional["PdfObject"]: + """Resolve indirect references.""" + return self + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + raise NotImplementedError + + +class NullObject(PdfObject): + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "NullObject": + """Clone object into pdf_dest.""" + return cast( + "NullObject", self._reference_clone(NullObject(), pdf_dest, force_duplicate) + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__,)) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"null") + + @staticmethod + def read_from_stream(stream: StreamType) -> "NullObject": + nulltxt = stream.read(4) + if nulltxt != b"null": + raise PdfReadError("Could not read Null object") + return NullObject() + + def __repr__(self) -> str: + return "NullObject" + + def __eq__(self, other: object) -> bool: + return isinstance(other, NullObject) + + def __hash__(self) -> int: + return self.hash_bin() + + +class BooleanObject(PdfObject): + value: bool + + def __init__(self, value: Any) -> None: + self.value = value + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "BooleanObject": + """Clone object into pdf_dest.""" + return cast( + "BooleanObject", + self._reference_clone(BooleanObject(self.value), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.value)) + + def __eq__(self, o: object, /) -> bool: + if isinstance(o, BooleanObject): + return self.value == o.value + if isinstance(o, bool): + return self.value == o + return False + + def __hash__(self) -> int: + return self.hash_bin() + + def __repr__(self) -> str: + return "True" if self.value else "False" + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + if self.value: + stream.write(b"true") + else: + stream.write(b"false") + + @staticmethod + def read_from_stream(stream: StreamType) -> "BooleanObject": + word = stream.read(4) + if word == b"true": + return BooleanObject(True) + if word == b"fals": + stream.read(1) + return BooleanObject(False) + raise PdfReadError("Could not read Boolean object") + + +class IndirectObject(PdfObject): + def __init__(self, idnum: int, generation: int, pdf: Any) -> None: # PdfReader + self.idnum = idnum + self.generation = generation + self.pdf = pdf + + def __hash__(self) -> int: + return hash((self.idnum, self.generation, id(self.pdf))) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.idnum, self.generation, id(self.pdf))) + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "PdfObject": + return IndirectObject(self.idnum, self.generation, pdf_dest) + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "IndirectObject": + """Clone object into pdf_dest.""" + if self.pdf == pdf_dest and not force_duplicate: + # Already duplicated and no extra duplication required + return self + if id(self.pdf) not in pdf_dest._id_translated: + pdf_dest._id_translated[id(self.pdf)] = {} + pdf_dest._id_translated[id(self.pdf)]["PreventGC"] = self.pdf # type: ignore[index] + + if self.idnum in pdf_dest._id_translated[id(self.pdf)]: + dup = pdf_dest.get_object(pdf_dest._id_translated[id(self.pdf)][self.idnum]) + if force_duplicate: + assert dup is not None + assert dup.indirect_reference is not None + idref = dup.indirect_reference + return IndirectObject(idref.idnum, idref.generation, idref.pdf) + else: + obj = self.get_object() + # case observed : a pointed object can not be found + if obj is None: + # this normally + obj = NullObject() + assert isinstance(self, (IndirectObject,)) + obj.indirect_reference = self + dup = pdf_dest._add_object( + obj.clone(pdf_dest, force_duplicate, ignore_fields) + ) + assert isinstance(dup, PdfObject), "mypy" + assert dup.indirect_reference is not None, "mypy" + return dup.indirect_reference + + @property + def indirect_reference(self) -> "IndirectObject": # type: ignore[override] + return self + + def get_object(self) -> Optional["PdfObject"]: + obj: Optional[PdfObject] = self.pdf.get_object(self) + return obj + + def __deepcopy__(self, memo: Any) -> "IndirectObject": + return IndirectObject(self.idnum, self.generation, self.pdf) + + def _get_object_with_check(self) -> Optional["PdfObject"]: + o = self.get_object() + # the check is done here to not slow down get_object() + if isinstance(o, IndirectObject): + raise PdfStreamError( + f"{self.__repr__()} references an IndirectObject {o.__repr__()}" + ) + return o + + def __getattr__(self, name: str) -> Any: + # Attribute not found in object: look in pointed object + try: + return getattr(self._get_object_with_check(), name) + except AttributeError: + raise AttributeError( + f"No attribute {name} found in IndirectObject or pointed object" + ) + + def __getitem__(self, key: Any) -> Any: + # items should be extracted from pointed Object + return self._get_object_with_check()[key] # type: ignore + + def __contains__(self, key: Any) -> bool: + return key in self._get_object_with_check() # type: ignore + + def __iter__(self) -> Any: + return self._get_object_with_check().__iter__() # type: ignore + + def __float__(self) -> str: + # in this case we are looking for the pointed data + return self.get_object().__float__() # type: ignore + + def __int__(self) -> int: + # in this case we are looking for the pointed data + return self.get_object().__int__() # type: ignore + + def __str__(self) -> str: + # in this case we are looking for the pointed data + return self.get_object().__str__() + + def __repr__(self) -> str: + return f"IndirectObject({self.idnum!r}, {self.generation!r}, {id(self.pdf)})" + + def __eq__(self, other: object) -> bool: + return ( + other is not None + and isinstance(other, IndirectObject) + and self.idnum == other.idnum + and self.generation == other.generation + and self.pdf is other.pdf + ) + + def __ne__(self, other: object) -> bool: + return not self.__eq__(other) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(f"{self.idnum} {self.generation} R".encode()) + + @staticmethod + def read_from_stream(stream: StreamType, pdf: Any) -> "IndirectObject": # PdfReader + idnum = b"" + while True: + tok = stream.read(1) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok.isspace(): + break + idnum += tok + generation = b"" + while True: + tok = stream.read(1) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok.isspace(): + if not generation: + continue + break + generation += tok + r = read_non_whitespace(stream) + if r != b"R": + raise PdfReadError( + f"Error reading indirect object reference at byte {hex(stream.tell())}" + ) + return IndirectObject(int(idnum), int(generation), pdf) + + +FLOAT_WRITE_PRECISION = 8 # shall be min 5 digits max, allow user adj + + +class FloatObject(float, PdfObject): + def __new__( + cls, value: Any = "0.0", context: Optional[Any] = None + ) -> Self: + try: + value = float(value) + return float.__new__(cls, value) + except Exception as e: + # If this isn't a valid decimal (happens in malformed PDFs) + # fallback to 0 + logger_warning( + f"{e} : FloatObject ({value}) invalid; use 0.0 instead", __name__ + ) + return float.__new__(cls, 0.0) + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "FloatObject": + """Clone object into pdf_dest.""" + return cast( + "FloatObject", + self._reference_clone(FloatObject(self), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.as_numeric)) + + def myrepr(self) -> str: + if self == 0: # type: ignore[comparison-overlap] + return "0.0" + nb = FLOAT_WRITE_PRECISION - int(log10(abs(self))) + return f"{self:.{max(1, nb)}f}".rstrip("0").rstrip(".") + + def __repr__(self) -> str: + return self.myrepr() # repr(float(self)) + + def as_numeric(self) -> float: + return float(self) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(self.myrepr().encode("utf8")) + + +class NumberObject(int, PdfObject): + NumberPattern = re.compile(b"[^+-.0-9]") + + def __new__(cls, value: Any) -> Self: + try: + return int.__new__(cls, int(value)) + except ValueError: + logger_warning(f"NumberObject({value}) invalid; use 0 instead", __name__) + return int.__new__(cls, 0) + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "NumberObject": + """Clone object into pdf_dest.""" + return cast( + "NumberObject", + self._reference_clone(NumberObject(self), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.as_numeric())) + + def as_numeric(self) -> int: + return int(repr(self).encode("utf8")) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(repr(self).encode("utf8")) + + @staticmethod + def read_from_stream(stream: StreamType) -> Union["NumberObject", "FloatObject"]: + num = read_until_regex(stream, NumberObject.NumberPattern) + if b"." in num: + return FloatObject(num) + return NumberObject(num) + + +class ByteStringObject(bytes, PdfObject): + """ + Represents a string object where the text encoding could not be determined. + + This occurs quite often, as the PDF spec doesn't provide an alternate way to + represent strings -- for example, the encryption data stored in files (like + /O) is clearly not text, but is still stored in a "String" object. + """ + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "ByteStringObject": + """Clone object into pdf_dest.""" + return cast( + "ByteStringObject", + self._reference_clone( + ByteStringObject(bytes(self)), pdf_dest, force_duplicate + ), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, bytes(self))) + + @property + def original_bytes(self) -> bytes: + """For compatibility with TextStringObject.original_bytes.""" + return self + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<") + stream.write(binascii.hexlify(self)) + stream.write(b">") + + def __str__(self) -> str: + charset_to_try = ["utf-16", *list(NameObject.CHARSETS)] + for enc in charset_to_try: + try: + return self.decode(enc) + except UnicodeDecodeError: + pass + raise PdfReadError("Cannot decode ByteStringObject.") + + +class TextStringObject(str, PdfObject): # noqa: SLOT000 + """ + A string object that has been decoded into a real unicode string. + + If read from a PDF document, this string appeared to match the + PDFDocEncoding, or contained a UTF-16BE BOM mark to cause UTF-16 decoding + to occur. + """ + + autodetect_pdfdocencoding: bool + autodetect_utf16: bool + utf16_bom: bytes + _original_bytes: Optional[bytes] = None + + def __new__(cls, value: Any) -> Self: + original_bytes = None + if isinstance(value, bytes): + original_bytes = value + value = value.decode("charmap") + text_string_object = str.__new__(cls, value) + text_string_object._original_bytes = original_bytes + text_string_object.autodetect_utf16 = False + text_string_object.autodetect_pdfdocencoding = False + text_string_object.utf16_bom = b"" + if original_bytes is not None and original_bytes[:2] in {codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE}: + # The value of `original_bytes` is only set for inputs being `bytes`. + # If this is UTF-16 data according to the BOM (first two characters), + # perform special handling. All other cases should not need any special conversion + # due to already being a string. + try: + text_string_object = str.__new__(cls, original_bytes.decode("utf-16")) + except UnicodeDecodeError as exception: + logger_warning( + f"{exception!s}\ninitial string:{exception.object!r}", + __name__, + ) + text_string_object = str.__new__(cls, exception.object[: exception.start].decode("utf-16")) + text_string_object._original_bytes = original_bytes + text_string_object.autodetect_utf16 = True + text_string_object.utf16_bom = original_bytes[:2] + else: + try: + encode_pdfdocencoding(text_string_object) + text_string_object.autodetect_pdfdocencoding = True + except UnicodeEncodeError: + text_string_object.autodetect_utf16 = True + text_string_object.utf16_bom = codecs.BOM_UTF16_BE + return text_string_object + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "TextStringObject": + """Clone object into pdf_dest.""" + obj = TextStringObject(self) + obj._original_bytes = self._original_bytes + obj.autodetect_pdfdocencoding = self.autodetect_pdfdocencoding + obj.autodetect_utf16 = self.autodetect_utf16 + obj.utf16_bom = self.utf16_bom + return cast( + "TextStringObject", self._reference_clone(obj, pdf_dest, force_duplicate) + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self.original_bytes)) + + @property + def original_bytes(self) -> bytes: + """ + It is occasionally possible that a text string object gets created where + a byte string object was expected due to the autodetection mechanism -- + if that occurs, this "original_bytes" property can be used to + back-calculate what the original encoded bytes were. + """ + if self._original_bytes is not None: + return self._original_bytes + return self.get_original_bytes() + + def get_original_bytes(self) -> bytes: + # We're a text string object, but the library is trying to get our raw + # bytes. This can happen if we auto-detected this string as text, but + # we were wrong. It's pretty common. Return the original bytes that + # would have been used to create this object, based upon the autodetect + # method. + if self.autodetect_utf16: + if self.utf16_bom == codecs.BOM_UTF16_LE: + return codecs.BOM_UTF16_LE + self.encode("utf-16le") + if self.utf16_bom == codecs.BOM_UTF16_BE: + return codecs.BOM_UTF16_BE + self.encode("utf-16be") + return self.encode("utf-16be") + if self.autodetect_pdfdocencoding: + return encode_pdfdocencoding(self) + raise Exception("no information about original bytes") # pragma: no cover + + def get_encoded_bytes(self) -> bytes: + # Try to write the string out as a PDFDocEncoding encoded string. It's + # nicer to look at in the PDF file. Sadly, we take a performance hit + # here for trying... + try: + if self._original_bytes is not None: + return self._original_bytes + if self.autodetect_utf16: + raise UnicodeEncodeError("", "forced", -1, -1, "") + bytearr = encode_pdfdocencoding(self) + except UnicodeEncodeError: + if self.utf16_bom == codecs.BOM_UTF16_LE: + bytearr = codecs.BOM_UTF16_LE + self.encode("utf-16le") + elif self.utf16_bom == codecs.BOM_UTF16_BE: + bytearr = codecs.BOM_UTF16_BE + self.encode("utf-16be") + else: + bytearr = self.encode("utf-16be") + return bytearr + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + bytearr = self.get_encoded_bytes() + stream.write(b"(") + for c_ in iter_unpack("c", bytearr): + c = cast(bytes, c_[0]) + if not c.isalnum() and c != b" ": + # This: + # stream.write(rf"\{c:0>3o}".encode()) + # gives + # https://github.com/davidhalter/parso/issues/207 + stream.write(b"\\%03o" % ord(c)) + else: + stream.write(c) + stream.write(b")") + + +class NameObject(str, PdfObject): # noqa: SLOT000 + delimiter_pattern = re.compile(rb"\s+|[\(\)<>\[\]{}/%]") + prefix = b"/" + renumber_table: ClassVar[dict[str, bytes]] = { + **{chr(i): f"#{i:02X}".encode() for i in b"#()<>[]{}/%"}, + **{chr(i): f"#{i:02X}".encode() for i in range(33)}, + } + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "NameObject": + """Clone object into pdf_dest.""" + return cast( + "NameObject", + self._reference_clone(NameObject(self), pdf_dest, force_duplicate), + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, self)) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(self.renumber()) + + def renumber(self) -> bytes: + out = self[0].encode("utf-8") + if out != b"/": + deprecation_no_replacement( + f"Incorrect first char in NameObject, should start with '/': ({self})", + "5.0.0", + ) + parts = [out] + for c in self[1:]: + if c > "~": + parts.extend(f"#{x:02X}".encode() for x in c.encode("utf-8")) + else: + try: + parts.append(self.renumber_table[c]) + except KeyError: + parts.append(c.encode("utf-8")) + return b"".join(parts) + + def _sanitize(self) -> "NameObject": + """ + Sanitize the NameObject's name to be a valid PDF name part + (alphanumeric, underscore, hyphen). The _sanitize method replaces + spaces and any non-alphanumeric/non-underscore/non-hyphen with + underscores. + + Returns: + NameObject with sanitized name. + """ + name = str(self).removeprefix("/") + name = re.sub(r"\ ", "_", name) + name = re.sub(r"[^a-zA-Z0-9_-]", "_", name) + return NameObject("/" + name) + + @classproperty + def surfix(cls) -> bytes: # noqa: N805 + deprecation_with_replacement("surfix", "prefix", "5.0.0") + return b"/" + + @staticmethod + def unnumber(sin: bytes) -> bytes: + result = bytearray() + i = 0 + while i < len(sin): + if sin[i:i + 1] == b"#": + try: + result.append(int(sin[i + 1 : i + 3], 16)) + i += 3 + continue + except (ValueError, IndexError): + # if the 2 characters after # can not be converted to hex + # we change nothing and carry on + pass + result.append(sin[i]) + i += 1 + return bytes(result) + + CHARSETS = ("utf-8", "gbk", "latin1") + + @staticmethod + def read_from_stream(stream: StreamType, pdf: Any) -> "NameObject": # PdfReader + name = stream.read(1) + if name != NameObject.prefix: + raise PdfReadError("Name read error") + name += read_until_regex(stream, NameObject.delimiter_pattern) + try: + # Name objects should represent irregular characters + # with a '#' followed by the symbol's hex number + name = NameObject.unnumber(name) + for enc in NameObject.CHARSETS: + try: + ret = name.decode(enc) + return NameObject(ret) + except Exception: + pass + raise UnicodeDecodeError("", name, 0, 0, "Code Not Found") + except (UnicodeEncodeError, UnicodeDecodeError) as e: + if not pdf.strict: + logger_warning( + f"Illegal character in NameObject ({name!r}), " + "you may need to adjust NameObject.CHARSETS", + __name__, + ) + return NameObject(name.decode("charmap")) + raise PdfReadError( + f"Illegal character in NameObject ({name!r}). " + "You may need to adjust NameObject.CHARSETS.", + ) from e + + +def encode_pdfdocencoding(unicode_string: str) -> bytes: + try: + return bytes([_pdfdoc_encoding_rev[k] for k in unicode_string]) + except KeyError: + raise UnicodeEncodeError( + "pdfdocencoding", + unicode_string, + -1, + -1, + "does not exist in translation table", + ) + + +def is_null_or_none(x: Any) -> TypeGuard[Union[None, NullObject, IndirectObject]]: + """ + Returns: + True if x is None or NullObject. + + """ + return x is None or ( + isinstance(x, PdfObject) + and (x.get_object() is None or isinstance(x.get_object(), NullObject)) + ) diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_data_structures.py b/python/user_packages/Python313/site-packages/pypdf/generic/_data_structures.py new file mode 100644 index 0000000000000000000000000000000000000000..12a064653262c23ea1ed57b8381e2d2a081bcbbd --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_data_structures.py @@ -0,0 +1,1804 @@ +# Copyright (c) 2006, Mathieu Fenniak +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +__author__ = "Mathieu Fenniak" +__author_email__ = "biziqe@mathieu.fenniak.net" + +import logging +import re +import sys +from collections.abc import Iterable, Sequence +from io import BytesIO +from math import ceil +from typing import ( + Any, + Callable, + Optional, + Union, + cast, +) + +from .._protocols import PdfReaderProtocol, PdfWriterProtocol, XmpInformationProtocol +from .._utils import ( + WHITESPACES, + BinaryStreamType, + StreamType, + deprecation_no_replacement, + logger_warning, + read_non_whitespace, + read_until_regex, + read_until_whitespace, + skip_over_comment, +) +from ..constants import ( + CheckboxRadioButtonAttributes, + FieldDictionaryAttributes, + OutlineFontFlag, + StreamAttributes, +) +from ..constants import FilterTypes as FT +from ..constants import TypArguments as TA +from ..constants import TypFitArguments as TF +from ..errors import STREAM_TRUNCATED_PREMATURELY, LimitReachedError, PdfReadError, PdfStreamError +from ._base import ( + BooleanObject, + ByteStringObject, + FloatObject, + IndirectObject, + NameObject, + NullObject, + NumberObject, + PdfObject, + TextStringObject, + is_null_or_none, +) +from ._fit import Fit +from ._image_inline import ( + extract_inline__ascii85_decode, + extract_inline__ascii_hex_decode, + extract_inline__dct_decode, + extract_inline__run_length_decode, + extract_inline_default, +) +from ._utils import read_hex_string_from_stream, read_string_from_stream + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +logger = logging.getLogger(__name__) + +IndirectPattern = re.compile(rb"[+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]") + + +class ArrayObject(list[Any], PdfObject): + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "ArrayObject": + arr = cast( + "ArrayObject", + self._reference_clone(ArrayObject(), pdf_dest, False), + ) + for data in self: + if hasattr(data, "replicate"): + arr.append(data.replicate(pdf_dest)) + else: + arr.append(data) + return arr + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "ArrayObject": + """Clone object into pdf_dest.""" + try: + if self.indirect_reference.pdf == pdf_dest and not force_duplicate: # type: ignore + return self + except Exception: + pass + arr = cast( + "ArrayObject", + self._reference_clone(ArrayObject(), pdf_dest, force_duplicate=True), + ) + for data in self: + if isinstance(data, StreamObject): + dup = data._reference_clone( + data.clone(pdf_dest, force_duplicate, ignore_fields), + pdf_dest, + force_duplicate, + ) + arr.append(dup.indirect_reference) + elif isinstance(data, IndirectObject) and isinstance(resolved := data.get_object(), StreamObject): + dup = data._reference_clone( + resolved.clone(pdf_dest, force_duplicate=True, ignore_fields=ignore_fields), + pdf_dest, + force_duplicate, + ) + arr.append(dup.indirect_reference) + elif hasattr(data, "clone"): + arr.append(data.clone(pdf_dest, force_duplicate, ignore_fields)) + else: + arr.append(data) + return arr + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash((self.__class__, tuple(x.hash_bin() for x in self))) + + def items(self) -> Iterable[Any]: + """Emulate DictionaryObject.items for a list (index, object).""" + return enumerate(self) + + def _to_lst(self, lst: Any) -> list[Any]: + # Convert to list, internal + result: list[Any] + if isinstance(lst, (list, tuple, set)): + result = list(lst) + elif isinstance(lst, PdfObject): + result = [lst] + elif isinstance(lst, str): + if lst[0] == "/": + result = [NameObject(lst)] + else: + result = [TextStringObject(lst)] + elif isinstance(lst, bytes): + result = [ByteStringObject(lst)] + else: # for numbers,... + result = [lst] + return result + + def __add__(self, lst: Any) -> "ArrayObject": + """ + Allow extension by adding list or add one element only + + Args: + lst: any list, tuples are extended the list. + other types(numbers,...) will be appended. + if str is passed it will be converted into TextStringObject + or NameObject (if starting with "/") + if bytes is passed it will be converted into ByteStringObject + + Returns: + ArrayObject with all elements + + """ + temp = ArrayObject(self) + temp.extend(self._to_lst(lst)) + return temp + + def __iadd__(self, lst: Any) -> Self: + """ + Allow extension by adding list or add one element only + + Args: + lst: any list, tuples are extended the list. + other types(numbers,...) will be appended. + if str is passed it will be converted into TextStringObject + or NameObject (if starting with "/") + if bytes is passed it will be converted into ByteStringObject + + """ + self.extend(self._to_lst(lst)) + return self + + def __isub__(self, lst: Any) -> Self: + """Allow to remove items""" + for x in self._to_lst(lst): + try: + index = self.index(x) + del self[index] + except ValueError: + pass + return self + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"[") + for data in self: + stream.write(b" ") + data.write_to_stream(stream) + stream.write(b" ]") + + @staticmethod + def read_from_stream( + stream: StreamType, + pdf: Optional[PdfReaderProtocol], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, + ) -> "ArrayObject": + arr = ArrayObject() + tmp = stream.read(1) + if tmp != b"[": + raise PdfReadError("Could not read array") + while True: + # skip leading whitespace + tok = stream.read(1) + while tok.isspace(): + tok = stream.read(1) + if tok == b"": + break + if tok == b"%": + stream.seek(-1, 1) + skip_over_comment(stream) + continue + stream.seek(-1, 1) + # check for array ending + peek_ahead = stream.read(1) + if peek_ahead == b"]": + break + stream.seek(-1, 1) + # read and append object + arr.append(read_object(stream, pdf, forced_encoding)) + return arr + + +class DictionaryObject(dict[Any, Any], PdfObject): + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "DictionaryObject": + d__ = cast( + "DictionaryObject", + self._reference_clone(self.__class__(), pdf_dest, False), + ) + for k, v in self.items(): + d__[k.replicate(pdf_dest)] = ( + v.replicate(pdf_dest) if hasattr(v, "replicate") else v + ) + return d__ + + def clone( + self, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "DictionaryObject": + """Clone object into pdf_dest.""" + try: + if self.indirect_reference.pdf == pdf_dest and not force_duplicate: # type: ignore + return self + except Exception: + pass + + visited: set[tuple[int, int]] = set() # (idnum, generation) + d__ = cast( + "DictionaryObject", + self._reference_clone(self.__class__(), pdf_dest, force_duplicate), + ) + if ignore_fields is None: + ignore_fields = [] + if len(d__.keys()) == 0: + d__._clone(self, pdf_dest, force_duplicate, ignore_fields, visited) + return d__ + + def _clone( + self, + src: "DictionaryObject", + pdf_dest: PdfWriterProtocol, + force_duplicate: bool, + ignore_fields: Optional[Sequence[Union[str, int]]], + visited: set[tuple[int, int]], # (idnum, generation) + ) -> None: + """ + Update the object from src. + + Args: + src: "DictionaryObject": + pdf_dest: + force_duplicate: + ignore_fields: + + """ + # First we remove the ignore_fields + # that are for a limited number of levels + assert ignore_fields is not None + ignore_fields = list(ignore_fields) + x = 0 + while x < len(ignore_fields): + if isinstance(ignore_fields[x], int): + if cast(int, ignore_fields[x]) <= 0: + del ignore_fields[x] + del ignore_fields[x] + continue + ignore_fields[x] -= 1 # type:ignore + x += 1 + # Check if this is a chain list, we need to loop to prevent recur + if any( + field not in ignore_fields + and field in src + and isinstance(src.raw_get(field), IndirectObject) + and isinstance(src[field], DictionaryObject) + and ( + src.get("/Type", None) is None + or cast(DictionaryObject, src[field]).get("/Type", None) is None + or src.get("/Type", None) + == cast(DictionaryObject, src[field]).get("/Type", None) + ) + for field in ["/Next", "/Prev", "/N", "/V"] + ): + ignore_fields = list(ignore_fields) + for lst in (("/Next", "/Prev"), ("/N", "/V")): + for k in lst: + objs = [] + if ( + k in src + and k not in self + and isinstance(src.raw_get(k), IndirectObject) + and isinstance(src[k], DictionaryObject) + # If need to go further the idea is to check + # that the types are the same + and ( + src.get("/Type", None) is None + or cast(DictionaryObject, src[k]).get("/Type", None) is None + or src.get("/Type", None) + == cast(DictionaryObject, src[k]).get("/Type", None) + ) + ): + cur_obj: Optional[DictionaryObject] = cast( + "DictionaryObject", src[k] + ) + prev_obj: Optional[DictionaryObject] = self + while cur_obj is not None: + clon = cast( + "DictionaryObject", + cur_obj._reference_clone( + cur_obj.__class__(), pdf_dest, force_duplicate + ), + ) + # Check to see if we've previously processed our item + if clon.indirect_reference is not None: + idnum = clon.indirect_reference.idnum + generation = clon.indirect_reference.generation + if (idnum, generation) in visited: + cur_obj = None + break + visited.add((idnum, generation)) + objs.append((cur_obj, clon)) + assert prev_obj is not None + prev_obj[NameObject(k)] = clon.indirect_reference + prev_obj = clon + try: + if cur_obj == src: + cur_obj = None + else: + cur_obj = cast("DictionaryObject", cur_obj[k]) + except Exception: + cur_obj = None + for s, c in objs: + c._clone( + s, pdf_dest, force_duplicate, ignore_fields, visited + ) + + for k, v in src.items(): + if k not in ignore_fields: + if isinstance(v, StreamObject): + if not hasattr(v, "indirect_reference"): + v.indirect_reference = None + vv = v.clone(pdf_dest, force_duplicate, ignore_fields) + assert vv.indirect_reference is not None + self[k.clone(pdf_dest)] = vv.indirect_reference + elif k not in self: + self[NameObject(k)] = ( + v.clone(pdf_dest, force_duplicate, ignore_fields) + if hasattr(v, "clone") + else v + ) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + return hash( + (self.__class__, tuple(((k, v.hash_bin()) for k, v in self.items()))) + ) + + def raw_get(self, key: Any) -> Any: + return dict.__getitem__(self, key) + + def get_inherited(self, key: str, default: Any = None) -> Any: + """ + Returns the value of a key or from the parent if not found. + If not found returns default. + + Args: + key: string identifying the field to return + + default: default value to return + + Returns: + Current key or inherited one, otherwise default value. + + """ + if key in self: + return self[key] + try: + if "/Parent" not in self: + return default + raise KeyError("Not present") + except KeyError: + return cast("DictionaryObject", self["/Parent"].get_object()).get_inherited( + key, default + ) + + def __setitem__(self, key: Any, value: Any) -> Any: + if not isinstance(key, PdfObject): + raise ValueError("Key must be a PdfObject") + if not isinstance(value, PdfObject): + raise ValueError("Value must be a PdfObject") + return dict.__setitem__(self, key, value) + + def setdefault(self, key: Any, value: Optional[Any] = None) -> Any: + if not isinstance(key, PdfObject): + raise ValueError("Key must be a PdfObject") + if not isinstance(value, PdfObject): + raise ValueError("Value must be a PdfObject") + return dict.setdefault(self, key, value) + + def __getitem__(self, key: Any) -> PdfObject: + return cast(PdfObject, dict.__getitem__(self, key).get_object()) + + @property + def xmp_metadata(self) -> Optional[XmpInformationProtocol]: + """ + Retrieve XMP (Extensible Metadata Platform) data relevant to this + object, if available. + + See Table 347 — Additional entries in a metadata stream dictionary. + + Returns: + Returns a :class:`~pypdf.xmp.XmpInformation` instance + that can be used to access XMP metadata from the document. Can also + return None if no metadata was found on the document root. + + """ + from ..xmp import XmpInformation # noqa: PLC0415 + + metadata = self.get("/Metadata", None) + if is_null_or_none(metadata): + return None + assert metadata is not None, "mypy" + metadata = metadata.get_object() + return XmpInformation(metadata) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<<\n") + for key, value in self.items(): + if len(key) > 2 and key[1] == "%" and key[-1] == "%": + continue + key.write_to_stream(stream, encryption_key) + stream.write(b" ") + value.write_to_stream(stream) + stream.write(b"\n") + stream.write(b">>") + + @classmethod + def _get_next_object_position( + cls, position_before: int, position_end: int, generations: list[int], pdf: PdfReaderProtocol + ) -> int: + out = position_end + for generation in generations: + location = pdf.xref[generation] + values = [x for x in location.values() if position_before < x <= position_end] + if values: + out = min(out, *values) + return out + + @classmethod + def _read_unsized_from_stream( + cls, stream: BinaryStreamType, pdf: PdfReaderProtocol + ) -> bytes: + object_position = cls._get_next_object_position( + position_before=stream.tell(), position_end=2 ** 32, generations=list(pdf.xref), pdf=pdf + ) - 1 + current_position = stream.tell() + # Read until the next object position. + read_value = stream.read(object_position - stream.tell()) + endstream_position = read_value.find(b"endstream") + if endstream_position < 0: + raise PdfReadError( + f"Unable to find 'endstream' marker for obj starting at {current_position}." + ) + # 9 = len(b"endstream") + stream.seek(current_position + endstream_position + 9) + return read_value[: endstream_position - 1] + + @staticmethod + def read_from_stream( + stream: StreamType, + pdf: Optional[PdfReaderProtocol], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, + ) -> "DictionaryObject": + tmp = stream.read(2) + if tmp != b"<<": + raise PdfReadError( + f"Dictionary read error at byte {hex(stream.tell())}: " + "stream must begin with '<<'" + ) + data: dict[Any, Any] = {} + while True: + tok = read_non_whitespace(stream) + if tok == b"\x00": + continue + if tok == b"%": + stream.seek(-1, 1) + skip_over_comment(stream) + continue + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + + if tok == b">": + stream.read(1) + break + stream.seek(-1, 1) + try: + try: + key = read_object(stream, pdf) + if isinstance(key, NullObject): + break + if not isinstance(key, NameObject): + raise PdfReadError( + f"Expecting a NameObject for key but found {key!r}" + ) + except PdfReadError as exc: + if pdf is not None and pdf.strict: + raise + logger_warning(exc.__repr__(), __name__) + continue + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + value = read_object(stream, pdf, forced_encoding) + except (RecursionError, LimitReachedError) as exc: + raise PdfReadError(exc.__repr__()) + except Exception as exc: + if pdf is not None and pdf.strict: + raise PdfReadError(exc.__repr__()) + logger_warning(exc.__repr__(), __name__) + retval = DictionaryObject() + retval.update(data) + return retval # return partial data + + if not data.get(key): + data[key] = value + else: + # multiple definitions of key not permitted + msg = ( + f"Multiple definitions in dictionary at byte " + f"{hex(stream.tell())} for key {key}" + ) + if pdf is not None and pdf.strict: + raise PdfReadError(msg) + logger_warning(msg, __name__) + + pos = stream.tell() + s = read_non_whitespace(stream) + if s == b"s" and stream.read(5) == b"tream": + eol = stream.read(1) + # Occasional PDF file output has spaces after 'stream' keyword but before EOL. + # patch provided by Danial Sandler + while eol == b" ": + eol = stream.read(1) + if eol not in (b"\n", b"\r"): + raise PdfStreamError("Stream data must be followed by a newline") + if eol == b"\r" and stream.read(1) != b"\n": + stream.seek(-1, 1) + # this is a stream object, not a dictionary + if StreamAttributes.LENGTH not in data: + if pdf is not None and pdf.strict: + raise PdfStreamError("Stream length not defined") + logger_warning( + f"Stream length not defined @pos={stream.tell()}", __name__ + ) + data[NameObject(StreamAttributes.LENGTH)] = NumberObject(-1) + length = data[StreamAttributes.LENGTH] + if isinstance(length, IndirectObject): + t = stream.tell() + assert pdf is not None, "mypy" + length = pdf.get_object(length) + stream.seek(t, 0) + if length is None: # if the PDF is damaged + length = -1 + pstart = stream.tell() + if length >= 0: + from ..filters import MAX_DECLARED_STREAM_LENGTH # noqa: PLC0415 + if length > MAX_DECLARED_STREAM_LENGTH: + raise LimitReachedError(f"Declared stream length of {length} exceeds maximum allowed length.") + + data["__streamdata__"] = stream.read(length) + else: + data["__streamdata__"] = read_until_regex( + stream, re.compile(b"endstream") + ) + e = read_non_whitespace(stream) + ndstream = stream.read(8) + if (e + ndstream) != b"endstream": + # the odd PDF file has a length that is too long, so + # we need to read backwards to find the "endstream" ending. + # ReportLab (unknown version) generates files with this bug, + # and Python users into PDF files tend to be our audience. + # we need to do this to correct the streamdata and chop off + # an extra character. + pos = stream.tell() + stream.seek(-10, 1) + end = stream.read(9) + if end == b"endstream": + # we found it by looking back one character further. + data["__streamdata__"] = data["__streamdata__"][:-1] + elif pdf is not None and not pdf.strict: + stream.seek(pstart, 0) + data["__streamdata__"] = DictionaryObject._read_unsized_from_stream(stream, pdf) + pos = stream.tell() + else: + stream.seek(pos, 0) + raise PdfReadError( + "Unable to find 'endstream' marker after stream at byte " + f"{hex(stream.tell())} (nd='{ndstream!r}', end='{end!r}')." + ) + else: + stream.seek(pos, 0) + if "__streamdata__" in data: + return StreamObject.initialize_from_dictionary(data) + retval = DictionaryObject() + retval.update(data) + return retval + + +class TreeObject(DictionaryObject): + def __init__(self, dct: Optional[DictionaryObject] = None) -> None: + DictionaryObject.__init__(self) + if dct: + self.update(dct) + + def has_children(self) -> bool: + return "/First" in self + + def __iter__(self) -> Any: + return self.children() + + def children(self) -> Iterable[Any]: + if not self.has_children(): + return + + child_ref = self[NameObject("/First")] + last = self[NameObject("/Last")] + child = child_ref.get_object() + visited: set[int] = set() + while True: + child_id = id(child) + if child_id in visited: + logger_warning(f"Detected cycle in outline structure for {child}", __name__) + return + visited.add(child_id) + + yield child + + if child == last: + return + child_ref = child.get(NameObject("/Next")) # type: ignore + if is_null_or_none(child_ref): + return + child = child_ref.get_object() + + def add_child(self, child: Any, pdf: PdfWriterProtocol) -> None: + self.insert_child(child, None, pdf) + + def inc_parent_counter_default( + self, parent: Union[None, IndirectObject, "TreeObject"], n: int + ) -> None: + if is_null_or_none(parent): + return + assert parent is not None, "mypy" + parent = cast("TreeObject", parent.get_object()) + if "/Count" in parent: + parent[NameObject("/Count")] = NumberObject( + max(0, cast(int, parent[NameObject("/Count")]) + n) + ) + self.inc_parent_counter_default(parent.get("/Parent", None), n) + + def inc_parent_counter_outline( + self, parent: Union[None, IndirectObject, "TreeObject"], n: int + ) -> None: + if is_null_or_none(parent): + return + assert parent is not None, "mypy" + parent = cast("TreeObject", parent.get_object()) + # BooleanObject requires comparison with == not is + opn = parent.get("/%is_open%", True) == True # noqa: E712 + c = cast(int, parent.get("/Count", 0)) + if c < 0: + c = abs(c) + parent[NameObject("/Count")] = NumberObject((c + n) * (1 if opn else -1)) + if not opn: + return + self.inc_parent_counter_outline(parent.get("/Parent", None), n) + + def insert_child( + self, + child: Any, + before: Any, + pdf: PdfWriterProtocol, + inc_parent_counter: Optional[Callable[..., Any]] = None, + ) -> IndirectObject: + if inc_parent_counter is None: + inc_parent_counter = self.inc_parent_counter_default + child_obj = child.get_object() + assert child.indirect_reference is not None, "mypy" + child_reference: IndirectObject = child.indirect_reference + + prev: Optional[DictionaryObject] + if "/First" not in self: # no child yet + self[NameObject("/First")] = child_reference + self[NameObject("/Count")] = NumberObject(0) + self[NameObject("/Last")] = child_reference + child_obj[NameObject("/Parent")] = self.indirect_reference + inc_parent_counter(self, child_obj.get("/Count", 1)) + if "/Next" in child_obj: + del child_obj["/Next"] + if "/Prev" in child_obj: + del child_obj["/Prev"] + return child_reference + prev = cast("DictionaryObject", self["/Last"]) + + while prev.indirect_reference != before: + if "/Next" in prev: + prev = cast("TreeObject", prev["/Next"]) + else: # append at the end + prev[NameObject("/Next")] = cast("TreeObject", child_reference) + child_obj[NameObject("/Prev")] = prev.indirect_reference + child_obj[NameObject("/Parent")] = self.indirect_reference + if "/Next" in child_obj: + del child_obj["/Next"] + self[NameObject("/Last")] = child_reference + inc_parent_counter(self, child_obj.get("/Count", 1)) + return child_reference + try: # insert as first or in the middle + assert isinstance(prev["/Prev"], DictionaryObject) + prev["/Prev"][NameObject("/Next")] = child_reference + child_obj[NameObject("/Prev")] = prev["/Prev"] + except Exception: # it means we are inserting in first position + del child_obj["/Next"] + child_obj[NameObject("/Next")] = prev + prev[NameObject("/Prev")] = child_reference + child_obj[NameObject("/Parent")] = self.indirect_reference + inc_parent_counter(self, child_obj.get("/Count", 1)) + return child_reference + + def _remove_node_from_tree( + self, prev: Any, prev_ref: Any, cur: Any, last: Any + ) -> None: + """ + Adjust the pointers of the linked list and tree node count. + + Args: + prev: + prev_ref: + cur: + last: + + """ + next_ref = cur.get(NameObject("/Next"), None) + if prev is None: + if next_ref: + # Removing first tree node + next_obj = next_ref.get_object() + del next_obj[NameObject("/Prev")] + self[NameObject("/First")] = next_ref + self[NameObject("/Count")] = NumberObject( + self[NameObject("/Count")] - 1 # type: ignore + ) + + else: + # Removing only tree node + self[NameObject("/Count")] = NumberObject(0) + del self[NameObject("/First")] + if NameObject("/Last") in self: + del self[NameObject("/Last")] + else: + if next_ref: + # Removing middle tree node + next_obj = next_ref.get_object() + next_obj[NameObject("/Prev")] = prev_ref + prev[NameObject("/Next")] = next_ref + else: + # Removing last tree node + assert cur == last + del prev[NameObject("/Next")] + self[NameObject("/Last")] = prev_ref + self[NameObject("/Count")] = NumberObject(self[NameObject("/Count")] - 1) # type: ignore + + def remove_child(self, child: Any) -> None: + child_obj = child.get_object() + child = child_obj.indirect_reference + + if NameObject("/Parent") not in child_obj: + raise ValueError("Removed child does not appear to be a tree item") + if child_obj[NameObject("/Parent")] != self: + raise ValueError("Removed child is not a member of this tree") + + found = False + prev_ref = None + prev = None + cur_ref: Optional[Any] = self[NameObject("/First")] + cur: Optional[dict[str, Any]] = cur_ref.get_object() # type: ignore + last_ref = self[NameObject("/Last")] + last = last_ref.get_object() + while cur is not None: + if cur == child_obj: + self._remove_node_from_tree(prev, prev_ref, cur, last) + found = True + break + + # Go to the next node + prev_ref = cur_ref + prev = cur + if NameObject("/Next") in cur: + cur_ref = cur[NameObject("/Next")] + cur = cur_ref.get_object() + else: + cur_ref = None + cur = None + + if not found: + raise ValueError("Removal couldn't find item in tree") + + _reset_node_tree_relationship(child_obj) + + def remove_from_tree(self) -> None: + """Remove the object from the tree it is in.""" + if NameObject("/Parent") not in self: + raise ValueError("Removed child does not appear to be a tree item") + cast("TreeObject", self["/Parent"]).remove_child(self) + + def empty_tree(self) -> None: + for child in self: + child_obj = child.get_object() + _reset_node_tree_relationship(child_obj) + + if NameObject("/Count") in self: + del self[NameObject("/Count")] + if NameObject("/First") in self: + del self[NameObject("/First")] + if NameObject("/Last") in self: + del self[NameObject("/Last")] + + +def _reset_node_tree_relationship(child_obj: Any) -> None: + """ + Call this after a node has been removed from a tree. + + This resets the nodes attributes in respect to that tree. + + Args: + child_obj: + + """ + del child_obj[NameObject("/Parent")] + if NameObject("/Next") in child_obj: + del child_obj[NameObject("/Next")] + if NameObject("/Prev") in child_obj: + del child_obj[NameObject("/Prev")] + + +class StreamObject(DictionaryObject): + def __init__(self) -> None: + self._data: bytes = b"" + self.decoded_self: Optional[DecodedStreamObject] = None + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "StreamObject": + d__ = cast( + "StreamObject", + self._reference_clone(self.__class__(), pdf_dest, False), + ) + d__._data = self._data + try: + decoded_self = self.decoded_self + if decoded_self is None: + self.decoded_self = None + else: + self.decoded_self = cast( + "DecodedStreamObject", decoded_self.replicate(pdf_dest) + ) + except Exception: + pass + for k, v in self.items(): + d__[k.replicate(pdf_dest)] = ( + v.replicate(pdf_dest) if hasattr(v, "replicate") else v + ) + return d__ + + def _clone( + self, + src: DictionaryObject, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool, + ignore_fields: Optional[Sequence[Union[str, int]]], + visited: set[tuple[int, int]], + ) -> None: + """ + Update the object from src. + + Args: + src: + pdf_dest: + force_duplicate: + ignore_fields: + + """ + self._data = cast("StreamObject", src)._data + try: + decoded_self = cast("StreamObject", src).decoded_self + if decoded_self is None: + self.decoded_self = None + else: + self.decoded_self = cast( + "DecodedStreamObject", + decoded_self.clone(pdf_dest, force_duplicate, ignore_fields), + ) + except Exception: + pass + super()._clone(src, pdf_dest, force_duplicate, ignore_fields, visited) + + def hash_bin(self) -> int: + """ + Used to detect modified object. + + Returns: + Hash considering type and value. + + """ + # Use _data to prevent errors on non-decoded streams. + return hash((super().hash_bin(), self._data)) + + def get_data(self) -> bytes: + return self._data + + def set_data(self, data: bytes) -> None: + self._data = data + + def hash_value_data(self) -> bytes: + data = super().hash_value_data() + data += self.get_data() + return data + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + self[NameObject(StreamAttributes.LENGTH)] = NumberObject(len(self._data)) + DictionaryObject.write_to_stream(self, stream) + del self[StreamAttributes.LENGTH] + stream.write(b"\nstream\n") + stream.write(self._data) + stream.write(b"\nendstream") + + @staticmethod + def initialize_from_dictionary( + data: dict[str, Any] + ) -> Union["EncodedStreamObject", "DecodedStreamObject"]: + retval: Union[EncodedStreamObject, DecodedStreamObject] + if StreamAttributes.FILTER in data: + retval = EncodedStreamObject() + else: + retval = DecodedStreamObject() + retval._data = data["__streamdata__"] + del data["__streamdata__"] + if StreamAttributes.LENGTH in data: + del data[StreamAttributes.LENGTH] + retval.update(data) + return retval + + def flate_encode(self, level: int = -1) -> "EncodedStreamObject": + from ..filters import FlateDecode # noqa: PLC0415 + + if StreamAttributes.FILTER in self: + f = self[StreamAttributes.FILTER] + if isinstance(f, ArrayObject): + f = ArrayObject([NameObject(FT.FLATE_DECODE), *f]) + try: + params = ArrayObject( + [NullObject(), *self.get(StreamAttributes.DECODE_PARMS, ArrayObject())] + ) + except TypeError: + # case of error where the * operator is not working (not an array + params = ArrayObject( + [NullObject(), self.get(StreamAttributes.DECODE_PARMS, ArrayObject())] + ) + else: + f = ArrayObject([NameObject(FT.FLATE_DECODE), f]) + params = ArrayObject( + [NullObject(), self.get(StreamAttributes.DECODE_PARMS, NullObject())] + ) + else: + f = NameObject(FT.FLATE_DECODE) + params = None + retval = EncodedStreamObject() + retval.update(self) + retval[NameObject(StreamAttributes.FILTER)] = f + if params is not None: + retval[NameObject(StreamAttributes.DECODE_PARMS)] = params + retval._data = FlateDecode.encode(self._data, level) + return retval + + def decode_as_image(self, pillow_parameters: Union[dict[str, Any], None] = None) -> Any: + """ + Try to decode the stream object as an image + + Args: + pillow_parameters: parameters provided to Pillow Image.save() method, + cf. + + Returns: + a PIL image if proper decoding has been found + Raises: + Exception: Errors during decoding will be reported. + It is recommended to catch exceptions to prevent + stops in your program. + + """ + from ._image_xobject import _xobj_to_image # noqa: PLC0415 + + if self.get("/Subtype", "") != "/Image": + try: + msg = f"{self.indirect_reference} does not seem to be an Image" # pragma: no cover + except AttributeError: + msg = f"{self.__repr__()} object does not seem to be an Image" # pragma: no cover + logger_warning(msg, __name__) + extension, _, img = _xobj_to_image(self, pillow_parameters) + if extension is None: + return None # pragma: no cover + return img + + +class DecodedStreamObject(StreamObject): + pass + + +class EncodedStreamObject(StreamObject): + def __init__(self) -> None: + self.decoded_self: Optional[DecodedStreamObject] = None + + # This overrides the parent method + def get_data(self) -> bytes: + from ..filters import decode_stream_data # noqa: PLC0415 + + if self.decoded_self is not None: + # Cached version of decoded object + return self.decoded_self.get_data() + + # Create decoded object + decoded = DecodedStreamObject() + decoded.set_data(decode_stream_data(self)) + for key, value in self.items(): + if key not in (StreamAttributes.LENGTH, StreamAttributes.FILTER, StreamAttributes.DECODE_PARMS): + decoded[key] = value + self.decoded_self = decoded + return decoded.get_data() + + # This overrides the parent method: + def set_data(self, data: bytes) -> None: + from ..filters import FlateDecode # noqa: PLC0415 + + if self.get(StreamAttributes.FILTER, "") in (FT.FLATE_DECODE, [FT.FLATE_DECODE]): + if not isinstance(data, bytes): + raise TypeError("Data must be bytes") + if self.decoded_self is None: + self.get_data() # to create self.decoded_self + assert self.decoded_self is not None, "mypy" + self.decoded_self.set_data(data) + super().set_data(FlateDecode.encode(data)) + else: + raise PdfReadError( + "Streams encoded with a filter different from FlateDecode are not supported" + ) + + +CONTENT_STREAM_ARRAY_MAX_LENGTH = 10_000 + + +class ContentStream(DecodedStreamObject): + """ + In order to be fast, this data structure can contain either: + + * raw data in ._data + * parsed stream operations in ._operations. + + At any time, ContentStream object can either have both of those fields defined, + or one field defined and the other set to None. + + These fields are "rebuilt" lazily, when accessed: + + * when .get_data() is called, if ._data is None, it is rebuilt from ._operations. + * when .operations is called, if ._operations is None, it is rebuilt from ._data. + + Conversely, these fields can be invalidated: + + * when .set_data() is called, ._operations is set to None. + * when .operations is set, ._data is set to None. + """ + + def __init__( + self, + stream: Any, + pdf: Any, + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, + ) -> None: + self.pdf = pdf + self._operations: list[tuple[Any, bytes]] = [] + + # stream may be a StreamObject or an ArrayObject containing + # StreamObjects to be concatenated together. + if stream is None: + super().set_data(b"") + else: + stream = stream.get_object() + if isinstance(stream, ArrayObject): + from pypdf.filters import MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH # noqa: PLC0415 + + if (stream_length := len(stream)) > CONTENT_STREAM_ARRAY_MAX_LENGTH: + raise LimitReachedError( + f"Array-based stream has {stream_length} > {CONTENT_STREAM_ARRAY_MAX_LENGTH} elements." + ) + data = bytearray() + length = 0 + for s in stream: + s_resolved = s.get_object() + if isinstance(s_resolved, NullObject): + continue + if not isinstance(s_resolved, StreamObject): + # No need to emit an exception here for now - the PDF structure + # seems to already be broken beforehand in these cases. + logger_warning( + f"Expected StreamObject, got {type(s_resolved).__name__} instead. Data might be wrong.", + __name__ + ) + else: + new_data = s_resolved.get_data() + length += len(new_data) + if length > MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH: + raise LimitReachedError( + f"Array-based stream has at least {length} > " + f"{MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTH} output bytes." + ) + data += new_data + if len(data) == 0 or data[-1:] != b"\n": + # There should be no direct need to check for a change of one byte. + length += 1 + data += b"\n" + super().set_data(bytes(data)) + else: + stream_data = stream.get_data() + assert stream_data is not None + super().set_data(stream_data) + self.forced_encoding = forced_encoding + + def replicate( + self, + pdf_dest: PdfWriterProtocol, + ) -> "ContentStream": + d__ = cast( + "ContentStream", + self._reference_clone(self.__class__(None, None), pdf_dest, False), + ) + d__._data = self._data + try: + decoded_self = self.decoded_self + if decoded_self is None: + self.decoded_self = None + else: + self.decoded_self = cast( + "DecodedStreamObject", decoded_self.replicate(pdf_dest) + ) + except Exception: + pass + for k, v in self.items(): + d__[k.replicate(pdf_dest)] = ( + v.replicate(pdf_dest) if hasattr(v, "replicate") else v + ) + return d__ + d__.set_data(self._data) + d__.pdf = pdf_dest + d__._operations = list(self._operations) + d__.forced_encoding = self.forced_encoding + return d__ + + def clone( + self, + pdf_dest: Any, + force_duplicate: bool = False, + ignore_fields: Optional[Sequence[Union[str, int]]] = (), + ) -> "ContentStream": + """ + Clone object into pdf_dest. + + Args: + pdf_dest: + force_duplicate: + ignore_fields: + + Returns: + The cloned ContentStream + + """ + try: + if self.indirect_reference.pdf == pdf_dest and not force_duplicate: # type: ignore + return self + except Exception: + pass + + visited: set[tuple[int, int]] = set() + d__ = cast( + "ContentStream", + self._reference_clone( + self.__class__(None, None), pdf_dest, force_duplicate + ), + ) + if ignore_fields is None: + ignore_fields = [] + d__._clone(self, pdf_dest, force_duplicate, ignore_fields, visited) + return d__ + + def _clone( + self, + src: DictionaryObject, + pdf_dest: PdfWriterProtocol, + force_duplicate: bool, + ignore_fields: Optional[Sequence[Union[str, int]]], + visited: set[tuple[int, int]], + ) -> None: + """ + Update the object from src. + + Args: + src: + pdf_dest: + force_duplicate: + ignore_fields: + + """ + src_cs = cast("ContentStream", src) + super().set_data(src_cs._data) + self.pdf = pdf_dest + self._operations = list(src_cs._operations) + self.forced_encoding = src_cs.forced_encoding + # no need to call DictionaryObjection or anything + # like super(DictionaryObject,self)._clone(src, pdf_dest, force_duplicate, ignore_fields, visited) + + def _parse_content_stream(self, stream: StreamType) -> None: + # 7.8.2 Content Streams + stream.seek(0, 0) + operands: list[Union[int, str, PdfObject]] = [] + while True: + peek = read_non_whitespace(stream) + if peek in (b"", 0): + break + stream.seek(-1, 1) + if peek.isalpha() or peek in (b"'", b'"'): + operator = read_until_regex(stream, NameObject.delimiter_pattern) + if operator == b"BI": + # begin inline image - a completely different parsing + # mechanism is required, of course... thanks buddy... + assert operands == [] + ii = self._read_inline_image(stream) + self._operations.append((ii, b"INLINE IMAGE")) + else: + self._operations.append((operands, operator)) + operands = [] + elif peek == b"%": + # If we encounter a comment in the content stream, we have to + # handle it here. Typically, read_object will handle + # encountering a comment -- but read_object assumes that + # following the comment must be the object we're trying to + # read. In this case, it could be an operator instead. + while peek not in (b"\r", b"\n", b""): + peek = stream.read(1) + else: + operands.append(read_object(stream, None, self.forced_encoding)) + + def _read_inline_image(self, stream: StreamType) -> dict[str, Any]: + # begin reading just after the "BI" - begin image + # first read the dictionary of settings. + settings = DictionaryObject() + while True: + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + if tok == b"I": + # "ID" - begin of image data + break + key = read_object(stream, self.pdf) + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + value = read_object(stream, self.pdf) + settings[key] = value + # left at beginning of ID + tmp = stream.read(3) + assert tmp[:2] == b"ID" + filtr = settings.get("/F", settings.get("/Filter", "not set")) + savpos = stream.tell() + if isinstance(filtr, list): + filtr = filtr[0] # used forencoding + if "AHx" in filtr or "ASCIIHexDecode" in filtr: + data = extract_inline__ascii_hex_decode(stream) + elif "A85" in filtr or "ASCII85Decode" in filtr: + data = extract_inline__ascii85_decode(stream) + elif "RL" in filtr or "RunLengthDecode" in filtr: + data = extract_inline__run_length_decode(stream) + elif "DCT" in filtr or "DCTDecode" in filtr: + data = extract_inline__dct_decode(stream) + elif filtr == "not set": + cs = settings.get("/CS", "") + if isinstance(cs, list): + cs = cs[0] + if "RGB" in cs: + lcs = 3 + elif "CMYK" in cs: + lcs = 4 + else: + bits = settings.get( + "/BPC", + 8 if cs in {"/I", "/G", "/Indexed", "/DeviceGray"} else -1, + ) + if bits > 0: + lcs = bits / 8.0 + else: + data = extract_inline_default(stream) + lcs = -1 + if lcs > 0: + data = stream.read( + ceil(cast(int, settings["/W"]) * lcs) * cast(int, settings["/H"]) + ) + # Move to the `EI` if possible. + ei = read_non_whitespace(stream) + stream.seek(-1, 1) + else: + data = extract_inline_default(stream) + + ei = stream.read(3) + stream.seek(-1, 1) + if ei[:2] != b"EI" or ei[2:3] not in WHITESPACES: + # Deal with wrong/missing `EI` tags. Example: Wrong dimensions specified above. + stream.seek(savpos, 0) + data = extract_inline_default(stream) + ei = stream.read(3) + stream.seek(-1, 1) + if ei[:2] != b"EI" or ei[2:3] not in WHITESPACES: # pragma: no cover + # Check the same condition again. This should never fail as + # edge cases are covered by `extract_inline_default` above, + # but check this ot make sure that we are behind the `EI` afterwards. + raise PdfStreamError( + f"Could not extract inline image, even using fallback. Expected 'EI', got {ei!r}" + ) + return {"settings": settings, "data": data} + + # This overrides the parent method + def get_data(self) -> bytes: + if not self._data: + new_data = BytesIO() + for operands, operator in self._operations: + if operator == b"INLINE IMAGE": + new_data.write(b"BI") + dict_text = BytesIO() + operands["settings"].write_to_stream(dict_text) + new_data.write(dict_text.getvalue()[2:-2]) + new_data.write(b"ID ") + new_data.write(operands["data"]) + new_data.write(b"EI") + else: + for op in operands: + op.write_to_stream(new_data) + new_data.write(b" ") + new_data.write(operator) + new_data.write(b"\n") + self._data = new_data.getvalue() + return self._data + + # This overrides the parent method + def set_data(self, data: bytes) -> None: + super().set_data(data) + self._operations = [] + + @property + def operations(self) -> list[tuple[Any, bytes]]: + if not self._operations and self._data: + self._parse_content_stream(BytesIO(self._data)) + self._data = b"" + return self._operations + + @operations.setter + def operations(self, operations: list[tuple[Any, bytes]]) -> None: + self._operations = operations + self._data = b"" + + def isolate_graphics_state(self) -> None: + if self._operations: + self._operations.insert(0, ([], b"q")) + self._operations.append(([], b"Q")) + elif self._data: + self._data = b"q\n" + self._data + b"\nQ\n" + + # This overrides the parent method + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if not self._data and self._operations: + self.get_data() # this ensures ._data is rebuilt + super().write_to_stream(stream, encryption_key) + + +def read_object( + stream: StreamType, + pdf: Optional[PdfReaderProtocol], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union[PdfObject, int, str, ContentStream]: + tok = stream.read(1) + stream.seek(-1, 1) # reset to start + if tok == b"/": + return NameObject.read_from_stream(stream, pdf) + if tok == b"<": + # hexadecimal string OR dictionary + peek = stream.read(2) + stream.seek(-2, 1) # reset to start + if peek == b"<<": + return DictionaryObject.read_from_stream(stream, pdf, forced_encoding) + return read_hex_string_from_stream(stream, forced_encoding) + if tok == b"[": + return ArrayObject.read_from_stream(stream, pdf, forced_encoding) + if tok in (b"t", b"f"): + return BooleanObject.read_from_stream(stream) + if tok == b"(": + return read_string_from_stream(stream, forced_encoding) + if tok == b"e" and stream.read(6) == b"endobj": + return NullObject() + if tok == b"n": + return NullObject.read_from_stream(stream) + if tok == b"%": + # comment + skip_over_comment(stream) + tok = read_non_whitespace(stream) + stream.seek(-1, 1) + return read_object(stream, pdf, forced_encoding) + if tok in b"0123456789+-.": + # number object OR indirect reference + peek = stream.read(20) + stream.seek(-len(peek), 1) # reset to start + if IndirectPattern.match(peek) is not None: + assert pdf is not None, "mypy" + return IndirectObject.read_from_stream(stream, pdf) + return NumberObject.read_from_stream(stream) + pos = stream.tell() + stream.seek(-20, 1) + stream_extract = stream.read(80) + stream.seek(pos) + read_until_whitespace(stream) + raise PdfReadError( + f"Invalid Elementary Object starting with {tok!r} @{pos}: {stream_extract!r}" + ) + + +class Field(TreeObject): + """ + A class representing a field dictionary. + + This class is accessed through + :meth:`get_fields()` + """ + + def __init__(self, data: DictionaryObject) -> None: + DictionaryObject.__init__(self) + field_attributes = ( + FieldDictionaryAttributes.attributes() + + CheckboxRadioButtonAttributes.attributes() + ) + self.indirect_reference = data.indirect_reference + for attr in field_attributes: + try: + self[NameObject(attr)] = data[attr] + except KeyError: + pass + if isinstance(self.get("/V"), EncodedStreamObject): + d = cast(EncodedStreamObject, self[NameObject("/V")]).get_data() + if isinstance(d, bytes): + d_str = d.decode() + elif d is None: + d_str = "" + else: + raise Exception("Should never happen") + self[NameObject("/V")] = TextStringObject(d_str) + + # TABLE 8.69 Entries common to all field dictionaries + @property + def field_type(self) -> Optional[NameObject]: + """Read-only property accessing the type of this field.""" + return self.get(FieldDictionaryAttributes.FT) + + @property + def parent(self) -> Optional[DictionaryObject]: + """Read-only property accessing the parent of this field.""" + return self.get(FieldDictionaryAttributes.Parent) + + @property + def kids(self) -> Optional["ArrayObject"]: + """Read-only property accessing the kids of this field.""" + return self.get(FieldDictionaryAttributes.Kids) + + @property + def name(self) -> Optional[str]: + """Read-only property accessing the name of this field.""" + return self.get(FieldDictionaryAttributes.T) + + @property + def alternate_name(self) -> Optional[str]: + """Read-only property accessing the alternate name of this field.""" + return self.get(FieldDictionaryAttributes.TU) + + @property + def mapping_name(self) -> Optional[str]: + """ + Read-only property accessing the mapping name of this field. + + This name is used by pypdf as a key in the dictionary returned by + :meth:`get_fields()` + """ + return self.get(FieldDictionaryAttributes.TM) + + @property + def flags(self) -> Optional[int]: + """ + Read-only property accessing the field flags, specifying various + characteristics of the field (see Table 8.70 of the PDF 1.7 reference). + """ + return self.get(FieldDictionaryAttributes.Ff) + + @property + def value(self) -> Optional[Any]: + """ + Read-only property accessing the value of this field. + + Format varies based on field type. + """ + return self.get(FieldDictionaryAttributes.V) + + @property + def default_value(self) -> Optional[Any]: + """Read-only property accessing the default value of this field.""" + return self.get(FieldDictionaryAttributes.DV) + + @property + def additional_actions(self) -> Optional[DictionaryObject]: + """ + Read-only property accessing the additional actions dictionary. + + This dictionary defines the field's behavior in response to trigger + events. See Section 8.5.2 of the PDF 1.7 reference. + """ + return self.get(FieldDictionaryAttributes.AA) + + +class Destination(TreeObject): + """ + A class representing a destination within a PDF file. + + See section 12.3.2 of the PDF 2.0 reference. + + Args: + title: Title of this destination. + page: Reference to the page of this destination. Should + be an instance of :class:`IndirectObject`. + fit: How the destination is displayed. + + Raises: + PdfReadError: If destination type is invalid. + + """ + + node: Optional[ + DictionaryObject + ] = None # node provide access to the original Object + + def __init__( + self, + title: Union[str, bytes], + page: Union[NumberObject, IndirectObject, NullObject, DictionaryObject], + fit: Fit, + ) -> None: + self._filtered_children: list[Any] = [] # used in PdfWriter + + typ = fit.fit_type + args = fit.fit_args + + DictionaryObject.__init__(self) + self[NameObject("/Title")] = TextStringObject(title) + self[NameObject("/Page")] = page + self[NameObject("/Type")] = typ + + # from table 8.2 of the PDF 1.7 reference. + if typ == "/XYZ": + if len(args) < 1: # left is missing : should never occur + args.append(NumberObject(0.0)) + if len(args) < 2: # top is missing + args.append(NumberObject(0.0)) + if len(args) < 3: # zoom is missing + args.append(NumberObject(0.0)) + ( + self[NameObject(TA.LEFT)], + self[NameObject(TA.TOP)], + self[NameObject("/Zoom")], + ) = args + elif len(args) == 0: + pass + elif typ == TF.FIT_R: + ( + self[NameObject(TA.LEFT)], + self[NameObject(TA.BOTTOM)], + self[NameObject(TA.RIGHT)], + self[NameObject(TA.TOP)], + ) = args + elif typ in [TF.FIT_H, TF.FIT_BH]: + try: # Prefer to be more robust not only to null parameters + (self[NameObject(TA.TOP)],) = args + except Exception: + (self[NameObject(TA.TOP)],) = (NullObject(),) + elif typ in [TF.FIT_V, TF.FIT_BV]: + try: # Prefer to be more robust not only to null parameters + (self[NameObject(TA.LEFT)],) = args + except Exception: + (self[NameObject(TA.LEFT)],) = (NullObject(),) + elif typ in [TF.FIT, TF.FIT_B]: + pass + else: + raise PdfReadError(f"Unknown Destination Type: {typ!r}") + + @property + def dest_array(self) -> "ArrayObject": + return ArrayObject( + [self.raw_get("/Page"), self["/Type"]] + + [ + self[x] + for x in ["/Left", "/Bottom", "/Right", "/Top", "/Zoom"] + if x in self + ] + ) + + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<<\n") + key = NameObject("/D") + key.write_to_stream(stream) + stream.write(b" ") + value = self.dest_array + value.write_to_stream(stream) + + key = NameObject("/S") + key.write_to_stream(stream) + stream.write(b" ") + value_s = NameObject("/GoTo") + value_s.write_to_stream(stream) + + stream.write(b"\n") + stream.write(b">>") + + @property + def title(self) -> Optional[str]: + """Read-only property accessing the destination title.""" + return self.get("/Title") + + @property + def page(self) -> Optional[IndirectObject]: + """Read-only property accessing the IndirectObject of the destination page.""" + return self.get("/Page") + + @property + def typ(self) -> Optional[str]: + """Read-only property accessing the destination type.""" + return self.get("/Type") + + @property + def zoom(self) -> Optional[int]: + """Read-only property accessing the zoom factor.""" + return self.get("/Zoom", None) + + @property + def left(self) -> Optional[FloatObject]: + """Read-only property accessing the left horizontal coordinate.""" + return self.get("/Left", None) + + @property + def right(self) -> Optional[FloatObject]: + """Read-only property accessing the right horizontal coordinate.""" + return self.get("/Right", None) + + @property + def top(self) -> Optional[FloatObject]: + """Read-only property accessing the top vertical coordinate.""" + return self.get("/Top", None) + + @property + def bottom(self) -> Optional[FloatObject]: + """Read-only property accessing the bottom vertical coordinate.""" + return self.get("/Bottom", None) + + @property + def color(self) -> Optional["ArrayObject"]: + """Read-only property accessing the color in (R, G, B) with values 0.0-1.0.""" + return cast( + "ArrayObject", + self.get("/C", ArrayObject([FloatObject(0), FloatObject(0), FloatObject(0)])), + ) + + @property + def font_format(self) -> Optional[OutlineFontFlag]: + """ + Read-only property accessing the font type. + + 1=italic, 2=bold, 3=both + """ + return OutlineFontFlag(self.get("/F", 0)) + + @property + def outline_count(self) -> Optional[int]: + """ + Read-only property accessing the outline count. + + positive = expanded + negative = collapsed + absolute value = number of visible descendants at all levels + """ + return self.get("/Count", None) diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_files.py b/python/user_packages/Python313/site-packages/pypdf/generic/_files.py new file mode 100644 index 0000000000000000000000000000000000000000..d40009f9ab1812c7c6ba8d754c6c99e8c3a95f16 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_files.py @@ -0,0 +1,404 @@ +from __future__ import annotations + +import bisect +from functools import cached_property +from typing import TYPE_CHECKING, cast + +from pypdf._utils import format_iso8824_date, parse_iso8824_date +from pypdf.constants import CatalogAttributes as CA +from pypdf.constants import FileSpecificationDictionaryEntries +from pypdf.constants import PageAttributes as PG +from pypdf.errors import PdfReadError, PyPdfError +from pypdf.generic import ( + ArrayObject, + ByteStringObject, + DecodedStreamObject, + DictionaryObject, + NameObject, + NullObject, + NumberObject, + StreamObject, + TextStringObject, + is_null_or_none, +) + +if TYPE_CHECKING: + import datetime + from collections.abc import Generator + + from pypdf._writer import PdfWriter + + +class EmbeddedFile: + """ + Container holding the information on an embedded file. + + Attributes are evaluated lazily if possible. + + Further information on embedded files can be found in section 7.11 of the PDF 2.0 specification. + """ + def __init__(self, name: str, pdf_object: DictionaryObject, parent: ArrayObject | None = None) -> None: + """ + Args: + name: The (primary) name as provided in the name tree. + pdf_object: The corresponding PDF object to allow retrieving further data. + parent: The parent list. + """ + self._name = name + self.pdf_object = pdf_object + self._parent = parent + + @property + def name(self) -> str: + """The (primary) name of the embedded file as provided in the name tree.""" + return self._name + + @classmethod + def _create_new(cls, writer: PdfWriter, name: str, content: str | bytes) -> EmbeddedFile: + """ + Create a new embedded file and add it to the PdfWriter. + + Args: + writer: The PdfWriter instance to add the embedded file to. + name: The filename to display. + content: The data in the file. + + Returns: + EmbeddedFile instance for the newly created embedded file. + """ + # Convert string content to bytes if needed + if isinstance(content, str): + content = content.encode("latin-1") + + # Create the file entry (the actual embedded file stream) + file_entry = DecodedStreamObject() + file_entry.set_data(content) + file_entry.update({NameObject(PG.TYPE): NameObject("/EmbeddedFile")}) + + # Create the /EF entry + ef_entry = DictionaryObject() + ef_entry.update({NameObject("/F"): writer._add_object(file_entry)}) + + # Create the filespec dictionary + from pypdf.generic import create_string_object # noqa: PLC0415 + filespec = DictionaryObject() + filespec_reference = writer._add_object(filespec) + name_object = cast(TextStringObject, create_string_object(name)) + filespec.update( + { + NameObject(PG.TYPE): NameObject("/Filespec"), + NameObject(FileSpecificationDictionaryEntries.F): name_object, + NameObject(FileSpecificationDictionaryEntries.EF): ef_entry, + } + ) + + # Add the name and filespec to the names array. + # We use the inverse order for insertion, as this allows us to re-use the + # same index. + names_array = cls._get_names_array(writer) + insertion_index = cls._get_insertion_index(names_array, name_object) + names_array.insert(insertion_index, filespec_reference) + names_array.insert(insertion_index, name_object) + + # Return an EmbeddedFile instance + return cls(name=name, pdf_object=filespec, parent=names_array) + + @classmethod + def _get_names_array(cls, writer: PdfWriter) -> ArrayObject: + """Get the names array for embedded files, possibly creating and flattening it.""" + if CA.NAMES not in writer.root_object: + # Add the /Names entry to the catalog. + writer.root_object[NameObject(CA.NAMES)] = writer._add_object(DictionaryObject()) + + names_dict = cast(DictionaryObject, writer.root_object[CA.NAMES]) + if "/EmbeddedFiles" not in names_dict: + # We do not yet have an entry for embedded files. Create and return it. + names = ArrayObject() + embedded_files_names_dictionary = DictionaryObject( + {NameObject(CA.NAMES): names} + ) + names_dict[NameObject("/EmbeddedFiles")] = writer._add_object(embedded_files_names_dictionary) + return names + + # We have an existing embedded files entry. + embedded_files_names_tree = cast(DictionaryObject, names_dict["/EmbeddedFiles"]) + if "/Names" in embedded_files_names_tree: + # Simple case: We already have a flat list. + return cast(ArrayObject, embedded_files_names_tree[NameObject(CA.NAMES)]) + if "/Kids" not in embedded_files_names_tree: + # Invalid case: This is no name tree. + raise PdfReadError("Got neither Names nor Kids in embedded files tree.") + + # Complex case: Convert a /Kids-based name tree to a /Names-based one. + # /Name-based ones are much easier to handle and allow us to simplify the + # actual insertion logic by only having to consider one case. + names = ArrayObject() + kids = cast(ArrayObject, embedded_files_names_tree["/Kids"].get_object()) + embedded_files_names_dictionary = DictionaryObject( + {NameObject(CA.NAMES): names} + ) + names_dict[NameObject("/EmbeddedFiles")] = writer._add_object(embedded_files_names_dictionary) + for kid in kids: + # Write the flattened file entries. As we do not change the actual files, + # this should not have any impact on references to them. + # There might be further (nested) kids here. + # Wait for an example before evaluating an implementation. + for name in kid.get_object().get("/Names", []): + names.append(name) + return names + + @classmethod + def _get_insertion_index(cls, names_array: ArrayObject, name: str) -> int: + keys = [names_array[i].encode("utf-8") for i in range(0, len(names_array), 2)] + name_bytes = name.encode("utf-8") + + start = bisect.bisect_left(keys, name_bytes) + end = bisect.bisect_right(keys, name_bytes) + + if start != end: + return end * 2 + if start == 0: + return 0 + if start == (key_count := len(keys)): + return key_count * 2 + return end * 2 + + @property + def alternative_name(self) -> str | None: + """Retrieve the alternative name (file specification).""" + for key in [FileSpecificationDictionaryEntries.UF, FileSpecificationDictionaryEntries.F]: + # PDF 2.0 reference, table 43: + # > A PDF reader shall use the value of the UF key, when present, instead of the F key. + if key in self.pdf_object: + value = self.pdf_object[key].get_object() + if not is_null_or_none(value): + return cast(str, value) + return None + + @alternative_name.setter + def alternative_name(self, value: TextStringObject | None) -> None: + """Set the alternative name (file specification).""" + if value is None: + if FileSpecificationDictionaryEntries.UF in self.pdf_object: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.UF)] = NullObject() + if FileSpecificationDictionaryEntries.F in self.pdf_object: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.F)] = NullObject() + else: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.UF)] = value + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.F)] = value + + @property + def description(self) -> str | None: + """Retrieve the description.""" + value = self.pdf_object.get(FileSpecificationDictionaryEntries.DESC) + if is_null_or_none(value): + return None + return value + + @description.setter + def description(self, value: TextStringObject | None) -> None: + """Set the description.""" + if value is None: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.DESC)] = NullObject() + else: + self.pdf_object[NameObject(FileSpecificationDictionaryEntries.DESC)] = value + + @property + def associated_file_relationship(self) -> str: + """Retrieve the relationship of the referring document to this embedded file.""" + return cast( + NameObject, + self.pdf_object.get("/AFRelationship", NameObject("/Unspecified")), + ) + + @associated_file_relationship.setter + def associated_file_relationship(self, value: NameObject) -> None: + """Set the relationship of the referring document to this embedded file.""" + self.pdf_object[NameObject("/AFRelationship")] = value + + @property + def _embedded_file(self) -> StreamObject: + """Retrieve the actual embedded file stream.""" + if "/EF" not in self.pdf_object: + raise PdfReadError(f"/EF entry not found: {self.pdf_object}") + ef = cast(DictionaryObject, self.pdf_object["/EF"]) + for key in [FileSpecificationDictionaryEntries.UF, FileSpecificationDictionaryEntries.F]: + if key in ef: + return cast(StreamObject, ef[key].get_object()) + raise PdfReadError(f"No /(U)F key found in file dictionary: {ef}") + + @property + def _params(self) -> DictionaryObject: + """Retrieve the file-specific parameters.""" + return cast(DictionaryObject, self._embedded_file.get("/Params", DictionaryObject()).get_object()) + + @cached_property + def _ensure_params(self) -> DictionaryObject: + """Ensure the /Params dictionary exists and return it.""" + embedded_file = self._embedded_file + if "/Params" not in embedded_file: + embedded_file[NameObject("/Params")] = DictionaryObject() + return cast(DictionaryObject, embedded_file["/Params"]) + + @property + def subtype(self) -> str | None: + """Retrieve the subtype. This is a MIME media type, prefixed by a slash.""" + value = self._embedded_file.get("/Subtype") + if is_null_or_none(value): + return None + return value + + @subtype.setter + def subtype(self, value: NameObject | None) -> None: + """Set the subtype. This should be a MIME media type, prefixed by a slash.""" + embedded_file = self._embedded_file + if value is None: + embedded_file[NameObject("/Subtype")] = NullObject() + else: + embedded_file[NameObject("/Subtype")] = value + + @property + def content(self) -> bytes: + """Retrieve the actual file content.""" + return self._embedded_file.get_data() + + @content.setter + def content(self, value: str | bytes) -> None: + """Set the file content.""" + if isinstance(value, str): + value = value.encode("latin-1") + self._embedded_file.set_data(value) + + @property + def size(self) -> int | None: + """Retrieve the size of the uncompressed file in bytes.""" + value = self._params.get("/Size") + if is_null_or_none(value): + return None + return value + + @size.setter + def size(self, value: NumberObject | None) -> None: + """Set the size of the uncompressed file in bytes.""" + params = self._ensure_params + if value is None: + params[NameObject("/Size")] = NullObject() + else: + params[NameObject("/Size")] = value + + @property + def creation_date(self) -> datetime.datetime | None: + """Retrieve the file creation datetime.""" + return parse_iso8824_date(self._params.get("/CreationDate")) + + @creation_date.setter + def creation_date(self, value: datetime.datetime | None) -> None: + """Set the file creation datetime.""" + params = self._ensure_params + if value is None: + params[NameObject("/CreationDate")] = NullObject() + else: + date_str = format_iso8824_date(value) + params[NameObject("/CreationDate")] = TextStringObject(date_str) + + @property + def modification_date(self) -> datetime.datetime | None: + """Retrieve the datetime of the last file modification.""" + return parse_iso8824_date(self._params.get("/ModDate")) + + @modification_date.setter + def modification_date(self, value: datetime.datetime | None) -> None: + """Set the datetime of the last file modification.""" + params = self._ensure_params + if value is None: + params[NameObject("/ModDate")] = NullObject() + else: + date_str = format_iso8824_date(value) + params[NameObject("/ModDate")] = TextStringObject(date_str) + + @property + def checksum(self) -> bytes | None: + """Retrieve the MD5 checksum of the (uncompressed) file.""" + value = self._params.get("/CheckSum") + if is_null_or_none(value): + return None + return value + + @checksum.setter + def checksum(self, value: ByteStringObject | None) -> None: + """Set the MD5 checksum of the (uncompressed) file.""" + params = self._ensure_params + if value is None: + params[NameObject("/CheckSum")] = NullObject() + else: + params[NameObject("/CheckSum")] = value + + def delete(self) -> None: + """Delete the file from the document.""" + if not self._parent: + raise PyPdfError("Parent required to delete file from document.") + if self.pdf_object in self._parent: + index = self._parent.index(self.pdf_object) + elif ( + (indirect_reference := getattr(self.pdf_object, "indirect_reference", None)) is not None + and indirect_reference in self._parent + ): + index = self._parent.index(indirect_reference) + else: + raise PyPdfError("File not found in parent object.") + self._parent.pop(index) # Reference. + self._parent.pop(index - 1) # Name. + self.pdf_object = DictionaryObject() # Invalidate. + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} name={self.name!r}>" + + @classmethod + def _load_from_names(cls, names: ArrayObject) -> Generator[EmbeddedFile]: + """ + Convert the given name tree into class instances. + + Args: + names: The name tree to load the data from. + + Returns: + Iterable of class instances for the files found. + """ + # This is a name tree of the format [name_1, reference_1, name_2, reference_2, ...] + for i, name in enumerate(names): + if not isinstance(name, str): + # Skip plain strings and retrieve them as `direct_name` by index. + file_dictionary = name.get_object() + direct_name = names[i - 1].get_object() + yield EmbeddedFile(name=direct_name, pdf_object=file_dictionary, parent=names) + + @classmethod + def _load(cls, catalog: DictionaryObject) -> Generator[EmbeddedFile]: + """ + Load the embedded files for the given document catalog. + + This method and its signature are considered internal API and thus not exposed publicly for now. + + Args: + catalog: The document catalog to load from. + + Returns: + Iterable of class instances for the files found. + """ + try: + container = cast( + DictionaryObject, + cast(DictionaryObject, catalog["/Names"])["/EmbeddedFiles"], + ) + except KeyError: + return + + if "/Kids" in container: + for kid in cast(ArrayObject, container["/Kids"].get_object()): + # There might be further (nested) kids here. + # Wait for an example before evaluating an implementation. + kid = kid.get_object() + if "/Names" in kid: + yield from cls._load_from_names(cast(ArrayObject, kid["/Names"])) + if "/Names" in container: + yield from cls._load_from_names(cast(ArrayObject, container["/Names"])) diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_fit.py b/python/user_packages/Python313/site-packages/pypdf/generic/_fit.py new file mode 100644 index 0000000000000000000000000000000000000000..293066ad37cbab19401312c41c6d070fdb6a7971 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_fit.py @@ -0,0 +1,174 @@ +from typing import Any, Optional, Union + +from ._base import is_null_or_none + + +class Fit: + def __init__( + self, fit_type: str, fit_args: tuple[Union[None, float, Any], ...] = () + ) -> None: + from ._base import FloatObject, NameObject, NullObject, NumberObject # noqa: PLC0415 + + self.fit_type = NameObject(fit_type) + self.fit_args: list[Union[NullObject, FloatObject, NumberObject]] = [ + NullObject() if is_null_or_none(a) else FloatObject(a) for a in fit_args + ] + + @classmethod + def xyz( + cls, + left: Optional[float] = None, + top: Optional[float] = None, + zoom: Optional[float] = None, + ) -> "Fit": + """ + Display the page designated by page, with the coordinates (left, top) + positioned at the upper-left corner of the window and the contents + of the page magnified by the factor zoom. + + A null value for any of the parameters left, top, or zoom specifies + that the current value of that parameter is to be retained unchanged. + + A zoom value of 0 has the same meaning as a null value. + + Args: + left: + top: + zoom: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/XYZ", fit_args=(left, top, zoom)) + + @classmethod + def fit(cls) -> "Fit": + """ + Display the page designated by page, with its contents magnified just + enough to fit the entire page within the window both horizontally and + vertically. + + If the required horizontal and vertical magnification factors are + different, use the smaller of the two, centering the page within the + window in the other dimension. + """ + return Fit(fit_type="/Fit") + + @classmethod + def fit_horizontally(cls, top: Optional[float] = None) -> "Fit": + """ + Display the page designated by page, with the vertical coordinate top + positioned at the top edge of the window and the contents of the page + magnified just enough to fit the entire width of the page within the + window. + + A null value for ``top`` specifies that the current value of that + parameter is to be retained unchanged. + + Args: + top: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitH", fit_args=(top,)) + + @classmethod + def fit_vertically(cls, left: Optional[float] = None) -> "Fit": + return Fit(fit_type="/FitV", fit_args=(left,)) + + @classmethod + def fit_rectangle( + cls, + left: Optional[float] = None, + bottom: Optional[float] = None, + right: Optional[float] = None, + top: Optional[float] = None, + ) -> "Fit": + """ + Display the page designated by page, with its contents magnified + just enough to fit the rectangle specified by the coordinates + left, bottom, right, and top entirely within the window + both horizontally and vertically. + + If the required horizontal and vertical magnification factors are + different, use the smaller of the two, centering the rectangle within + the window in the other dimension. + + A null value for any of the parameters may result in unpredictable + behavior. + + Args: + left: + bottom: + right: + top: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitR", fit_args=(left, bottom, right, top)) + + @classmethod + def fit_box(cls) -> "Fit": + """ + Display the page designated by page, with its contents magnified just + enough to fit its bounding box entirely within the window both + horizontally and vertically. + + If the required horizontal and vertical magnification factors are + different, use the smaller of the two, centering the bounding box + within the window in the other dimension. + """ + return Fit(fit_type="/FitB") + + @classmethod + def fit_box_horizontally(cls, top: Optional[float] = None) -> "Fit": + """ + Display the page designated by page, with the vertical coordinate top + positioned at the top edge of the window and the contents of the page + magnified just enough to fit the entire width of its bounding box + within the window. + + A null value for top specifies that the current value of that parameter + is to be retained unchanged. + + Args: + top: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitBH", fit_args=(top,)) + + @classmethod + def fit_box_vertically(cls, left: Optional[float] = None) -> "Fit": + """ + Display the page designated by page, with the horizontal coordinate + left positioned at the left edge of the window and the contents of the + page magnified just enough to fit the entire height of its bounding box + within the window. + + A null value for left specifies that the current value of that + parameter is to be retained unchanged. + + Args: + left: + + Returns: + The created fit object. + + """ + return Fit(fit_type="/FitBV", fit_args=(left,)) + + def __str__(self) -> str: + if not self.fit_args: + return f"Fit({self.fit_type})" + return f"Fit({self.fit_type}, {self.fit_args})" + + +DEFAULT_FIT = Fit.fit() diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_image_inline.py b/python/user_packages/Python313/site-packages/pypdf/generic/_image_inline.py new file mode 100644 index 0000000000000000000000000000000000000000..82e423a18079b72066a9f5f9a32990f800d7641c --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_image_inline.py @@ -0,0 +1,315 @@ +# Copyright (c) 2024, pypdf contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import logging +from io import BytesIO +from typing import IO + +from .._utils import ( + WHITESPACES, + WHITESPACES_AS_BYTES, + BinaryStreamType, + StreamType, + logger_warning, + read_non_whitespace, +) +from ..errors import PdfReadError + +logger = logging.getLogger(__name__) + +# An inline image should be used only for small images (4096 bytes or less), +# but allow twice this for cases where this has been exceeded. +BUFFER_SIZE = 8192 + + +def _check_end_image_marker(stream: StreamType) -> bool: + ei_tok = read_non_whitespace(stream) + ei_tok += stream.read(2) + stream.seek(-3, 1) + return ei_tok[:2] == b"EI" and (ei_tok[2:3] == b"" or ei_tok[2:3] in WHITESPACES) + + +def extract_inline__ascii_hex_decode(stream: StreamType) -> bytes: + """ + Extract HexEncoded stream from inline image. + The stream will be moved onto the EI. + """ + data_out = bytearray() + # Read data until delimiter > and EI as backup. + while True: + data_buffered = read_non_whitespace(stream) + stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_tok = data_buffered.find(b">") + if pos_tok >= 0: # found > + data_out += data_buffered[: pos_tok + 1] + stream.seek(-len(data_buffered) + pos_tok + 1, 1) + break + pos_ei = data_buffered.find(b"EI") + if pos_ei >= 0: # found EI + stream.seek(-len(data_buffered) + pos_ei - 1, 1) + c = stream.read(1) + while c in WHITESPACES: + stream.seek(-2, 1) + c = stream.read(1) + pos_ei -= 1 + data_out += data_buffered[:pos_ei] + break + if len(data_buffered) == 2: + data_out += data_buffered + raise PdfReadError("Unexpected end of stream") + # Neither > nor EI found + data_out += data_buffered[:-2] + stream.seek(-2, 1) + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline__ascii85_decode(stream: StreamType) -> bytes: + """ + Extract A85 stream from inline image. + The stream will be moved onto the EI. + """ + data_out = bytearray() + # Read data until delimiter ~> + while True: + data_buffered = read_non_whitespace(stream) + stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_tok = data_buffered.find(b"~>") + if pos_tok >= 0: # found! + data_out += data_buffered[: pos_tok + 2] + stream.seek(-len(data_buffered) + pos_tok + 2, 1) + break + if len(data_buffered) == 2: # end of buffer + data_out += data_buffered + raise PdfReadError("Unexpected end of stream") + data_out += data_buffered[ + :-2 + ] # back by one char in case of in the middle of ~> + stream.seek(-2, 1) + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline__run_length_decode(stream: StreamType) -> bytes: + """ + Extract RL (RunLengthDecode) stream from inline image. + The stream will be moved onto the EI. + """ + data_out = bytearray() + # Read data until delimiter 128 + while True: + data_buffered = stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_tok = data_buffered.find(b"\x80") + if pos_tok >= 0: # found + # Ideally, we could just use plain run-length decoding here, where 80_16 = 128_10 + # marks the EOD. But there apparently are cases like in issue #3517, where we have + # an inline image with up to 51 EOD markers. In these cases, be resilient here and + # use the default `EI` marker detection instead. Please note that this fallback + # still omits special `EI` handling within the stream, but for now assume that having + # both of these cases occur at the same time is very unlikely (and the image stream + # is broken anyway). + # For now, do not skip over more than one whitespace character. + after_token = data_buffered[pos_tok + 1 : pos_tok + 4] + if after_token.startswith(b"EI") or after_token.endswith(b"EI"): + data_out += data_buffered[: pos_tok + 1] + stream.seek(-len(data_buffered) + pos_tok + 1, 1) + else: + logger_warning("Early EOD in RunLengthDecode of inline image, using fallback.", __name__) + ei_marker = data_buffered.find(b"EI") + if ei_marker > 0: + data_out += data_buffered[: ei_marker] + stream.seek(-len(data_buffered) + ei_marker - 1, 1) + break + data_out += data_buffered + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline__dct_decode(stream: BinaryStreamType) -> bytes: + """ + Extract DCT (JPEG) stream from inline image. + The stream will be moved onto the EI. + """ + def read(length: int) -> bytes: + # If 0 bytes are returned, and *size* was not 0, this indicates end of file. + # If the object is in non-blocking mode and no bytes are available, `None` is returned. + _result = stream.read(length) + if _result is None or len(_result) != length: + raise PdfReadError("Unexpected end of stream") + return _result + + data_out = bytearray() + # Read Blocks of data (ID/Size/data) up to ID=FF/D9 + # https://www.digicamsoft.com/itu/itu-t81-36.html + not_first = False + while True: + c = read(1) + if not_first or (c == b"\xff"): + data_out += c + if c != b"\xff": + continue + not_first = True + c = read(1) + data_out += c + if c == b"\xff": + stream.seek(-1, 1) # pragma: no cover + elif c == b"\x00": # stuffing + pass + elif c == b"\xd9": # end + break + elif c in ( + b"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc9\xca\xcb\xcc\xcd\xce\xcf" + b"\xda\xdb\xdc\xdd\xde\xdf" + b"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xfe" + ): + c = read(2) + data_out += c + sz = c[0] * 256 + c[1] + data_out += read(sz - 2) + + if not _check_end_image_marker(stream): + raise PdfReadError("EI stream not found") + return bytes(data_out) + + +def extract_inline_default(stream: StreamType) -> bytes: + """Legacy method, used by default""" + stream_out = BytesIO() + # Read the inline image, while checking for EI (End Image) operator. + while True: + data_buffered = stream.read(BUFFER_SIZE) + if not data_buffered: + raise PdfReadError("Unexpected end of stream") + pos_ei = data_buffered.find( + b"E" + ) # We can not look straight for "EI" because it may not have been loaded in the buffer + + if pos_ei == -1: + stream_out.write(data_buffered) + else: + # Write out everything including E (the one from EI to be removed) + stream_out.write(data_buffered[0 : pos_ei + 1]) + sav_pos_ei = stream_out.tell() - 1 + # Seek back in the stream to read the E next + stream.seek(pos_ei + 1 - len(data_buffered), 1) + saved_pos = stream.tell() + # Check for End Image + tok2 = stream.read(1) # I of "EI" + if tok2 != b"I": + stream.seek(saved_pos, 0) + continue + tok3 = stream.read(1) # possible space after "EI" + if tok3 not in WHITESPACES: + stream.seek(saved_pos, 0) + continue + while tok3 in WHITESPACES: + tok3 = stream.read(1) + if data_buffered[pos_ei - 1 : pos_ei] not in WHITESPACES and tok3 not in { + b"Q", + b"E", + }: # for Q or EMC + stream.seek(saved_pos, 0) + continue + if is_followed_by_binary_data(stream): + # Inline image contains `EI ` sequence usually marking the end of it, but + # is followed by binary data which does not make sense for the actual end. + stream.seek(saved_pos, 0) + continue + # Data contains [\s]EI[\s](Q|EMC): 4 chars are sufficient + # remove E(I) wrongly inserted earlier + stream.seek(saved_pos - 1, 0) + stream_out.truncate(sav_pos_ei) + break + + return stream_out.getvalue() + + +def is_followed_by_binary_data(stream: IO[bytes], length: int = 10) -> bool: + """ + Check if the next bytes of the stream look like binary image data or regular page content. + + This is just some heuristics due to the PDF specification being too imprecise about + inline images containing the `EI` marker which would end an image. Starting with PDF 2.0, + we finally get a mandatory length field, but with (proper) PDF 2.0 support being very limited + everywhere, we should not expect to be able to remove such hacks in the near future - especially + considering legacy documents as well. + + The actual implementation draws some inspiration from + https://github.com/itext/itext-java/blob/9.1.0/kernel/src/main/java/com/itextpdf/kernel/pdf/canvas/parser/util/InlineImageParsingUtils.java + """ + position = stream.tell() + data = stream.read(length) + stream.seek(position) + if not data: + return False + operator_start = None + operator_end = None + + for index, byte in enumerate(data): + if byte < 32 and byte not in WHITESPACES_AS_BYTES: + # This covers all characters not being displayable directly, although omitting whitespace + # to allow for operator detection. + return True + is_whitespace = byte in WHITESPACES_AS_BYTES + if operator_start is None and not is_whitespace: + # Interpret all other non-whitespace characters as the start of an operation. + operator_start = index + if operator_start is not None and is_whitespace: + # A whitespace stops an operation. + # Assume that having an inline image with tons of whitespace is rather unlikely. + operator_end = index + break + + if operator_start is None: + # Inline images should not have tons of whitespaces, which would lead to no operator start. + return False + if operator_end is None: + # We probably are inside an operation. + operator_end = length + operator_length = operator_end - operator_start + operator = data[operator_start:operator_end] + if operator.startswith(b"/") and operator_length > 1: + # Name object. + return False + if operator.replace(b".", b"").isdigit(): + # Graphics operator, for example a move. A number (integer or float). + return False + if operator_length > 3: # noqa: SIM103 + # Usually, the operators inside a content stream should not have more than three characters, + # especially after an inline image. + return True + return False diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_image_xobject.py b/python/user_packages/Python313/site-packages/pypdf/generic/_image_xobject.py new file mode 100644 index 0000000000000000000000000000000000000000..04ebb6036e2635db72a26ea402c32dc2777a7d45 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_image_xobject.py @@ -0,0 +1,590 @@ +"""Functions to convert an image XObject to an image""" + +import sys +from io import BytesIO +from typing import Any, Literal, Optional, Union, cast + +from .._utils import check_if_whitespace_only, logger_warning +from ..constants import ColorSpaces, StreamAttributes +from ..constants import FilterTypes as FT +from ..constants import ImageAttributes as IA +from ..errors import EmptyImageDataError, LimitReachedError, PdfReadError +from ..generic import ( + ArrayObject, + DecodedStreamObject, + EncodedStreamObject, + NullObject, + TextStringObject, + is_null_or_none, +) + +if sys.version_info[:2] >= (3, 10): + from typing import TypeAlias +else: + from typing_extensions import TypeAlias + + +try: + from PIL import Image, UnidentifiedImageError +except ImportError: + raise ImportError( + "pillow is required to do image extraction. " + "It can be installed via 'pip install pypdf[image]'" + ) + +mode_str_type: TypeAlias = Literal[ + "", "1", "RGB", "2bits", "4bits", "P", "L", "RGBA", "CMYK" +] + +MAX_IMAGE_MODE_NESTING_DEPTH: int = 10 + + +def _get_image_mode( + color_space: Union[str, list[Any], Any], + color_components: int, + prev_mode: mode_str_type, + depth: int = 0, +) -> tuple[mode_str_type, bool]: + """ + Returns: + Image mode, not taking into account mask (transparency). + ColorInversion is required (like for some DeviceCMYK). + + """ + if depth > MAX_IMAGE_MODE_NESTING_DEPTH: + raise PdfReadError( + "Color spaces nested too deeply. If required, consider increasing MAX_IMAGE_MODE_NESTING_DEPTH." + ) + if is_null_or_none(color_space): + return "", False + color_space_str: str = "" + if isinstance(color_space, str): + color_space_str = color_space + elif not isinstance(color_space, list): + raise PdfReadError( + "Cannot interpret color space", color_space + ) # pragma: no cover + elif not color_space: + return "", False + elif color_space[0].startswith("/Cal"): # /CalRGB or /CalGray + color_space_str = "/Device" + color_space[0][4:] + elif color_space[0] == "/ICCBased": + icc_profile = color_space[1].get_object() + color_components = cast(int, icc_profile["/N"]) + color_space_str = icc_profile.get("/Alternate", "") + elif color_space[0] == "/Indexed": + color_space_str = color_space[1].get_object() + mode, invert_color = _get_image_mode( + color_space_str, color_components, prev_mode, depth + 1 + ) + if mode in ("RGB", "CMYK"): + mode = "P" + return mode, invert_color + elif color_space[0] == "/Separation": + color_space_str = color_space[2].get_object() + mode, invert_color = _get_image_mode( + color_space_str, color_components, prev_mode, depth + 1 + ) + return mode, True + elif color_space[0] == "/DeviceN": + original_color_space = color_space + color_components = len(color_space[1]) + color_space_str = color_space[2].get_object() + if color_space_str == "/DeviceCMYK" and color_components == 1: + if original_color_space[1][0] != "/Black": + logger_warning( + f"Color {original_color_space[1][0]} converted to Gray. Please share PDF with pypdf dev team", + __name__, + ) + return "L", True + mode, invert_color = _get_image_mode( + color_space_str, color_components, prev_mode, depth + 1 + ) + return mode, invert_color + + mode_map: dict[str, mode_str_type] = { + "1bit": "1", # must be zeroth position: color_components may index the values + "/DeviceGray": "L", # must be first position: color_components may index the values + "palette": "P", # must be second position: color_components may index the values + "/DeviceRGB": "RGB", # must be third position: color_components may index the values + "/DeviceCMYK": "CMYK", # must be fourth position: color_components may index the values + "2bit": "2bits", + "4bit": "4bits", + } + + mode = ( + mode_map.get(color_space_str) + or list(mode_map.values())[color_components] + or prev_mode + ) + + return mode, mode == "CMYK" + + +def bits2byte(data: bytes, size: tuple[int, int], bits: int) -> bytes: + from pypdf.filters import FLATE_MAX_BUFFER_SIZE # noqa: PLC0415 + + buffer_size = size[0] * size[1] + if buffer_size > FLATE_MAX_BUFFER_SIZE: + raise LimitReachedError(f"Requested buffer size {buffer_size} exceeds limit of {FLATE_MAX_BUFFER_SIZE}.") + + byte_buffer = bytearray(buffer_size) + mask = (1 << bits) - 1 + data_index = 0 + bit = 8 - bits + for y in range(size[1]): + if bit != 8 - bits: + data_index += 1 + bit = 8 - bits + for x in range(size[0]): + byte_buffer[x + y * size[0]] = (data[data_index] >> bit) & mask + bit -= bits + if bit < 0: + data_index += 1 + bit = 8 - bits + return bytes(byte_buffer) + + +def _extended_image_from_bytes( + mode: str, size: tuple[int, int], data: bytes +) -> Image.Image: + try: + img = Image.frombytes(mode, size, data) + except ValueError as exc: + nb_pix = size[0] * size[1] + data_length = len(data) + if data_length == 0: + raise EmptyImageDataError( + "Data is 0 bytes, cannot process an image from empty data." + ) from exc + if data_length % nb_pix != 0: + raise exc + k = nb_pix * len(mode) / data_length + data = b"".join(bytes((x,) * int(k)) for x in data) + img = Image.frombytes(mode, size, data) + return img + + +def __handle_flate__indexed(color_space: ArrayObject) -> tuple[Any, Any, Any, Any]: + count = len(color_space) + if count == 4: + color_space, base, hival, lookup = (value.get_object() for value in color_space) + return color_space, base, hival, lookup + + # Deal with strange AutoDesk files where `base` and `hival` look like this: + # /DeviceRGB\x00255 + element1 = color_space[1] + element1 = element1 if isinstance(element1, str) else element1.get_object() + if count == 3 and "\x00" in element1: + color_space, lookup = color_space[0].get_object(), color_space[2].get_object() + base, hival = element1.split("\x00") + hival = int(hival) + return color_space, base, hival, lookup + raise PdfReadError(f"Expected color space with 4 values, got {count}: {color_space}") + + +def _handle_flate( + size: tuple[int, int], + data: bytes, + mode: mode_str_type, + color_space: Union[str, ArrayObject], + colors: int, + obj_as_text: str, +) -> tuple[Image.Image, str, str, bool]: + """ + Process image encoded in flateEncode + Returns img, image_format, extension, color inversion + """ + extension = ".png" # mime_type: "image/png" + image_format = "PNG" + lookup: Any + base: Any + hival: Any + if isinstance(color_space, ArrayObject) and color_space[0] == "/Indexed": + color_space, base, hival, lookup = __handle_flate__indexed(color_space) + if mode == "2bits": + mode = "P" + data = bits2byte(data, size, 2) + elif mode == "4bits": + mode = "P" + data = bits2byte(data, size, 4) + img = _extended_image_from_bytes(mode, size, data) + if color_space == "/Indexed": + if isinstance(lookup, (EncodedStreamObject, DecodedStreamObject)): + lookup = lookup.get_data() + if isinstance(lookup, TextStringObject): + lookup = lookup.original_bytes + if isinstance(lookup, str): + lookup = lookup.encode() + try: + nb, conv, mode = { # type: ignore + "1": (0, "", ""), + "L": (1, "P", "L"), + "P": (0, "", ""), + "RGB": (3, "P", "RGB"), + "CMYK": (4, "P", "CMYK"), + }[_get_image_mode(base, 0, "")[0]] + except KeyError: # pragma: no cover + logger_warning( + f"Base {base} not coded please share the pdf file with pypdf dev team", + __name__, + ) + lookup = None + else: + if img.mode == "1": + # Two values ("high" and "low"). + expected_count = 2 * nb + actual_count = len(lookup) + if actual_count != expected_count: + if actual_count < expected_count: + logger_warning( + f"Not enough lookup values: Expected {expected_count}, got {actual_count}.", + __name__ + ) + lookup += bytes([0] * (expected_count - actual_count)) + elif not check_if_whitespace_only(lookup[expected_count:]): + logger_warning( + f"Too many lookup values: Expected {expected_count}, got {actual_count}.", + __name__ + ) + lookup = lookup[:expected_count] + colors_arr = [lookup[:nb], lookup[nb:]] + arr = b"".join( + b"".join( + colors_arr[1 if img.getpixel((x, y)) > 127 else 0] # type: ignore[operator,unused-ignore] # TODO: Remove unused-ignore on Python 3.10 + for x in range(img.size[0]) + ) + for y in range(img.size[1]) + ) + img = Image.frombytes(mode, img.size, arr) + else: + img = img.convert(conv) + if len(lookup) != (hival + 1) * nb: + logger_warning(f"Invalid Lookup Table in {obj_as_text}", __name__) + lookup = None + elif mode == "L": + # gray lookup does not work: it is converted to a similar RGB lookup + lookup = b"".join([bytes([b, b, b]) for b in lookup]) + mode = "RGB" + # TODO: https://github.com/py-pdf/pypdf/pull/2039 + # this is a work around until PIL is able to process CMYK images + elif mode == "CMYK": + _rgb = [] + for _c, _m, _y, _k in ( + lookup[n : n + 4] for n in range(0, 4 * (len(lookup) // 4), 4) + ): + _r = int(255 * (1 - _c / 255) * (1 - _k / 255)) + _g = int(255 * (1 - _m / 255) * (1 - _k / 255)) + _b = int(255 * (1 - _y / 255) * (1 - _k / 255)) + _rgb.append(bytes((_r, _g, _b))) + lookup = b"".join(_rgb) + mode = "RGB" + if lookup is not None: + img.putpalette(lookup, rawmode=mode) + img = img.convert("L" if base == ColorSpaces.DEVICE_GRAY else "RGB") + elif not is_null_or_none(color_space) and color_space[0] == "/ICCBased": + # Exclude pure black-and-white images. + # TODO: The remaining code still does not look correct. Shouldn't the proper way be + # to use the original image and apply the ICC transformation on it? + # For now, this just loads the original image with a different color space. + if mode != "1": + # Table 65 - Additional Entries Specific to an ICC Profile Stream Dictionary + mode2 = _get_image_mode(color_space, colors, mode)[0] + if mode != mode2: + img = Image.frombytes(mode, size, data) # reloaded as mode may have changed + if mode == "CMYK": + extension = ".tif" + image_format = "TIFF" + return img, image_format, extension, False + + +def _handle_jpx( + size: tuple[int, int], + data: bytes, + mode: mode_str_type, + color_space: str, + colors: int, +) -> tuple[Image.Image, str, str, bool]: + """ + Process image encoded as JPX/JPEG2000 + Returns img, image_format, extension, inversion + """ + extension = ".jp2" # mime_type: "image/x-jp2" + img1: Image.Image = Image.open(BytesIO(data), formats=("JPEG2000",)) + mode, invert_color = _get_image_mode(color_space, colors, mode) + if mode == "": + mode = cast(mode_str_type, img1.mode) + invert_color = mode == "CMYK" + if img1.mode == "RGBA" and mode == "RGB": + mode = "RGBA" + # we need to convert to the good mode + if img1.mode == mode or {img1.mode, mode} == {"L", "P"}: # compare (unordered) sets + # L and P are indexed modes which should not be changed. + img = img1 + elif {img1.mode, mode} == {"RGBA", "CMYK"}: + # RGBA / CMYK are 4bytes encoding where + # the encoding should be corrected + img = Image.frombytes(mode, img1.size, img1.tobytes()) + else: # pragma: no cover + img = img1.convert(mode) + # CMYK conversion + # https://stackverflow.com/questions/38855022/ + if img.mode == "CMYK" and color_space == "/ICCBased": + img = img.convert("RGB") + image_format = "JPEG2000" + return img, image_format, extension, invert_color + + +def _apply_decode( + img: Image.Image, + x_object_obj: dict[str, Any], + lfilters: FT, + color_space: Union[str, list[Any], Any], + invert_color: bool, +) -> Image.Image: + # CMYK image and other color spaces without decode + # requires reverting scale (cf p243,2§ last sentence) + if IA.DECODE in x_object_obj: + decode = x_object_obj[IA.DECODE] + # if invert_color and lfilters == FT.DCT_DECODE: + # decode = list(reversed(decode)) + elif img.mode == "CMYK" and lfilters == FT.JPX_DECODE: + decode = [1.0, 0.0] if not invert_color else [0.0, 1.0] + decode = decode * len(img.getbands()) + elif (img.mode == "CMYK" and lfilters == FT.DCT_DECODE) or (invert_color and img.mode == "L"): + decode = [1.0, 0.0] * len(img.getbands()) + else: + decode = None + + if ( + isinstance(color_space, ArrayObject) + and color_space[0].get_object() == "/Indexed" + ): + decode = None # decode is meaningless if Indexed + if ( + isinstance(color_space, ArrayObject) + and color_space[0].get_object() == "/Separation" + ): + decode = [1.0, 0.0] * len(img.getbands()) + if decode is not None and not all(decode[i] == i % 2 for i in range(len(decode))): + lut: list[int] = [] + for i in range(0, len(decode), 2): + dmin = decode[i] + dmax = decode[i + 1] + lut.extend( + round(255.0 * (j / 255.0 * (dmax - dmin) + dmin)) for j in range(256) + ) + img = img.point(lut) + return img + + +def _get_mode_and_invert_color( + x_object_obj: dict[str, Any], colors: int, color_space: Union[str, list[Any], Any] +) -> tuple[mode_str_type, bool]: + if ( + IA.COLOR_SPACE in x_object_obj + and x_object_obj[IA.COLOR_SPACE] == ColorSpaces.DEVICE_RGB + ): + # https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes + mode: mode_str_type = "RGB" + if x_object_obj.get("/BitsPerComponent", 8) < 8: + mode, invert_color = _get_image_mode( + f"{x_object_obj.get('/BitsPerComponent', 8)}bit", 0, "" + ) + else: + mode, invert_color = _get_image_mode( + color_space, + 2 + if ( + colors == 1 + and ( + not is_null_or_none(color_space) + and "Gray" not in color_space + ) + ) + else colors, + "", + ) + return mode, invert_color + + +def _xobj_to_image( + x_object: dict[str, Any], + pillow_parameters: Union[dict[str, Any], None] = None +) -> tuple[Optional[str], bytes, Any]: + """ + Users need to have the pillow package installed. + + It's unclear if pypdf will keep this function here, hence it's private. + It might get removed at any point. + + Args: + x_object: + pillow_parameters: parameters provided to Pillow Image.save() method, + cf. + + Returns: + Tuple[file extension, bytes, PIL.Image.Image] + + """ + def _apply_alpha( + img: Image.Image, + x_object: dict[str, Any], + obj_as_text: str, + image_format: str, + extension: str, + ) -> tuple[Image.Image, str, str]: + alpha = None + if IA.S_MASK in x_object: # add alpha channel + alpha = _xobj_to_image(x_object[IA.S_MASK])[2] + if img.size != alpha.size: + logger_warning( + f"image and mask size not matching: {obj_as_text}", __name__ + ) + else: + # TODO: implement mask + if alpha.mode != "L": + alpha = alpha.convert("L") + if img.mode == "P": + img = img.convert("RGB") + elif img.mode == "1": + img = img.convert("L") + img.putalpha(alpha) + if "JPEG" in image_format: + image_format = "JPEG2000" + extension = ".jp2" + else: + image_format = "PNG" + extension = ".png" + return img, extension, image_format + + # For error reporting + obj_as_text = ( + x_object.indirect_reference.__repr__() + if x_object is None # pragma: no cover + else x_object.__repr__() + ) + + # Get size and data + size = (cast(int, x_object[IA.WIDTH]), cast(int, x_object[IA.HEIGHT])) + data = x_object.get_data() # type: ignore + if isinstance(data, str): # pragma: no cover + data = data.encode() + if len(data) % (size[0] * size[1]) == 1 and data[-1] == 0x0A: # ie. '\n' + data = data[:-1] + + # Get color properties + colors = x_object.get("/Colors", 1) + color_space: Any = x_object.get("/ColorSpace", NullObject()).get_object() + if isinstance(color_space, list) and len(color_space) == 1: + color_space = color_space[0].get_object() + + mode, invert_color = _get_mode_and_invert_color(x_object, colors, color_space) + + # Get filters + filters = x_object.get(StreamAttributes.FILTER, NullObject()).get_object() + lfilters = filters[-1] if isinstance(filters, list) else filters + decode_parms = x_object.get(StreamAttributes.DECODE_PARMS) + if decode_parms and isinstance(decode_parms, (tuple, list)): + decode_parms = decode_parms[0] + else: + decode_parms = {} + if not isinstance(decode_parms, dict): + decode_parms = {} + + extension = None + if lfilters in (FT.FLATE_DECODE, FT.RUN_LENGTH_DECODE): + img, image_format, extension, _ = _handle_flate( + size, + data, + mode, + color_space, + colors, + obj_as_text, + ) + elif lfilters in (FT.LZW_DECODE, FT.ASCII_85_DECODE): + # I'm not sure if the following logic is correct. + # There might not be any relationship between the filters and the + # extension + if lfilters == FT.LZW_DECODE: + image_format = "TIFF" + extension = ".tiff" # mime_type = "image/tiff" + else: + image_format = "PNG" + extension = ".png" # mime_type = "image/png" + try: + img = Image.open(BytesIO(data), formats=("TIFF", "PNG")) + except UnidentifiedImageError: + img = _extended_image_from_bytes(mode, size, data) + elif lfilters == FT.DCT_DECODE: + img, image_format, extension = Image.open(BytesIO(data)), "JPEG", ".jpg" + # invert_color kept unchanged + elif lfilters == FT.JPX_DECODE: + img, image_format, extension, invert_color = _handle_jpx( + size, data, mode, color_space, colors + ) + elif lfilters == FT.CCITT_FAX_DECODE: + img, image_format, extension, invert_color = ( + Image.open(BytesIO(data), formats=("TIFF",)), + "TIFF", + ".tiff", + False, + ) + elif lfilters == FT.JBIG2_DECODE: + img, image_format, extension, invert_color = ( + Image.open(BytesIO(data), formats=("PNG", "PPM")), + "PNG", + ".png", + False, + ) + elif mode == "CMYK": + img, image_format, extension, invert_color = ( + _extended_image_from_bytes(mode, size, data), + "TIFF", + ".tif", + False, + ) + elif mode == "": + raise PdfReadError(f"ColorSpace field not found in {x_object}") + else: + img, image_format, extension, invert_color = ( + _extended_image_from_bytes(mode, size, data), + "PNG", + ".png", + False, + ) + + img = _apply_decode(img, x_object, lfilters, color_space, invert_color) + img, extension, image_format = _apply_alpha( + img, x_object, obj_as_text, image_format, extension + ) + + if pillow_parameters is None: + pillow_parameters = {} + # Preserve JPEG image quality - see issue #3515. + if image_format == "JPEG": + # This prevents: Cannot use 'keep' when original image is not a JPEG: + # "JPEG" is the value of PIL.JpegImagePlugin.JpegImageFile.format + img.format = "JPEG" + if "quality" not in pillow_parameters: + pillow_parameters["quality"] = "keep" + + # Save image to bytes + img_byte_arr = BytesIO() + try: + img.save(img_byte_arr, format=image_format, **pillow_parameters) + except OSError: # pragma: no cover # covered with pillow 10.3 + # in case of we convert to RGBA and then to PNG + img1 = img.convert("RGBA") + image_format = "PNG" + extension = ".png" + img_byte_arr = BytesIO() + img1.save(img_byte_arr, format=image_format) + data = img_byte_arr.getvalue() + + try: # temporary try/except until other fixes of images + img = Image.open(BytesIO(data)) + except Exception as exception: + logger_warning(f"Failed loading image: {exception}", __name__) + img = None # type: ignore[assignment,unused-ignore] # TODO: Remove unused-ignore on Python 3.10 + return extension, data, img diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_link.py b/python/user_packages/Python313/site-packages/pypdf/generic/_link.py new file mode 100644 index 0000000000000000000000000000000000000000..f3e7566549872e0f4d1b94388803c38b89ea7a9c --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_link.py @@ -0,0 +1,144 @@ +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +# This module contains code used by _writer.py to track links in pages +# being added to the writer until the links can be resolved. + +from typing import TYPE_CHECKING, Optional, Union, cast + +from .._utils import logger_warning +from . import ArrayObject, DictionaryObject, IndirectObject, PdfObject, TextStringObject, is_null_or_none + +if TYPE_CHECKING: + from .._page import PageObject + from .._reader import PdfReader + from .._writer import PdfWriter + + +class NamedReferenceLink: + """Named reference link being preserved until we can resolve it correctly.""" + + def __init__(self, reference: TextStringObject, source_pdf: "PdfReader") -> None: + """reference: TextStringObject with named reference""" + self._reference = reference + self._source_pdf = source_pdf + + def find_referenced_page(self) -> Union[IndirectObject, None]: + destination = self._source_pdf.named_destinations.get(str(self._reference)) + return destination.page if destination else None + + def patch_reference(self, target_pdf: "PdfWriter", new_page: IndirectObject) -> None: + """target_pdf: PdfWriter which the new link went into""" + # point named destination in new PDF to the new page + if str(self._reference) not in target_pdf.named_destinations: + target_pdf.add_named_destination(str(self._reference), new_page.page_number) + + +class DirectReferenceLink: + """Direct reference link being preserved until we can resolve it correctly.""" + + def __init__(self, reference: ArrayObject) -> None: + """reference: an ArrayObject whose first element is the Page indirect object""" + self._reference = reference + + def find_referenced_page(self) -> IndirectObject: + return cast(IndirectObject, self._reference[0]) + + def patch_reference(self, target_pdf: "PdfWriter", new_page: IndirectObject) -> None: + """target_pdf: PdfWriter which the new link went into""" + self._reference[0] = new_page + + +ReferenceLink = Union[NamedReferenceLink, DirectReferenceLink] + + +def extract_links(new_page: "PageObject", old_page: "PageObject") -> list[tuple[ReferenceLink, ReferenceLink]]: + """Extracts links from two pages on the assumption that the two pages are + the same. Produces one list of (new link, old link) tuples. + + Non-link annotations are ignored before pairing to avoid dropping valid + links when one page includes additional non-link annotation entries. + """ + new_annotations = new_page.get("/Annots", ArrayObject()).get_object() + old_annotations = old_page.get("/Annots", ArrayObject()).get_object() + if is_null_or_none(new_annotations): + new_annotations = ArrayObject() + if is_null_or_none(old_annotations): + old_annotations = ArrayObject() + if not isinstance(new_annotations, ArrayObject) or not isinstance(old_annotations, ArrayObject): + logger_warning( + f"Expected annotation arrays: {old_annotations} {new_annotations}. Ignoring annotations.", + __name__ + ) + return [] + new_links = [ + link + for annotation in new_annotations + if (link := _build_link(annotation, new_page)) is not None + ] + old_links = [ + link + for annotation in old_annotations + if (link := _build_link(annotation, old_page)) is not None + ] + + if len(new_links) != len(old_links): + logger_warning( + f"Annotation sizes differ: {old_links} vs. {new_links}", + __name__, + ) + + return list(zip(new_links, old_links)) + + +def _build_link(indirect_object: IndirectObject, page: "PageObject") -> Optional[ReferenceLink]: + src = cast("PdfReader", page.pdf) + link = cast(DictionaryObject, indirect_object.get_object()) + if (not isinstance(link, DictionaryObject)) or link.get("/Subtype") != "/Link": + return None + + if "/A" in link: + action = cast(DictionaryObject, link["/A"]) + if action.get("/S") != "/GoTo": + return None + + if "/D" not in action: + return None + return _create_link(action["/D"], src) + + if "/Dest" in link: + return _create_link(link["/Dest"], src) + + return None # Nothing to do here + + +def _create_link(reference: PdfObject, source_pdf: "PdfReader") -> Optional[ReferenceLink]: + if isinstance(reference, TextStringObject): + return NamedReferenceLink(reference, source_pdf) + if isinstance(reference, ArrayObject): + return DirectReferenceLink(reference) + return None diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_outline.py b/python/user_packages/Python313/site-packages/pypdf/generic/_outline.py new file mode 100644 index 0000000000000000000000000000000000000000..d5d4bb132c412567fe69d75cb71c4c3da1d4bbfe --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_outline.py @@ -0,0 +1,33 @@ +from typing import Union + +from .._utils import StreamType, deprecation_no_replacement +from ._base import NameObject +from ._data_structures import Destination + + +class OutlineItem(Destination): + def write_to_stream( + self, stream: StreamType, encryption_key: Union[None, str, bytes] = None + ) -> None: + if encryption_key is not None: # deprecated + deprecation_no_replacement( + "the encryption_key parameter of write_to_stream", "5.0.0" + ) + stream.write(b"<<\n") + for key in [ + NameObject(x) + for x in ["/Title", "/Parent", "/First", "/Last", "/Next", "/Prev"] + if x in self + ]: + key.write_to_stream(stream) + stream.write(b" ") + value = self.raw_get(key) + value.write_to_stream(stream) + stream.write(b"\n") + key = NameObject("/Dest") + key.write_to_stream(stream) + stream.write(b" ") + value = self.dest_array + value.write_to_stream(stream) + stream.write(b"\n") + stream.write(b">>") diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_rectangle.py b/python/user_packages/Python313/site-packages/pypdf/generic/_rectangle.py new file mode 100644 index 0000000000000000000000000000000000000000..c07d6bb1f42e90e01066055384c5aeea07d27a23 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_rectangle.py @@ -0,0 +1,136 @@ +from typing import Any, Union + +from ._base import FloatObject, NumberObject +from ._data_structures import ArrayObject + + +class RectangleObject(ArrayObject): + """ + This class is used to represent *page boxes* in pypdf. + + These boxes include: + + * :attr:`artbox ` + * :attr:`bleedbox ` + * :attr:`cropbox ` + * :attr:`mediabox ` + * :attr:`trimbox ` + """ + + def __init__( + self, arr: Union["RectangleObject", tuple[float, float, float, float]] + ) -> None: + # must have four points + assert len(arr) == 4 + # automatically convert arr[x] into NumberObject(arr[x]) if necessary + ArrayObject.__init__(self, [self._ensure_is_number(x) for x in arr]) + + def _ensure_is_number(self, value: Any) -> Union[FloatObject, NumberObject]: + if not isinstance(value, (FloatObject, NumberObject)): + return FloatObject(value) + return value + + def scale(self, sx: float, sy: float) -> "RectangleObject": + return RectangleObject( + ( + float(self.left) * sx, + float(self.bottom) * sy, + float(self.right) * sx, + float(self.top) * sy, + ) + ) + + def __repr__(self) -> str: + return f"RectangleObject({list(self)!r})" + + @property + def left(self) -> FloatObject: + value: FloatObject = self[0] + return value + + @left.setter + def left(self, f: float) -> None: + self[0] = FloatObject(f) + + @property + def bottom(self) -> FloatObject: + value: FloatObject = self[1] + return value + + @bottom.setter + def bottom(self, f: float) -> None: + self[1] = FloatObject(f) + + @property + def right(self) -> FloatObject: + value: FloatObject = self[2] + return value + + @right.setter + def right(self, f: float) -> None: + self[2] = FloatObject(f) + + @property + def top(self) -> FloatObject: + value: FloatObject = self[3] + return value + + @top.setter + def top(self, f: float) -> None: + self[3] = FloatObject(f) + + @property + def lower_left(self) -> tuple[float, float]: + """ + Property to read and modify the lower left coordinate of this box + in (x,y) form. + """ + return self.left, self.bottom + + @lower_left.setter + def lower_left(self, value: tuple[float, float]) -> None: + self[0], self[1] = (self._ensure_is_number(x) for x in value) + + @property + def lower_right(self) -> tuple[float, float]: + """ + Property to read and modify the lower right coordinate of this box + in (x,y) form. + """ + return self.right, self.bottom + + @lower_right.setter + def lower_right(self, value: tuple[float, float]) -> None: + self[2], self[1] = (self._ensure_is_number(x) for x in value) + + @property + def upper_left(self) -> tuple[float, float]: + """ + Property to read and modify the upper left coordinate of this box + in (x,y) form. + """ + return self.left, self.top + + @upper_left.setter + def upper_left(self, value: tuple[float, float]) -> None: + self[0], self[3] = (self._ensure_is_number(x) for x in value) + + @property + def upper_right(self) -> tuple[float, float]: + """ + Property to read and modify the upper right coordinate of this box + in (x,y) form. + """ + return self.right, self.top + + @upper_right.setter + def upper_right(self, value: tuple[float, float]) -> None: + self[2], self[3] = (self._ensure_is_number(x) for x in value) + + @property + def width(self) -> float: + return self.right - self.left + + @property + def height(self) -> float: + return self.top - self.bottom diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_utils.py b/python/user_packages/Python313/site-packages/pypdf/generic/_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..1b81fd23b0f8d7f4be86e6dfb3e583275e3716c5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_utils.py @@ -0,0 +1,208 @@ +import codecs +from typing import Union + +from .._codecs import _pdfdoc_encoding +from .._utils import StreamType, logger_warning, read_non_whitespace +from ..errors import STREAM_TRUNCATED_PREMATURELY, PdfStreamError +from ._base import ByteStringObject, TextStringObject + + +def hex_to_rgb(value: str) -> tuple[float, float, float]: + return tuple(int(value.lstrip("#")[i : i + 2], 16) / 255.0 for i in (0, 2, 4)) # type: ignore + + +def read_hex_string_from_stream( + stream: StreamType, + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union["TextStringObject", "ByteStringObject"]: + stream.read(1) + arr = [] + x = b"" + while True: + tok = read_non_whitespace(stream) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok == b">": + break + x += tok + if len(x) == 2: + arr.append(int(x, base=16)) + x = b"" + if len(x) == 1: + x += b"0" + if x != b"": + arr.append(int(x, base=16)) + return create_string_object(bytes(arr), forced_encoding) + + +__ESCAPE_DICT__ = { + b"n": ord(b"\n"), + b"r": ord(b"\r"), + b"t": ord(b"\t"), + b"b": ord(b"\b"), + b"f": ord(b"\f"), + b"(": ord(b"("), + b")": ord(b")"), + b"/": ord(b"/"), + b"\\": ord(b"\\"), + b" ": ord(b" "), + b"%": ord(b"%"), + b"<": ord(b"<"), + b">": ord(b">"), + b"[": ord(b"["), + b"]": ord(b"]"), + b"#": ord(b"#"), + b"_": ord(b"_"), + b"&": ord(b"&"), + b"$": ord(b"$"), +} +__BACKSLASH_CODE__ = 92 + + +def read_string_from_stream( + stream: StreamType, + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union["TextStringObject", "ByteStringObject"]: + tok = stream.read(1) + parens = 1 + txt = [] + while True: + tok = stream.read(1) + if not tok: + raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY) + if tok == b"(": + parens += 1 + elif tok == b")": + parens -= 1 + if parens == 0: + break + elif tok == b"\\": + tok = stream.read(1) + try: + txt.append(__ESCAPE_DICT__[tok]) + continue + except KeyError: + if b"0" <= tok <= b"7": + # "The number ddd may consist of one, two, or three + # octal digits; high-order overflow shall be ignored. + # Three octal digits shall be used, with leading zeros + # as needed, if the next character of the string is also + # a digit." (PDF reference 7.3.4.2, p 16) + sav = stream.tell() - 1 + for _ in range(2): + ntok = stream.read(1) + if b"0" <= ntok <= b"7": + tok += ntok + else: + stream.seek(-1, 1) # ntok has to be analyzed + break + i = int(tok, base=8) + if i > 255: + txt.append(__BACKSLASH_CODE__) + stream.seek(sav) + else: + txt.append(i) + continue + if tok in b"\n\r": + # This case is hit when a backslash followed by a line + # break occurs. If it's a multi-char EOL, consume the + # second character: + tok = stream.read(1) + if tok not in b"\n\r": + stream.seek(-1, 1) + # Then don't add anything to the actual string, since this + # line break was escaped: + continue + msg = f"Unexpected escaped string: {tok.decode('utf-8', 'ignore')}" + logger_warning(msg, __name__) + txt.append(__BACKSLASH_CODE__) + txt.append(ord(tok)) + return create_string_object(bytes(txt), forced_encoding) + + +def create_string_object( + string: Union[str, bytes], + forced_encoding: Union[None, str, list[str], dict[int, str]] = None, +) -> Union[TextStringObject, ByteStringObject]: + """ + Create a ByteStringObject or a TextStringObject from a string to represent the string. + + Args: + string: The data being used + forced_encoding: Typically None, or an encoding string + + Returns: + A ByteStringObject + + Raises: + TypeError: If string is not of type str or bytes. + + """ + if isinstance(string, str): + return TextStringObject(string) + if isinstance(string, bytes): + if isinstance(forced_encoding, (list, dict)): + out = "" + for x in string: + try: + out += forced_encoding[x] + except Exception: + out += bytes((x,)).decode("charmap") + obj = TextStringObject(out) + obj._original_bytes = string + return obj + if isinstance(forced_encoding, str): + if forced_encoding == "bytes": + return ByteStringObject(string) + obj = TextStringObject(string.decode(forced_encoding)) + obj._original_bytes = string + return obj + try: + if string.startswith((codecs.BOM_UTF16_BE, codecs.BOM_UTF16_LE)): + retval = TextStringObject(string.decode("utf-16")) + retval._original_bytes = string + retval.autodetect_utf16 = True + retval.utf16_bom = string[:2] + return retval + if string.startswith(b"\x00"): + retval = TextStringObject(string.decode("utf-16be")) + retval._original_bytes = string + retval.autodetect_utf16 = True + retval.utf16_bom = codecs.BOM_UTF16_BE + return retval + if string[1:2] == b"\x00": + retval = TextStringObject(string.decode("utf-16le")) + retval._original_bytes = string + retval.autodetect_utf16 = True + retval.utf16_bom = codecs.BOM_UTF16_LE + return retval + + # This is probably a big performance hit here, but we need + # to convert string objects into the text/unicode-aware + # version if possible... and the only way to check if that's + # possible is to try. + # Some strings are strings, some are just byte arrays. + retval = TextStringObject(decode_pdfdocencoding(string)) + retval._original_bytes = string + retval.autodetect_pdfdocencoding = True + return retval + except UnicodeDecodeError: + return ByteStringObject(string) + else: + raise TypeError("create_string_object should have str or unicode arg") + + +def decode_pdfdocencoding(byte_array: bytes) -> str: + retval = "" + for b in byte_array: + c = _pdfdoc_encoding[b] + if c == "\u0000": + raise UnicodeDecodeError( + "pdfdocencoding", + bytearray(b), + -1, + -1, + "does not exist in translation table", + ) + retval += c + return retval diff --git a/python/user_packages/Python313/site-packages/pypdf/generic/_viewerpref.py b/python/user_packages/Python313/site-packages/pypdf/generic/_viewerpref.py new file mode 100644 index 0000000000000000000000000000000000000000..84fce613b162d0beeafda759c2d90f96b511196f --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypdf/generic/_viewerpref.py @@ -0,0 +1,164 @@ +# Copyright (c) 2023, Pubpub-ZZ +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +from typing import ( + Any, + Optional, + cast, +) + +from ._base import BooleanObject, NameObject, NumberObject, is_null_or_none +from ._data_structures import ArrayObject, DictionaryObject + +f_obj = BooleanObject(False) + + +class ViewerPreferences(DictionaryObject): + def __init__(self, obj: Optional[DictionaryObject] = None) -> None: + super().__init__(self) + if not is_null_or_none(obj): + self.update(obj.items()) # type: ignore + try: + self.indirect_reference = obj.indirect_reference # type: ignore + except AttributeError: + pass + + def _get_bool(self, key: str, default: Optional[BooleanObject]) -> Optional[BooleanObject]: + return self.get(key, default) + + def _set_bool(self, key: str, v: bool) -> None: + self[NameObject(key)] = BooleanObject(v is True) + + def _get_name(self, key: str, default: Optional[NameObject]) -> Optional[NameObject]: + return self.get(key, default) + + def _set_name(self, key: str, lst: list[str], v: NameObject) -> None: + if v[0] != "/": + raise ValueError(f"{v} does not start with '/'") + if lst != [] and v not in lst: + raise ValueError(f"{v} is an unacceptable value") + self[NameObject(key)] = NameObject(v) + + def _get_arr(self, key: str, default: Optional[list[Any]]) -> Optional[ArrayObject]: + return self.get(key, None if default is None else ArrayObject(default)) + + def _set_arr(self, key: str, v: Optional[ArrayObject]) -> None: + if v is None: + try: + del self[NameObject(key)] + except KeyError: + pass + return + if not isinstance(v, ArrayObject): + raise ValueError("ArrayObject is expected") + self[NameObject(key)] = v + + def _get_int(self, key: str, default: Optional[NumberObject]) -> Optional[NumberObject]: + return self.get(key, default) + + def _set_int(self, key: str, v: int) -> None: + self[NameObject(key)] = NumberObject(v) + + @property + def PRINT_SCALING(self) -> NameObject: + return NameObject("/PrintScaling") + + def __new__(cls: Any, value: Any = None) -> "ViewerPreferences": # noqa: PYI034 + def _add_prop_bool(key: str, default: Optional[BooleanObject]) -> property: + return property( + lambda self: self._get_bool(key, default), + lambda self, v: self._set_bool(key, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined + """, + ) + + def _add_prop_name( + key: str, lst: list[str], default: Optional[NameObject] + ) -> property: + return property( + lambda self: self._get_name(key, default), + lambda self, v: self._set_name(key, lst, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined. + Acceptable values: {lst} + """, + ) + + def _add_prop_arr(key: str, default: Optional[ArrayObject]) -> property: + return property( + lambda self: self._get_arr(key, default), + lambda self, v: self._set_arr(key, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined + """, + ) + + def _add_prop_int(key: str, default: Optional[int]) -> property: + return property( + lambda self: self._get_int(key, default), + lambda self, v: self._set_int(key, v), + None, + f""" + Returns/Modify the status of {key}, Returns {default} if not defined + """, + ) + + cls.hide_toolbar = _add_prop_bool("/HideToolbar", f_obj) + cls.hide_menubar = _add_prop_bool("/HideMenubar", f_obj) + cls.hide_windowui = _add_prop_bool("/HideWindowUI", f_obj) + cls.fit_window = _add_prop_bool("/FitWindow", f_obj) + cls.center_window = _add_prop_bool("/CenterWindow", f_obj) + cls.display_doctitle = _add_prop_bool("/DisplayDocTitle", f_obj) + + cls.non_fullscreen_pagemode = _add_prop_name( + "/NonFullScreenPageMode", + ["/UseNone", "/UseOutlines", "/UseThumbs", "/UseOC"], + NameObject("/UseNone"), + ) + cls.direction = _add_prop_name( + "/Direction", ["/L2R", "/R2L"], NameObject("/L2R") + ) + cls.view_area = _add_prop_name("/ViewArea", [], None) + cls.view_clip = _add_prop_name("/ViewClip", [], None) + cls.print_area = _add_prop_name("/PrintArea", [], None) + cls.print_clip = _add_prop_name("/PrintClip", [], None) + cls.print_scaling = _add_prop_name("/PrintScaling", [], None) + cls.duplex = _add_prop_name( + "/Duplex", ["/Simplex", "/DuplexFlipShortEdge", "/DuplexFlipLongEdge"], None + ) + cls.pick_tray_by_pdfsize = _add_prop_bool("/PickTrayByPDFSize", None) + cls.print_pagerange = _add_prop_arr("/PrintPageRange", None) + cls.num_copies = _add_prop_int("/NumCopies", None) + + cls.enforce = _add_prop_arr("/Enforce", ArrayObject()) + + return cast("ViewerPreferences", DictionaryObject.__new__(cls)) diff --git a/python/user_packages/Python313/site-packages/pyperclip-1.11.0.dist-info/licenses/AUTHORS.txt b/python/user_packages/Python313/site-packages/pyperclip-1.11.0.dist-info/licenses/AUTHORS.txt new file mode 100644 index 0000000000000000000000000000000000000000..579a25f2fca844eded5fb91ac78faa2c224de7f3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pyperclip-1.11.0.dist-info/licenses/AUTHORS.txt @@ -0,0 +1,57 @@ +Here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- +people who have submitted patches, reported bugs, added translations, helped +answer newbie questions, and generally made Pyperclip that much better: + +Al Sweigart +Alexander Cobleigh @cblgh +Andrea Scarpino https://github.com/ilpianista +Aniket Pandey https://github.com/lordaniket06 +Anton Yakutovich https://github.com/drakulavich +Brian Levin https://github.com/bnice5000 +Carvell Scott https://github.com/CarvellScott +Cees Timmerman https://github.com/CTimmerman +Chris Clark +Christopher Lambert https://github.com/XN137 +Chris Woerz https://github.com/erendrake +Corey Bryant https://github.com/coreycb +Daniel Shimon https://github.com/daniel-shimon +Edd Barrett https://github.com/vext01 +Eugene Yang https://github.com/eugene-yang +Felix Yan https://github.com/felixonmars +Fredrik Borg https://github.com/frbor +fthoma https://github.com/fthoma +Greg Witt https://github.com/GoodGuyGregory +hinlader https://github.com/hinlader +Hugo van Kemenade https://github.com/hugovk +Hynek Cernoch https://github.com/hynekcer +Jason R. Coombs https://github.com/jaraco +Jon Crall https://github.com/Erotemic +Jonathan Slenders https://github.com/jonathanslenders +JustAShoeMaker https://github.com/JustAShoeMaker +Marcelo Glezer https://github.com/gato +masajxxx https://github.com/masajxxx +Maximilian Hils https://github.com/mhils +mgunyho https://github.com/mgunyho +Melwyn Francis Carlo https://github.com/melwyncarlo +Michał Górny https://github.com/mgorny +Nicola Guerrera https://github.com/nik012003 +Nikolaos-Digenis Karagiannis https://github.com/Digenis +Nils Ohlmeier https://github.com/nils-ohlmeier +Orson Peters https://github.com/orlp +pgajdos https://github.com/pgajdos +PirateOfAndaman https://github.com/PirateOfAndaman +Six https://github.com/brbsix +Stefan Devai https://github.com/stefandevai +Stephen Finucane https://github.com/stephenfin +Stefan Scherfke https://github.com/sscherfke +Steve Elam +Tamir Bahar https://github.com/tmr232 +Terrel Shumway https://github.com/lernisto +Tim Cuthbertson https://github.com/timbertson +Tim Gates https://github.com/timgates42 +Todd Leonhardt https://github.com/tleonhardt +Troy Sankey https://github.com/pwnage101 +utagawa kiki https://github.com/utgwkk +Vertliba V.V. https://github.com/vertliba +Vince West https://github.com/dvincentwest +ZEDGR https://github.com/ZEDGR diff --git a/python/user_packages/Python313/site-packages/pyperclip-1.11.0.dist-info/licenses/LICENSE.txt b/python/user_packages/Python313/site-packages/pyperclip-1.11.0.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..799b74c5bf39adf1b6df285374890056fb4c48eb --- /dev/null +++ b/python/user_packages/Python313/site-packages/pyperclip-1.11.0.dist-info/licenses/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2014, Al Sweigart +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/python/user_packages/Python313/site-packages/pyperclip/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyperclip/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40cfdb52ca75641e76078e2dc26b8e57070345bb Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyperclip/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyperclip/__pycache__/__main__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyperclip/__pycache__/__main__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aec6e4bd4a85393c426bf94f8887ce12212cce16 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyperclip/__pycache__/__main__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika-0.51.1.dist-info/licenses/LICENSE.txt b/python/user_packages/Python313/site-packages/pypika-0.51.1.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c8f3ea0871e0bfe81da0fa6e7c1d7d156dc380e --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika-0.51.1.dist-info/licenses/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ed7484464996fc1da1b4c413e3e6e9a98a94e82 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/analytics.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/analytics.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44b6b37e6a4a5644110f2ed05b12fd60c9d38e37 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/analytics.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/dialects.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/dialects.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a7f03a371740fef10857732ad37b10aa92a18ca0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/dialects.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/enums.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/enums.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..77c93245bb16beb61e77840bd095eb115ead84be Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/enums.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/functions.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/functions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9d2ed686614b1ed769a215221291cb59da25146 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/functions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/pseudocolumns.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/pseudocolumns.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f54332f2d7e8b6ff8cef8d9821e45b52d8c9ce6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/pseudocolumns.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/terms.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/terms.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c5b0e06878acc6694d230c619a46942663007ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/terms.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62576b3f1e7357962598e642892233c733c4f8d2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__init__.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e91d763691da537b6695821dba795401da517a7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/array.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/array.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52f4fbe89df5104e7247d4a9814ac8f87b9dba30 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/array.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/condition.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/condition.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86eec0b471802fdf5e5a9d9e2218a36b4ac7b8ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/condition.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/dates_and_times.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/dates_and_times.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e6b4fab11ed69dbf0342cb0475bdeab0ba07f79 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/dates_and_times.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/nullable_arg.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/nullable_arg.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60de047008e50f6ac15e26df64740eda38a08623 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/nullable_arg.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/search_string.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/search_string.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36324c89c514628aa6042dd043707576ded41e7d Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/search_string.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/type_conversion.cpython-313.pyc b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/type_conversion.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..520b7ece22827ddd6f3c23b58a08fb9b9fcaddb6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pypika/clickhouse/__pycache__/type_conversion.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/array.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/array.py new file mode 100644 index 0000000000000000000000000000000000000000..2c6250f601605b29b0fae11ac0a50c4ab97a5312 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika/clickhouse/array.py @@ -0,0 +1,98 @@ +from __future__ import annotations + +import abc + +from pypika.terms import ( + Field, + Function, + Term, +) +from pypika.utils import format_alias_sql + + +class Array(Term): + def __init__( + self, values: list, converter_cls=None, converter_options: dict | None = None, alias: str | None = None + ): + super().__init__(alias) + self._values = values + self._converter_cls = converter_cls + self._converter_options = converter_options or dict() + + def get_sql(self): + if self._converter_cls: + converted = [] + for value in self._values: + converter = self._converter_cls(value, **self._converter_options) + converted.append(converter.get_sql()) + sql = "".join(["[", ",".join(converted), "]"]) + + else: + sql = str(self._values) + + return format_alias_sql(sql, self.alias) + + +class HasAny(Function): + def __init__( + self, + left_array: Array or Field, + right_array: Array or Field, + alias: str | None = None, + schema: str | None = None, + ): + self._left_array = left_array + self._right_array = right_array + self.alias = alias + self.schema = schema + self.args = () + self.name = "hasAny" + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + left = self._left_array.get_sql() + right = self._right_array.get_sql() + sql = "{name}({left},{right})".format( + name=self.name, + left='"%s"' % left if isinstance(self._left_array, Field) else left, + right='"%s"' % right if isinstance(self._right_array, Field) else right, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class _AbstractArrayFunction(Function, metaclass=abc.ABCMeta): + def __init__(self, array: Array or Field, alias: str | None = None, schema: str | None = None): + self.schema = schema + self.alias = alias + self.name = self.clickhouse_function() + self._array = array + + def get_sql(self, with_namespace=False, quote_char=None, dialect=None, **kwargs): + array = self._array.get_sql() + sql = "{name}({array})".format( + name=self.name, + array='"%s"' % array if isinstance(self._array, Field) else array, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + @classmethod + @abc.abstractmethod + def clickhouse_function(cls) -> str: + pass + + +class NotEmpty(_AbstractArrayFunction): + @classmethod + def clickhouse_function(cls) -> str: + return "notEmpty" + + +class Empty(_AbstractArrayFunction): + @classmethod + def clickhouse_function(cls) -> str: + return "empty" + + +class Length(_AbstractArrayFunction): + @classmethod + def clickhouse_function(cls) -> str: + return "length" diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/condition.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/condition.py new file mode 100644 index 0000000000000000000000000000000000000000..ed08224e22fb27eb18876595a542dcd3ad14bffc --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika/clickhouse/condition.py @@ -0,0 +1,11 @@ +from pypika.terms import Function + + +class If(Function): + def __init__(self, *conditions, **kwargs): + super().__init__("if", *conditions, **kwargs) + + +class MultiIf(Function): + def __init__(self, *conditions, **kwargs): + super().__init__("multiIf", *conditions, **kwargs) diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/dates_and_times.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/dates_and_times.py new file mode 100644 index 0000000000000000000000000000000000000000..0c975902ce5e2145dc4f7ed9b5ae10ad8cf9cfe5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika/clickhouse/dates_and_times.py @@ -0,0 +1,22 @@ +from pypika import CustomFunction + +_add_subtract_args = ["name", "interval"] + +ToYYYYMM = CustomFunction("toYYYYMM") +AddYears = CustomFunction("addYears", _add_subtract_args) +AddMonths = CustomFunction("addMonths", _add_subtract_args) +AddWeeks = CustomFunction("addWeeks", _add_subtract_args) +AddDays = CustomFunction("addDays", _add_subtract_args) +AddHours = CustomFunction("addHours", _add_subtract_args) +AddMinutes = CustomFunction("addMinutes", _add_subtract_args) +AddSeconds = CustomFunction("addSeconds", _add_subtract_args) +AddQuarters = CustomFunction("addQuarters", _add_subtract_args) +SubtractYears = CustomFunction("subtractYears", _add_subtract_args) +SubtractMonths = CustomFunction("subtractMonths", _add_subtract_args) +SubtractWeeks = CustomFunction("subtractWeeks", _add_subtract_args) +SubtractDays = CustomFunction("subtractDays", _add_subtract_args) +SubtractHours = CustomFunction("subtractHours", _add_subtract_args) +SubtractMinutes = CustomFunction("subtractMinutes", _add_subtract_args) +SubtractSeconds = CustomFunction("subtractSeconds", _add_subtract_args) +SubtractQuarters = CustomFunction("subtractQuarters", _add_subtract_args) +FormatDateTime = CustomFunction("formatDateTime", ["name", "dt_format"]) diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/nullable_arg.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/nullable_arg.py new file mode 100644 index 0000000000000000000000000000000000000000..a3f23fe53af3174a33b002f6965e2d1ca06d2790 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika/clickhouse/nullable_arg.py @@ -0,0 +1,6 @@ +from pypika.terms import Function + + +class IfNull(Function): + def __init__(self, term, alt, **kwargs): + super().__init__("ifNull", term, alt, **kwargs) diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/search_string.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/search_string.py new file mode 100644 index 0000000000000000000000000000000000000000..4dfb1ec06b4c1182454b8bc508b50410efc2c79a --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika/clickhouse/search_string.py @@ -0,0 +1,90 @@ +from __future__ import annotations + +import abc + +from pypika.terms import Function +from pypika.utils import format_alias_sql + + +class _AbstractSearchString(Function, metaclass=abc.ABCMeta): + def __init__(self, name, pattern: str, alias: str | None = None): + super().__init__(self.clickhouse_function(), name, alias=alias) + + self._pattern = pattern + + @classmethod + @abc.abstractmethod + def clickhouse_function(cls) -> str: + pass + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + args = [] + for p in self.args: + if hasattr(p, "get_sql"): + args.append('toString("{arg}")'.format(arg=p.get_sql(with_alias=False, **kwargs))) + else: + args.append(str(p)) + + sql = "{name}({args},'{pattern}')".format( + name=self.name, + args=",".join(args), + pattern=self._pattern, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class Match(_AbstractSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "match" + + +class Like(_AbstractSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "like" + + +class NotLike(_AbstractSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "notLike" + + +class _AbstractMultiSearchString(Function, metaclass=abc.ABCMeta): + def __init__(self, name, patterns: list, alias: str | None = None): + super().__init__(self.clickhouse_function(), name, alias=alias) + + self._patterns = patterns + + @classmethod + @abc.abstractmethod + def clickhouse_function(cls) -> str: + pass + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + args = [] + for p in self.args: + if hasattr(p, "get_sql"): + args.append('toString("{arg}")'.format(arg=p.get_sql(with_alias=False, **kwargs))) + else: + args.append(str(p)) + + sql = "{name}({args},[{patterns}])".format( + name=self.name, + args=",".join(args), + patterns=",".join(["'%s'" % i for i in self._patterns]), + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class MultiSearchAny(_AbstractMultiSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "multiSearchAny" + + +class MultiMatchAny(_AbstractMultiSearchString): + @classmethod + def clickhouse_function(cls) -> str: + return "multiMatchAny" diff --git a/python/user_packages/Python313/site-packages/pypika/clickhouse/type_conversion.py b/python/user_packages/Python313/site-packages/pypika/clickhouse/type_conversion.py new file mode 100644 index 0000000000000000000000000000000000000000..a17cd02d133199bf1477cfda78d218c20af74270 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pypika/clickhouse/type_conversion.py @@ -0,0 +1,90 @@ +from __future__ import annotations + +from pypika.terms import ( + Field, + Function, +) +from pypika.utils import format_alias_sql + + +class ToString(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toString", name, alias=alias) + + +class ToFixedString(Function): + def __init__(self, field, length: int, alias: str | None = None, schema: str | None = None): + self._length = length + self._field = field + self.alias = alias + self.name = "toFixedString" + self.schema = schema + self.args = () + + def get_sql(self, with_alias=False, with_namespace=False, quote_char=None, dialect=None, **kwargs): + sql = "{name}({field},{length})".format( + name=self.name, + field=self._field if isinstance(self._field, Field) else "'%s'" % str(self._field), + length=self._length, + ) + return format_alias_sql(sql, self.alias, **kwargs) + + +class ToInt8(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt8", name, alias=alias) + + +class ToInt16(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt16", name, alias=alias) + + +class ToInt32(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt32", name, alias=alias) + + +class ToInt64(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toInt64", name, alias=alias) + + +class ToUInt8(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt8", name, alias=alias) + + +class ToUInt16(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt16", name, alias=alias) + + +class ToUInt32(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt32", name, alias=alias) + + +class ToUInt64(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toUInt64", name, alias=alias) + + +class ToFloat32(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toFloat32", name, alias=alias) + + +class ToFloat64(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toFloat64", name, alias=alias) + + +class ToDate(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toDate", name, alias=alias) + + +class ToDateTime(Function): + def __init__(self, name, alias: str | None = None): + super().__init__("toDateTime", name, alias=alias) diff --git a/python/user_packages/Python313/site-packages/pyproject_hooks/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyproject_hooks/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6ba08e6c8ef52248a34106b0a9700a4728d4608 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyproject_hooks/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyproject_hooks/__pycache__/_impl.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyproject_hooks/__pycache__/_impl.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2e0355ddf395571edef472bac96ad5e13c25e0a Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyproject_hooks/__pycache__/_impl.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__init__.py b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..906d0ba20e1f3e10b35456c2db1f207a071ce246 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__init__.py @@ -0,0 +1,21 @@ +"""This is a subpackage because the directory is on sys.path for _in_process.py + +The subpackage should stay as empty as possible to avoid shadowing modules that +the backend might import. +""" + +import importlib.resources as resources + +try: + resources.files +except AttributeError: + # Python 3.8 compatibility + def _in_proc_script_path(): + return resources.path(__package__, "_in_process.py") + +else: + + def _in_proc_script_path(): + return resources.as_file( + resources.files(__package__).joinpath("_in_process.py") + ) diff --git a/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80e91cf942f3b9447f6a619c8c873e45df26877c Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-313.pyc b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9264b326bd218bbcdadc766531c6a66cfa962943 Binary files /dev/null and b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/_in_process.py b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/_in_process.py new file mode 100644 index 0000000000000000000000000000000000000000..d689bab7219b0d2abf8b127d3ddd1eb0a61eb997 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pyproject_hooks/_in_process/_in_process.py @@ -0,0 +1,389 @@ +"""This is invoked in a subprocess to call the build backend hooks. + +It expects: +- Command line args: hook_name, control_dir +- Environment variables: + _PYPROJECT_HOOKS_BUILD_BACKEND=entry.point:spec + _PYPROJECT_HOOKS_BACKEND_PATH=paths (separated with os.pathsep) +- control_dir/input.json: + - {"kwargs": {...}} + +Results: +- control_dir/output.json + - {"return_val": ...} +""" +import json +import os +import os.path +import re +import shutil +import sys +import traceback +from glob import glob +from importlib import import_module +from importlib.machinery import PathFinder +from os.path import join as pjoin + +# This file is run as a script, and `import wrappers` is not zip-safe, so we +# include write_json() and read_json() from wrappers.py. + + +def write_json(obj, path, **kwargs): + with open(path, "w", encoding="utf-8") as f: + json.dump(obj, f, **kwargs) + + +def read_json(path): + with open(path, encoding="utf-8") as f: + return json.load(f) + + +class BackendUnavailable(Exception): + """Raised if we cannot import the backend""" + + def __init__(self, message, traceback=None): + super().__init__(message) + self.message = message + self.traceback = traceback + + +class HookMissing(Exception): + """Raised if a hook is missing and we are not executing the fallback""" + + def __init__(self, hook_name=None): + super().__init__(hook_name) + self.hook_name = hook_name + + +def _build_backend(): + """Find and load the build backend""" + backend_path = os.environ.get("_PYPROJECT_HOOKS_BACKEND_PATH") + ep = os.environ["_PYPROJECT_HOOKS_BUILD_BACKEND"] + mod_path, _, obj_path = ep.partition(":") + + if backend_path: + # Ensure in-tree backend directories have the highest priority when importing. + extra_pathitems = backend_path.split(os.pathsep) + sys.meta_path.insert(0, _BackendPathFinder(extra_pathitems, mod_path)) + + try: + obj = import_module(mod_path) + except ImportError: + msg = f"Cannot import {mod_path!r}" + raise BackendUnavailable(msg, traceback.format_exc()) + + if obj_path: + for path_part in obj_path.split("."): + obj = getattr(obj, path_part) + return obj + + +class _BackendPathFinder: + """Implements the MetaPathFinder interface to locate modules in ``backend-path``. + + Since the environment provided by the frontend can contain all sorts of + MetaPathFinders, the only way to ensure the backend is loaded from the + right place is to prepend our own. + """ + + def __init__(self, backend_path, backend_module): + self.backend_path = backend_path + self.backend_module = backend_module + self.backend_parent, _, _ = backend_module.partition(".") + + def find_spec(self, fullname, _path, _target=None): + if "." in fullname: + # Rely on importlib to find nested modules based on parent's path + return None + + # Ignore other items in _path or sys.path and use backend_path instead: + spec = PathFinder.find_spec(fullname, path=self.backend_path) + if spec is None and fullname == self.backend_parent: + # According to the spec, the backend MUST be loaded from backend-path. + # Therefore, we can halt the import machinery and raise a clean error. + msg = f"Cannot find module {self.backend_module!r} in {self.backend_path!r}" + raise BackendUnavailable(msg) + + return spec + + if sys.version_info >= (3, 8): + + def find_distributions(self, context=None): + # Delayed import: Python 3.7 does not contain importlib.metadata + from importlib.metadata import DistributionFinder, MetadataPathFinder + + context = DistributionFinder.Context(path=self.backend_path) + return MetadataPathFinder.find_distributions(context=context) + + +def _supported_features(): + """Return the list of options features supported by the backend. + + Returns a list of strings. + The only possible value is 'build_editable'. + """ + backend = _build_backend() + features = [] + if hasattr(backend, "build_editable"): + features.append("build_editable") + return features + + +def get_requires_for_build_wheel(config_settings): + """Invoke the optional get_requires_for_build_wheel hook + + Returns [] if the hook is not defined. + """ + backend = _build_backend() + try: + hook = backend.get_requires_for_build_wheel + except AttributeError: + return [] + else: + return hook(config_settings) + + +def get_requires_for_build_editable(config_settings): + """Invoke the optional get_requires_for_build_editable hook + + Returns [] if the hook is not defined. + """ + backend = _build_backend() + try: + hook = backend.get_requires_for_build_editable + except AttributeError: + return [] + else: + return hook(config_settings) + + +def prepare_metadata_for_build_wheel( + metadata_directory, config_settings, _allow_fallback +): + """Invoke optional prepare_metadata_for_build_wheel + + Implements a fallback by building a wheel if the hook isn't defined, + unless _allow_fallback is False in which case HookMissing is raised. + """ + backend = _build_backend() + try: + hook = backend.prepare_metadata_for_build_wheel + except AttributeError: + if not _allow_fallback: + raise HookMissing() + else: + return hook(metadata_directory, config_settings) + # fallback to build_wheel outside the try block to avoid exception chaining + # which can be confusing to users and is not relevant + whl_basename = backend.build_wheel(metadata_directory, config_settings) + return _get_wheel_metadata_from_wheel( + whl_basename, metadata_directory, config_settings + ) + + +def prepare_metadata_for_build_editable( + metadata_directory, config_settings, _allow_fallback +): + """Invoke optional prepare_metadata_for_build_editable + + Implements a fallback by building an editable wheel if the hook isn't + defined, unless _allow_fallback is False in which case HookMissing is + raised. + """ + backend = _build_backend() + try: + hook = backend.prepare_metadata_for_build_editable + except AttributeError: + if not _allow_fallback: + raise HookMissing() + try: + build_hook = backend.build_editable + except AttributeError: + raise HookMissing(hook_name="build_editable") + else: + whl_basename = build_hook(metadata_directory, config_settings) + return _get_wheel_metadata_from_wheel( + whl_basename, metadata_directory, config_settings + ) + else: + return hook(metadata_directory, config_settings) + + +WHEEL_BUILT_MARKER = "PYPROJECT_HOOKS_ALREADY_BUILT_WHEEL" + + +def _dist_info_files(whl_zip): + """Identify the .dist-info folder inside a wheel ZipFile.""" + res = [] + for path in whl_zip.namelist(): + m = re.match(r"[^/\\]+-[^/\\]+\.dist-info/", path) + if m: + res.append(path) + if res: + return res + raise Exception("No .dist-info folder found in wheel") + + +def _get_wheel_metadata_from_wheel(whl_basename, metadata_directory, config_settings): + """Extract the metadata from a wheel. + + Fallback for when the build backend does not + define the 'get_wheel_metadata' hook. + """ + from zipfile import ZipFile + + with open(os.path.join(metadata_directory, WHEEL_BUILT_MARKER), "wb"): + pass # Touch marker file + + whl_file = os.path.join(metadata_directory, whl_basename) + with ZipFile(whl_file) as zipf: + dist_info = _dist_info_files(zipf) + zipf.extractall(path=metadata_directory, members=dist_info) + return dist_info[0].split("/")[0] + + +def _find_already_built_wheel(metadata_directory): + """Check for a wheel already built during the get_wheel_metadata hook.""" + if not metadata_directory: + return None + metadata_parent = os.path.dirname(metadata_directory) + if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)): + return None + + whl_files = glob(os.path.join(metadata_parent, "*.whl")) + if not whl_files: + print("Found wheel built marker, but no .whl files") + return None + if len(whl_files) > 1: + print( + "Found multiple .whl files; unspecified behaviour. " + "Will call build_wheel." + ) + return None + + # Exactly one .whl file + return whl_files[0] + + +def build_wheel(wheel_directory, config_settings, metadata_directory=None): + """Invoke the mandatory build_wheel hook. + + If a wheel was already built in the + prepare_metadata_for_build_wheel fallback, this + will copy it rather than rebuilding the wheel. + """ + prebuilt_whl = _find_already_built_wheel(metadata_directory) + if prebuilt_whl: + shutil.copy2(prebuilt_whl, wheel_directory) + return os.path.basename(prebuilt_whl) + + return _build_backend().build_wheel( + wheel_directory, config_settings, metadata_directory + ) + + +def build_editable(wheel_directory, config_settings, metadata_directory=None): + """Invoke the optional build_editable hook. + + If a wheel was already built in the + prepare_metadata_for_build_editable fallback, this + will copy it rather than rebuilding the wheel. + """ + backend = _build_backend() + try: + hook = backend.build_editable + except AttributeError: + raise HookMissing() + else: + prebuilt_whl = _find_already_built_wheel(metadata_directory) + if prebuilt_whl: + shutil.copy2(prebuilt_whl, wheel_directory) + return os.path.basename(prebuilt_whl) + + return hook(wheel_directory, config_settings, metadata_directory) + + +def get_requires_for_build_sdist(config_settings): + """Invoke the optional get_requires_for_build_wheel hook + + Returns [] if the hook is not defined. + """ + backend = _build_backend() + try: + hook = backend.get_requires_for_build_sdist + except AttributeError: + return [] + else: + return hook(config_settings) + + +class _DummyException(Exception): + """Nothing should ever raise this exception""" + + +class GotUnsupportedOperation(Exception): + """For internal use when backend raises UnsupportedOperation""" + + def __init__(self, traceback): + self.traceback = traceback + + +def build_sdist(sdist_directory, config_settings): + """Invoke the mandatory build_sdist hook.""" + backend = _build_backend() + try: + return backend.build_sdist(sdist_directory, config_settings) + except getattr(backend, "UnsupportedOperation", _DummyException): + raise GotUnsupportedOperation(traceback.format_exc()) + + +HOOK_NAMES = { + "get_requires_for_build_wheel", + "prepare_metadata_for_build_wheel", + "build_wheel", + "get_requires_for_build_editable", + "prepare_metadata_for_build_editable", + "build_editable", + "get_requires_for_build_sdist", + "build_sdist", + "_supported_features", +} + + +def main(): + if len(sys.argv) < 3: + sys.exit("Needs args: hook_name, control_dir") + hook_name = sys.argv[1] + control_dir = sys.argv[2] + if hook_name not in HOOK_NAMES: + sys.exit("Unknown hook: %s" % hook_name) + + # Remove the parent directory from sys.path to avoid polluting the backend + # import namespace with this directory. + here = os.path.dirname(__file__) + if here in sys.path: + sys.path.remove(here) + + hook = globals()[hook_name] + + hook_input = read_json(pjoin(control_dir, "input.json")) + + json_out = {"unsupported": False, "return_val": None} + try: + json_out["return_val"] = hook(**hook_input["kwargs"]) + except BackendUnavailable as e: + json_out["no_backend"] = True + json_out["traceback"] = e.traceback + json_out["backend_error"] = e.message + except GotUnsupportedOperation as e: + json_out["unsupported"] = True + json_out["traceback"] = e.traceback + except HookMissing as e: + json_out["hook_missing"] = True + json_out["missing_hook_name"] = e.hook_name or hook_name + + write_json(json_out, pjoin(control_dir, "output.json"), indent=2) + + +if __name__ == "__main__": + main() diff --git a/python/user_packages/Python313/site-packages/python_dotenv-1.2.2.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/python_dotenv-1.2.2.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..3a97119010ac82e15e917a69b7b8f9f59b5a4601 --- /dev/null +++ b/python/user_packages/Python313/site-packages/python_dotenv-1.2.2.dist-info/licenses/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2014, Saurabh Kumar (python-dotenv), 2013, Ted Tieken (django-dotenv-rw), 2013, Jacob Kaplan-Moss (django-dotenv) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of django-dotenv nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/python/user_packages/Python313/site-packages/pyyaml-6.0.3.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/pyyaml-6.0.3.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..2f1b8e15e5627d92f0521605c9870bc8e5505cb4 --- /dev/null +++ b/python/user_packages/Python313/site-packages/pyyaml-6.0.3.dist-info/licenses/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2017-2021 Ingy döt Net +Copyright (c) 2006-2016 Kirill Simonov + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/referencing-0.37.0.dist-info/licenses/COPYING b/python/user_packages/Python313/site-packages/referencing-0.37.0.dist-info/licenses/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..a9f853e43069b8e3f8a156a4af2b1198a004230d --- /dev/null +++ b/python/user_packages/Python313/site-packages/referencing-0.37.0.dist-info/licenses/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2022 Julian Berman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8931026a7d03599c287cd4953e1d5325c1e77c6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/_attrs.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/_attrs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05ee9871830f61929059ad198e988f51c6df3a46 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/_attrs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/_core.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/_core.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db755d8b6ea84a670cc4aed19868c86f693bf570 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/_core.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9cf2bf059629d5a55b2c6deee26c5076608e250 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/jsonschema.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/jsonschema.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dca7fc55b385144edadc47a7bf291ab559f1f69e Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/jsonschema.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/retrieval.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/retrieval.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..177dc982ec753a2752cf6dfb31dbc764ce605865 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/retrieval.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/__pycache__/typing.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/__pycache__/typing.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0111c5e184e703d6f48d6f951ffe7512431b8ed2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/__pycache__/typing.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__init__.py b/python/user_packages/Python313/site-packages/referencing/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93bde5bdd2c4e7093daab17a632ea17566972799 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_core.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_core.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cd5773f9cd158b9ba37612162fe0a00f305db9a Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_core.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30a0bbbeb14c5d34cb2f08661c011f6ef4ad074b Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..289cfc9668177265e97ee7984de62ee52fc9a356 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_jsonschema.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b8f181d036c213693788296f54729ce4a418f77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_referencing_suite.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-313.pyc b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4ee605f3f24e6069a86bd3ac7eee1692d0ce89e Binary files /dev/null and b/python/user_packages/Python313/site-packages/referencing/tests/__pycache__/test_retrieval.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/referencing/tests/test_core.py b/python/user_packages/Python313/site-packages/referencing/tests/test_core.py new file mode 100644 index 0000000000000000000000000000000000000000..3edddbc3d96581e1c74069baa873900495366bab --- /dev/null +++ b/python/user_packages/Python313/site-packages/referencing/tests/test_core.py @@ -0,0 +1,1057 @@ +from rpds import HashTrieMap +import pytest + +from referencing import Anchor, Registry, Resource, Specification, exceptions +from referencing.jsonschema import DRAFT202012 + +ID_AND_CHILDREN = Specification( + name="id-and-children", + id_of=lambda contents: contents.get("ID"), + subresources_of=lambda contents: contents.get("children", []), + anchors_in=lambda specification, contents: [ + Anchor( + name=name, + resource=specification.create_resource(contents=each), + ) + for name, each in contents.get("anchors", {}).items() + ], + maybe_in_subresource=lambda segments, resolver, subresource: ( + resolver.in_subresource(subresource) + if not len(segments) % 2 + and all(each == "children" for each in segments[::2]) + else resolver + ), +) + + +def blow_up(uri): # pragma: no cover + """ + A retriever suitable for use in tests which expect it never to be used. + """ + raise RuntimeError("This retrieve function expects to never be called!") + + +class TestRegistry: + def test_with_resource(self): + """ + Adding a resource to the registry then allows re-retrieving it. + """ + + resource = Resource.opaque(contents={"foo": "bar"}) + uri = "urn:example" + registry = Registry().with_resource(uri=uri, resource=resource) + assert registry[uri] is resource + + def test_with_resources(self): + """ + Adding multiple resources to the registry is like adding each one. + """ + + one = Resource.opaque(contents={}) + two = Resource(contents={"foo": "bar"}, specification=ID_AND_CHILDREN) + registry = Registry().with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + assert registry == Registry().with_resource( + uri="http://example.com/1", + resource=one, + ).with_resource( + uri="http://example.com/foo/bar", + resource=two, + ) + + def test_matmul_resource(self): + uri = "urn:example:resource" + resource = ID_AND_CHILDREN.create_resource({"ID": uri, "foo": 12}) + registry = resource @ Registry() + assert registry == Registry().with_resource(uri, resource) + + def test_matmul_many_resources(self): + one_uri = "urn:example:one" + one = ID_AND_CHILDREN.create_resource({"ID": one_uri, "foo": 12}) + + two_uri = "urn:example:two" + two = ID_AND_CHILDREN.create_resource({"ID": two_uri, "foo": 12}) + + registry = [one, two] @ Registry() + assert registry == Registry().with_resources( + [(one_uri, one), (two_uri, two)], + ) + + def test_matmul_resource_without_id(self): + resource = Resource.opaque(contents={"foo": "bar"}) + with pytest.raises(exceptions.NoInternalID) as e: + resource @ Registry() + assert e.value == exceptions.NoInternalID(resource=resource) + + def test_with_contents_from_json_schema(self): + uri = "urn:example" + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + registry = Registry().with_contents([(uri, schema)]) + + expected = Resource(contents=schema, specification=DRAFT202012) + assert registry[uri] == expected + + def test_with_contents_and_default_specification(self): + uri = "urn:example" + registry = Registry().with_contents( + [(uri, {"foo": "bar"})], + default_specification=Specification.OPAQUE, + ) + assert registry[uri] == Resource.opaque({"foo": "bar"}) + + def test_len(self): + total = 5 + registry = Registry().with_contents( + [(str(i), {"foo": "bar"}) for i in range(total)], + default_specification=Specification.OPAQUE, + ) + assert len(registry) == total + + def test_bool_empty(self): + assert not Registry() + + def test_bool_not_empty(self): + registry = Registry().with_contents( + [(str(i), {"foo": "bar"}) for i in range(3)], + default_specification=Specification.OPAQUE, + ) + assert registry + + def test_iter(self): + registry = Registry().with_contents( + [(str(i), {"foo": "bar"}) for i in range(8)], + default_specification=Specification.OPAQUE, + ) + assert set(registry) == {str(i) for i in range(8)} + + def test_crawl_still_has_top_level_resource(self): + resource = Resource.opaque({"foo": "bar"}) + uri = "urn:example" + registry = Registry({uri: resource}).crawl() + assert registry[uri] is resource + + def test_crawl_finds_a_subresource(self): + child_id = "urn:child" + root = ID_AND_CHILDREN.create_resource( + {"ID": "urn:root", "children": [{"ID": child_id, "foo": 12}]}, + ) + registry = root @ Registry() + with pytest.raises(LookupError): + registry[child_id] + + expected = ID_AND_CHILDREN.create_resource({"ID": child_id, "foo": 12}) + assert registry.crawl()[child_id] == expected + + def test_crawl_finds_anchors_with_id(self): + resource = ID_AND_CHILDREN.create_resource( + {"ID": "urn:bar", "anchors": {"foo": 12}}, + ) + registry = resource @ Registry() + + assert registry.crawl().anchor(resource.id(), "foo").value == Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource(12), + ) + + def test_crawl_finds_anchors_no_id(self): + resource = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}}) + registry = Registry().with_resource("urn:root", resource) + + assert registry.crawl().anchor("urn:root", "foo").value == Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource(12), + ) + + def test_contents(self): + resource = Resource.opaque({"foo": "bar"}) + uri = "urn:example" + registry = Registry().with_resource(uri, resource) + assert registry.contents(uri) == {"foo": "bar"} + + def test_getitem_strips_empty_fragments(self): + uri = "http://example.com/" + resource = ID_AND_CHILDREN.create_resource({"ID": uri + "#"}) + registry = resource @ Registry() + assert registry[uri] == registry[uri + "#"] == resource + + def test_contents_strips_empty_fragments(self): + uri = "http://example.com/" + resource = ID_AND_CHILDREN.create_resource({"ID": uri + "#"}) + registry = resource @ Registry() + assert ( + registry.contents(uri) + == registry.contents(uri + "#") + == {"ID": uri + "#"} + ) + + def test_contents_nonexistent_resource(self): + registry = Registry() + with pytest.raises(exceptions.NoSuchResource) as e: + registry.contents("urn:example") + assert e.value == exceptions.NoSuchResource(ref="urn:example") + + def test_crawled_anchor(self): + resource = ID_AND_CHILDREN.create_resource({"anchors": {"foo": "bar"}}) + registry = Registry().with_resource("urn:example", resource) + retrieved = registry.anchor("urn:example", "foo") + assert retrieved.value == Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource("bar"), + ) + assert retrieved.registry == registry.crawl() + + def test_anchor_in_nonexistent_resource(self): + registry = Registry() + with pytest.raises(exceptions.NoSuchResource) as e: + registry.anchor("urn:example", "foo") + assert e.value == exceptions.NoSuchResource(ref="urn:example") + + def test_init(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry( + { + "http://example.com/1": one, + "http://example.com/foo/bar": two, + }, + ) + assert ( + registry + == Registry() + .with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + .crawl() + ) + + def test_dict_conversion(self): + """ + Passing a `dict` to `Registry` gets converted to a `HashTrieMap`. + + So continuing to use the registry works. + """ + + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry( + {"http://example.com/1": one}, + ).with_resource("http://example.com/foo/bar", two) + assert ( + registry.crawl() + == Registry() + .with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + .crawl() + ) + + def test_no_such_resource(self): + registry = Registry() + with pytest.raises(exceptions.NoSuchResource) as e: + registry["urn:bigboom"] + assert e.value == exceptions.NoSuchResource(ref="urn:bigboom") + + def test_combine(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + four = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}}) + + first = Registry({"http://example.com/1": one}) + second = Registry().with_resource("http://example.com/foo/bar", two) + third = Registry( + { + "http://example.com/1": one, + "http://example.com/baz": three, + }, + ) + fourth = ( + Registry() + .with_resource( + "http://example.com/foo/quux", + four, + ) + .crawl() + ) + assert first.combine(second, third, fourth) == Registry( + [ + ("http://example.com/1", one), + ("http://example.com/baz", three), + ("http://example.com/foo/quux", four), + ], + anchors=HashTrieMap( + { + ("http://example.com/foo/quux", "foo"): Anchor( + name="foo", + resource=ID_AND_CHILDREN.create_resource(12), + ), + }, + ), + ).with_resource("http://example.com/foo/bar", two) + + def test_combine_self(self): + """ + Combining a registry with itself short-circuits. + + This is a performance optimization -- otherwise we do lots more work + (in jsonschema this seems to correspond to making the test suite take + *3x* longer). + """ + + registry = Registry({"urn:foo": "bar"}) + assert registry.combine(registry) is registry + + def test_combine_with_uncrawled_resources(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + first = Registry().with_resource("http://example.com/1", one) + second = Registry().with_resource("http://example.com/foo/bar", two) + third = Registry( + { + "http://example.com/1": one, + "http://example.com/baz": three, + }, + ) + expected = Registry( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ("http://example.com/baz", three), + ], + ) + combined = first.combine(second, third) + assert combined != expected + assert combined.crawl() == expected + + def test_combine_with_single_retrieve(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + def retrieve(uri): # pragma: no cover + pass + + first = Registry().with_resource("http://example.com/1", one) + second = Registry( + retrieve=retrieve, + ).with_resource("http://example.com/2", two) + third = Registry().with_resource("http://example.com/3", three) + + assert first.combine(second, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + assert second.combine(first, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + + def test_combine_with_common_retrieve(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + def retrieve(uri): # pragma: no cover + pass + + first = Registry(retrieve=retrieve).with_resource( + "http://example.com/1", + one, + ) + second = Registry( + retrieve=retrieve, + ).with_resource("http://example.com/2", two) + third = Registry(retrieve=retrieve).with_resource( + "http://example.com/3", + three, + ) + + assert first.combine(second, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + assert second.combine(first, third) == Registry( + retrieve=retrieve, + ).with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/2", two), + ("http://example.com/3", three), + ], + ) + + def test_combine_conflicting_retrieve(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + three = ID_AND_CHILDREN.create_resource({"baz": "quux"}) + + def foo_retrieve(uri): # pragma: no cover + pass + + def bar_retrieve(uri): # pragma: no cover + pass + + first = Registry(retrieve=foo_retrieve).with_resource( + "http://example.com/1", + one, + ) + second = Registry().with_resource("http://example.com/2", two) + third = Registry(retrieve=bar_retrieve).with_resource( + "http://example.com/3", + three, + ) + + with pytest.raises(Exception, match="conflict.*retriev"): + first.combine(second, third) + + def test_remove(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry({"urn:foo": one, "urn:bar": two}) + assert registry.remove("urn:foo") == Registry({"urn:bar": two}) + + def test_remove_uncrawled(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry().with_resources( + [("urn:foo", one), ("urn:bar", two)], + ) + assert registry.remove("urn:foo") == Registry().with_resource( + "urn:bar", + two, + ) + + def test_remove_with_anchors(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"anchors": {"foo": "bar"}}) + registry = ( + Registry() + .with_resources( + [("urn:foo", one), ("urn:bar", two)], + ) + .crawl() + ) + assert ( + registry.remove("urn:bar") + == Registry() + .with_resource( + "urn:foo", + one, + ) + .crawl() + ) + + def test_remove_nonexistent_uri(self): + with pytest.raises(exceptions.NoSuchResource) as e: + Registry().remove("urn:doesNotExist") + assert e.value == exceptions.NoSuchResource(ref="urn:doesNotExist") + + def test_retrieve(self): + foo = Resource.opaque({"foo": "bar"}) + registry = Registry(retrieve=lambda uri: foo) + assert registry.get_or_retrieve("urn:example").value == foo + + def test_retrieve_arbitrary_exception(self): + foo = Resource.opaque({"foo": "bar"}) + + def retrieve(uri): + if uri == "urn:succeed": + return foo + raise Exception("Oh no!") + + registry = Registry(retrieve=retrieve) + assert registry.get_or_retrieve("urn:succeed").value == foo + with pytest.raises(exceptions.Unretrievable): + registry.get_or_retrieve("urn:uhoh") + + def test_retrieve_no_such_resource(self): + foo = Resource.opaque({"foo": "bar"}) + + def retrieve(uri): + if uri == "urn:succeed": + return foo + raise exceptions.NoSuchResource(ref=uri) + + registry = Registry(retrieve=retrieve) + assert registry.get_or_retrieve("urn:succeed").value == foo + with pytest.raises(exceptions.NoSuchResource): + registry.get_or_retrieve("urn:uhoh") + + def test_retrieve_cannot_determine_specification(self): + def retrieve(uri): + return Resource.from_contents({}) + + registry = Registry(retrieve=retrieve) + with pytest.raises(exceptions.CannotDetermineSpecification): + registry.get_or_retrieve("urn:uhoh") + + def test_retrieve_already_available_resource(self): + foo = Resource.opaque({"foo": "bar"}) + registry = Registry({"urn:example": foo}, retrieve=blow_up) + assert registry["urn:example"] == foo + assert registry.get_or_retrieve("urn:example").value == foo + + def test_retrieve_first_checks_crawlable_resource(self): + child = ID_AND_CHILDREN.create_resource({"ID": "urn:child", "foo": 12}) + root = ID_AND_CHILDREN.create_resource({"children": [child.contents]}) + registry = Registry(retrieve=blow_up).with_resource("urn:root", root) + assert registry.crawl()["urn:child"] == child + + def test_resolver(self): + one = Resource.opaque(contents={}) + registry = Registry({"http://example.com": one}) + resolver = registry.resolver(base_uri="http://example.com") + assert resolver.lookup("#").contents == {} + + def test_resolver_with_root_identified(self): + root = ID_AND_CHILDREN.create_resource({"ID": "http://example.com"}) + resolver = Registry().resolver_with_root(root) + assert resolver.lookup("http://example.com").contents == root.contents + assert resolver.lookup("#").contents == root.contents + + def test_resolver_with_root_unidentified(self): + root = Resource.opaque(contents={}) + resolver = Registry().resolver_with_root(root) + assert resolver.lookup("#").contents == root.contents + + def test_repr(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = Registry().with_resources( + [ + ("http://example.com/1", one), + ("http://example.com/foo/bar", two), + ], + ) + assert repr(registry) == "" + assert repr(registry.crawl()) == "" + + def test_repr_mixed_crawled(self): + one = Resource.opaque(contents={}) + two = ID_AND_CHILDREN.create_resource({"foo": "bar"}) + registry = ( + Registry( + {"http://example.com/1": one}, + ) + .crawl() + .with_resource(uri="http://example.com/foo/bar", resource=two) + ) + assert repr(registry) == "" + + def test_repr_one_resource(self): + registry = Registry().with_resource( + uri="http://example.com/1", + resource=Resource.opaque(contents={}), + ) + assert repr(registry) == "" + + def test_repr_empty(self): + assert repr(Registry()) == "" + + +class TestResource: + def test_from_contents_from_json_schema(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + resource = Resource.from_contents(schema) + assert resource == Resource(contents=schema, specification=DRAFT202012) + + def test_from_contents_with_no_discernible_information(self): + """ + Creating a resource with no discernible way to see what + specification it belongs to (e.g. no ``$schema`` keyword for JSON + Schema) raises an error. + """ + + with pytest.raises(exceptions.CannotDetermineSpecification): + Resource.from_contents({"foo": "bar"}) + + def test_from_contents_with_no_discernible_information_and_default(self): + resource = Resource.from_contents( + {"foo": "bar"}, + default_specification=Specification.OPAQUE, + ) + assert resource == Resource.opaque(contents={"foo": "bar"}) + + def test_from_contents_unneeded_default(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + resource = Resource.from_contents( + schema, + default_specification=Specification.OPAQUE, + ) + assert resource == Resource( + contents=schema, + specification=DRAFT202012, + ) + + def test_non_mapping_from_contents(self): + resource = Resource.from_contents( + True, + default_specification=ID_AND_CHILDREN, + ) + assert resource == Resource( + contents=True, + specification=ID_AND_CHILDREN, + ) + + def test_from_contents_with_fallback(self): + resource = Resource.from_contents( + {"foo": "bar"}, + default_specification=Specification.OPAQUE, + ) + assert resource == Resource.opaque(contents={"foo": "bar"}) + + def test_id_delegates_to_specification(self): + specification = Specification( + name="", + id_of=lambda contents: "urn:fixedID", + subresources_of=lambda contents: [], + anchors_in=lambda specification, contents: [], + maybe_in_subresource=( + lambda segments, resolver, subresource: resolver + ), + ) + resource = Resource( + contents={"foo": "baz"}, + specification=specification, + ) + assert resource.id() == "urn:fixedID" + + def test_id_strips_empty_fragment(self): + uri = "http://example.com/" + root = ID_AND_CHILDREN.create_resource({"ID": uri + "#"}) + assert root.id() == uri + + def test_subresources_delegates_to_specification(self): + resource = ID_AND_CHILDREN.create_resource({"children": [{}, 12]}) + assert list(resource.subresources()) == [ + ID_AND_CHILDREN.create_resource(each) for each in [{}, 12] + ] + + def test_subresource_with_different_specification(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + resource = ID_AND_CHILDREN.create_resource({"children": [schema]}) + assert list(resource.subresources()) == [ + DRAFT202012.create_resource(schema), + ] + + def test_anchors_delegates_to_specification(self): + resource = ID_AND_CHILDREN.create_resource( + {"anchors": {"foo": {}, "bar": 1, "baz": ""}}, + ) + assert list(resource.anchors()) == [ + Anchor(name="foo", resource=ID_AND_CHILDREN.create_resource({})), + Anchor(name="bar", resource=ID_AND_CHILDREN.create_resource(1)), + Anchor(name="baz", resource=ID_AND_CHILDREN.create_resource("")), + ] + + def test_pointer_to_mapping(self): + resource = Resource.opaque(contents={"foo": "baz"}) + resolver = Registry().resolver() + assert resource.pointer("/foo", resolver=resolver).contents == "baz" + + def test_pointer_to_array(self): + resource = Resource.opaque(contents={"foo": {"bar": [3]}}) + resolver = Registry().resolver() + assert resource.pointer("/foo/bar/0", resolver=resolver).contents == 3 + + def test_root_pointer(self): + contents = {"foo": "baz"} + resource = Resource.opaque(contents=contents) + resolver = Registry().resolver() + assert resource.pointer("", resolver=resolver).contents == contents + + def test_opaque(self): + contents = {"foo": "bar"} + assert Resource.opaque(contents) == Resource( + contents=contents, + specification=Specification.OPAQUE, + ) + + +class TestResolver: + def test_lookup_exact_uri(self): + resource = Resource.opaque(contents={"foo": "baz"}) + resolver = Registry({"http://example.com/1": resource}).resolver() + resolved = resolver.lookup("http://example.com/1") + assert resolved.contents == resource.contents + + def test_lookup_subresource(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + {"ID": "http://example.com/a", "foo": 12}, + ], + }, + ) + registry = root @ Registry() + resolved = registry.resolver().lookup("http://example.com/a") + assert resolved.contents == {"ID": "http://example.com/a", "foo": 12} + + def test_lookup_anchor_with_id(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "anchors": {"foo": 12}, + }, + ) + registry = root @ Registry() + resolved = registry.resolver().lookup("http://example.com/#foo") + assert resolved.contents == 12 + + def test_lookup_anchor_without_id(self): + root = ID_AND_CHILDREN.create_resource({"anchors": {"foo": 12}}) + resolver = Registry().with_resource("urn:example", root).resolver() + resolved = resolver.lookup("urn:example#foo") + assert resolved.contents == 12 + + def test_lookup_unknown_reference(self): + resolver = Registry().resolver() + ref = "http://example.com/does/not/exist" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert e.value == exceptions.Unresolvable(ref=ref) + + def test_lookup_non_existent_pointer(self): + resource = Resource.opaque({"foo": {}}) + resolver = Registry({"http://example.com/1": resource}).resolver() + ref = "http://example.com/1#/foo/bar" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert e.value == exceptions.PointerToNowhere( + ref="/foo/bar", + resource=resource, + ) + assert str(e.value) == "'/foo/bar' does not exist within {'foo': {}}" + + def test_lookup_non_existent_pointer_to_array_index(self): + resource = Resource.opaque([1, 2, 4, 8]) + resolver = Registry({"http://example.com/1": resource}).resolver() + ref = "http://example.com/1#/10" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert e.value == exceptions.PointerToNowhere( + ref="/10", + resource=resource, + ) + + def test_lookup_pointer_to_empty_string(self): + resolver = Registry().resolver_with_root(Resource.opaque({"": {}})) + assert resolver.lookup("#/").contents == {} + + def test_lookup_non_existent_pointer_to_empty_string(self): + resource = Resource.opaque({"foo": {}}) + resolver = Registry().resolver_with_root(resource) + with pytest.raises( + exceptions.Unresolvable, + match="^'/' does not exist within {'foo': {}}.*'#'", + ) as e: + resolver.lookup("#/") + assert e.value == exceptions.PointerToNowhere( + ref="/", + resource=resource, + ) + + def test_lookup_non_existent_anchor(self): + root = ID_AND_CHILDREN.create_resource({"anchors": {}}) + resolver = Registry().with_resource("urn:example", root).resolver() + resolved = resolver.lookup("urn:example") + assert resolved.contents == root.contents + + ref = "urn:example#noSuchAnchor" + with pytest.raises(exceptions.Unresolvable) as e: + resolver.lookup(ref) + assert "'noSuchAnchor' does not exist" in str(e.value) + assert e.value == exceptions.NoSuchAnchor( + ref="urn:example", + resource=root, + anchor="noSuchAnchor", + ) + + def test_lookup_invalid_JSON_pointerish_anchor(self): + resolver = Registry().resolver_with_root( + ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "foo": {"bar": 12}, + }, + ), + ) + + valid = resolver.lookup("#/foo/bar") + assert valid.contents == 12 + + with pytest.raises(exceptions.InvalidAnchor) as e: + resolver.lookup("#foo/bar") + assert " '#/foo/bar'" in str(e.value) + + def test_lookup_retrieved_resource(self): + resource = Resource.opaque(contents={"foo": "baz"}) + resolver = Registry(retrieve=lambda uri: resource).resolver() + resolved = resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + def test_lookup_failed_retrieved_resource(self): + """ + Unretrievable exceptions are also wrapped in Unresolvable. + """ + + uri = "http://example.com/" + + registry = Registry(retrieve=blow_up) + with pytest.raises(exceptions.Unretrievable): + registry.get_or_retrieve(uri) + + resolver = registry.resolver() + with pytest.raises(exceptions.Unresolvable): + resolver.lookup(uri) + + def test_repeated_lookup_from_retrieved_resource(self): + """ + A (custom-)retrieved resource is added to the registry returned by + looking it up. + """ + resource = Resource.opaque(contents={"foo": "baz"}) + once = [resource] + + def retrieve(uri): + return once.pop() + + resolver = Registry(retrieve=retrieve).resolver() + resolved = resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + resolved = resolved.resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + def test_repeated_anchor_lookup_from_retrieved_resource(self): + resource = Resource.opaque(contents={"foo": "baz"}) + once = [resource] + + def retrieve(uri): + return once.pop() + + resolver = Registry(retrieve=retrieve).resolver() + resolved = resolver.lookup("http://example.com/") + assert resolved.contents == resource.contents + + resolved = resolved.resolver.lookup("#") + assert resolved.contents == resource.contents + + # FIXME: The tests below aren't really representable in the current + # suite, though we should probably think of ways to do so. + + def test_in_subresource(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + { + "ID": "child/", + "children": [{"ID": "grandchild"}], + }, + ], + }, + ) + registry = root @ Registry() + + resolver = registry.resolver() + first = resolver.lookup("http://example.com/") + assert first.contents == root.contents + + with pytest.raises(exceptions.Unresolvable): + first.resolver.lookup("grandchild") + + sub = first.resolver.in_subresource( + ID_AND_CHILDREN.create_resource(first.contents["children"][0]), + ) + second = sub.lookup("grandchild") + assert second.contents == {"ID": "grandchild"} + + def test_in_pointer_subresource(self): + root = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + { + "ID": "child/", + "children": [{"ID": "grandchild"}], + }, + ], + }, + ) + registry = root @ Registry() + + resolver = registry.resolver() + first = resolver.lookup("http://example.com/") + assert first.contents == root.contents + + with pytest.raises(exceptions.Unresolvable): + first.resolver.lookup("grandchild") + + second = first.resolver.lookup("#/children/0") + third = second.resolver.lookup("grandchild") + assert third.contents == {"ID": "grandchild"} + + def test_dynamic_scope(self): + one = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/", + "children": [ + { + "ID": "child/", + "children": [{"ID": "grandchild"}], + }, + ], + }, + ) + two = ID_AND_CHILDREN.create_resource( + { + "ID": "http://example.com/two", + "children": [{"ID": "two-child/"}], + }, + ) + registry = [one, two] @ Registry() + + resolver = registry.resolver() + first = resolver.lookup("http://example.com/") + second = first.resolver.lookup("#/children/0") + third = second.resolver.lookup("grandchild") + fourth = third.resolver.lookup("http://example.com/two") + assert list(fourth.resolver.dynamic_scope()) == [ + ("http://example.com/child/grandchild", fourth.resolver._registry), + ("http://example.com/child/", fourth.resolver._registry), + ("http://example.com/", fourth.resolver._registry), + ] + assert list(third.resolver.dynamic_scope()) == [ + ("http://example.com/child/", third.resolver._registry), + ("http://example.com/", third.resolver._registry), + ] + assert list(second.resolver.dynamic_scope()) == [ + ("http://example.com/", second.resolver._registry), + ] + assert list(first.resolver.dynamic_scope()) == [] + + +class TestSpecification: + def test_create_resource(self): + specification = Specification( + name="", + id_of=lambda contents: "urn:fixedID", + subresources_of=lambda contents: [], + anchors_in=lambda specification, contents: [], + maybe_in_subresource=( + lambda segments, resolver, subresource: resolver + ), + ) + resource = specification.create_resource(contents={"foo": "baz"}) + assert resource == Resource( + contents={"foo": "baz"}, + specification=specification, + ) + assert resource.id() == "urn:fixedID" + + def test_detect_from_json_schema(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + specification = Specification.detect(schema) + assert specification == DRAFT202012 + + def test_detect_with_no_discernible_information(self): + with pytest.raises(exceptions.CannotDetermineSpecification): + Specification.detect({"foo": "bar"}) + + def test_detect_with_non_URI_schema(self): + with pytest.raises(exceptions.CannotDetermineSpecification): + Specification.detect({"$schema": 37}) + + def test_detect_with_no_discernible_information_and_default(self): + specification = Specification.OPAQUE.detect({"foo": "bar"}) + assert specification is Specification.OPAQUE + + def test_detect_unneeded_default(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + specification = Specification.OPAQUE.detect(schema) + assert specification == DRAFT202012 + + def test_non_mapping_detect(self): + with pytest.raises(exceptions.CannotDetermineSpecification): + Specification.detect(True) + + def test_non_mapping_detect_with_default(self): + specification = ID_AND_CHILDREN.detect(True) + assert specification is ID_AND_CHILDREN + + def test_detect_with_fallback(self): + specification = Specification.OPAQUE.detect({"foo": "bar"}) + assert specification is Specification.OPAQUE + + def test_repr(self): + assert ( + repr(ID_AND_CHILDREN) == "" + ) + + +class TestOpaqueSpecification: + THINGS = [{"foo": "bar"}, True, 37, "foo", object()] + + @pytest.mark.parametrize("thing", THINGS) + def test_no_id(self, thing): + """ + An arbitrary thing has no ID. + """ + + assert Specification.OPAQUE.id_of(thing) is None + + @pytest.mark.parametrize("thing", THINGS) + def test_no_subresources(self, thing): + """ + An arbitrary thing has no subresources. + """ + + assert list(Specification.OPAQUE.subresources_of(thing)) == [] + + @pytest.mark.parametrize("thing", THINGS) + def test_no_anchors(self, thing): + """ + An arbitrary thing has no anchors. + """ + + assert list(Specification.OPAQUE.anchors_in(thing)) == [] + + +@pytest.mark.parametrize( + "cls", + [Anchor, Registry, Resource, Specification, exceptions.PointerToNowhere], +) +def test_nonsubclassable(cls): + with pytest.raises(Exception, match="(?i)subclassing"): + + class Boom(cls): # pragma: no cover + pass diff --git a/python/user_packages/Python313/site-packages/referencing/tests/test_exceptions.py b/python/user_packages/Python313/site-packages/referencing/tests/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..85cf99ecdd86c86e84df0b64f24aec6c447f4c08 --- /dev/null +++ b/python/user_packages/Python313/site-packages/referencing/tests/test_exceptions.py @@ -0,0 +1,34 @@ +import itertools + +import pytest + +from referencing import Resource, exceptions + + +def pairs(choices): + return itertools.combinations(choices, 2) + + +TRUE = Resource.opaque(True) + + +thunks = ( + lambda: exceptions.CannotDetermineSpecification(TRUE), + lambda: exceptions.NoSuchResource("urn:example:foo"), + lambda: exceptions.NoInternalID(TRUE), + lambda: exceptions.InvalidAnchor(resource=TRUE, anchor="foo", ref="a#b"), + lambda: exceptions.NoSuchAnchor(resource=TRUE, anchor="foo", ref="a#b"), + lambda: exceptions.PointerToNowhere(resource=TRUE, ref="urn:example:foo"), + lambda: exceptions.Unresolvable("urn:example:foo"), + lambda: exceptions.Unretrievable("urn:example:foo"), +) + + +@pytest.mark.parametrize("one, two", pairs(each() for each in thunks)) +def test_eq_incompatible_types(one, two): + assert one != two + + +@pytest.mark.parametrize("thunk", thunks) +def test_hash(thunk): + assert thunk() in {thunk()} diff --git a/python/user_packages/Python313/site-packages/referencing/tests/test_jsonschema.py b/python/user_packages/Python313/site-packages/referencing/tests/test_jsonschema.py new file mode 100644 index 0000000000000000000000000000000000000000..c80714d0132bebbec33401f42a2e06aee3fed9c6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/referencing/tests/test_jsonschema.py @@ -0,0 +1,382 @@ +import pytest + +from referencing import Registry, Resource, Specification +import referencing.jsonschema + + +@pytest.mark.parametrize( + "uri, expected", + [ + ( + "https://json-schema.org/draft/2020-12/schema", + referencing.jsonschema.DRAFT202012, + ), + ( + "https://json-schema.org/draft/2019-09/schema", + referencing.jsonschema.DRAFT201909, + ), + ( + "http://json-schema.org/draft-07/schema#", + referencing.jsonschema.DRAFT7, + ), + ( + "http://json-schema.org/draft-06/schema#", + referencing.jsonschema.DRAFT6, + ), + ( + "http://json-schema.org/draft-04/schema#", + referencing.jsonschema.DRAFT4, + ), + ( + "http://json-schema.org/draft-03/schema#", + referencing.jsonschema.DRAFT3, + ), + ], +) +def test_schemas_with_explicit_schema_keywords_are_detected(uri, expected): + """ + The $schema keyword in JSON Schema is a dialect identifier. + """ + contents = {"$schema": uri} + resource = Resource.from_contents(contents) + assert resource == Resource(contents=contents, specification=expected) + + +def test_unknown_dialect(): + dialect_id = "http://example.com/unknown-json-schema-dialect-id" + with pytest.raises(referencing.jsonschema.UnknownDialect) as excinfo: + Resource.from_contents({"$schema": dialect_id}) + assert excinfo.value.uri == dialect_id + + +@pytest.mark.parametrize( + "id, specification", + [ + ("$id", referencing.jsonschema.DRAFT202012), + ("$id", referencing.jsonschema.DRAFT201909), + ("$id", referencing.jsonschema.DRAFT7), + ("$id", referencing.jsonschema.DRAFT6), + ("id", referencing.jsonschema.DRAFT4), + ("id", referencing.jsonschema.DRAFT3), + ], +) +def test_id_of_mapping(id, specification): + uri = "http://example.com/some-schema" + assert specification.id_of({id: uri}) == uri + + +@pytest.mark.parametrize( + "specification", + [ + referencing.jsonschema.DRAFT202012, + referencing.jsonschema.DRAFT201909, + referencing.jsonschema.DRAFT7, + referencing.jsonschema.DRAFT6, + ], +) +@pytest.mark.parametrize("value", [True, False]) +def test_id_of_bool(specification, value): + assert specification.id_of(value) is None + + +@pytest.mark.parametrize( + "specification", + [ + referencing.jsonschema.DRAFT202012, + referencing.jsonschema.DRAFT201909, + referencing.jsonschema.DRAFT7, + referencing.jsonschema.DRAFT6, + ], +) +@pytest.mark.parametrize("value", [True, False]) +def test_anchors_in_bool(specification, value): + assert list(specification.anchors_in(value)) == [] + + +@pytest.mark.parametrize( + "specification", + [ + referencing.jsonschema.DRAFT202012, + referencing.jsonschema.DRAFT201909, + referencing.jsonschema.DRAFT7, + referencing.jsonschema.DRAFT6, + ], +) +@pytest.mark.parametrize("value", [True, False]) +def test_subresources_of_bool(specification, value): + assert list(specification.subresources_of(value)) == [] + + +@pytest.mark.parametrize( + "uri, expected", + [ + ( + "https://json-schema.org/draft/2020-12/schema", + referencing.jsonschema.DRAFT202012, + ), + ( + "https://json-schema.org/draft/2019-09/schema", + referencing.jsonschema.DRAFT201909, + ), + ( + "http://json-schema.org/draft-07/schema#", + referencing.jsonschema.DRAFT7, + ), + ( + "http://json-schema.org/draft-06/schema#", + referencing.jsonschema.DRAFT6, + ), + ( + "http://json-schema.org/draft-04/schema#", + referencing.jsonschema.DRAFT4, + ), + ( + "http://json-schema.org/draft-03/schema#", + referencing.jsonschema.DRAFT3, + ), + ], +) +def test_specification_with(uri, expected): + assert referencing.jsonschema.specification_with(uri) == expected + + +@pytest.mark.parametrize( + "uri, expected", + [ + ( + "http://json-schema.org/draft-07/schema", + referencing.jsonschema.DRAFT7, + ), + ( + "http://json-schema.org/draft-06/schema", + referencing.jsonschema.DRAFT6, + ), + ( + "http://json-schema.org/draft-04/schema", + referencing.jsonschema.DRAFT4, + ), + ( + "http://json-schema.org/draft-03/schema", + referencing.jsonschema.DRAFT3, + ), + ], +) +def test_specification_with_no_empty_fragment(uri, expected): + assert referencing.jsonschema.specification_with(uri) == expected + + +def test_specification_with_unknown_dialect(): + dialect_id = "http://example.com/unknown-json-schema-dialect-id" + with pytest.raises(referencing.jsonschema.UnknownDialect) as excinfo: + referencing.jsonschema.specification_with(dialect_id) + assert excinfo.value.uri == dialect_id + + +def test_specification_with_default(): + dialect_id = "http://example.com/unknown-json-schema-dialect-id" + specification = referencing.jsonschema.specification_with( + dialect_id, + default=Specification.OPAQUE, + ) + assert specification is Specification.OPAQUE + + +# FIXME: The tests below should move to the referencing suite but I haven't yet +# figured out how to represent dynamic (& recursive) ref lookups in it. +def test_lookup_trivial_dynamic_ref(): + one = referencing.jsonschema.DRAFT202012.create_resource( + {"$dynamicAnchor": "foo"}, + ) + resolver = Registry().with_resource("http://example.com", one).resolver() + resolved = resolver.lookup("http://example.com#foo") + assert resolved.contents == one.contents + + +def test_multiple_lookup_trivial_dynamic_ref(): + TRUE = referencing.jsonschema.DRAFT202012.create_resource(True) + root = referencing.jsonschema.DRAFT202012.create_resource( + { + "$id": "http://example.com", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "foo": { + "$id": "foo", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "bar": True, + "baz": { + "$dynamicAnchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", root), + ("http://example.com/foo/", TRUE), + ("http://example.com/foo/bar", root), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = resolver.lookup("#fooAnchor") + assert fourth.contents == root.contents + + +def test_multiple_lookup_dynamic_ref_to_nondynamic_ref(): + one = referencing.jsonschema.DRAFT202012.create_resource( + {"$anchor": "fooAnchor"}, + ) + two = referencing.jsonschema.DRAFT202012.create_resource( + { + "$id": "http://example.com", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "foo": { + "$id": "foo", + "$dynamicAnchor": "fooAnchor", + "$defs": { + "bar": True, + "baz": { + "$dynamicAnchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", two), + ("http://example.com/foo/", one), + ("http://example.com/foo/bar", two), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = resolver.lookup("#fooAnchor") + assert fourth.contents == two.contents + + +def test_lookup_trivial_recursive_ref(): + one = referencing.jsonschema.DRAFT201909.create_resource( + {"$recursiveAnchor": True}, + ) + resolver = Registry().with_resource("http://example.com", one).resolver() + first = resolver.lookup("http://example.com") + resolved = referencing.jsonschema.lookup_recursive_ref( + resolver=first.resolver, + ) + assert resolved.contents == one.contents + + +def test_lookup_recursive_ref_to_bool(): + TRUE = referencing.jsonschema.DRAFT201909.create_resource(True) + registry = Registry({"http://example.com": TRUE}) + resolved = referencing.jsonschema.lookup_recursive_ref( + resolver=registry.resolver(base_uri="http://example.com"), + ) + assert resolved.contents == TRUE.contents + + +def test_multiple_lookup_recursive_ref_to_bool(): + TRUE = referencing.jsonschema.DRAFT201909.create_resource(True) + root = referencing.jsonschema.DRAFT201909.create_resource( + { + "$id": "http://example.com", + "$recursiveAnchor": True, + "$defs": { + "foo": { + "$id": "foo", + "$recursiveAnchor": True, + "$defs": { + "bar": True, + "baz": { + "$recursiveAnchor": True, + "$anchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", root), + ("http://example.com/foo/", TRUE), + ("http://example.com/foo/bar", root), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver) + assert fourth.contents == root.contents + + +def test_multiple_lookup_recursive_ref_with_nonrecursive_ref(): + one = referencing.jsonschema.DRAFT201909.create_resource( + {"$recursiveAnchor": True}, + ) + two = referencing.jsonschema.DRAFT201909.create_resource( + { + "$id": "http://example.com", + "$recursiveAnchor": True, + "$defs": { + "foo": { + "$id": "foo", + "$recursiveAnchor": True, + "$defs": { + "bar": True, + "baz": { + "$recursiveAnchor": True, + "$anchor": "fooAnchor", + }, + }, + }, + }, + }, + ) + three = referencing.jsonschema.DRAFT201909.create_resource( + {"$recursiveAnchor": False}, + ) + resolver = ( + Registry() + .with_resources( + [ + ("http://example.com", three), + ("http://example.com/foo/", two), + ("http://example.com/foo/bar", one), + ], + ) + .resolver() + ) + + first = resolver.lookup("http://example.com") + second = first.resolver.lookup("foo/") + resolver = second.resolver.lookup("bar").resolver + fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver) + assert fourth.contents == two.contents + + +def test_empty_registry(): + assert referencing.jsonschema.EMPTY_REGISTRY == Registry() diff --git a/python/user_packages/Python313/site-packages/referencing/tests/test_referencing_suite.py b/python/user_packages/Python313/site-packages/referencing/tests/test_referencing_suite.py new file mode 100644 index 0000000000000000000000000000000000000000..4b8ae9177c197456bb3bbd62d4c1875bc95ff28b --- /dev/null +++ b/python/user_packages/Python313/site-packages/referencing/tests/test_referencing_suite.py @@ -0,0 +1,66 @@ +from pathlib import Path +import json +import os + +import pytest + +from referencing import Registry +from referencing.exceptions import Unresolvable +import referencing.jsonschema + + +class SuiteNotFound(Exception): + def __str__(self): # pragma: no cover + return ( + "Cannot find the referencing suite. " + "Set the REFERENCING_SUITE environment variable to the path to " + "the suite, or run the test suite from alongside a full checkout " + "of the git repository." + ) + + +if "REFERENCING_SUITE" in os.environ: # pragma: no cover + SUITE = Path(os.environ["REFERENCING_SUITE"]) / "tests" +else: + SUITE = Path(__file__).parent.parent.parent / "suite/tests" +if not SUITE.is_dir(): # pragma: no cover + raise SuiteNotFound() +DIALECT_IDS = json.loads(SUITE.joinpath("specifications.json").read_text()) + + +@pytest.mark.parametrize( + "test_path", + [ + pytest.param(each, id=f"{each.parent.name}-{each.stem}") + for each in SUITE.glob("*/**/*.json") + ], +) +def test_referencing_suite(test_path, subtests): + dialect_id = DIALECT_IDS[test_path.relative_to(SUITE).parts[0]] + specification = referencing.jsonschema.specification_with(dialect_id) + loaded = json.loads(test_path.read_text()) + registry = loaded["registry"] + registry = Registry().with_resources( + (uri, specification.create_resource(contents)) + for uri, contents in loaded["registry"].items() + ) + for test in loaded["tests"]: + with subtests.test(test=test): + if "normalization" in test_path.stem: + pytest.xfail("APIs need to change for proper URL support.") + + resolver = registry.resolver(base_uri=test.get("base_uri", "")) + + if test.get("error"): + with pytest.raises(Unresolvable): + resolver.lookup(test["ref"]) + else: + resolved = resolver.lookup(test["ref"]) + assert resolved.contents == test["target"] + + then = test.get("then") + while then: # pragma: no cover + with subtests.test(test=test, then=then): + resolved = resolved.resolver.lookup(then["ref"]) + assert resolved.contents == then["target"] + then = then.get("then") diff --git a/python/user_packages/Python313/site-packages/referencing/tests/test_retrieval.py b/python/user_packages/Python313/site-packages/referencing/tests/test_retrieval.py new file mode 100644 index 0000000000000000000000000000000000000000..d0a8f8ad9975d1a760bca14dea7b60d41fb8ea75 --- /dev/null +++ b/python/user_packages/Python313/site-packages/referencing/tests/test_retrieval.py @@ -0,0 +1,106 @@ +from functools import lru_cache +import json + +import pytest + +from referencing import Registry, Resource, exceptions +from referencing.jsonschema import DRAFT202012 +from referencing.retrieval import to_cached_resource + + +class TestToCachedResource: + def test_it_caches_retrieved_resources(self): + contents = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + stack = [json.dumps(contents)] + + @to_cached_resource() + def retrieve(uri): + return stack.pop() + + registry = Registry(retrieve=retrieve) + + expected = Resource.from_contents(contents) + + got = registry.get_or_retrieve("urn:example:schema") + assert got.value == expected + + # And a second time we get the same value. + again = registry.get_or_retrieve("urn:example:schema") + assert again.value is got.value + + def test_custom_loader(self): + contents = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + stack = [json.dumps(contents)[::-1]] + + @to_cached_resource(loads=lambda s: json.loads(s[::-1])) + def retrieve(uri): + return stack.pop() + + registry = Registry(retrieve=retrieve) + + expected = Resource.from_contents(contents) + + got = registry.get_or_retrieve("urn:example:schema") + assert got.value == expected + + # And a second time we get the same value. + again = registry.get_or_retrieve("urn:example:schema") + assert again.value is got.value + + def test_custom_from_contents(self): + contents = {} + stack = [json.dumps(contents)] + + @to_cached_resource(from_contents=DRAFT202012.create_resource) + def retrieve(uri): + return stack.pop() + + registry = Registry(retrieve=retrieve) + + expected = DRAFT202012.create_resource(contents) + + got = registry.get_or_retrieve("urn:example:schema") + assert got.value == expected + + # And a second time we get the same value. + again = registry.get_or_retrieve("urn:example:schema") + assert again.value is got.value + + def test_custom_cache(self): + schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"} + mapping = { + "urn:example:1": dict(schema, foo=1), + "urn:example:2": dict(schema, foo=2), + "urn:example:3": dict(schema, foo=3), + } + + resources = { + uri: Resource.from_contents(contents) + for uri, contents in mapping.items() + } + + @to_cached_resource(cache=lru_cache(maxsize=2)) + def retrieve(uri): + return json.dumps(mapping.pop(uri)) + + registry = Registry(retrieve=retrieve) + + got = registry.get_or_retrieve("urn:example:1") + assert got.value == resources["urn:example:1"] + assert registry.get_or_retrieve("urn:example:1").value is got.value + assert registry.get_or_retrieve("urn:example:1").value is got.value + + got = registry.get_or_retrieve("urn:example:2") + assert got.value == resources["urn:example:2"] + assert registry.get_or_retrieve("urn:example:2").value is got.value + assert registry.get_or_retrieve("urn:example:2").value is got.value + + # This still succeeds, but evicts the first URI + got = registry.get_or_retrieve("urn:example:3") + assert got.value == resources["urn:example:3"] + assert registry.get_or_retrieve("urn:example:3").value is got.value + assert registry.get_or_retrieve("urn:example:3").value is got.value + + # And now this fails (as we popped the value out of `mapping`) + with pytest.raises(exceptions.Unretrievable): + registry.get_or_retrieve("urn:example:1") diff --git a/python/user_packages/Python313/site-packages/regex-2026.5.9.dist-info/licenses/LICENSE.txt b/python/user_packages/Python313/site-packages/regex-2026.5.9.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..989a872fa6be338f3e91ddb87e107104d370f57a --- /dev/null +++ b/python/user_packages/Python313/site-packages/regex-2026.5.9.dist-info/licenses/LICENSE.txt @@ -0,0 +1,208 @@ +This work was derived from the 're' module of CPython 2.6 and CPython 3.1, +copyright (c) 1998-2001 by Secret Labs AB and licensed under CNRI's Python 1.6 +license. + +All additions and alterations are licensed under the Apache 2.0 License. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Matthew Barnett + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/python/user_packages/Python313/site-packages/regex/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/regex/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5403ad531d6c5387f77cb913873065dd566a7c1b Binary files /dev/null and b/python/user_packages/Python313/site-packages/regex/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/regex/__pycache__/_main.cpython-313.pyc b/python/user_packages/Python313/site-packages/regex/__pycache__/_main.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9894451e27a24df8ddd5d94137f4be79792e96e6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/regex/__pycache__/_main.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/regex/tests/test_regex.py b/python/user_packages/Python313/site-packages/regex/tests/test_regex.py new file mode 100644 index 0000000000000000000000000000000000000000..b94ac8babd0615f524960d1aa2d85f724d4bd73d --- /dev/null +++ b/python/user_packages/Python313/site-packages/regex/tests/test_regex.py @@ -0,0 +1,4540 @@ +from weakref import proxy +import copy +import pickle +import regex +import string +import sys +import unittest + +# String subclasses for issue 18468. +class StrSubclass(str): + def __getitem__(self, index): + return StrSubclass(super().__getitem__(index)) + +class BytesSubclass(bytes): + def __getitem__(self, index): + return BytesSubclass(super().__getitem__(index)) + +class RegexTests(unittest.TestCase): + PATTERN_CLASS = "" + FLAGS_WITH_COMPILED_PAT = "cannot process flags argument with a compiled pattern" + INVALID_GROUP_REF = "invalid group reference" + MISSING_GT = "missing >" + BAD_GROUP_NAME = "bad character in group name" + MISSING_GROUP_NAME = "missing group name" + MISSING_LT = "missing <" + UNKNOWN_GROUP_I = "unknown group" + UNKNOWN_GROUP = "unknown group" + BAD_ESCAPE = r"bad escape \(end of pattern\)" + BAD_OCTAL_ESCAPE = r"bad escape \\" + BAD_SET = "unterminated character set" + STR_PAT_ON_BYTES = "cannot use a string pattern on a bytes-like object" + BYTES_PAT_ON_STR = "cannot use a bytes pattern on a string-like object" + STR_PAT_BYTES_TEMPL = "expected str instance, bytes found" + BYTES_PAT_STR_TEMPL = "expected a bytes-like object, str found" + BYTES_PAT_UNI_FLAG = "cannot use UNICODE flag with a bytes pattern" + MIXED_FLAGS = "ASCII, LOCALE and UNICODE flags are mutually incompatible" + MISSING_RPAREN = "missing \\)" + TRAILING_CHARS = "unbalanced parenthesis" + BAD_CHAR_RANGE = "bad character range" + NOTHING_TO_REPEAT = "nothing to repeat" + MULTIPLE_REPEAT = "multiple repeat" + OPEN_GROUP = "cannot refer to an open group" + DUPLICATE_GROUP = "duplicate group" + CANT_TURN_OFF = "bad inline flags: cannot turn flags off" + UNDEF_CHAR_NAME = "undefined character name" + + def assertTypedEqual(self, actual, expect, msg=None): + self.assertEqual(actual, expect, msg) + + def recurse(actual, expect): + if isinstance(expect, (tuple, list)): + for x, y in zip(actual, expect): + recurse(x, y) + else: + self.assertIs(type(actual), type(expect), msg) + + recurse(actual, expect) + + def test_weakref(self): + s = 'QabbbcR' + x = regex.compile('ab+c') + y = proxy(x) + if x.findall('QabbbcR') != y.findall('QabbbcR'): + self.fail() + + def test_search_star_plus(self): + self.assertEqual(regex.search('a*', 'xxx').span(0), (0, 0)) + self.assertEqual(regex.search('x*', 'axx').span(), (0, 0)) + self.assertEqual(regex.search('x+', 'axx').span(0), (1, 3)) + self.assertEqual(regex.search('x+', 'axx').span(), (1, 3)) + self.assertEqual(regex.search('x', 'aaa'), None) + self.assertEqual(regex.match('a*', 'xxx').span(0), (0, 0)) + self.assertEqual(regex.match('a*', 'xxx').span(), (0, 0)) + self.assertEqual(regex.match('x*', 'xxxa').span(0), (0, 3)) + self.assertEqual(regex.match('x*', 'xxxa').span(), (0, 3)) + self.assertEqual(regex.match('a+', 'xxx'), None) + + def bump_num(self, matchobj): + int_value = int(matchobj[0]) + return str(int_value + 1) + + def test_basic_regex_sub(self): + self.assertEqual(regex.sub("(?i)b+", "x", "bbbb BBBB"), 'x x') + self.assertEqual(regex.sub(r'\d+', self.bump_num, '08.2 -2 23x99y'), + '9.3 -3 24x100y') + self.assertEqual(regex.sub(r'\d+', self.bump_num, '08.2 -2 23x99y', 3), + '9.3 -3 23x99y') + + self.assertEqual(regex.sub('.', lambda m: r"\n", 'x'), "\\n") + self.assertEqual(regex.sub('.', r"\n", 'x'), "\n") + + self.assertEqual(regex.sub('(?P
x)', r'\g\g', 'xx'), 'xxxx') + self.assertEqual(regex.sub('(?Px)', r'\g\g<1>', 'xx'), 'xxxx') + self.assertEqual(regex.sub('(?Px)', r'\g\g', 'xx'), + 'xxxx') + self.assertEqual(regex.sub('(?Px)', r'\g<1>\g<1>', 'xx'), 'xxxx') + + self.assertEqual(regex.sub('a', r'\t\n\v\r\f\a\b', 'a'), "\t\n\v\r\f\a\b") + self.assertEqual(regex.sub('a', '\t\n\v\r\f\a', 'a'), "\t\n\v\r\f\a") + self.assertEqual(regex.sub('a', '\t\n\v\r\f\a', 'a'), chr(9) + chr(10) + + chr(11) + chr(13) + chr(12) + chr(7)) + + self.assertEqual(regex.sub(r'^\s*', 'X', 'test'), 'Xtest') + + self.assertEqual(regex.sub(r"x", r"\x0A", "x"), "\n") + self.assertEqual(regex.sub(r"x", r"\u000A", "x"), "\n") + self.assertEqual(regex.sub(r"x", r"\U0000000A", "x"), "\n") + self.assertEqual(regex.sub(r"x", r"\N{LATIN CAPITAL LETTER A}", + "x"), "A") + + self.assertEqual(regex.sub(br"x", br"\x0A", b"x"), b"\n") + + def test_bug_449964(self): + # Fails for group followed by other escape. + self.assertEqual(regex.sub(r'(?Px)', r'\g<1>\g<1>\b', 'xx'), + "xx\bxx\b") + + def test_bug_449000(self): + # Test for sub() on escaped characters. + self.assertEqual(regex.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + self.assertEqual(regex.sub('\r\n', r'\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + self.assertEqual(regex.sub(r'\r\n', '\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + self.assertEqual(regex.sub('\r\n', '\n', 'abc\r\ndef\r\n'), + "abc\ndef\n") + + def test_bug_1661(self): + # Verify that flags do not get silently ignored with compiled patterns + pattern = regex.compile('.') + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.match(pattern, 'A', regex.I)) + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.search(pattern, 'A', regex.I)) + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.findall(pattern, 'A', regex.I)) + self.assertRaisesRegex(ValueError, self.FLAGS_WITH_COMPILED_PAT, + lambda: regex.compile(pattern, regex.I)) + + def test_bug_3629(self): + # A regex that triggered a bug in the sre-code validator + self.assertEqual(repr(type(regex.compile("(?P)(?(quote))"))), + self.PATTERN_CLASS) + + def test_sub_template_numeric_escape(self): + # Bug 776311 and friends. + self.assertEqual(regex.sub('x', r'\0', 'x'), "\0") + self.assertEqual(regex.sub('x', r'\000', 'x'), "\000") + self.assertEqual(regex.sub('x', r'\001', 'x'), "\001") + self.assertEqual(regex.sub('x', r'\008', 'x'), "\0" + "8") + self.assertEqual(regex.sub('x', r'\009', 'x'), "\0" + "9") + self.assertEqual(regex.sub('x', r'\111', 'x'), "\111") + self.assertEqual(regex.sub('x', r'\117', 'x'), "\117") + + self.assertEqual(regex.sub('x', r'\1111', 'x'), "\1111") + self.assertEqual(regex.sub('x', r'\1111', 'x'), "\111" + "1") + + self.assertEqual(regex.sub('x', r'\00', 'x'), '\x00') + self.assertEqual(regex.sub('x', r'\07', 'x'), '\x07') + self.assertEqual(regex.sub('x', r'\08', 'x'), "\0" + "8") + self.assertEqual(regex.sub('x', r'\09', 'x'), "\0" + "9") + self.assertEqual(regex.sub('x', r'\0a', 'x'), "\0" + "a") + + self.assertEqual(regex.sub('x', r'\400', 'x'), "\u0100") + self.assertEqual(regex.sub('x', r'\777', 'x'), "\u01FF") + self.assertEqual(regex.sub(b'x', br'\400', b'x'), b"\x00") + self.assertEqual(regex.sub(b'x', br'\777', b'x'), b"\xFF") + + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\1', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\8', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\9', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\11', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\18', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\1a', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\90', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\99', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\118', 'x')) # r'\11' + '8' + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\11a', 'x')) + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\181', 'x')) # r'\18' + '1' + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.sub('x', r'\800', 'x')) # r'\80' + '0' + + # In Python 2.3 (etc), these loop endlessly in sre_parser.py. + self.assertEqual(regex.sub('(((((((((((x)))))))))))', r'\11', 'x'), + 'x') + self.assertEqual(regex.sub('((((((((((y))))))))))(.)', r'\118', 'xyz'), + 'xz8') + self.assertEqual(regex.sub('((((((((((y))))))))))(.)', r'\11a', 'xyz'), + 'xza') + + def test_qualified_re_sub(self): + self.assertEqual(regex.sub('a', 'b', 'aaaaa'), 'bbbbb') + self.assertEqual(regex.sub('a', 'b', 'aaaaa', 1), 'baaaa') + + def test_bug_114660(self): + self.assertEqual(regex.sub(r'(\S)\s+(\S)', r'\1 \2', 'hello there'), + 'hello there') + + def test_bug_462270(self): + # Test for empty sub() behaviour, see SF bug #462270 + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub('(?V0)x*', '-', 'abxd'), '-a-b--d-') + else: + self.assertEqual(regex.sub('(?V0)x*', '-', 'abxd'), '-a-b-d-') + self.assertEqual(regex.sub('(?V1)x*', '-', 'abxd'), '-a-b--d-') + self.assertEqual(regex.sub('x+', '-', 'abxd'), 'ab-d') + + def test_bug_14462(self): + # chr(255) is a valid identifier in Python 3. + group_name = '\xFF' + self.assertEqual(regex.search(r'(?P<' + group_name + '>a)', + 'abc').group(group_name), 'a') + + def test_symbolic_refs(self): + self.assertRaisesRegex(regex.error, self.MISSING_GT, lambda: + regex.sub('(?Px)', r'\gx)', r'\g<', 'xx')) + self.assertRaisesRegex(regex.error, self.MISSING_LT, lambda: + regex.sub('(?Px)', r'\g', 'xx')) + self.assertRaisesRegex(regex.error, self.BAD_GROUP_NAME, lambda: + regex.sub('(?Px)', r'\g', 'xx')) + self.assertRaisesRegex(regex.error, self.BAD_GROUP_NAME, lambda: + regex.sub('(?Px)', r'\g<1a1>', 'xx')) + self.assertRaisesRegex(IndexError, self.UNKNOWN_GROUP_I, lambda: + regex.sub('(?Px)', r'\g', 'xx')) + + # The new behaviour of unmatched but valid groups is to treat them like + # empty matches in the replacement template, like in Perl. + self.assertEqual(regex.sub('(?Px)|(?Py)', r'\g', 'xx'), '') + self.assertEqual(regex.sub('(?Px)|(?Py)', r'\2', 'xx'), '') + + # The old behaviour was to raise it as an IndexError. + self.assertRaisesRegex(regex.error, self.BAD_GROUP_NAME, lambda: + regex.sub('(?Px)', r'\g<-1>', 'xx')) + + def test_re_subn(self): + self.assertEqual(regex.subn("(?i)b+", "x", "bbbb BBBB"), ('x x', 2)) + self.assertEqual(regex.subn("b+", "x", "bbbb BBBB"), ('x BBBB', 1)) + self.assertEqual(regex.subn("b+", "x", "xyz"), ('xyz', 0)) + self.assertEqual(regex.subn("b*", "x", "xyz"), ('xxxyxzx', 4)) + self.assertEqual(regex.subn("b*", "x", "xyz", 2), ('xxxyz', 2)) + + def test_re_split(self): + self.assertEqual(regex.split(":", ":a:b::c"), ['', 'a', 'b', '', 'c']) + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split(":*", ":a:b::c"), ['', '', 'a', '', + 'b', '', 'c', '']) + self.assertEqual(regex.split("(:*)", ":a:b::c"), ['', ':', '', '', + 'a', ':', '', '', 'b', '::', '', '', 'c', '', '']) + self.assertEqual(regex.split("(?::*)", ":a:b::c"), ['', '', 'a', + '', 'b', '', 'c', '']) + self.assertEqual(regex.split("(:)*", ":a:b::c"), ['', ':', '', + None, 'a', ':', '', None, 'b', ':', '', None, 'c', None, '']) + else: + self.assertEqual(regex.split(":*", ":a:b::c"), ['', 'a', 'b', 'c']) + self.assertEqual(regex.split("(:*)", ":a:b::c"), ['', ':', 'a', + ':', 'b', '::', 'c']) + self.assertEqual(regex.split("(?::*)", ":a:b::c"), ['', 'a', 'b', + 'c']) + self.assertEqual(regex.split("(:)*", ":a:b::c"), ['', ':', 'a', + ':', 'b', ':', 'c']) + self.assertEqual(regex.split("([b:]+)", ":a:b::c"), ['', ':', 'a', + ':b::', 'c']) + self.assertEqual(regex.split("(b)|(:+)", ":a:b::c"), ['', None, ':', + 'a', None, ':', '', 'b', None, '', None, '::', 'c']) + self.assertEqual(regex.split("(?:b)|(?::+)", ":a:b::c"), ['', 'a', '', + '', 'c']) + + self.assertEqual(regex.split("x", "xaxbxc"), ['', 'a', 'b', 'c']) + self.assertEqual([m for m in regex.splititer("x", "xaxbxc")], ['', 'a', + 'b', 'c']) + + self.assertEqual(regex.split("(?r)x", "xaxbxc"), ['c', 'b', 'a', '']) + self.assertEqual([m for m in regex.splititer("(?r)x", "xaxbxc")], ['c', + 'b', 'a', '']) + + self.assertEqual(regex.split("(x)|(y)", "xaxbxc"), ['', 'x', None, 'a', + 'x', None, 'b', 'x', None, 'c']) + self.assertEqual([m for m in regex.splititer("(x)|(y)", "xaxbxc")], + ['', 'x', None, 'a', 'x', None, 'b', 'x', None, 'c']) + + self.assertEqual(regex.split("(?r)(x)|(y)", "xaxbxc"), ['c', 'x', None, + 'b', 'x', None, 'a', 'x', None, '']) + self.assertEqual([m for m in regex.splititer("(?r)(x)|(y)", "xaxbxc")], + ['c', 'x', None, 'b', 'x', None, 'a', 'x', None, '']) + + self.assertEqual(regex.split(r"(?V1)\b", "a b c"), ['', 'a', ' ', 'b', + ' ', 'c', '']) + self.assertEqual(regex.split(r"(?V1)\m", "a b c"), ['', 'a ', 'b ', + 'c']) + self.assertEqual(regex.split(r"(?V1)\M", "a b c"), ['a', ' b', ' c', + '']) + + def test_qualified_re_split(self): + self.assertEqual(regex.split(":", ":a:b::c", 2), ['', 'a', 'b::c']) + self.assertEqual(regex.split(':', 'a:b:c:d', 2), ['a', 'b', 'c:d']) + self.assertEqual(regex.split("(:)", ":a:b::c", 2), ['', ':', 'a', ':', + 'b::c']) + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split("(:*)", ":a:b::c", 2), ['', ':', '', + '', 'a:b::c']) + else: + self.assertEqual(regex.split("(:*)", ":a:b::c", 2), ['', ':', 'a', + ':', 'b::c']) + + def test_re_findall(self): + self.assertEqual(regex.findall(":+", "abc"), []) + self.assertEqual(regex.findall(":+", "a:b::c:::d"), [':', '::', ':::']) + self.assertEqual(regex.findall("(:+)", "a:b::c:::d"), [':', '::', + ':::']) + self.assertEqual(regex.findall("(:)(:*)", "a:b::c:::d"), [(':', ''), + (':', ':'), (':', '::')]) + + self.assertEqual(regex.findall(r"\((?P.{0,5}?TEST)\)", + "(MY TEST)"), ["MY TEST"]) + self.assertEqual(regex.findall(r"\((?P.{0,3}?TEST)\)", + "(MY TEST)"), ["MY TEST"]) + self.assertEqual(regex.findall(r"\((?P.{0,3}?T)\)", "(MY T)"), + ["MY T"]) + + self.assertEqual(regex.findall(r"[^a]{2}[A-Z]", "\n S"), [' S']) + self.assertEqual(regex.findall(r"[^a]{2,3}[A-Z]", "\n S"), ['\n S']) + self.assertEqual(regex.findall(r"[^a]{2,3}[A-Z]", "\n S"), [' S']) + + self.assertEqual(regex.findall(r"X(Y[^Y]+?){1,2}( |Q)+DEF", + "XYABCYPPQ\nQ DEF"), [('YPPQ\n', ' ')]) + + self.assertEqual(regex.findall(r"(\nTest(\n+.+?){0,2}?)?\n+End", + "\nTest\nxyz\nxyz\nEnd"), [('\nTest\nxyz\nxyz', '\nxyz')]) + + def test_bug_117612(self): + self.assertEqual(regex.findall(r"(a|(b))", "aba"), [('a', ''), ('b', + 'b'), ('a', '')]) + + def test_re_match(self): + self.assertEqual(regex.match('a', 'a')[:], ('a',)) + self.assertEqual(regex.match('(a)', 'a')[:], ('a', 'a')) + self.assertEqual(regex.match(r'(a)', 'a')[0], 'a') + self.assertEqual(regex.match(r'(a)', 'a')[1], 'a') + self.assertEqual(regex.match(r'(a)', 'a').group(1, 1), ('a', 'a')) + + pat = regex.compile('((a)|(b))(c)?') + self.assertEqual(pat.match('a')[:], ('a', 'a', 'a', None, None)) + self.assertEqual(pat.match('b')[:], ('b', 'b', None, 'b', None)) + self.assertEqual(pat.match('ac')[:], ('ac', 'a', 'a', None, 'c')) + self.assertEqual(pat.match('bc')[:], ('bc', 'b', None, 'b', 'c')) + self.assertEqual(pat.match('bc')[:], ('bc', 'b', None, 'b', 'c')) + + # A single group. + m = regex.match('(a)', 'a') + self.assertEqual(m.group(), 'a') + self.assertEqual(m.group(0), 'a') + self.assertEqual(m.group(1), 'a') + self.assertEqual(m.group(1, 1), ('a', 'a')) + + pat = regex.compile('(?:(?Pa)|(?Pb))(?Pc)?') + self.assertEqual(pat.match('a').group(1, 2, 3), ('a', None, None)) + self.assertEqual(pat.match('b').group('a1', 'b2', 'c3'), (None, 'b', + None)) + self.assertEqual(pat.match('ac').group(1, 'b2', 3), ('a', None, 'c')) + + def test_re_groupref_exists(self): + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', '(a)')[:], + ('(a)', '(', 'a')) + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', 'a')[:], ('a', + None, 'a')) + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', 'a)'), None) + self.assertEqual(regex.match(r'^(\()?([^()]+)(?(1)\))$', '(a'), None) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)b|d))$', 'ab')[:], ('ab', + 'a', 'b')) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)b|d))$', 'cd')[:], ('cd', + None, 'd')) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)|d))$', 'cd')[:], ('cd', + None, 'd')) + self.assertEqual(regex.match('^(?:(a)|c)((?(1)|d))$', 'a')[:], ('a', + 'a', '')) + + # Tests for bug #1177831: exercise groups other than the first group. + p = regex.compile('(?Pa)(?Pb)?((?(g2)c|d))') + self.assertEqual(p.match('abc')[:], ('abc', 'a', 'b', 'c')) + self.assertEqual(p.match('ad')[:], ('ad', 'a', None, 'd')) + self.assertEqual(p.match('abd'), None) + self.assertEqual(p.match('ac'), None) + + def test_re_groupref(self): + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1$', '|a|')[:], ('|a|', + '|', 'a')) + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1?$', 'a')[:], ('a', + None, 'a')) + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1$', 'a|'), None) + self.assertEqual(regex.match(r'^(\|)?([^()]+)\1$', '|a'), None) + self.assertEqual(regex.match(r'^(?:(a)|c)(\1)$', 'aa')[:], ('aa', 'a', + 'a')) + self.assertEqual(regex.match(r'^(?:(a)|c)(\1)?$', 'c')[:], ('c', None, + None)) + + self.assertEqual(regex.findall(r"(?i)(.{1,40}?),(.{1,40}?)(?:;)+(.{1,80}).{1,40}?\3(\ |;)+(.{1,80}?)\1", + "TEST, BEST; LEST ; Lest 123 Test, Best"), [('TEST', ' BEST', + ' LEST', ' ', '123 ')]) + + def test_groupdict(self): + self.assertEqual(regex.match('(?Pfirst) (?Psecond)', + 'first second').groupdict(), {'first': 'first', 'second': 'second'}) + + def test_expand(self): + self.assertEqual(regex.match("(?Pfirst) (?Psecond)", + "first second").expand(r"\2 \1 \g \g"), + 'second first second first') + + def test_repeat_minmax(self): + self.assertEqual(regex.match(r"^(\w){1}$", "abc"), None) + self.assertEqual(regex.match(r"^(\w){1}?$", "abc"), None) + self.assertEqual(regex.match(r"^(\w){1,2}$", "abc"), None) + self.assertEqual(regex.match(r"^(\w){1,2}?$", "abc"), None) + + self.assertEqual(regex.match(r"^(\w){3}$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,3}$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,4}$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){3,4}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){3}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,3}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){1,4}?$", "abc")[1], 'c') + self.assertEqual(regex.match(r"^(\w){3,4}?$", "abc")[1], 'c') + + self.assertEqual(regex.match("^x{1}$", "xxx"), None) + self.assertEqual(regex.match("^x{1}?$", "xxx"), None) + self.assertEqual(regex.match("^x{1,2}$", "xxx"), None) + self.assertEqual(regex.match("^x{1,2}?$", "xxx"), None) + + self.assertEqual(regex.match("^x{1}", "xxx")[0], 'x') + self.assertEqual(regex.match("^x{1}?", "xxx")[0], 'x') + self.assertEqual(regex.match("^x{0,1}", "xxx")[0], 'x') + self.assertEqual(regex.match("^x{0,1}?", "xxx")[0], '') + + self.assertEqual(bool(regex.match("^x{3}$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,3}$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,4}$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{3,4}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{3}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,3}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{1,4}?$", "xxx")), True) + self.assertEqual(bool(regex.match("^x{3,4}?$", "xxx")), True) + + self.assertEqual(regex.match("^x{}$", "xxx"), None) + self.assertEqual(bool(regex.match("^x{}$", "x{}")), True) + + def test_getattr(self): + self.assertEqual(regex.compile("(?i)(a)(b)").pattern, '(?i)(a)(b)') + self.assertEqual(regex.compile("(?i)(a)(b)").flags, regex.I | regex.U | + regex.DEFAULT_VERSION) + self.assertEqual(regex.compile(b"(?i)(a)(b)").flags, regex.A | regex.I + | regex.DEFAULT_VERSION) + self.assertEqual(regex.compile("(?i)(a)(b)").groups, 2) + self.assertEqual(regex.compile("(?i)(a)(b)").groupindex, {}) + + self.assertEqual(regex.compile("(?i)(?Pa)(?Pb)").groupindex, + {'first': 1, 'other': 2}) + + self.assertEqual(regex.match("(a)", "a").pos, 0) + self.assertEqual(regex.match("(a)", "a").endpos, 1) + + self.assertEqual(regex.search("b(c)", "abcdef").pos, 0) + self.assertEqual(regex.search("b(c)", "abcdef").endpos, 6) + self.assertEqual(regex.search("b(c)", "abcdef").span(), (1, 3)) + self.assertEqual(regex.search("b(c)", "abcdef").span(1), (2, 3)) + + self.assertEqual(regex.match("(a)", "a").string, 'a') + self.assertEqual(regex.match("(a)", "a").regs, ((0, 1), (0, 1))) + self.assertEqual(repr(type(regex.match("(a)", "a").re)), + self.PATTERN_CLASS) + + # Issue 14260. + p = regex.compile(r'abc(?Pdef)') + p.groupindex["n"] = 0 + self.assertEqual(p.groupindex["n"], 1) + + def test_special_escapes(self): + self.assertEqual(regex.search(r"\b(b.)\b", "abcd abc bcd bx")[1], 'bx') + self.assertEqual(regex.search(r"\B(b.)\B", "abc bcd bc abxd")[1], 'bx') + self.assertEqual(regex.search(br"\b(b.)\b", b"abcd abc bcd bx", + regex.LOCALE)[1], b'bx') + self.assertEqual(regex.search(br"\B(b.)\B", b"abc bcd bc abxd", + regex.LOCALE)[1], b'bx') + self.assertEqual(regex.search(r"\b(b.)\b", "abcd abc bcd bx", + regex.UNICODE)[1], 'bx') + self.assertEqual(regex.search(r"\B(b.)\B", "abc bcd bc abxd", + regex.UNICODE)[1], 'bx') + + self.assertEqual(regex.search(r"^abc$", "\nabc\n", regex.M)[0], 'abc') + self.assertEqual(regex.search(r"^\Aabc\Z$", "abc", regex.M)[0], 'abc') + self.assertEqual(regex.search(r"^\Aabc\Z$", "\nabc\n", regex.M), None) + + self.assertEqual(regex.search(br"\b(b.)\b", b"abcd abc bcd bx")[1], + b'bx') + self.assertEqual(regex.search(br"\B(b.)\B", b"abc bcd bc abxd")[1], + b'bx') + self.assertEqual(regex.search(br"^abc$", b"\nabc\n", regex.M)[0], + b'abc') + self.assertEqual(regex.search(br"^\Aabc\Z$", b"abc", regex.M)[0], + b'abc') + self.assertEqual(regex.search(br"^\Aabc\Z$", b"\nabc\n", regex.M), + None) + + self.assertEqual(regex.search(r"\d\D\w\W\s\S", "1aa! a")[0], '1aa! a') + self.assertEqual(regex.search(br"\d\D\w\W\s\S", b"1aa! a", + regex.LOCALE)[0], b'1aa! a') + self.assertEqual(regex.search(r"\d\D\w\W\s\S", "1aa! a", + regex.UNICODE)[0], '1aa! a') + + def test_bigcharset(self): + self.assertEqual(regex.match(r"([\u2222\u2223])", "\u2222")[1], + '\u2222') + self.assertEqual(regex.match(r"([\u2222\u2223])", "\u2222", + regex.UNICODE)[1], '\u2222') + self.assertEqual("".join(regex.findall(".", + "e\xe8\xe9\xea\xeb\u0113\u011b\u0117", flags=regex.UNICODE)), + 'e\xe8\xe9\xea\xeb\u0113\u011b\u0117') + self.assertEqual("".join(regex.findall(r"[e\xe8\xe9\xea\xeb\u0113\u011b\u0117]", + "e\xe8\xe9\xea\xeb\u0113\u011b\u0117", flags=regex.UNICODE)), + 'e\xe8\xe9\xea\xeb\u0113\u011b\u0117') + self.assertEqual("".join(regex.findall(r"e|\xe8|\xe9|\xea|\xeb|\u0113|\u011b|\u0117", + "e\xe8\xe9\xea\xeb\u0113\u011b\u0117", flags=regex.UNICODE)), + 'e\xe8\xe9\xea\xeb\u0113\u011b\u0117') + + def test_anyall(self): + self.assertEqual(regex.match("a.b", "a\nb", regex.DOTALL)[0], "a\nb") + self.assertEqual(regex.match("a.*b", "a\n\nb", regex.DOTALL)[0], + "a\n\nb") + + def test_non_consuming(self): + self.assertEqual(regex.match(r"(a(?=\s[^a]))", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a(?=\s[^a]*))", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a(?=\s[abc]))", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a(?=\s[abc]*))", "a bc")[1], 'a') + self.assertEqual(regex.match(r"(a)(?=\s\1)", "a a")[1], 'a') + self.assertEqual(regex.match(r"(a)(?=\s\1*)", "a aa")[1], 'a') + self.assertEqual(regex.match(r"(a)(?=\s(abc|a))", "a a")[1], 'a') + + self.assertEqual(regex.match(r"(a(?!\s[^a]))", "a a")[1], 'a') + self.assertEqual(regex.match(r"(a(?!\s[abc]))", "a d")[1], 'a') + self.assertEqual(regex.match(r"(a)(?!\s\1)", "a b")[1], 'a') + self.assertEqual(regex.match(r"(a)(?!\s(abc|a))", "a b")[1], 'a') + + def test_ignore_case(self): + self.assertEqual(regex.match("abc", "ABC", regex.I)[0], 'ABC') + self.assertEqual(regex.match(b"abc", b"ABC", regex.I)[0], b'ABC') + + self.assertEqual(regex.match(r"(a\s[^a]*)", "a bb", regex.I)[1], + 'a bb') + self.assertEqual(regex.match(r"(a\s[abc])", "a b", regex.I)[1], 'a b') + self.assertEqual(regex.match(r"(a\s[abc]*)", "a bb", regex.I)[1], + 'a bb') + self.assertEqual(regex.match(r"((a)\s\2)", "a a", regex.I)[1], 'a a') + self.assertEqual(regex.match(r"((a)\s\2*)", "a aa", regex.I)[1], + 'a aa') + self.assertEqual(regex.match(r"((a)\s(abc|a))", "a a", regex.I)[1], + 'a a') + self.assertEqual(regex.match(r"((a)\s(abc|a)*)", "a aa", regex.I)[1], + 'a aa') + + # Issue 3511. + self.assertEqual(regex.match(r"[Z-a]", "_").span(), (0, 1)) + self.assertEqual(regex.match(r"(?i)[Z-a]", "_").span(), (0, 1)) + + self.assertEqual(bool(regex.match(r"(?i)nao", "nAo")), True) + self.assertEqual(bool(regex.match(r"(?i)n\xE3o", "n\xC3o")), True) + self.assertEqual(bool(regex.match(r"(?i)n\xE3o", "N\xC3O")), True) + self.assertEqual(bool(regex.match(r"(?i)s", "\u017F")), True) + + def test_case_folding(self): + self.assertEqual(regex.search(r"(?fi)ss", "SS").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SS", "ss").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SS", + "\N{LATIN SMALL LETTER SHARP S}").span(), (0, 1)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LETTER SHARP S}", + "SS").span(), (0, 2)) + + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE ST}", + "ST").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)ST", + "\N{LATIN SMALL LIGATURE ST}").span(), (0, 1)) + self.assertEqual(regex.search(r"(?fi)ST", + "\N{LATIN SMALL LIGATURE LONG S T}").span(), (0, 1)) + + self.assertEqual(regex.search(r"(?fi)SST", + "\N{LATIN SMALL LETTER SHARP S}t").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SST", + "s\N{LATIN SMALL LIGATURE LONG S T}").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)SST", + "s\N{LATIN SMALL LIGATURE ST}").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE ST}", + "SST").span(), (1, 3)) + self.assertEqual(regex.search(r"(?fi)SST", + "s\N{LATIN SMALL LIGATURE ST}").span(), (0, 2)) + + self.assertEqual(regex.search(r"(?fi)FFI", + "\N{LATIN SMALL LIGATURE FFI}").span(), (0, 1)) + self.assertEqual(regex.search(r"(?fi)FFI", + "\N{LATIN SMALL LIGATURE FF}i").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)FFI", + "f\N{LATIN SMALL LIGATURE FI}").span(), (0, 2)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE FFI}", + "FFI").span(), (0, 3)) + self.assertEqual(regex.search(r"(?fi)\N{LATIN SMALL LIGATURE FF}i", + "FFI").span(), (0, 3)) + self.assertEqual(regex.search(r"(?fi)f\N{LATIN SMALL LIGATURE FI}", + "FFI").span(), (0, 3)) + + sigma = "\u03A3\u03C3\u03C2" + for ch1 in sigma: + for ch2 in sigma: + if not regex.match(r"(?fi)" + ch1, ch2): + self.fail() + + self.assertEqual(bool(regex.search(r"(?iV1)ff", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)ff", "\uFB01\uFB00")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fi", "\uFB01\uFB00")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fffi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB03", + "\uFB00\uFB01")), True) + self.assertEqual(bool(regex.search(r"(?iV1)ff", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)fffi", "\uFB00\uFB01")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB03", + "\uFB00\uFB01")), True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB01", "\uFB00i")), + True) + self.assertEqual(bool(regex.search(r"(?iV1)f\uFB01", "\uFB00i")), + True) + + self.assertEqual(regex.findall(r"(?iV0)\m(?:word){e<=3}\M(?ne", "affine", + options=["\N{LATIN SMALL LIGATURE FFI}"]).span(), (0, 6)) + self.assertEqual(regex.search(r"(?fi)a\Lne", + "a\N{LATIN SMALL LIGATURE FFI}ne", options=["ffi"]).span(), (0, 4)) + + def test_category(self): + self.assertEqual(regex.match(r"(\s)", " ")[1], ' ') + + def test_not_literal(self): + self.assertEqual(regex.search(r"\s([^a])", " b")[1], 'b') + self.assertEqual(regex.search(r"\s([^a]*)", " bb")[1], 'bb') + + def test_search_coverage(self): + self.assertEqual(regex.search(r"\s(b)", " b")[1], 'b') + self.assertEqual(regex.search(r"a\s", "a ")[0], 'a ') + + def test_re_escape(self): + p = "" + self.assertEqual(regex.escape(p), p) + for i in range(0, 256): + p += chr(i) + self.assertEqual(bool(regex.match(regex.escape(chr(i)), chr(i))), + True) + self.assertEqual(regex.match(regex.escape(chr(i)), chr(i)).span(), + (0, 1)) + + pat = regex.compile(regex.escape(p)) + self.assertEqual(pat.match(p).span(), (0, 256)) + + def test_re_escape_byte(self): + p = b"" + self.assertEqual(regex.escape(p), p) + for i in range(0, 256): + b = bytes([i]) + p += b + self.assertEqual(bool(regex.match(regex.escape(b), b)), True) + self.assertEqual(regex.match(regex.escape(b), b).span(), (0, 1)) + + pat = regex.compile(regex.escape(p)) + self.assertEqual(pat.match(p).span(), (0, 256)) + + def test_constants(self): + if regex.I != regex.IGNORECASE: + self.fail() + if regex.L != regex.LOCALE: + self.fail() + if regex.M != regex.MULTILINE: + self.fail() + if regex.S != regex.DOTALL: + self.fail() + if regex.X != regex.VERBOSE: + self.fail() + + def test_flags(self): + for flag in [regex.I, regex.M, regex.X, regex.S, regex.L]: + self.assertEqual(repr(type(regex.compile('^pattern$', flag))), + self.PATTERN_CLASS) + + def test_sre_character_literals(self): + for i in [0, 8, 16, 32, 64, 127, 128, 255]: + self.assertEqual(bool(regex.match(r"\%03o" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"\%03o0" % i, chr(i) + "0")), + True) + self.assertEqual(bool(regex.match(r"\%03o8" % i, chr(i) + "8")), + True) + self.assertEqual(bool(regex.match(r"\x%02x" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"\x%02x0" % i, chr(i) + "0")), + True) + self.assertEqual(bool(regex.match(r"\x%02xz" % i, chr(i) + "z")), + True) + + self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda: + regex.match(r"\911", "")) + + def test_sre_character_class_literals(self): + for i in [0, 8, 16, 32, 64, 127, 128, 255]: + self.assertEqual(bool(regex.match(r"[\%03o]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\%03o0]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\%03o8]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\x%02x]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\x%02x0]" % i, chr(i))), True) + self.assertEqual(bool(regex.match(r"[\x%02xz]" % i, chr(i))), True) + + self.assertRaisesRegex(regex.error, self.BAD_OCTAL_ESCAPE, lambda: + regex.match(r"[\911]", "")) + + def test_bug_113254(self): + self.assertEqual(regex.match(r'(a)|(b)', 'b').start(1), -1) + self.assertEqual(regex.match(r'(a)|(b)', 'b').end(1), -1) + self.assertEqual(regex.match(r'(a)|(b)', 'b').span(1), (-1, -1)) + + def test_bug_527371(self): + # Bug described in patches 527371/672491. + self.assertEqual(regex.match(r'(a)?a','a').lastindex, None) + self.assertEqual(regex.match(r'(a)(b)?b','ab').lastindex, 1) + self.assertEqual(regex.match(r'(?Pa)(?Pb)?b','ab').lastgroup, + 'a') + self.assertEqual(regex.match("(?Pa(b))", "ab").lastgroup, 'a') + self.assertEqual(regex.match("((a))", "a").lastindex, 1) + + def test_bug_545855(self): + # Bug 545855 -- This pattern failed to cause a compile error as it + # should, instead provoking a TypeError. + self.assertRaisesRegex(regex.error, self.BAD_SET, lambda: + regex.compile('foo[a-')) + + def test_bug_418626(self): + # Bugs 418626 at al. -- Testing Greg Chapman's addition of op code + # SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of + # pattern '*?' on a long string. + self.assertEqual(regex.match('.*?c', 10000 * 'ab' + 'cd').end(0), + 20001) + self.assertEqual(regex.match('.*?cd', 5000 * 'ab' + 'c' + 5000 * 'ab' + + 'cde').end(0), 20003) + self.assertEqual(regex.match('.*?cd', 20000 * 'abc' + 'de').end(0), + 60001) + # Non-simple '*?' still used to hit the recursion limit, before the + # non-recursive scheme was implemented. + self.assertEqual(regex.search('(a|b)*?c', 10000 * 'ab' + 'cd').end(0), + 20001) + + def test_bug_612074(self): + pat = "[" + regex.escape("\u2039") + "]" + self.assertEqual(regex.compile(pat) and 1, 1) + + def test_stack_overflow(self): + # Nasty cases that used to overflow the straightforward recursive + # implementation of repeated groups. + self.assertEqual(regex.match('(x)*', 50000 * 'x')[1], 'x') + self.assertEqual(regex.match('(x)*y', 50000 * 'x' + 'y')[1], 'x') + self.assertEqual(regex.match('(x)*?y', 50000 * 'x' + 'y')[1], 'x') + + def test_scanner(self): + def s_ident(scanner, token): return token + def s_operator(scanner, token): return "op%s" % token + def s_float(scanner, token): return float(token) + def s_int(scanner, token): return int(token) + + scanner = regex.Scanner([(r"[a-zA-Z_]\w*", s_ident), (r"\d+\.\d*", + s_float), (r"\d+", s_int), (r"=|\+|-|\*|/", s_operator), (r"\s+", + None), ]) + + self.assertEqual(repr(type(scanner.scanner.scanner("").pattern)), + self.PATTERN_CLASS) + + self.assertEqual(scanner.scan("sum = 3*foo + 312.50 + bar"), (['sum', + 'op=', 3, 'op*', 'foo', 'op+', 312.5, 'op+', 'bar'], '')) + + def test_bug_448951(self): + # Bug 448951 (similar to 429357, but with single char match). + # (Also test greedy matches.) + for op in '', '?', '*': + self.assertEqual(regex.match(r'((.%s):)?z' % op, 'z')[:], ('z', + None, None)) + self.assertEqual(regex.match(r'((.%s):)?z' % op, 'a:z')[:], ('a:z', + 'a:', 'a')) + + def test_bug_725106(self): + # Capturing groups in alternatives in repeats. + self.assertEqual(regex.match('^((a)|b)*', 'abc')[:], ('ab', 'b', 'a')) + self.assertEqual(regex.match('^(([ab])|c)*', 'abc')[:], ('abc', 'c', + 'b')) + self.assertEqual(regex.match('^((d)|[ab])*', 'abc')[:], ('ab', 'b', + None)) + self.assertEqual(regex.match('^((a)c|[ab])*', 'abc')[:], ('ab', 'b', + None)) + self.assertEqual(regex.match('^((a)|b)*?c', 'abc')[:], ('abc', 'b', + 'a')) + self.assertEqual(regex.match('^(([ab])|c)*?d', 'abcd')[:], ('abcd', + 'c', 'b')) + self.assertEqual(regex.match('^((d)|[ab])*?c', 'abc')[:], ('abc', 'b', + None)) + self.assertEqual(regex.match('^((a)c|[ab])*?c', 'abc')[:], ('abc', 'b', + None)) + + def test_bug_725149(self): + # Mark_stack_base restoring before restoring marks. + self.assertEqual(regex.match('(a)(?:(?=(b)*)c)*', 'abb')[:], ('a', 'a', + None)) + self.assertEqual(regex.match('(a)((?!(b)*))*', 'abb')[:], ('a', 'a', + None, None)) + + def test_bug_764548(self): + # Bug 764548, regex.compile() barfs on str/unicode subclasses. + class my_unicode(str): pass + pat = regex.compile(my_unicode("abc")) + self.assertEqual(pat.match("xyz"), None) + + def test_finditer(self): + it = regex.finditer(r":+", "a:b::c:::d") + self.assertEqual([item[0] for item in it], [':', '::', ':::']) + + def test_bug_926075(self): + if regex.compile('bug_926075') is regex.compile(b'bug_926075'): + self.fail() + + def test_bug_931848(self): + pattern = "[\u002E\u3002\uFF0E\uFF61]" + self.assertEqual(regex.compile(pattern).split("a.b.c"), ['a', 'b', + 'c']) + + def test_bug_581080(self): + it = regex.finditer(r"\s", "a b") + self.assertEqual(next(it).span(), (1, 2)) + self.assertRaises(StopIteration, lambda: next(it)) + + scanner = regex.compile(r"\s").scanner("a b") + self.assertEqual(scanner.search().span(), (1, 2)) + self.assertEqual(scanner.search(), None) + + def test_bug_817234(self): + it = regex.finditer(r".*", "asdf") + self.assertEqual(next(it).span(), (0, 4)) + self.assertEqual(next(it).span(), (4, 4)) + self.assertRaises(StopIteration, lambda: next(it)) + + def test_empty_array(self): + # SF buf 1647541. + import array + for typecode in 'bBhHiIlLfd': + a = array.array(typecode) + self.assertEqual(regex.compile(b"bla").match(a), None) + self.assertEqual(regex.compile(b"").match(a)[1 : ], ()) + + def test_inline_flags(self): + # Bug #1700. + upper_char = chr(0x1ea0) # Latin Capital Letter A with Dot Below + lower_char = chr(0x1ea1) # Latin Small Letter A with Dot Below + + p = regex.compile(upper_char, regex.I | regex.U) + self.assertEqual(bool(p.match(lower_char)), True) + + p = regex.compile(lower_char, regex.I | regex.U) + self.assertEqual(bool(p.match(upper_char)), True) + + p = regex.compile('(?i)' + upper_char, regex.U) + self.assertEqual(bool(p.match(lower_char)), True) + + p = regex.compile('(?i)' + lower_char, regex.U) + self.assertEqual(bool(p.match(upper_char)), True) + + p = regex.compile('(?iu)' + upper_char) + self.assertEqual(bool(p.match(lower_char)), True) + + p = regex.compile('(?iu)' + lower_char) + self.assertEqual(bool(p.match(upper_char)), True) + + # Changed to positional flags in regex 2023.12.23. + self.assertEqual(bool(regex.match(r"(?i)a", "A")), True) + self.assertEqual(regex.match(r"a(?i)", "A"), None) + + def test_dollar_matches_twice(self): + # $ matches the end of string, and just before the terminating \n. + pattern = regex.compile('$') + self.assertEqual(pattern.sub('#', 'a\nb\n'), 'a\nb#\n#') + self.assertEqual(pattern.sub('#', 'a\nb\nc'), 'a\nb\nc#') + self.assertEqual(pattern.sub('#', '\n'), '#\n#') + + pattern = regex.compile('$', regex.MULTILINE) + self.assertEqual(pattern.sub('#', 'a\nb\n' ), 'a#\nb#\n#') + self.assertEqual(pattern.sub('#', 'a\nb\nc'), 'a#\nb#\nc#') + self.assertEqual(pattern.sub('#', '\n'), '#\n#') + + def test_bytes_str_mixing(self): + # Mixing str and bytes is disallowed. + pat = regex.compile('.') + bpat = regex.compile(b'.') + self.assertRaisesRegex(TypeError, self.STR_PAT_ON_BYTES, lambda: + pat.match(b'b')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_ON_STR, lambda: + bpat.match('b')) + self.assertRaisesRegex(TypeError, self.STR_PAT_BYTES_TEMPL, lambda: + pat.sub(b'b', 'c')) + self.assertRaisesRegex(TypeError, self.STR_PAT_ON_BYTES, lambda: + pat.sub('b', b'c')) + self.assertRaisesRegex(TypeError, self.STR_PAT_ON_BYTES, lambda: + pat.sub(b'b', b'c')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_ON_STR, lambda: + bpat.sub(b'b', 'c')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_STR_TEMPL, lambda: + bpat.sub('b', b'c')) + self.assertRaisesRegex(TypeError, self.BYTES_PAT_ON_STR, lambda: + bpat.sub('b', 'c')) + + self.assertRaisesRegex(ValueError, self.BYTES_PAT_UNI_FLAG, lambda: + regex.compile(br'\w', regex.UNICODE)) + self.assertRaisesRegex(ValueError, self.BYTES_PAT_UNI_FLAG, lambda: + regex.compile(br'(?u)\w')) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'\w', regex.UNICODE | regex.ASCII)) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?u)\w', regex.ASCII)) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?a)\w', regex.UNICODE)) + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?au)\w')) + + def test_ascii_and_unicode_flag(self): + # String patterns. + for flags in (0, regex.UNICODE): + pat = regex.compile('\xc0', flags | regex.IGNORECASE) + self.assertEqual(bool(pat.match('\xe0')), True) + pat = regex.compile(r'\w', flags) + self.assertEqual(bool(pat.match('\xe0')), True) + + pat = regex.compile('\xc0', regex.ASCII | regex.IGNORECASE) + self.assertEqual(pat.match('\xe0'), None) + pat = regex.compile('(?a)\xc0', regex.IGNORECASE) + self.assertEqual(pat.match('\xe0'), None) + pat = regex.compile(r'\w', regex.ASCII) + self.assertEqual(pat.match('\xe0'), None) + pat = regex.compile(r'(?a)\w') + self.assertEqual(pat.match('\xe0'), None) + + # Bytes patterns. + for flags in (0, regex.ASCII): + pat = regex.compile(b'\xc0', flags | regex.IGNORECASE) + self.assertEqual(pat.match(b'\xe0'), None) + pat = regex.compile(br'\w') + self.assertEqual(pat.match(b'\xe0'), None) + + self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda: + regex.compile(r'(?au)\w')) + + def test_subscripting_match(self): + m = regex.match(r'(?\w)', 'xy') + if not m: + self.fail("Failed: expected match but returned None") + elif not m or m[0] != m.group(0) or m[1] != m.group(1): + self.fail("Failed") + if not m: + self.fail("Failed: expected match but returned None") + elif m[:] != ('x', 'x'): + self.fail("Failed: expected \"('x', 'x')\" but got {} instead".format(ascii(m[:]))) + + def test_new_named_groups(self): + m0 = regex.match(r'(?P\w)', 'x') + m1 = regex.match(r'(?\w)', 'x') + if not (m0 and m1 and m0[:] == m1[:]): + self.fail("Failed") + + def test_properties(self): + self.assertEqual(regex.match(b'(?ai)\xC0', b'\xE0'), None) + self.assertEqual(regex.match(br'(?ai)\xC0', b'\xE0'), None) + self.assertEqual(regex.match(br'(?a)\w', b'\xE0'), None) + self.assertEqual(bool(regex.match(r'\w', '\xE0')), True) + + # Dropped the following test. It's not possible to determine what the + # correct result should be in the general case. +# self.assertEqual(bool(regex.match(br'(?L)\w', b'\xE0')), +# b'\xE0'.isalnum()) + + self.assertEqual(bool(regex.match(br'(?L)\d', b'0')), True) + self.assertEqual(bool(regex.match(br'(?L)\s', b' ')), True) + self.assertEqual(bool(regex.match(br'(?L)\w', b'a')), True) + self.assertEqual(regex.match(br'(?L)\d', b'?'), None) + self.assertEqual(regex.match(br'(?L)\s', b'?'), None) + self.assertEqual(regex.match(br'(?L)\w', b'?'), None) + + self.assertEqual(regex.match(br'(?L)\D', b'0'), None) + self.assertEqual(regex.match(br'(?L)\S', b' '), None) + self.assertEqual(regex.match(br'(?L)\W', b'a'), None) + self.assertEqual(bool(regex.match(br'(?L)\D', b'?')), True) + self.assertEqual(bool(regex.match(br'(?L)\S', b'?')), True) + self.assertEqual(bool(regex.match(br'(?L)\W', b'?')), True) + + self.assertEqual(bool(regex.match(r'\p{Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'(?i)\p{Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{IsCyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{Script=Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{InCyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{Block=Cyrillic}', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:Cyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:IsCyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:Script=Cyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:InCyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:Block=Cyrillic:]]', + '\N{CYRILLIC CAPITAL LETTER A}')), True) + + self.assertEqual(bool(regex.match(r'\P{Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{IsCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{Script=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{InCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\P{Block=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^IsCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^Script=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^InCyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'\p{^Block=Cyrillic}', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^Cyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^IsCyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^Script=Cyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^InCyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + self.assertEqual(bool(regex.match(r'[[:^Block=Cyrillic:]]', + '\N{LATIN CAPITAL LETTER A}')), True) + + self.assertEqual(bool(regex.match(r'\d', '0')), True) + self.assertEqual(bool(regex.match(r'\s', ' ')), True) + self.assertEqual(bool(regex.match(r'\w', 'A')), True) + self.assertEqual(regex.match(r"\d", "?"), None) + self.assertEqual(regex.match(r"\s", "?"), None) + self.assertEqual(regex.match(r"\w", "?"), None) + self.assertEqual(regex.match(r"\D", "0"), None) + self.assertEqual(regex.match(r"\S", " "), None) + self.assertEqual(regex.match(r"\W", "A"), None) + self.assertEqual(bool(regex.match(r'\D', '?')), True) + self.assertEqual(bool(regex.match(r'\S', '?')), True) + self.assertEqual(bool(regex.match(r'\W', '?')), True) + + self.assertEqual(bool(regex.match(r'\p{L}', 'A')), True) + self.assertEqual(bool(regex.match(r'\p{L}', 'a')), True) + self.assertEqual(bool(regex.match(r'\p{Lu}', 'A')), True) + self.assertEqual(bool(regex.match(r'\p{Ll}', 'a')), True) + + self.assertEqual(bool(regex.match(r'(?i)a', 'a')), True) + self.assertEqual(bool(regex.match(r'(?i)a', 'A')), True) + + self.assertEqual(bool(regex.match(r'\w', '0')), True) + self.assertEqual(bool(regex.match(r'\w', 'a')), True) + self.assertEqual(bool(regex.match(r'\w', '_')), True) + + self.assertEqual(regex.match(r"\X", "\xE0").span(), (0, 1)) + self.assertEqual(regex.match(r"\X", "a\u0300").span(), (0, 2)) + self.assertEqual(regex.findall(r"\X", + "a\xE0a\u0300e\xE9e\u0301"), ['a', '\xe0', 'a\u0300', 'e', + '\xe9', 'e\u0301']) + self.assertEqual(regex.findall(r"\X{3}", + "a\xE0a\u0300e\xE9e\u0301"), ['a\xe0a\u0300', 'e\xe9e\u0301']) + self.assertEqual(regex.findall(r"\X", "\r\r\n\u0301A\u0301"), + ['\r', '\r\n', '\u0301', 'A\u0301']) + + self.assertEqual(bool(regex.match(r'\p{Ll}', 'a')), True) + + chars_u = "-09AZaz_\u0393\u03b3" + chars_b = b"-09AZaz_" + word_set = set("Ll Lm Lo Lt Lu Mc Me Mn Nd Nl No Pc".split()) + + tests = [ + (r"\w", chars_u, "09AZaz_\u0393\u03b3"), + (r"[[:word:]]", chars_u, "09AZaz_\u0393\u03b3"), + (r"\W", chars_u, "-"), + (r"[[:^word:]]", chars_u, "-"), + (r"\d", chars_u, "09"), + (r"[[:digit:]]", chars_u, "09"), + (r"\D", chars_u, "-AZaz_\u0393\u03b3"), + (r"[[:^digit:]]", chars_u, "-AZaz_\u0393\u03b3"), + (r"[[:alpha:]]", chars_u, "AZaz\u0393\u03b3"), + (r"[[:^alpha:]]", chars_u, "-09_"), + (r"[[:alnum:]]", chars_u, "09AZaz\u0393\u03b3"), + (r"[[:^alnum:]]", chars_u, "-_"), + (r"[[:xdigit:]]", chars_u, "09Aa"), + (r"[[:^xdigit:]]", chars_u, "-Zz_\u0393\u03b3"), + (r"\p{InBasicLatin}", "a\xE1", "a"), + (r"\P{InBasicLatin}", "a\xE1", "\xE1"), + (r"(?i)\p{InBasicLatin}", "a\xE1", "a"), + (r"(?i)\P{InBasicLatin}", "a\xE1", "\xE1"), + + (br"(?L)\w", chars_b, b"09AZaz_"), + (br"(?L)[[:word:]]", chars_b, b"09AZaz_"), + (br"(?L)\W", chars_b, b"-"), + (br"(?L)[[:^word:]]", chars_b, b"-"), + (br"(?L)\d", chars_b, b"09"), + (br"(?L)[[:digit:]]", chars_b, b"09"), + (br"(?L)\D", chars_b, b"-AZaz_"), + (br"(?L)[[:^digit:]]", chars_b, b"-AZaz_"), + (br"(?L)[[:alpha:]]", chars_b, b"AZaz"), + (br"(?L)[[:^alpha:]]", chars_b, b"-09_"), + (br"(?L)[[:alnum:]]", chars_b, b"09AZaz"), + (br"(?L)[[:^alnum:]]", chars_b, b"-_"), + (br"(?L)[[:xdigit:]]", chars_b, b"09Aa"), + (br"(?L)[[:^xdigit:]]", chars_b, b"-Zz_"), + + (br"(?a)\w", chars_b, b"09AZaz_"), + (br"(?a)[[:word:]]", chars_b, b"09AZaz_"), + (br"(?a)\W", chars_b, b"-"), + (br"(?a)[[:^word:]]", chars_b, b"-"), + (br"(?a)\d", chars_b, b"09"), + (br"(?a)[[:digit:]]", chars_b, b"09"), + (br"(?a)\D", chars_b, b"-AZaz_"), + (br"(?a)[[:^digit:]]", chars_b, b"-AZaz_"), + (br"(?a)[[:alpha:]]", chars_b, b"AZaz"), + (br"(?a)[[:^alpha:]]", chars_b, b"-09_"), + (br"(?a)[[:alnum:]]", chars_b, b"09AZaz"), + (br"(?a)[[:^alnum:]]", chars_b, b"-_"), + (br"(?a)[[:xdigit:]]", chars_b, b"09Aa"), + (br"(?a)[[:^xdigit:]]", chars_b, b"-Zz_"), + ] + for pattern, chars, expected in tests: + try: + if chars[ : 0].join(regex.findall(pattern, chars)) != expected: + self.fail("Failed: {}".format(pattern)) + except Exception as e: + self.fail("Failed: {} raised {}".format(pattern, ascii(e))) + + self.assertEqual(bool(regex.match(r"\p{NumericValue=0}", "0")), + True) + self.assertEqual(bool(regex.match(r"\p{NumericValue=1/2}", + "\N{VULGAR FRACTION ONE HALF}")), True) + self.assertEqual(bool(regex.match(r"\p{NumericValue=0.5}", + "\N{VULGAR FRACTION ONE HALF}")), True) + + def test_word_class(self): + self.assertEqual(regex.findall(r"\w+", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), + ['\u0939\u093f\u0928\u094d\u0926\u0940']) + self.assertEqual(regex.findall(r"\W+", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), [' ', ',']) + self.assertEqual(regex.split(r"(?V1)\b", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), [' ', + '\u0939\u093f\u0928\u094d\u0926\u0940', ',']) + self.assertEqual(regex.split(r"(?V1)\B", + " \u0939\u093f\u0928\u094d\u0926\u0940,"), ['', ' \u0939', + '\u093f', '\u0928', '\u094d', '\u0926', '\u0940,', '']) + + def test_search_anchor(self): + self.assertEqual(regex.findall(r"\G\w{2}", "abcd ef"), ['ab', 'cd']) + + def test_search_reverse(self): + self.assertEqual(regex.findall(r"(?r).", "abc"), ['c', 'b', 'a']) + self.assertEqual(regex.findall(r"(?r).", "abc", overlapped=True), ['c', + 'b', 'a']) + self.assertEqual(regex.findall(r"(?r)..", "abcde"), ['de', 'bc']) + self.assertEqual(regex.findall(r"(?r)..", "abcde", overlapped=True), + ['de', 'cd', 'bc', 'ab']) + self.assertEqual(regex.findall(r"(?r)(.)(-)(.)", "a-b-c", + overlapped=True), [("b", "-", "c"), ("a", "-", "b")]) + + self.assertEqual([m[0] for m in regex.finditer(r"(?r).", "abc")], ['c', + 'b', 'a']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde", + overlapped=True)], ['de', 'cd', 'bc', 'ab']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r).", "abc")], ['c', + 'b', 'a']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde", + overlapped=True)], ['de', 'cd', 'bc', 'ab']) + + self.assertEqual(regex.findall(r"^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual(regex.findall(r"(?V1)^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual(regex.findall(r"(?r)^|\w+", "foo bar"), ['bar', 'foo', + '']) + self.assertEqual(regex.findall(r"(?rV1)^|\w+", "foo bar"), ['bar', + 'foo', '']) + + self.assertEqual([m[0] for m in regex.finditer(r"^|\w+", "foo bar")], + ['', 'foo', 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"(?V1)^|\w+", + "foo bar")], ['', 'foo', 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)^|\w+", + "foo bar")], ['bar', 'foo', '']) + self.assertEqual([m[0] for m in regex.finditer(r"(?rV1)^|\w+", + "foo bar")], ['bar', 'foo', '']) + + self.assertEqual(regex.findall(r"\G\w{2}", "abcd ef"), ['ab', 'cd']) + self.assertEqual(regex.findall(r".{2}(?<=\G.*)", "abcd"), ['ab', 'cd']) + self.assertEqual(regex.findall(r"(?r)\G\w{2}", "abcd ef"), []) + self.assertEqual(regex.findall(r"(?r)\w{2}\G", "abcd ef"), ['ef']) + + self.assertEqual(regex.findall(r"q*", "qqwe"), ['qq', '', '', '']) + self.assertEqual(regex.findall(r"(?V1)q*", "qqwe"), ['qq', '', '', '']) + self.assertEqual(regex.findall(r"(?r)q*", "qqwe"), ['', '', 'qq', '']) + self.assertEqual(regex.findall(r"(?rV1)q*", "qqwe"), ['', '', 'qq', + '']) + + self.assertEqual(regex.findall(".", "abcd", pos=1, endpos=3), ['b', + 'c']) + self.assertEqual(regex.findall(".", "abcd", pos=1, endpos=-1), ['b', + 'c']) + self.assertEqual([m[0] for m in regex.finditer(".", "abcd", pos=1, + endpos=3)], ['b', 'c']) + self.assertEqual([m[0] for m in regex.finditer(".", "abcd", pos=1, + endpos=-1)], ['b', 'c']) + + self.assertEqual([m[0] for m in regex.finditer("(?r).", "abcd", pos=1, + endpos=3)], ['c', 'b']) + self.assertEqual([m[0] for m in regex.finditer("(?r).", "abcd", pos=1, + endpos=-1)], ['c', 'b']) + self.assertEqual(regex.findall("(?r).", "abcd", pos=1, endpos=3), ['c', + 'b']) + self.assertEqual(regex.findall("(?r).", "abcd", pos=1, endpos=-1), + ['c', 'b']) + + self.assertEqual(regex.findall(r"[ab]", "aB", regex.I), ['a', 'B']) + self.assertEqual(regex.findall(r"(?r)[ab]", "aB", regex.I), ['B', 'a']) + + self.assertEqual(regex.findall(r"(?r).{2}", "abc"), ['bc']) + self.assertEqual(regex.findall(r"(?r).{2}", "abc", overlapped=True), + ['bc', 'ab']) + self.assertEqual(regex.findall(r"(\w+) (\w+)", + "first second third fourth fifth"), [('first', 'second'), ('third', + 'fourth')]) + self.assertEqual(regex.findall(r"(?r)(\w+) (\w+)", + "first second third fourth fifth"), [('fourth', 'fifth'), ('second', + 'third')]) + + self.assertEqual([m[0] for m in regex.finditer(r"(?r).{2}", "abc")], + ['bc']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r).{2}", "abc", + overlapped=True)], ['bc', 'ab']) + self.assertEqual([m[0] for m in regex.finditer(r"(\w+) (\w+)", + "first second third fourth fifth")], ['first second', + 'third fourth']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)(\w+) (\w+)", + "first second third fourth fifth")], ['fourth fifth', + 'second third']) + + self.assertEqual(regex.search("abcdef", "abcdef").span(), (0, 6)) + self.assertEqual(regex.search("(?r)abcdef", "abcdef").span(), (0, 6)) + self.assertEqual(regex.search("(?i)abcdef", "ABCDEF").span(), (0, 6)) + self.assertEqual(regex.search("(?ir)abcdef", "ABCDEF").span(), (0, 6)) + + self.assertEqual(regex.sub(r"(.)", r"\1", "abc"), 'abc') + self.assertEqual(regex.sub(r"(?r)(.)", r"\1", "abc"), 'abc') + + def test_atomic(self): + # Issue 433030. + self.assertEqual(regex.search(r"(?>a*)a", "aa"), None) + + def test_possessive(self): + # Single-character non-possessive. + self.assertEqual(regex.search(r"a?a", "a").span(), (0, 1)) + self.assertEqual(regex.search(r"a*a", "aaa").span(), (0, 3)) + self.assertEqual(regex.search(r"a+a", "aaa").span(), (0, 3)) + self.assertEqual(regex.search(r"a{1,3}a", "aaa").span(), (0, 3)) + + # Multiple-character non-possessive. + self.assertEqual(regex.search(r"(?:ab)?ab", "ab").span(), (0, 2)) + self.assertEqual(regex.search(r"(?:ab)*ab", "ababab").span(), (0, 6)) + self.assertEqual(regex.search(r"(?:ab)+ab", "ababab").span(), (0, 6)) + self.assertEqual(regex.search(r"(?:ab){1,3}ab", "ababab").span(), (0, + 6)) + + # Single-character possessive. + self.assertEqual(regex.search(r"a?+a", "a"), None) + self.assertEqual(regex.search(r"a*+a", "aaa"), None) + self.assertEqual(regex.search(r"a++a", "aaa"), None) + self.assertEqual(regex.search(r"a{1,3}+a", "aaa"), None) + + # Multiple-character possessive. + self.assertEqual(regex.search(r"(?:ab)?+ab", "ab"), None) + self.assertEqual(regex.search(r"(?:ab)*+ab", "ababab"), None) + self.assertEqual(regex.search(r"(?:ab)++ab", "ababab"), None) + self.assertEqual(regex.search(r"(?:ab){1,3}+ab", "ababab"), None) + + def test_zerowidth(self): + # Issue 3262. + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split(r"\b", "a b"), ['', 'a', ' ', 'b', + '']) + else: + self.assertEqual(regex.split(r"\b", "a b"), ['a b']) + self.assertEqual(regex.split(r"(?V1)\b", "a b"), ['', 'a', ' ', 'b', + '']) + + # Issue 1647489. + self.assertEqual(regex.findall(r"^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"^|\w+", "foo bar")], + ['', 'foo', 'bar']) + self.assertEqual(regex.findall(r"(?r)^|\w+", "foo bar"), ['bar', + 'foo', '']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)^|\w+", + "foo bar")], ['bar', 'foo', '']) + self.assertEqual(regex.findall(r"(?V1)^|\w+", "foo bar"), ['', 'foo', + 'bar']) + self.assertEqual([m[0] for m in regex.finditer(r"(?V1)^|\w+", + "foo bar")], ['', 'foo', 'bar']) + self.assertEqual(regex.findall(r"(?rV1)^|\w+", "foo bar"), ['bar', + 'foo', '']) + self.assertEqual([m[0] for m in regex.finditer(r"(?rV1)^|\w+", + "foo bar")], ['bar', 'foo', '']) + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split("", "xaxbxc"), ['', 'x', 'a', 'x', + 'b', 'x', 'c', '']) + self.assertEqual([m for m in regex.splititer("", "xaxbxc")], ['', + 'x', 'a', 'x', 'b', 'x', 'c', '']) + else: + self.assertEqual(regex.split("", "xaxbxc"), ['xaxbxc']) + self.assertEqual([m for m in regex.splititer("", "xaxbxc")], + ['xaxbxc']) + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split("(?r)", "xaxbxc"), ['', 'c', 'x', 'b', + 'x', 'a', 'x', '']) + self.assertEqual([m for m in regex.splititer("(?r)", "xaxbxc")], + ['', 'c', 'x', 'b', 'x', 'a', 'x', '']) + else: + self.assertEqual(regex.split("(?r)", "xaxbxc"), ['xaxbxc']) + self.assertEqual([m for m in regex.splititer("(?r)", "xaxbxc")], + ['xaxbxc']) + + self.assertEqual(regex.split("(?V1)", "xaxbxc"), ['', 'x', 'a', 'x', + 'b', 'x', 'c', '']) + self.assertEqual([m for m in regex.splititer("(?V1)", "xaxbxc")], ['', + 'x', 'a', 'x', 'b', 'x', 'c', '']) + + self.assertEqual(regex.split("(?rV1)", "xaxbxc"), ['', 'c', 'x', 'b', + 'x', 'a', 'x', '']) + self.assertEqual([m for m in regex.splititer("(?rV1)", "xaxbxc")], ['', + 'c', 'x', 'b', 'x', 'a', 'x', '']) + + def test_scoped_and_inline_flags(self): + # Issues 433028, 433024, 433027. + self.assertEqual(regex.search(r"(?i)Ab", "ab").span(), (0, 2)) + self.assertEqual(regex.search(r"(?i:A)b", "ab").span(), (0, 2)) + # Changed to positional flags in regex 2023.12.23. + self.assertEqual(regex.search(r"A(?i)b", "ab"), None) + + self.assertEqual(regex.search(r"(?V0)Ab", "ab"), None) + self.assertEqual(regex.search(r"(?V1)Ab", "ab"), None) + self.assertEqual(regex.search(r"(?-i)Ab", "ab", flags=regex.I), None) + self.assertEqual(regex.search(r"(?-i:A)b", "ab", flags=regex.I), None) + self.assertEqual(regex.search(r"A(?-i)b", "ab", flags=regex.I).span(), + (0, 2)) + + def test_repeated_repeats(self): + # Issue 2537. + self.assertEqual(regex.search(r"(?:a+)+", "aaa").span(), (0, 3)) + self.assertEqual(regex.search(r"(?:(?:ab)+c)+", "abcabc").span(), (0, + 6)) + + # Hg issue 286. + self.assertEqual(regex.search(r"(?:a+){2,}", "aaa").span(), (0, 3)) + + def test_lookbehind(self): + self.assertEqual(regex.search(r"123(?<=a\d+)", "a123").span(), (1, 4)) + self.assertEqual(regex.search(r"123(?<=a\d+)", "b123"), None) + self.assertEqual(regex.search(r"123(?= (3, 7, 0): + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "xy"), + 'y-x-') + else: + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "xy"), + 'y-x') + self.assertEqual(regex.sub(r"(?V1)(x)?(y)?", r"\2-\1", "xy"), 'y-x-') + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "x"), '-x-') + else: + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "x"), '-x') + self.assertEqual(regex.sub(r"(?V1)(x)?(y)?", r"\2-\1", "x"), '-x-') + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "y"), 'y--') + else: + self.assertEqual(regex.sub(r"(?V0)(x)?(y)?", r"\2-\1", "y"), 'y-') + self.assertEqual(regex.sub(r"(?V1)(x)?(y)?", r"\2-\1", "y"), 'y--') + + def test_bug_10328 (self): + # Issue 10328. + pat = regex.compile(r'(?mV0)(?P[ \t]+\r*$)|(?P(?<=[^\n])\Z)') + if sys.version_info >= (3, 7, 0): + self.assertEqual(pat.subn(lambda m: '<' + m.lastgroup + '>', + 'foobar '), ('foobar', 2)) + else: + self.assertEqual(pat.subn(lambda m: '<' + m.lastgroup + '>', + 'foobar '), ('foobar', 1)) + self.assertEqual([m.group() for m in pat.finditer('foobar ')], [' ', + '']) + pat = regex.compile(r'(?mV1)(?P[ \t]+\r*$)|(?P(?<=[^\n])\Z)') + self.assertEqual(pat.subn(lambda m: '<' + m.lastgroup + '>', + 'foobar '), ('foobar', 2)) + self.assertEqual([m.group() for m in pat.finditer('foobar ')], [' ', + '']) + + def test_overlapped(self): + self.assertEqual(regex.findall(r"..", "abcde"), ['ab', 'cd']) + self.assertEqual(regex.findall(r"..", "abcde", overlapped=True), ['ab', + 'bc', 'cd', 'de']) + self.assertEqual(regex.findall(r"(?r)..", "abcde"), ['de', 'bc']) + self.assertEqual(regex.findall(r"(?r)..", "abcde", overlapped=True), + ['de', 'cd', 'bc', 'ab']) + self.assertEqual(regex.findall(r"(.)(-)(.)", "a-b-c", overlapped=True), + [("a", "-", "b"), ("b", "-", "c")]) + + self.assertEqual([m[0] for m in regex.finditer(r"..", "abcde")], ['ab', + 'cd']) + self.assertEqual([m[0] for m in regex.finditer(r"..", "abcde", + overlapped=True)], ['ab', 'bc', 'cd', 'de']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde")], + ['de', 'bc']) + self.assertEqual([m[0] for m in regex.finditer(r"(?r)..", "abcde", + overlapped=True)], ['de', 'cd', 'bc', 'ab']) + + self.assertEqual([m.groups() for m in regex.finditer(r"(.)(-)(.)", + "a-b-c", overlapped=True)], [("a", "-", "b"), ("b", "-", "c")]) + self.assertEqual([m.groups() for m in regex.finditer(r"(?r)(.)(-)(.)", + "a-b-c", overlapped=True)], [("b", "-", "c"), ("a", "-", "b")]) + + def test_splititer(self): + self.assertEqual(regex.split(r",", "a,b,,c,"), ['a', 'b', '', 'c', '']) + self.assertEqual([m for m in regex.splititer(r",", "a,b,,c,")], ['a', + 'b', '', 'c', '']) + + def test_grapheme(self): + self.assertEqual(regex.match(r"\X", "\xE0").span(), (0, 1)) + self.assertEqual(regex.match(r"\X", "a\u0300").span(), (0, 2)) + + self.assertEqual(regex.findall(r"\X", + "a\xE0a\u0300e\xE9e\u0301"), ['a', '\xe0', 'a\u0300', 'e', + '\xe9', 'e\u0301']) + self.assertEqual(regex.findall(r"\X{3}", + "a\xE0a\u0300e\xE9e\u0301"), ['a\xe0a\u0300', 'e\xe9e\u0301']) + self.assertEqual(regex.findall(r"\X", "\r\r\n\u0301A\u0301"), + ['\r', '\r\n', '\u0301', 'A\u0301']) + + def test_word_boundary(self): + text = 'The quick ("brown") fox can\'t jump 32.3 feet, right?' + self.assertEqual(regex.split(r'(?V1)\b', text), ['', 'The', ' ', + 'quick', ' ("', 'brown', '") ', 'fox', ' ', 'can', "'", 't', + ' ', 'jump', ' ', '32', '.', '3', ' ', 'feet', ', ', + 'right', '?']) + self.assertEqual(regex.split(r'(?V1w)\b', text), ['', 'The', ' ', + 'quick', ' ', '(', '"', 'brown', '"', ')', ' ', 'fox', ' ', + "can't", ' ', 'jump', ' ', '32.3', ' ', 'feet', ',', ' ', + 'right', '?', '']) + + text = "The fox" + self.assertEqual(regex.split(r'(?V1)\b', text), ['', 'The', ' ', + 'fox', '']) + self.assertEqual(regex.split(r'(?V1w)\b', text), ['', 'The', ' ', + 'fox', '']) + + text = "can't aujourd'hui l'objectif" + self.assertEqual(regex.split(r'(?V1)\b', text), ['', 'can', "'", + 't', ' ', 'aujourd', "'", 'hui', ' ', 'l', "'", 'objectif', + '']) + self.assertEqual(regex.split(r'(?V1w)\b', text), ['', "can't", ' ', + "aujourd'hui", ' ', "l'objectif", '']) + + def test_line_boundary(self): + self.assertEqual(regex.findall(r".+", "Line 1\nLine 2\n"), ["Line 1", + "Line 2"]) + self.assertEqual(regex.findall(r".+", "Line 1\rLine 2\r"), + ["Line 1\rLine 2\r"]) + self.assertEqual(regex.findall(r".+", "Line 1\r\nLine 2\r\n"), + ["Line 1\r", "Line 2\r"]) + self.assertEqual(regex.findall(r"(?w).+", "Line 1\nLine 2\n"), + ["Line 1", "Line 2"]) + self.assertEqual(regex.findall(r"(?w).+", "Line 1\rLine 2\r"), + ["Line 1", "Line 2"]) + self.assertEqual(regex.findall(r"(?w).+", "Line 1\r\nLine 2\r\n"), + ["Line 1", "Line 2"]) + + self.assertEqual(regex.search(r"^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"^abc", "\nabc"), None) + self.assertEqual(regex.search(r"^abc", "\rabc"), None) + self.assertEqual(regex.search(r"(?w)^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"(?w)^abc", "\nabc"), None) + self.assertEqual(regex.search(r"(?w)^abc", "\rabc"), None) + + self.assertEqual(regex.search(r"abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"abc$", "abc\r"), None) + self.assertEqual(regex.search(r"(?w)abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"(?w)abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"(?w)abc$", "abc\r").start(), 0) + + self.assertEqual(regex.search(r"(?m)^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"(?m)^abc", "\nabc").start(), 1) + self.assertEqual(regex.search(r"(?m)^abc", "\rabc"), None) + self.assertEqual(regex.search(r"(?mw)^abc", "abc").start(), 0) + self.assertEqual(regex.search(r"(?mw)^abc", "\nabc").start(), 1) + self.assertEqual(regex.search(r"(?mw)^abc", "\rabc").start(), 1) + + self.assertEqual(regex.search(r"(?m)abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"(?m)abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"(?m)abc$", "abc\r"), None) + self.assertEqual(regex.search(r"(?mw)abc$", "abc").start(), 0) + self.assertEqual(regex.search(r"(?mw)abc$", "abc\n").start(), 0) + self.assertEqual(regex.search(r"(?mw)abc$", "abc\r").start(), 0) + + def test_branch_reset(self): + self.assertEqual(regex.match(r"(?:(a)|(b))(c)", "ac").groups(), ('a', + None, 'c')) + self.assertEqual(regex.match(r"(?:(a)|(b))(c)", "bc").groups(), (None, + 'b', 'c')) + self.assertEqual(regex.match(r"(?:(?a)|(?b))(?c)", + "ac").groups(), ('a', None, 'c')) + self.assertEqual(regex.match(r"(?:(?a)|(?b))(?c)", + "bc").groups(), (None, 'b', 'c')) + + self.assertEqual(regex.match(r"(?a)(?:(?b)|(?c))(?d)", + "abd").groups(), ('a', 'b', None, 'd')) + self.assertEqual(regex.match(r"(?a)(?:(?b)|(?c))(?d)", + "acd").groups(), ('a', None, 'c', 'd')) + self.assertEqual(regex.match(r"(a)(?:(b)|(c))(d)", "abd").groups(), + ('a', 'b', None, 'd')) + + self.assertEqual(regex.match(r"(a)(?:(b)|(c))(d)", "acd").groups(), + ('a', None, 'c', 'd')) + self.assertEqual(regex.match(r"(a)(?|(b)|(b))(d)", "abd").groups(), + ('a', 'b', 'd')) + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "ac").groups(), + ('a', None, 'c')) + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "bc").groups(), + (None, 'b', 'c')) + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "ac").groups(), + ('a', 'c')) + + self.assertEqual(regex.match(r"(?|(?a)|(?b))(c)", "bc").groups(), + ('b', 'c')) + + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(?d))(e)", + "abe").groups(), ('a', 'b', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(?d))(e)", + "cde").groups(), ('d', 'c', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(d))(e)", + "abe").groups(), ('a', 'b', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(?c)(d))(e)", + "cde").groups(), ('d', 'c', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(d))(e)", + "abe").groups(), ('a', 'b', 'e')) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(d))(e)", + "cde").groups(), ('c', 'd', 'e')) + + # Hg issue 87: Allow duplicate names of groups + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "abe").groups(), ("a", "b", "e")) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "abe").capturesdict(), {"a": ["a"], "b": ["b"]}) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "cde").groups(), ("d", None, "e")) + self.assertEqual(regex.match(r"(?|(?a)(?b)|(c)(?d))(e)", + "cde").capturesdict(), {"a": ["c", "d"], "b": []}) + + def test_set(self): + self.assertEqual(regex.match(r"[a]", "a").span(), (0, 1)) + self.assertEqual(regex.match(r"(?i)[a]", "A").span(), (0, 1)) + self.assertEqual(regex.match(r"[a-b]", r"a").span(), (0, 1)) + self.assertEqual(regex.match(r"(?i)[a-b]", r"A").span(), (0, 1)) + + self.assertEqual(regex.sub(r"(?V0)([][])", r"-", "a[b]c"), "a-b-c") + + self.assertEqual(regex.findall(r"[\p{Alpha}]", "a0"), ["a"]) + self.assertEqual(regex.findall(r"(?i)[\p{Alpha}]", "A0"), ["A"]) + + self.assertEqual(regex.findall(r"[a\p{Alpha}]", "ab0"), ["a", "b"]) + self.assertEqual(regex.findall(r"[a\P{Alpha}]", "ab0"), ["a", "0"]) + self.assertEqual(regex.findall(r"(?i)[a\p{Alpha}]", "ab0"), ["a", + "b"]) + self.assertEqual(regex.findall(r"(?i)[a\P{Alpha}]", "ab0"), ["a", + "0"]) + + self.assertEqual(regex.findall(r"[a-b\p{Alpha}]", "abC0"), ["a", + "b", "C"]) + self.assertEqual(regex.findall(r"(?i)[a-b\p{Alpha}]", "AbC0"), ["A", + "b", "C"]) + + self.assertEqual(regex.findall(r"[\p{Alpha}]", "a0"), ["a"]) + self.assertEqual(regex.findall(r"[\P{Alpha}]", "a0"), ["0"]) + self.assertEqual(regex.findall(r"[^\p{Alpha}]", "a0"), ["0"]) + self.assertEqual(regex.findall(r"[^\P{Alpha}]", "a0"), ["a"]) + + self.assertEqual("".join(regex.findall(r"[^\d-h]", "a^b12c-h")), + 'a^bc') + self.assertEqual("".join(regex.findall(r"[^\dh]", "a^b12c-h")), + 'a^bc-') + self.assertEqual("".join(regex.findall(r"[^h\s\db]", "a^b 12c-h")), + 'a^c-') + self.assertEqual("".join(regex.findall(r"[^b\w]", "a b")), ' ') + self.assertEqual("".join(regex.findall(r"[^b\S]", "a b")), ' ') + self.assertEqual("".join(regex.findall(r"[^8\d]", "a 1b2")), 'a b') + + all_chars = "".join(chr(c) for c in range(0x100)) + self.assertEqual(len(regex.findall(r"\p{ASCII}", all_chars)), 128) + self.assertEqual(len(regex.findall(r"\p{Letter}", all_chars)), + 117) + self.assertEqual(len(regex.findall(r"\p{Digit}", all_chars)), 10) + + # Set operators + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Letter}]", + all_chars)), 52) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Alnum}&&\p{Letter}]", + all_chars)), 52) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Alnum}&&\p{Digit}]", + all_chars)), 10) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Cc}]", + all_chars)), 33) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}&&\p{Graph}]", + all_chars)), 94) + self.assertEqual(len(regex.findall(r"(?V1)[\p{ASCII}--\p{Cc}]", + all_chars)), 95) + self.assertEqual(len(regex.findall(r"[\p{Letter}\p{Digit}]", + all_chars)), 127) + self.assertEqual(len(regex.findall(r"(?V1)[\p{Letter}||\p{Digit}]", + all_chars)), 127) + self.assertEqual(len(regex.findall(r"\p{HexDigit}", all_chars)), + 22) + self.assertEqual(len(regex.findall(r"(?V1)[\p{HexDigit}~~\p{Digit}]", + all_chars)), 12) + self.assertEqual(len(regex.findall(r"(?V1)[\p{Digit}~~\p{HexDigit}]", + all_chars)), 12) + + self.assertEqual(repr(type(regex.compile(r"(?V0)([][-])"))), + self.PATTERN_CLASS) + self.assertEqual(regex.findall(r"(?V1)[[a-z]--[aei]]", "abc"), ["b", + "c"]) + self.assertEqual(regex.findall(r"(?iV1)[[a-z]--[aei]]", "abc"), ["b", + "c"]) + self.assertEqual(regex.findall(r"(?V1)[\w--a]","abc"), ["b", "c"]) + self.assertEqual(regex.findall(r"(?iV1)[\w--a]","abc"), ["b", "c"]) + + def test_various(self): + tests = [ + # Test ?P< and ?P= extensions. + ('(?Pa)', '', '', regex.error, self.BAD_GROUP_NAME), # Begins with a digit. + ('(?Pa)', '', '', regex.error, self.BAD_GROUP_NAME), # Begins with an illegal char. + ('(?Pa)', '', '', regex.error, self.BAD_GROUP_NAME), # Begins with an illegal char. + + # Same tests, for the ?P= form. + ('(?Pa)(?P=foo_123', 'aa', '', regex.error, + self.MISSING_RPAREN), + ('(?Pa)(?P=1)', 'aa', '1', ascii('a')), + ('(?Pa)(?P=0)', 'aa', '', regex.error, + self.BAD_GROUP_NAME), + ('(?Pa)(?P=-1)', 'aa', '', regex.error, + self.BAD_GROUP_NAME), + ('(?Pa)(?P=!)', 'aa', '', regex.error, + self.BAD_GROUP_NAME), + ('(?Pa)(?P=foo_124)', 'aa', '', regex.error, + self.UNKNOWN_GROUP), # Backref to undefined group. + + ('(?Pa)', 'a', '1', ascii('a')), + ('(?Pa)(?P=foo_123)', 'aa', '1', ascii('a')), + + # Mal-formed \g in pattern treated as literal for compatibility. + (r'(?a)\ga)\g<1>', 'aa', '1', ascii('a')), + (r'(?a)\g', 'aa', '', ascii(None)), + (r'(?a)\g', 'aa', '', regex.error, + self.UNKNOWN_GROUP), # Backref to undefined group. + + ('(?a)', 'a', '1', ascii('a')), + (r'(?a)\g', 'aa', '1', ascii('a')), + + # Test octal escapes. + ('\\1', 'a', '', regex.error, self.INVALID_GROUP_REF), # Backreference. + ('[\\1]', '\1', '0', "'\\x01'"), # Character. + ('\\09', chr(0) + '9', '0', ascii(chr(0) + '9')), + ('\\141', 'a', '0', ascii('a')), + ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', + '0,11', ascii(('abcdefghijklk9', 'k'))), + + # Test \0 is handled everywhere. + (r'\0', '\0', '0', ascii('\0')), + (r'[\0a]', '\0', '0', ascii('\0')), + (r'[a\0]', '\0', '0', ascii('\0')), + (r'[^a\0]', '\0', '', ascii(None)), + + # Test various letter escapes. + (r'\a[\b]\f\n\r\t\v', '\a\b\f\n\r\t\v', '0', + ascii('\a\b\f\n\r\t\v')), + (r'[\a][\b][\f][\n][\r][\t][\v]', '\a\b\f\n\r\t\v', '0', + ascii('\a\b\f\n\r\t\v')), + (r'\xff', '\377', '0', ascii(chr(255))), + + # New \x semantics. + (r'\x00ffffffffffffff', '\377', '', ascii(None)), + (r'\x00f', '\017', '', ascii(None)), + (r'\x00fe', '\376', '', ascii(None)), + + (r'\x00ff', '\377', '', ascii(None)), + (r'\t\n\v\r\f\a\g', '\t\n\v\r\f\ag', '0', ascii('\t\n\v\r\f\ag')), + ('\t\n\v\r\f\a\\g', '\t\n\v\r\f\ag', '0', ascii('\t\n\v\r\f\ag')), + (r'\t\n\v\r\f\a', '\t\n\v\r\f\a', '0', ascii(chr(9) + chr(10) + + chr(11) + chr(13) + chr(12) + chr(7))), + (r'[\t][\n][\v][\r][\f][\b]', '\t\n\v\r\f\b', '0', + ascii('\t\n\v\r\f\b')), + + (r"^\w+=(\\[\000-\277]|[^\n\\])*", + "SRC=eval.c g.c blah blah blah \\\\\n\tapes.c", '0', + ascii("SRC=eval.c g.c blah blah blah \\\\")), + + # Test that . only matches \n in DOTALL mode. + ('a.b', 'acb', '0', ascii('acb')), + ('a.b', 'a\nb', '', ascii(None)), + ('a.*b', 'acc\nccb', '', ascii(None)), + ('a.{4,5}b', 'acc\nccb', '', ascii(None)), + ('a.b', 'a\rb', '0', ascii('a\rb')), + # Changed to positional flags in regex 2023.12.23. + ('a.b(?s)', 'a\nb', '', ascii(None)), + ('(?s)a.b', 'a\nb', '0', ascii('a\nb')), + ('a.*(?s)b', 'acc\nccb', '', ascii(None)), + ('(?s)a.*b', 'acc\nccb', '0', ascii('acc\nccb')), + ('(?s)a.{4,5}b', 'acc\nccb', '0', ascii('acc\nccb')), + + (')', '', '', regex.error, self.TRAILING_CHARS), # Unmatched right bracket. + ('', '', '0', "''"), # Empty pattern. + ('abc', 'abc', '0', ascii('abc')), + ('abc', 'xbc', '', ascii(None)), + ('abc', 'axc', '', ascii(None)), + ('abc', 'abx', '', ascii(None)), + ('abc', 'xabcy', '0', ascii('abc')), + ('abc', 'ababc', '0', ascii('abc')), + ('ab*c', 'abc', '0', ascii('abc')), + ('ab*bc', 'abc', '0', ascii('abc')), + + ('ab*bc', 'abbc', '0', ascii('abbc')), + ('ab*bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab+bc', 'abbc', '0', ascii('abbc')), + ('ab+bc', 'abc', '', ascii(None)), + ('ab+bc', 'abq', '', ascii(None)), + ('ab+bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab?bc', 'abbc', '0', ascii('abbc')), + ('ab?bc', 'abc', '0', ascii('abc')), + ('ab?bc', 'abbbbc', '', ascii(None)), + ('ab?c', 'abc', '0', ascii('abc')), + + ('^abc$', 'abc', '0', ascii('abc')), + ('^abc$', 'abcc', '', ascii(None)), + ('^abc', 'abcc', '0', ascii('abc')), + ('^abc$', 'aabc', '', ascii(None)), + ('abc$', 'aabc', '0', ascii('abc')), + ('^', 'abc', '0', ascii('')), + ('$', 'abc', '0', ascii('')), + ('a.c', 'abc', '0', ascii('abc')), + ('a.c', 'axc', '0', ascii('axc')), + ('a.*c', 'axyzc', '0', ascii('axyzc')), + + ('a.*c', 'axyzd', '', ascii(None)), + ('a[bc]d', 'abc', '', ascii(None)), + ('a[bc]d', 'abd', '0', ascii('abd')), + ('a[b-d]e', 'abd', '', ascii(None)), + ('a[b-d]e', 'ace', '0', ascii('ace')), + ('a[b-d]', 'aac', '0', ascii('ac')), + ('a[-b]', 'a-', '0', ascii('a-')), + ('a[\\-b]', 'a-', '0', ascii('a-')), + ('a[b-]', 'a-', '0', ascii('a-')), + ('a[]b', '-', '', regex.error, self.BAD_SET), + + ('a[', '-', '', regex.error, self.BAD_SET), + ('a\\', '-', '', regex.error, self.BAD_ESCAPE), + ('abc)', '-', '', regex.error, self.TRAILING_CHARS), + ('(abc', '-', '', regex.error, self.MISSING_RPAREN), + ('a]', 'a]', '0', ascii('a]')), + ('a[]]b', 'a]b', '0', ascii('a]b')), + ('a[]]b', 'a]b', '0', ascii('a]b')), + ('a[^bc]d', 'aed', '0', ascii('aed')), + ('a[^bc]d', 'abd', '', ascii(None)), + ('a[^-b]c', 'adc', '0', ascii('adc')), + + ('a[^-b]c', 'a-c', '', ascii(None)), + ('a[^]b]c', 'a]c', '', ascii(None)), + ('a[^]b]c', 'adc', '0', ascii('adc')), + ('\\ba\\b', 'a-', '0', ascii('a')), + ('\\ba\\b', '-a', '0', ascii('a')), + ('\\ba\\b', '-a-', '0', ascii('a')), + ('\\by\\b', 'xy', '', ascii(None)), + ('\\by\\b', 'yz', '', ascii(None)), + ('\\by\\b', 'xyz', '', ascii(None)), + ('x\\b', 'xyz', '', ascii(None)), + + ('x\\B', 'xyz', '0', ascii('x')), + ('\\Bz', 'xyz', '0', ascii('z')), + ('z\\B', 'xyz', '', ascii(None)), + ('\\Bx', 'xyz', '', ascii(None)), + ('\\Ba\\B', 'a-', '', ascii(None)), + ('\\Ba\\B', '-a', '', ascii(None)), + ('\\Ba\\B', '-a-', '', ascii(None)), + ('\\By\\B', 'xy', '', ascii(None)), + ('\\By\\B', 'yz', '', ascii(None)), + ('\\By\\b', 'xy', '0', ascii('y')), + + ('\\by\\B', 'yz', '0', ascii('y')), + ('\\By\\B', 'xyz', '0', ascii('y')), + ('ab|cd', 'abc', '0', ascii('ab')), + ('ab|cd', 'abcd', '0', ascii('ab')), + ('()ef', 'def', '0,1', ascii(('ef', ''))), + ('$b', 'b', '', ascii(None)), + ('a\\(b', 'a(b', '', ascii(('a(b',))), + ('a\\(*b', 'ab', '0', ascii('ab')), + ('a\\(*b', 'a((b', '0', ascii('a((b')), + ('a\\\\b', 'a\\b', '0', ascii('a\\b')), + + ('((a))', 'abc', '0,1,2', ascii(('a', 'a', 'a'))), + ('(a)b(c)', 'abc', '0,1,2', ascii(('abc', 'a', 'c'))), + ('a+b+c', 'aabbabc', '0', ascii('abc')), + ('(a+|b)*', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b)+', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b)?', 'ab', '0,1', ascii(('a', 'a'))), + (')(', '-', '', regex.error, self.TRAILING_CHARS), + ('[^ab]*', 'cde', '0', ascii('cde')), + ('abc', '', '', ascii(None)), + ('a*', '', '0', ascii('')), + + ('a|b|c|d|e', 'e', '0', ascii('e')), + ('(a|b|c|d|e)f', 'ef', '0,1', ascii(('ef', 'e'))), + ('abcd*efg', 'abcdefg', '0', ascii('abcdefg')), + ('ab*', 'xabyabbbz', '0', ascii('ab')), + ('ab*', 'xayabbbz', '0', ascii('a')), + ('(ab|cd)e', 'abcde', '0,1', ascii(('cde', 'cd'))), + ('[abhgefdc]ij', 'hij', '0', ascii('hij')), + ('^(ab|cd)e', 'abcde', '', ascii(None)), + ('(abc|)ef', 'abcdef', '0,1', ascii(('ef', ''))), + ('(a|b)c*d', 'abcd', '0,1', ascii(('bcd', 'b'))), + + ('(ab|ab*)bc', 'abc', '0,1', ascii(('abc', 'a'))), + ('a([bc]*)c*', 'abc', '0,1', ascii(('abc', 'bc'))), + ('a([bc]*)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]+)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]*)(c+d)', 'abcd', '0,1,2', ascii(('abcd', 'b', 'cd'))), + ('a[bcd]*dcdcde', 'adcdcde', '0', ascii('adcdcde')), + ('a[bcd]+dcdcde', 'adcdcde', '', ascii(None)), + ('(ab|a)b*c', 'abc', '0,1', ascii(('abc', 'ab'))), + ('((a)(b)c)(d)', 'abcd', '1,2,3,4', ascii(('abc', 'a', 'b', 'd'))), + ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', '0', ascii('alpha')), + + ('^a(bc+|b[eh])g|.h$', 'abh', '0,1', ascii(('bh', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'ij', '0,1,2', ascii(('ij', 'ij', + 'j'))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effg', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('(((((((((a)))))))))', 'a', '0', ascii('a')), + ('multiple words of text', 'uh-uh', '', ascii(None)), + ('multiple words', 'multiple words, yeah', '0', + ascii('multiple words')), + ('(.*)c(.*)', 'abcde', '0,1,2', ascii(('abcde', 'ab', 'de'))), + + ('\\((.*), (.*)\\)', '(a, b)', '2,1', ascii(('b', 'a'))), + ('[k]', 'ab', '', ascii(None)), + ('a[-]?c', 'ac', '0', ascii('ac')), + ('(abc)\\1', 'abcabc', '1', ascii('abc')), + ('([a-c]*)\\1', 'abcabc', '1', ascii('abc')), + ('^(.+)?B', 'AB', '1', ascii('A')), + ('(a+).\\1$', 'aaaaa', '0,1', ascii(('aaaaa', 'aa'))), + ('^(a+).\\1$', 'aaaa', '', ascii(None)), + ('(abc)\\1', 'abcabc', '0,1', ascii(('abcabc', 'abc'))), + ('([a-c]+)\\1', 'abcabc', '0,1', ascii(('abcabc', 'abc'))), + + ('(a)\\1', 'aa', '0,1', ascii(('aa', 'a'))), + ('(a+)\\1', 'aa', '0,1', ascii(('aa', 'a'))), + ('(a+)+\\1', 'aa', '0,1', ascii(('aa', 'a'))), + ('(a).+\\1', 'aba', '0,1', ascii(('aba', 'a'))), + ('(a)ba*\\1', 'aba', '0,1', ascii(('aba', 'a'))), + ('(aa|a)a\\1$', 'aaa', '0,1', ascii(('aaa', 'a'))), + ('(a|aa)a\\1$', 'aaa', '0,1', ascii(('aaa', 'a'))), + ('(a+)a\\1$', 'aaa', '0,1', ascii(('aaa', 'a'))), + ('([abc]*)\\1', 'abcabc', '0,1', ascii(('abcabc', 'abc'))), + ('(a)(b)c|ab', 'ab', '0,1,2', ascii(('ab', None, None))), + + ('(a)+x', 'aaax', '0,1', ascii(('aaax', 'a'))), + ('([ac])+x', 'aacx', '0,1', ascii(('aacx', 'c'))), + ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', '0,1', + ascii(('d:msgs/tdir/sub1/', 'tdir/'))), + ('([^.]*)\\.([^:]*):[T ]+(.*)', 'track1.title:TBlah blah blah', + '0,1,2,3', ascii(('track1.title:TBlah blah blah', 'track1', + 'title', 'Blah blah blah'))), + ('([^N]*N)+', 'abNNxyzN', '0,1', ascii(('abNNxyzN', 'xyzN'))), + ('([^N]*N)+', 'abNNxyz', '0,1', ascii(('abNN', 'N'))), + ('([abc]*)x', 'abcx', '0,1', ascii(('abcx', 'abc'))), + ('([abc]*)x', 'abc', '', ascii(None)), + ('([xyz]*)x', 'abcx', '0,1', ascii(('x', ''))), + ('(a)+b|aac', 'aac', '0,1', ascii(('aac', None))), + + # Test symbolic groups. + ('(?Paaa)a', 'aaaa', '', regex.error, self.BAD_GROUP_NAME), + ('(?Paaa)a', 'aaaa', '0,id', ascii(('aaaa', 'aaa'))), + ('(?Paa)(?P=id)', 'aaaa', '0,id', ascii(('aaaa', 'aa'))), + ('(?Paa)(?P=xd)', 'aaaa', '', regex.error, self.UNKNOWN_GROUP), + + # Character properties. + (r"\g", "g", '0', ascii('g')), + (r"\g<1>", "g", '', regex.error, self.INVALID_GROUP_REF), + (r"(.)\g<1>", "gg", '0', ascii('gg')), + (r"(.)\g<1>", "gg", '', ascii(('gg', 'g'))), + (r"\N", "N", '0', ascii('N')), + (r"\N{LATIN SMALL LETTER A}", "a", '0', ascii('a')), + (r"\p", "p", '0', ascii('p')), + (r"\p{Ll}", "a", '0', ascii('a')), + (r"\P", "P", '0', ascii('P')), + (r"\P{Lu}", "p", '0', ascii('p')), + + # All tests from Perl. + ('abc', 'abc', '0', ascii('abc')), + ('abc', 'xbc', '', ascii(None)), + ('abc', 'axc', '', ascii(None)), + ('abc', 'abx', '', ascii(None)), + ('abc', 'xabcy', '0', ascii('abc')), + ('abc', 'ababc', '0', ascii('abc')), + + ('ab*c', 'abc', '0', ascii('abc')), + ('ab*bc', 'abc', '0', ascii('abc')), + ('ab*bc', 'abbc', '0', ascii('abbc')), + ('ab*bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{0,}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab+bc', 'abbc', '0', ascii('abbc')), + ('ab+bc', 'abc', '', ascii(None)), + ('ab+bc', 'abq', '', ascii(None)), + ('ab{1,}bc', 'abq', '', ascii(None)), + ('ab+bc', 'abbbbc', '0', ascii('abbbbc')), + + ('ab{1,}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{1,3}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{3,4}bc', 'abbbbc', '0', ascii('abbbbc')), + ('ab{4,5}bc', 'abbbbc', '', ascii(None)), + ('ab?bc', 'abbc', '0', ascii('abbc')), + ('ab?bc', 'abc', '0', ascii('abc')), + ('ab{0,1}bc', 'abc', '0', ascii('abc')), + ('ab?bc', 'abbbbc', '', ascii(None)), + ('ab?c', 'abc', '0', ascii('abc')), + ('ab{0,1}c', 'abc', '0', ascii('abc')), + + ('^abc$', 'abc', '0', ascii('abc')), + ('^abc$', 'abcc', '', ascii(None)), + ('^abc', 'abcc', '0', ascii('abc')), + ('^abc$', 'aabc', '', ascii(None)), + ('abc$', 'aabc', '0', ascii('abc')), + ('^', 'abc', '0', ascii('')), + ('$', 'abc', '0', ascii('')), + ('a.c', 'abc', '0', ascii('abc')), + ('a.c', 'axc', '0', ascii('axc')), + ('a.*c', 'axyzc', '0', ascii('axyzc')), + + ('a.*c', 'axyzd', '', ascii(None)), + ('a[bc]d', 'abc', '', ascii(None)), + ('a[bc]d', 'abd', '0', ascii('abd')), + ('a[b-d]e', 'abd', '', ascii(None)), + ('a[b-d]e', 'ace', '0', ascii('ace')), + ('a[b-d]', 'aac', '0', ascii('ac')), + ('a[-b]', 'a-', '0', ascii('a-')), + ('a[b-]', 'a-', '0', ascii('a-')), + ('a[b-a]', '-', '', regex.error, self.BAD_CHAR_RANGE), + ('a[]b', '-', '', regex.error, self.BAD_SET), + + ('a[', '-', '', regex.error, self.BAD_SET), + ('a]', 'a]', '0', ascii('a]')), + ('a[]]b', 'a]b', '0', ascii('a]b')), + ('a[^bc]d', 'aed', '0', ascii('aed')), + ('a[^bc]d', 'abd', '', ascii(None)), + ('a[^-b]c', 'adc', '0', ascii('adc')), + ('a[^-b]c', 'a-c', '', ascii(None)), + ('a[^]b]c', 'a]c', '', ascii(None)), + ('a[^]b]c', 'adc', '0', ascii('adc')), + ('ab|cd', 'abc', '0', ascii('ab')), + + ('ab|cd', 'abcd', '0', ascii('ab')), + ('()ef', 'def', '0,1', ascii(('ef', ''))), + ('*a', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('(*)b', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('$b', 'b', '', ascii(None)), + ('a\\', '-', '', regex.error, self.BAD_ESCAPE), + ('a\\(b', 'a(b', '', ascii(('a(b',))), + ('a\\(*b', 'ab', '0', ascii('ab')), + ('a\\(*b', 'a((b', '0', ascii('a((b')), + ('a\\\\b', 'a\\b', '0', ascii('a\\b')), + + ('abc)', '-', '', regex.error, self.TRAILING_CHARS), + ('(abc', '-', '', regex.error, self.MISSING_RPAREN), + ('((a))', 'abc', '0,1,2', ascii(('a', 'a', 'a'))), + ('(a)b(c)', 'abc', '0,1,2', ascii(('abc', 'a', 'c'))), + ('a+b+c', 'aabbabc', '0', ascii('abc')), + ('a{1,}b{1,}c', 'aabbabc', '0', ascii('abc')), + ('a**', '-', '', regex.error, self.MULTIPLE_REPEAT), + ('a.+?c', 'abcabc', '0', ascii('abc')), + ('(a+|b)*', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b){0,}', 'ab', '0,1', ascii(('ab', 'b'))), + + ('(a+|b)+', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b){1,}', 'ab', '0,1', ascii(('ab', 'b'))), + ('(a+|b)?', 'ab', '0,1', ascii(('a', 'a'))), + ('(a+|b){0,1}', 'ab', '0,1', ascii(('a', 'a'))), + (')(', '-', '', regex.error, self.TRAILING_CHARS), + ('[^ab]*', 'cde', '0', ascii('cde')), + ('abc', '', '', ascii(None)), + ('a*', '', '0', ascii('')), + ('([abc])*d', 'abbbcd', '0,1', ascii(('abbbcd', 'c'))), + ('([abc])*bcd', 'abcd', '0,1', ascii(('abcd', 'a'))), + + ('a|b|c|d|e', 'e', '0', ascii('e')), + ('(a|b|c|d|e)f', 'ef', '0,1', ascii(('ef', 'e'))), + ('abcd*efg', 'abcdefg', '0', ascii('abcdefg')), + ('ab*', 'xabyabbbz', '0', ascii('ab')), + ('ab*', 'xayabbbz', '0', ascii('a')), + ('(ab|cd)e', 'abcde', '0,1', ascii(('cde', 'cd'))), + ('[abhgefdc]ij', 'hij', '0', ascii('hij')), + ('^(ab|cd)e', 'abcde', '', ascii(None)), + ('(abc|)ef', 'abcdef', '0,1', ascii(('ef', ''))), + ('(a|b)c*d', 'abcd', '0,1', ascii(('bcd', 'b'))), + + ('(ab|ab*)bc', 'abc', '0,1', ascii(('abc', 'a'))), + ('a([bc]*)c*', 'abc', '0,1', ascii(('abc', 'bc'))), + ('a([bc]*)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]+)(c*d)', 'abcd', '0,1,2', ascii(('abcd', 'bc', 'd'))), + ('a([bc]*)(c+d)', 'abcd', '0,1,2', ascii(('abcd', 'b', 'cd'))), + ('a[bcd]*dcdcde', 'adcdcde', '0', ascii('adcdcde')), + ('a[bcd]+dcdcde', 'adcdcde', '', ascii(None)), + ('(ab|a)b*c', 'abc', '0,1', ascii(('abc', 'ab'))), + ('((a)(b)c)(d)', 'abcd', '1,2,3,4', ascii(('abc', 'a', 'b', 'd'))), + ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', '0', ascii('alpha')), + + ('^a(bc+|b[eh])g|.h$', 'abh', '0,1', ascii(('bh', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('(bc+d$|ef*g.|h?i(j|k))', 'ij', '0,1,2', ascii(('ij', 'ij', + 'j'))), + ('(bc+d$|ef*g.|h?i(j|k))', 'effg', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', '', ascii(None)), + ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', '0,1,2', ascii(('effgz', + 'effgz', None))), + ('((((((((((a))))))))))', 'a', '10', ascii('a')), + ('((((((((((a))))))))))\\10', 'aa', '0', ascii('aa')), + + # Python does not have the same rules for \\41 so this is a syntax error + # ('((((((((((a))))))))))\\41', 'aa', '', ascii(None)), + # ('((((((((((a))))))))))\\41', 'a!', '0', ascii('a!')), + ('((((((((((a))))))))))\\41', '', '', regex.error, + self.INVALID_GROUP_REF), + ('(?i)((((((((((a))))))))))\\41', '', '', regex.error, + self.INVALID_GROUP_REF), + + ('(((((((((a)))))))))', 'a', '0', ascii('a')), + ('multiple words of text', 'uh-uh', '', ascii(None)), + ('multiple words', 'multiple words, yeah', '0', + ascii('multiple words')), + ('(.*)c(.*)', 'abcde', '0,1,2', ascii(('abcde', 'ab', 'de'))), + ('\\((.*), (.*)\\)', '(a, b)', '2,1', ascii(('b', 'a'))), + ('[k]', 'ab', '', ascii(None)), + ('a[-]?c', 'ac', '0', ascii('ac')), + ('(abc)\\1', 'abcabc', '1', ascii('abc')), + ('([a-c]*)\\1', 'abcabc', '1', ascii('abc')), + ('(?i)abc', 'ABC', '0', ascii('ABC')), + + ('(?i)abc', 'XBC', '', ascii(None)), + ('(?i)abc', 'AXC', '', ascii(None)), + ('(?i)abc', 'ABX', '', ascii(None)), + ('(?i)abc', 'XABCY', '0', ascii('ABC')), + ('(?i)abc', 'ABABC', '0', ascii('ABC')), + ('(?i)ab*c', 'ABC', '0', ascii('ABC')), + ('(?i)ab*bc', 'ABC', '0', ascii('ABC')), + ('(?i)ab*bc', 'ABBC', '0', ascii('ABBC')), + ('(?i)ab*?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{0,}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + + ('(?i)ab+?bc', 'ABBC', '0', ascii('ABBC')), + ('(?i)ab+bc', 'ABC', '', ascii(None)), + ('(?i)ab+bc', 'ABQ', '', ascii(None)), + ('(?i)ab{1,}bc', 'ABQ', '', ascii(None)), + ('(?i)ab+bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{1,}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{1,3}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{3,4}?bc', 'ABBBBC', '0', ascii('ABBBBC')), + ('(?i)ab{4,5}?bc', 'ABBBBC', '', ascii(None)), + ('(?i)ab??bc', 'ABBC', '0', ascii('ABBC')), + + ('(?i)ab??bc', 'ABC', '0', ascii('ABC')), + ('(?i)ab{0,1}?bc', 'ABC', '0', ascii('ABC')), + ('(?i)ab??bc', 'ABBBBC', '', ascii(None)), + ('(?i)ab??c', 'ABC', '0', ascii('ABC')), + ('(?i)ab{0,1}?c', 'ABC', '0', ascii('ABC')), + ('(?i)^abc$', 'ABC', '0', ascii('ABC')), + ('(?i)^abc$', 'ABCC', '', ascii(None)), + ('(?i)^abc', 'ABCC', '0', ascii('ABC')), + ('(?i)^abc$', 'AABC', '', ascii(None)), + ('(?i)abc$', 'AABC', '0', ascii('ABC')), + + ('(?i)^', 'ABC', '0', ascii('')), + ('(?i)$', 'ABC', '0', ascii('')), + ('(?i)a.c', 'ABC', '0', ascii('ABC')), + ('(?i)a.c', 'AXC', '0', ascii('AXC')), + ('(?i)a.*?c', 'AXYZC', '0', ascii('AXYZC')), + ('(?i)a.*c', 'AXYZD', '', ascii(None)), + ('(?i)a[bc]d', 'ABC', '', ascii(None)), + ('(?i)a[bc]d', 'ABD', '0', ascii('ABD')), + ('(?i)a[b-d]e', 'ABD', '', ascii(None)), + ('(?i)a[b-d]e', 'ACE', '0', ascii('ACE')), + + ('(?i)a[b-d]', 'AAC', '0', ascii('AC')), + ('(?i)a[-b]', 'A-', '0', ascii('A-')), + ('(?i)a[b-]', 'A-', '0', ascii('A-')), + ('(?i)a[b-a]', '-', '', regex.error, self.BAD_CHAR_RANGE), + ('(?i)a[]b', '-', '', regex.error, self.BAD_SET), + ('(?i)a[', '-', '', regex.error, self.BAD_SET), + ('(?i)a]', 'A]', '0', ascii('A]')), + ('(?i)a[]]b', 'A]B', '0', ascii('A]B')), + ('(?i)a[^bc]d', 'AED', '0', ascii('AED')), + ('(?i)a[^bc]d', 'ABD', '', ascii(None)), + + ('(?i)a[^-b]c', 'ADC', '0', ascii('ADC')), + ('(?i)a[^-b]c', 'A-C', '', ascii(None)), + ('(?i)a[^]b]c', 'A]C', '', ascii(None)), + ('(?i)a[^]b]c', 'ADC', '0', ascii('ADC')), + ('(?i)ab|cd', 'ABC', '0', ascii('AB')), + ('(?i)ab|cd', 'ABCD', '0', ascii('AB')), + ('(?i)()ef', 'DEF', '0,1', ascii(('EF', ''))), + ('(?i)*a', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('(?i)(*)b', '-', '', regex.error, self.NOTHING_TO_REPEAT), + ('(?i)$b', 'B', '', ascii(None)), + + ('(?i)a\\', '-', '', regex.error, self.BAD_ESCAPE), + ('(?i)a\\(b', 'A(B', '', ascii(('A(B',))), + ('(?i)a\\(*b', 'AB', '0', ascii('AB')), + ('(?i)a\\(*b', 'A((B', '0', ascii('A((B')), + ('(?i)a\\\\b', 'A\\B', '0', ascii('A\\B')), + ('(?i)abc)', '-', '', regex.error, self.TRAILING_CHARS), + ('(?i)(abc', '-', '', regex.error, self.MISSING_RPAREN), + ('(?i)((a))', 'ABC', '0,1,2', ascii(('A', 'A', 'A'))), + ('(?i)(a)b(c)', 'ABC', '0,1,2', ascii(('ABC', 'A', 'C'))), + ('(?i)a+b+c', 'AABBABC', '0', ascii('ABC')), + + ('(?i)a{1,}b{1,}c', 'AABBABC', '0', ascii('ABC')), + ('(?i)a**', '-', '', regex.error, self.MULTIPLE_REPEAT), + ('(?i)a.+?c', 'ABCABC', '0', ascii('ABC')), + ('(?i)a.*?c', 'ABCABC', '0', ascii('ABC')), + ('(?i)a.{0,5}?c', 'ABCABC', '0', ascii('ABC')), + ('(?i)(a+|b)*', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b){0,}', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b)+', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b){1,}', 'AB', '0,1', ascii(('AB', 'B'))), + ('(?i)(a+|b)?', 'AB', '0,1', ascii(('A', 'A'))), + + ('(?i)(a+|b){0,1}', 'AB', '0,1', ascii(('A', 'A'))), + ('(?i)(a+|b){0,1}?', 'AB', '0,1', ascii(('', None))), + ('(?i))(', '-', '', regex.error, self.TRAILING_CHARS), + ('(?i)[^ab]*', 'CDE', '0', ascii('CDE')), + ('(?i)abc', '', '', ascii(None)), + ('(?i)a*', '', '0', ascii('')), + ('(?i)([abc])*d', 'ABBBCD', '0,1', ascii(('ABBBCD', 'C'))), + ('(?i)([abc])*bcd', 'ABCD', '0,1', ascii(('ABCD', 'A'))), + ('(?i)a|b|c|d|e', 'E', '0', ascii('E')), + ('(?i)(a|b|c|d|e)f', 'EF', '0,1', ascii(('EF', 'E'))), + + ('(?i)abcd*efg', 'ABCDEFG', '0', ascii('ABCDEFG')), + ('(?i)ab*', 'XABYABBBZ', '0', ascii('AB')), + ('(?i)ab*', 'XAYABBBZ', '0', ascii('A')), + ('(?i)(ab|cd)e', 'ABCDE', '0,1', ascii(('CDE', 'CD'))), + ('(?i)[abhgefdc]ij', 'HIJ', '0', ascii('HIJ')), + ('(?i)^(ab|cd)e', 'ABCDE', '', ascii(None)), + ('(?i)(abc|)ef', 'ABCDEF', '0,1', ascii(('EF', ''))), + ('(?i)(a|b)c*d', 'ABCD', '0,1', ascii(('BCD', 'B'))), + ('(?i)(ab|ab*)bc', 'ABC', '0,1', ascii(('ABC', 'A'))), + ('(?i)a([bc]*)c*', 'ABC', '0,1', ascii(('ABC', 'BC'))), + + ('(?i)a([bc]*)(c*d)', 'ABCD', '0,1,2', ascii(('ABCD', 'BC', 'D'))), + ('(?i)a([bc]+)(c*d)', 'ABCD', '0,1,2', ascii(('ABCD', 'BC', 'D'))), + ('(?i)a([bc]*)(c+d)', 'ABCD', '0,1,2', ascii(('ABCD', 'B', 'CD'))), + ('(?i)a[bcd]*dcdcde', 'ADCDCDE', '0', ascii('ADCDCDE')), + ('(?i)a[bcd]+dcdcde', 'ADCDCDE', '', ascii(None)), + ('(?i)(ab|a)b*c', 'ABC', '0,1', ascii(('ABC', 'AB'))), + ('(?i)((a)(b)c)(d)', 'ABCD', '1,2,3,4', ascii(('ABC', 'A', 'B', + 'D'))), + ('(?i)[a-zA-Z_][a-zA-Z0-9_]*', 'ALPHA', '0', ascii('ALPHA')), + ('(?i)^a(bc+|b[eh])g|.h$', 'ABH', '0,1', ascii(('BH', None))), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFGZ', '0,1,2', ascii(('EFFGZ', + 'EFFGZ', None))), + + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'IJ', '0,1,2', ascii(('IJ', 'IJ', + 'J'))), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFG', '', ascii(None)), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'BCDD', '', ascii(None)), + ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'REFFGZ', '0,1,2', ascii(('EFFGZ', + 'EFFGZ', None))), + ('(?i)((((((((((a))))))))))', 'A', '10', ascii('A')), + ('(?i)((((((((((a))))))))))\\10', 'AA', '0', ascii('AA')), + #('(?i)((((((((((a))))))))))\\41', 'AA', '', ascii(None)), + #('(?i)((((((((((a))))))))))\\41', 'A!', '0', ascii('A!')), + ('(?i)(((((((((a)))))))))', 'A', '0', ascii('A')), + ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))', 'A', '1', + ascii('A')), + ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))', 'C', '1', + ascii('C')), + ('(?i)multiple words of text', 'UH-UH', '', ascii(None)), + + ('(?i)multiple words', 'MULTIPLE WORDS, YEAH', '0', + ascii('MULTIPLE WORDS')), + ('(?i)(.*)c(.*)', 'ABCDE', '0,1,2', ascii(('ABCDE', 'AB', 'DE'))), + ('(?i)\\((.*), (.*)\\)', '(A, B)', '2,1', ascii(('B', 'A'))), + ('(?i)[k]', 'AB', '', ascii(None)), + # ('(?i)abcd', 'ABCD', SUCCEED, 'found+"-"+\\found+"-"+\\\\found', ascii(ABCD-$&-\\ABCD)), + # ('(?i)a(bc)d', 'ABCD', SUCCEED, 'g1+"-"+\\g1+"-"+\\\\g1', ascii(BC-$1-\\BC)), + ('(?i)a[-]?c', 'AC', '0', ascii('AC')), + ('(?i)(abc)\\1', 'ABCABC', '1', ascii('ABC')), + ('(?i)([a-c]*)\\1', 'ABCABC', '1', ascii('ABC')), + ('a(?!b).', 'abad', '0', ascii('ad')), + ('a(?=d).', 'abad', '0', ascii('ad')), + ('a(?=c|d).', 'abad', '0', ascii('ad')), + + ('a(?:b|c|d)(.)', 'ace', '1', ascii('e')), + ('a(?:b|c|d)*(.)', 'ace', '1', ascii('e')), + ('a(?:b|c|d)+?(.)', 'ace', '1', ascii('e')), + ('a(?:b|(c|e){1,2}?|d)+?(.)', 'ace', '1,2', ascii(('c', 'e'))), + + # Lookbehind: split by : but not if it is escaped by -. + ('(?]*?b', 'a>b', '', ascii(None)), + # Bug 490573: minimizing repeat problem. + (r'^a*?$', 'foo', '', ascii(None)), + # Bug 470582: nested groups problem. + (r'^((a)c)?(ab)$', 'ab', '1,2,3', ascii((None, None, 'ab'))), + # Another minimizing repeat problem (capturing groups in assertions). + ('^([ab]*?)(?=(b)?)c', 'abc', '1,2', ascii(('ab', None))), + ('^([ab]*?)(?!(b))c', 'abc', '1,2', ascii(('ab', None))), + ('^([ab]*?)(?(.){0,2})d", "abcd").captures(1), + ['b', 'c']) + self.assertEqual(regex.search(r"(.)+", "a").captures(1), ['a']) + + def test_guards(self): + m = regex.search(r"(X.*?Y\s*){3}(X\s*)+AB:", + "XY\nX Y\nX Y\nXY\nXX AB:") + self.assertEqual(m.span(0, 1, 2), ((3, 21), (12, 15), (16, 18))) + + m = regex.search(r"(X.*?Y\s*){3,}(X\s*)+AB:", + "XY\nX Y\nX Y\nXY\nXX AB:") + self.assertEqual(m.span(0, 1, 2), ((0, 21), (12, 15), (16, 18))) + + m = regex.search(r'\d{4}(\s*\w)?\W*((?!\d)\w){2}', "9999XX") + self.assertEqual(m.span(0, 1, 2), ((0, 6), (-1, -1), (5, 6))) + + m = regex.search(r'A\s*?.*?(\n+.*?\s*?){0,2}\(X', 'A\n1\nS\n1 (X') + self.assertEqual(m.span(0, 1), ((0, 10), (5, 8))) + + m = regex.search(r'Derde\s*:', 'aaaaaa:\nDerde:') + self.assertEqual(m.span(), (8, 14)) + m = regex.search(r'Derde\s*:', 'aaaaa:\nDerde:') + self.assertEqual(m.span(), (7, 13)) + + def test_turkic(self): + # Turkish has dotted and dotless I/i. + pairs = "I=i;I=\u0131;i=\u0130" + + all_chars = set() + matching = set() + for pair in pairs.split(";"): + ch1, ch2 = pair.split("=") + all_chars.update((ch1, ch2)) + matching.add((ch1, ch1)) + matching.add((ch1, ch2)) + matching.add((ch2, ch1)) + matching.add((ch2, ch2)) + + for ch1 in all_chars: + for ch2 in all_chars: + m = regex.match(r"(?i)\A" + ch1 + r"\Z", ch2) + if m: + if (ch1, ch2) not in matching: + self.fail("{} matching {}".format(ascii(ch1), + ascii(ch2))) + else: + if (ch1, ch2) in matching: + self.fail("{} not matching {}".format(ascii(ch1), + ascii(ch2))) + + def test_named_lists(self): + options = ["one", "two", "three"] + self.assertEqual(regex.match(r"333\L444", "333one444", + bar=options).group(), "333one444") + self.assertEqual(regex.match(r"(?i)333\L444", "333TWO444", + bar=options).group(), "333TWO444") + self.assertEqual(regex.match(r"333\L444", "333four444", + bar=options), None) + + options = [b"one", b"two", b"three"] + self.assertEqual(regex.match(br"333\L444", b"333one444", + bar=options).group(), b"333one444") + self.assertEqual(regex.match(br"(?i)333\L444", b"333TWO444", + bar=options).group(), b"333TWO444") + self.assertEqual(regex.match(br"333\L444", b"333four444", + bar=options), None) + + self.assertEqual(repr(type(regex.compile(r"3\L4\L+5", + bar=["one", "two", "three"]))), self.PATTERN_CLASS) + + self.assertEqual(regex.findall(r"^\L", "solid QWERT", + options=set(['good', 'brilliant', '+s\\ol[i}d'])), []) + self.assertEqual(regex.findall(r"^\L", "+solid QWERT", + options=set(['good', 'brilliant', '+solid'])), ['+solid']) + + options = ["STRASSE"] + self.assertEqual(regex.match(r"(?fi)\L", + "stra\N{LATIN SMALL LETTER SHARP S}e", words=options).span(), (0, + 6)) + + options = ["STRASSE", "stress"] + self.assertEqual(regex.match(r"(?fi)\L", + "stra\N{LATIN SMALL LETTER SHARP S}e", words=options).span(), (0, + 6)) + + options = ["stra\N{LATIN SMALL LETTER SHARP S}e"] + self.assertEqual(regex.match(r"(?fi)\L", "STRASSE", + words=options).span(), (0, 7)) + + options = ["kit"] + self.assertEqual(regex.search(r"(?i)\L", "SKITS", + words=options).span(), (1, 4)) + self.assertEqual(regex.search(r"(?i)\L", + "SK\N{LATIN CAPITAL LETTER I WITH DOT ABOVE}TS", + words=options).span(), (1, 4)) + + self.assertEqual(regex.search(r"(?fi)\b(\w+) +\1\b", + " stra\N{LATIN SMALL LETTER SHARP S}e STRASSE ").span(), (1, 15)) + self.assertEqual(regex.search(r"(?fi)\b(\w+) +\1\b", + " STRASSE stra\N{LATIN SMALL LETTER SHARP S}e ").span(), (1, 15)) + + self.assertEqual(regex.search(r"^\L$", "", options=[]).span(), + (0, 0)) + + def test_fuzzy(self): + # Some tests borrowed from TRE library tests. + self.assertEqual(repr(type(regex.compile('(fou){s,e<=1}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(fuu){s}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(fuu){s,e}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(anaconda){1i+1d<1,s<=1}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(anaconda){1i+1d<1,s<=1,e<=10}'))), + self.PATTERN_CLASS) + self.assertEqual(repr(type(regex.compile('(anaconda){s<=1,e<=1,1i+1d<1}'))), + self.PATTERN_CLASS) + + text = 'molasses anaconda foo bar baz smith anderson ' + self.assertEqual(regex.search('(znacnda){s<=1,e<=3,1i+1d<1}', text), + None) + self.assertEqual(regex.search('(znacnda){s<=1,e<=3,1i+1d<2}', + text).span(0, 1), ((9, 17), (9, 17))) + self.assertEqual(regex.search('(ananda){1i+1d<2}', text), None) + self.assertEqual(regex.search(r"(?:\bznacnda){e<=2}", text)[0], + "anaconda") + self.assertEqual(regex.search(r"(?:\bnacnda){e<=2}", text)[0], + "anaconda") + + text = 'anaconda foo bar baz smith anderson' + self.assertEqual(regex.search('(fuu){i<=3,d<=3,e<=5}', text).span(0, + 1), ((0, 0), (0, 0))) + self.assertEqual(regex.search('(?b)(fuu){i<=3,d<=3,e<=5}', + text).span(0, 1), ((9, 10), (9, 10))) + self.assertEqual(regex.search('(fuu){i<=2,d<=2,e<=5}', text).span(0, + 1), ((7, 10), (7, 10))) + self.assertEqual(regex.search('(?e)(fuu){i<=2,d<=2,e<=5}', + text).span(0, 1), ((9, 10), (9, 10))) + self.assertEqual(regex.search('(fuu){i<=3,d<=3,e}', text).span(0, 1), + ((0, 0), (0, 0))) + self.assertEqual(regex.search('(?b)(fuu){i<=3,d<=3,e}', text).span(0, + 1), ((9, 10), (9, 10))) + + self.assertEqual(repr(type(regex.compile('(approximate){s<=3,1i+1d<3}'))), + self.PATTERN_CLASS) + + # No cost limit. + self.assertEqual(regex.search('(foobar){e}', + 'xirefoabralfobarxie').span(0, 1), ((0, 6), (0, 6))) + self.assertEqual(regex.search('(?e)(foobar){e}', + 'xirefoabralfobarxie').span(0, 1), ((0, 3), (0, 3))) + self.assertEqual(regex.search('(?b)(foobar){e}', + 'xirefoabralfobarxie').span(0, 1), ((11, 16), (11, 16))) + + # At most two errors. + self.assertEqual(regex.search('(foobar){e<=2}', + 'xirefoabrzlfd').span(0, 1), ((4, 9), (4, 9))) + self.assertEqual(regex.search('(foobar){e<=2}', 'xirefoabzlfd'), None) + + # At most two inserts or substitutions and max two errors total. + self.assertEqual(regex.search('(foobar){i<=2,s<=2,e<=2}', + 'oobargoobaploowap').span(0, 1), ((5, 11), (5, 11))) + + # Find best whole word match for "foobar". + self.assertEqual(regex.search('\\b(foobar){e}\\b', 'zfoobarz').span(0, + 1), ((0, 8), (0, 8))) + self.assertEqual(regex.search('\\b(foobar){e}\\b', + 'boing zfoobarz goobar woop').span(0, 1), ((0, 6), (0, 6))) + self.assertEqual(regex.search('(?b)\\b(foobar){e}\\b', + 'boing zfoobarz goobar woop').span(0, 1), ((15, 21), (15, 21))) + + # Match whole string, allow only 1 error. + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobar').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xfoobar').span(0, + 1), ((0, 7), (0, 7))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobarx').span(0, + 1), ((0, 7), (0, 7))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'fooxbar').span(0, + 1), ((0, 7), (0, 7))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foxbar').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xoobar').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobax').span(0, 1), + ((0, 6), (0, 6))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'oobar').span(0, 1), + ((0, 5), (0, 5))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'fobar').span(0, 1), + ((0, 5), (0, 5))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'fooba').span(0, 1), + ((0, 5), (0, 5))) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xfoobarx'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foobarxx'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xxfoobar'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'xfoxbar'), None) + self.assertEqual(regex.search('^(foobar){e<=1}$', 'foxbarx'), None) + + # At most one insert, two deletes, and three substitutions. + # Additionally, deletes cost two and substitutes one, and total + # cost must be less than 4. + self.assertEqual(regex.search('(foobar){i<=1,d<=2,s<=3,2d+1s<4}', + '3oifaowefbaoraofuiebofasebfaobfaorfeoaro').span(0, 1), ((6, 13), (6, + 13))) + self.assertEqual(regex.search('(?b)(foobar){i<=1,d<=2,s<=3,2d+1s<4}', + '3oifaowefbaoraofuiebofasebfaobfaorfeoaro').span(0, 1), ((34, 39), + (34, 39))) + + # Partially fuzzy matches. + self.assertEqual(regex.search('foo(bar){e<=1}zap', 'foobarzap').span(0, + 1), ((0, 9), (3, 6))) + self.assertEqual(regex.search('foo(bar){e<=1}zap', 'fobarzap'), None) + self.assertEqual(regex.search('foo(bar){e<=1}zap', 'foobrzap').span(0, + 1), ((0, 8), (3, 5))) + + text = ('www.cnn.com 64.236.16.20\nwww.slashdot.org 66.35.250.150\n' + 'For useful information, use www.slashdot.org\nthis is demo data!\n') + self.assertEqual(regex.search(r'(?s)^.*(dot.org){e}.*$', text).span(0, + 1), ((0, 120), (120, 120))) + self.assertEqual(regex.search(r'(?es)^.*(dot.org){e}.*$', text).span(0, + 1), ((0, 120), (93, 100))) + self.assertEqual(regex.search(r'^.*(dot.org){e}.*$', text).span(0, 1), + ((0, 119), (24, 101))) + + # Behaviour is unexpected, but arguably not wrong. It first finds the + # best match, then the best in what follows, etc. + self.assertEqual(regex.findall(r"\b\L{e<=1}\b", + " book cot dog desk ", words="cat dog".split()), ["cot", "dog"]) + self.assertEqual(regex.findall(r"\b\L{e<=1}\b", + " book dog cot desk ", words="cat dog".split()), [" dog", "cot"]) + self.assertEqual(regex.findall(r"(?e)\b\L{e<=1}\b", + " book dog cot desk ", words="cat dog".split()), ["dog", "cot"]) + self.assertEqual(regex.findall(r"(?r)\b\L{e<=1}\b", + " book cot dog desk ", words="cat dog".split()), ["dog ", "cot"]) + self.assertEqual(regex.findall(r"(?er)\b\L{e<=1}\b", + " book cot dog desk ", words="cat dog".split()), ["dog", "cot"]) + self.assertEqual(regex.findall(r"(?r)\b\L{e<=1}\b", + " book dog cot desk ", words="cat dog".split()), ["cot", "dog"]) + self.assertEqual(regex.findall(br"\b\L{e<=1}\b", + b" book cot dog desk ", words=b"cat dog".split()), [b"cot", b"dog"]) + self.assertEqual(regex.findall(br"\b\L{e<=1}\b", + b" book dog cot desk ", words=b"cat dog".split()), [b" dog", b"cot"]) + self.assertEqual(regex.findall(br"(?e)\b\L{e<=1}\b", + b" book dog cot desk ", words=b"cat dog".split()), [b"dog", b"cot"]) + self.assertEqual(regex.findall(br"(?r)\b\L{e<=1}\b", + b" book cot dog desk ", words=b"cat dog".split()), [b"dog ", b"cot"]) + self.assertEqual(regex.findall(br"(?er)\b\L{e<=1}\b", + b" book cot dog desk ", words=b"cat dog".split()), [b"dog", b"cot"]) + self.assertEqual(regex.findall(br"(?r)\b\L{e<=1}\b", + b" book dog cot desk ", words=b"cat dog".split()), [b"cot", b"dog"]) + + self.assertEqual(regex.search(r"(\w+) (\1{e<=1})", "foo fou").groups(), + ("foo", "fou")) + self.assertEqual(regex.search(r"(?r)(\2{e<=1}) (\w+)", + "foo fou").groups(), ("foo", "fou")) + self.assertEqual(regex.search(br"(\w+) (\1{e<=1})", + b"foo fou").groups(), (b"foo", b"fou")) + + self.assertEqual(regex.findall(r"(?:(?:QR)+){e}", "abcde"), ["abcde", + ""]) + self.assertEqual(regex.findall(r"(?:Q+){e}", "abc"), ["abc", ""]) + + # Hg issue 41: = for fuzzy matches + self.assertEqual(regex.match(r"(?:service detection){0[^()]+)|(?R))*\)", "(ab(cd)ef)")[ + : ], ("(ab(cd)ef)", "ef")) + self.assertEqual(regex.search(r"\(((?>[^()]+)|(?R))*\)", + "(ab(cd)ef)").captures(1), ["ab", "cd", "(cd)", "ef"]) + + self.assertEqual(regex.search(r"(?r)\(((?R)|(?>[^()]+))*\)", + "(ab(cd)ef)")[ : ], ("(ab(cd)ef)", "ab")) + self.assertEqual(regex.search(r"(?r)\(((?R)|(?>[^()]+))*\)", + "(ab(cd)ef)").captures(1), ["ef", "cd", "(cd)", "ab"]) + + self.assertEqual(regex.search(r"\(([^()]+|(?R))*\)", + "some text (a(b(c)d)e) more text")[ : ], ("(a(b(c)d)e)", "e")) + + self.assertEqual(regex.search(r"(?r)\(((?R)|[^()]+)*\)", + "some text (a(b(c)d)e) more text")[ : ], ("(a(b(c)d)e)", "a")) + + self.assertEqual(regex.search(r"(foo(\(((?:(?>[^()]+)|(?2))*)\)))", + "foo(bar(baz)+baz(bop))")[ : ], ("foo(bar(baz)+baz(bop))", + "foo(bar(baz)+baz(bop))", "(bar(baz)+baz(bop))", + "bar(baz)+baz(bop)")) + + self.assertEqual(regex.search(r"(?r)(foo(\(((?:(?2)|(?>[^()]+))*)\)))", + "foo(bar(baz)+baz(bop))")[ : ], ("foo(bar(baz)+baz(bop))", + "foo(bar(baz)+baz(bop))", "(bar(baz)+baz(bop))", + "bar(baz)+baz(bop)")) + + rgx = regex.compile(r"""^\s*(<\s*([a-zA-Z:]+)(?:\s*[a-zA-Z:]*\s*=\s*(?:'[^']*'|"[^"]*"))*\s*(/\s*)?>(?:[^<>]*|(?1))*(?(3)|<\s*/\s*\2\s*>))\s*$""") + self.assertEqual(bool(rgx.search('')), True) + self.assertEqual(bool(rgx.search('')), False) + self.assertEqual(bool(rgx.search('')), True) + self.assertEqual(bool(rgx.search('')), False) + self.assertEqual(bool(rgx.search('')), False) + + self.assertEqual(bool(rgx.search('')), False) + self.assertEqual(bool(rgx.search('')), True) + self.assertEqual(bool(rgx.search('< fooo / >')), True) + # The next regex should and does match. Perl 5.14 agrees. + #self.assertEqual(bool(rgx.search('foo')), False) + self.assertEqual(bool(rgx.search('foo')), False) + + self.assertEqual(bool(rgx.search('foo')), True) + self.assertEqual(bool(rgx.search('foo')), True) + self.assertEqual(bool(rgx.search('')), True) + + def test_copy(self): + # PatternObjects are immutable, therefore there's no need to clone them. + r = regex.compile("a") + self.assertTrue(copy.copy(r) is r) + self.assertTrue(copy.deepcopy(r) is r) + + # MatchObjects are normally mutable because the target string can be + # detached. However, after the target string has been detached, a + # MatchObject becomes immutable, so there's no need to clone it. + m = r.match("a") + self.assertTrue(copy.copy(m) is not m) + self.assertTrue(copy.deepcopy(m) is not m) + + self.assertTrue(m.string is not None) + m2 = copy.copy(m) + m2.detach_string() + self.assertTrue(m.string is not None) + self.assertTrue(m2.string is None) + + # The following behaviour matches that of the re module. + it = regex.finditer(".", "ab") + it2 = copy.copy(it) + self.assertEqual(next(it).group(), "a") + self.assertEqual(next(it2).group(), "b") + + # The following behaviour matches that of the re module. + it = regex.finditer(".", "ab") + it2 = copy.deepcopy(it) + self.assertEqual(next(it).group(), "a") + self.assertEqual(next(it2).group(), "b") + + # The following behaviour is designed to match that of copying 'finditer'. + it = regex.splititer(" ", "a b") + it2 = copy.copy(it) + self.assertEqual(next(it), "a") + self.assertEqual(next(it2), "b") + + # The following behaviour is designed to match that of copying 'finditer'. + it = regex.splititer(" ", "a b") + it2 = copy.deepcopy(it) + self.assertEqual(next(it), "a") + self.assertEqual(next(it2), "b") + + def test_format(self): + self.assertEqual(regex.subf(r"(\w+) (\w+)", "{0} => {2} {1}", + "foo bar"), "foo bar => bar foo") + self.assertEqual(regex.subf(r"(?\w+) (?\w+)", + "{word2} {word1}", "foo bar"), "bar foo") + + self.assertEqual(regex.subfn(r"(\w+) (\w+)", "{0} => {2} {1}", + "foo bar"), ("foo bar => bar foo", 1)) + self.assertEqual(regex.subfn(r"(?\w+) (?\w+)", + "{word2} {word1}", "foo bar"), ("bar foo", 1)) + + self.assertEqual(regex.match(r"(\w+) (\w+)", + "foo bar").expandf("{0} => {2} {1}"), "foo bar => bar foo") + + def test_fullmatch(self): + self.assertEqual(bool(regex.fullmatch(r"abc", "abc")), True) + self.assertEqual(bool(regex.fullmatch(r"abc", "abcx")), False) + self.assertEqual(bool(regex.fullmatch(r"abc", "abcx", endpos=3)), True) + + self.assertEqual(bool(regex.fullmatch(r"abc", "xabc", pos=1)), True) + self.assertEqual(bool(regex.fullmatch(r"abc", "xabcy", pos=1)), False) + self.assertEqual(bool(regex.fullmatch(r"abc", "xabcy", pos=1, + endpos=4)), True) + + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "abc")), True) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "abcx")), False) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "abcx", endpos=3)), + True) + + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabc", pos=1)), + True) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabcy", pos=1)), + False) + self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabcy", pos=1, + endpos=4)), True) + + def test_issue_18468(self): + self.assertTypedEqual(regex.sub('y', 'a', 'xyz'), 'xaz') + self.assertTypedEqual(regex.sub('y', StrSubclass('a'), + StrSubclass('xyz')), 'xaz') + self.assertTypedEqual(regex.sub(b'y', b'a', b'xyz'), b'xaz') + self.assertTypedEqual(regex.sub(b'y', BytesSubclass(b'a'), + BytesSubclass(b'xyz')), b'xaz') + self.assertTypedEqual(regex.sub(b'y', bytearray(b'a'), + bytearray(b'xyz')), b'xaz') + self.assertTypedEqual(regex.sub(b'y', memoryview(b'a'), + memoryview(b'xyz')), b'xaz') + + for string in ":a:b::c", StrSubclass(":a:b::c"): + self.assertTypedEqual(regex.split(":", string), ['', 'a', 'b', '', + 'c']) + if sys.version_info >= (3, 7, 0): + self.assertTypedEqual(regex.split(":*", string), ['', '', 'a', + '', 'b', '', 'c', '']) + self.assertTypedEqual(regex.split("(:*)", string), ['', ':', + '', '', 'a', ':', '', '', 'b', '::', '', '', 'c', '', '']) + else: + self.assertTypedEqual(regex.split(":*", string), ['', 'a', 'b', + 'c']) + self.assertTypedEqual(regex.split("(:*)", string), ['', ':', + 'a', ':', 'b', '::', 'c']) + + for string in (b":a:b::c", BytesSubclass(b":a:b::c"), + bytearray(b":a:b::c"), memoryview(b":a:b::c")): + self.assertTypedEqual(regex.split(b":", string), [b'', b'a', b'b', + b'', b'c']) + if sys.version_info >= (3, 7, 0): + self.assertTypedEqual(regex.split(b":*", string), [b'', b'', + b'a', b'', b'b', b'', b'c', b'']) + self.assertTypedEqual(regex.split(b"(:*)", string), [b'', b':', + b'', b'', b'a', b':', b'', b'', b'b', b'::', b'', b'', b'c', + b'', b'']) + else: + self.assertTypedEqual(regex.split(b":*", string), [b'', b'a', + b'b', b'c']) + self.assertTypedEqual(regex.split(b"(:*)", string), [b'', b':', + b'a', b':', b'b', b'::', b'c']) + + for string in "a:b::c:::d", StrSubclass("a:b::c:::d"): + self.assertTypedEqual(regex.findall(":+", string), [":", "::", + ":::"]) + self.assertTypedEqual(regex.findall("(:+)", string), [":", "::", + ":::"]) + self.assertTypedEqual(regex.findall("(:)(:*)", string), [(":", ""), + (":", ":"), (":", "::")]) + + for string in (b"a:b::c:::d", BytesSubclass(b"a:b::c:::d"), + bytearray(b"a:b::c:::d"), memoryview(b"a:b::c:::d")): + self.assertTypedEqual(regex.findall(b":+", string), [b":", b"::", + b":::"]) + self.assertTypedEqual(regex.findall(b"(:+)", string), [b":", b"::", + b":::"]) + self.assertTypedEqual(regex.findall(b"(:)(:*)", string), [(b":", + b""), (b":", b":"), (b":", b"::")]) + + for string in 'a', StrSubclass('a'): + self.assertEqual(regex.match('a', string).groups(), ()) + self.assertEqual(regex.match('(a)', string).groups(), ('a',)) + self.assertEqual(regex.match('(a)', string).group(0), 'a') + self.assertEqual(regex.match('(a)', string).group(1), 'a') + self.assertEqual(regex.match('(a)', string).group(1, 1), ('a', + 'a')) + + for string in (b'a', BytesSubclass(b'a'), bytearray(b'a'), + memoryview(b'a')): + self.assertEqual(regex.match(b'a', string).groups(), ()) + self.assertEqual(regex.match(b'(a)', string).groups(), (b'a',)) + self.assertEqual(regex.match(b'(a)', string).group(0), b'a') + self.assertEqual(regex.match(b'(a)', string).group(1), b'a') + self.assertEqual(regex.match(b'(a)', string).group(1, 1), (b'a', + b'a')) + + def test_partial(self): + self.assertEqual(regex.match('ab', 'a', partial=True).partial, True) + self.assertEqual(regex.match('ab', 'a', partial=True).span(), (0, 1)) + self.assertEqual(regex.match(r'cats', 'cat', partial=True).partial, + True) + self.assertEqual(regex.match(r'cats', 'cat', partial=True).span(), (0, + 3)) + self.assertEqual(regex.match(r'cats', 'catch', partial=True), None) + self.assertEqual(regex.match(r'abc\w{3}', 'abcdef', + partial=True).partial, False) + self.assertEqual(regex.match(r'abc\w{3}', 'abcdef', + partial=True).span(), (0, 6)) + self.assertEqual(regex.match(r'abc\w{3}', 'abcde', + partial=True).partial, True) + self.assertEqual(regex.match(r'abc\w{3}', 'abcde', + partial=True).span(), (0, 5)) + + self.assertEqual(regex.match(r'\d{4}$', '1234', partial=True).partial, + False) + + self.assertEqual(regex.match(r'\L', 'post', partial=True, + words=['post']).partial, False) + self.assertEqual(regex.match(r'\L', 'post', partial=True, + words=['post']).span(), (0, 4)) + self.assertEqual(regex.match(r'\L', 'pos', partial=True, + words=['post']).partial, True) + self.assertEqual(regex.match(r'\L', 'pos', partial=True, + words=['post']).span(), (0, 3)) + + self.assertEqual(regex.match(r'(?fi)\L', 'POST', partial=True, + words=['po\uFB06']).partial, False) + self.assertEqual(regex.match(r'(?fi)\L', 'POST', partial=True, + words=['po\uFB06']).span(), (0, 4)) + self.assertEqual(regex.match(r'(?fi)\L', 'POS', partial=True, + words=['po\uFB06']).partial, True) + self.assertEqual(regex.match(r'(?fi)\L', 'POS', partial=True, + words=['po\uFB06']).span(), (0, 3)) + self.assertEqual(regex.match(r'(?fi)\L', 'po\uFB06', + partial=True, words=['POS']), None) + + self.assertEqual(regex.match(r'[a-z]*4R$', 'a', partial=True).span(), + (0, 1)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'ab', partial=True).span(), + (0, 2)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'ab4', partial=True).span(), + (0, 3)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'a4', partial=True).span(), + (0, 2)) + self.assertEqual(regex.match(r'[a-z]*4R$', 'a4R', partial=True).span(), + (0, 3)) + self.assertEqual(regex.match(r'[a-z]*4R$', '4a', partial=True), None) + self.assertEqual(regex.match(r'[a-z]*4R$', 'a44', partial=True), None) + + def test_hg_bugs(self): + # Hg issue 28: regex.compile("(?>b)") causes "TypeError: 'Character' + # object is not subscriptable" + self.assertEqual(bool(regex.compile("(?>b)", flags=regex.V1)), True) + + # Hg issue 29: regex.compile("^((?>\w+)|(?>\s+))*$") causes + # "TypeError: 'GreedyRepeat' object is not iterable" + self.assertEqual(bool(regex.compile(r"^((?>\w+)|(?>\s+))*$", + flags=regex.V1)), True) + + # Hg issue 31: atomic and normal groups in recursive patterns + self.assertEqual(regex.findall(r"\((?:(?>[^()]+)|(?R))*\)", + "a(bcd(e)f)g(h)"), ['(bcd(e)f)', '(h)']) + self.assertEqual(regex.findall(r"\((?:(?:[^()]+)|(?R))*\)", + "a(bcd(e)f)g(h)"), ['(bcd(e)f)', '(h)']) + self.assertEqual(regex.findall(r"\((?:(?>[^()]+)|(?R))*\)", + "a(b(cd)e)f)g)h"), ['(b(cd)e)']) + self.assertEqual(regex.findall(r"\((?:(?>[^()]+)|(?R))*\)", + "a(bc(d(e)f)gh"), ['(d(e)f)']) + self.assertEqual(regex.findall(r"(?r)\((?:(?>[^()]+)|(?R))*\)", + "a(bc(d(e)f)gh"), ['(d(e)f)']) + self.assertEqual([m.group() for m in + regex.finditer(r"\((?:[^()]*+|(?0))*\)", "a(b(c(de)fg)h")], + ['(c(de)fg)']) + + # Hg issue 32: regex.search("a(bc)d", "abcd", regex.I|regex.V1) returns + # None + self.assertEqual(regex.search("a(bc)d", "abcd", regex.I | + regex.V1).group(0), "abcd") + + # Hg issue 33: regex.search("([\da-f:]+)$", "E", regex.I|regex.V1) + # returns None + self.assertEqual(regex.search(r"([\da-f:]+)$", "E", regex.I | + regex.V1).group(0), "E") + self.assertEqual(regex.search(r"([\da-f:]+)$", "e", regex.I | + regex.V1).group(0), "e") + + # Hg issue 34: regex.search("^(?=ab(de))(abd)(e)", "abde").groups() + # returns (None, 'abd', 'e') instead of ('de', 'abd', 'e') + self.assertEqual(regex.search("^(?=ab(de))(abd)(e)", "abde").groups(), + ('de', 'abd', 'e')) + + # Hg issue 35: regex.compile("\ ", regex.X) causes "_regex_core.error: + # bad escape" + self.assertEqual(bool(regex.match(r"\ ", " ", flags=regex.X)), True) + + # Hg issue 36: regex.search("^(a|)\1{2}b", "b") returns None + self.assertEqual(regex.search(r"^(a|)\1{2}b", "b").group(0, 1), ('b', + '')) + + # Hg issue 37: regex.search("^(a){0,0}", "abc").group(0,1) returns + # ('a', 'a') instead of ('', None) + self.assertEqual(regex.search("^(a){0,0}", "abc").group(0, 1), ('', + None)) + + # Hg issue 38: regex.search("(?>.*/)b", "a/b") returns None + self.assertEqual(regex.search("(?>.*/)b", "a/b").group(0), "a/b") + + # Hg issue 39: regex.search("((?i)blah)\\s+\\1", "blah BLAH") doesn't + # return None + # Changed to positional flags in regex 2023.12.23. + self.assertEqual(regex.search(r"((?i)blah)\s+\1", "blah BLAH"), None) + + # Hg issue 40: regex.search("(\()?[^()]+(?(1)\)|)", "(abcd").group(0) + # returns "bcd" instead of "abcd" + self.assertEqual(regex.search(r"(\()?[^()]+(?(1)\)|)", + "(abcd").group(0), "abcd") + + # Hg issue 42: regex.search("(a*)*", "a", flags=regex.V1).span(1) + # returns (0, 1) instead of (1, 1) + self.assertEqual(regex.search("(a*)*", "a").span(1), (1, 1)) + self.assertEqual(regex.search("(a*)*", "aa").span(1), (2, 2)) + self.assertEqual(regex.search("(a*)*", "aaa").span(1), (3, 3)) + + # Hg issue 43: regex.compile("a(?#xxx)*") causes "_regex_core.error: + # nothing to repeat" + self.assertEqual(regex.search("a(?#xxx)*", "aaa").group(), "aaa") + + # Hg issue 44: regex.compile("(?=abc){3}abc") causes + # "_regex_core.error: nothing to repeat" + self.assertEqual(regex.search("(?=abc){3}abc", "abcabcabc").span(), (0, + 3)) + + # Hg issue 45: regex.compile("^(?:a(?:(?:))+)+") causes + # "_regex_core.error: nothing to repeat" + self.assertEqual(regex.search("^(?:a(?:(?:))+)+", "a").span(), (0, 1)) + self.assertEqual(regex.search("^(?:a(?:(?:))+)+", "aa").span(), (0, 2)) + + # Hg issue 46: regex.compile("a(?x: b c )d") causes + # "_regex_core.error: missing )" + self.assertEqual(regex.search("a(?x: b c )d", "abcd").group(0), "abcd") + + # Hg issue 47: regex.compile("a#comment\n*", flags=regex.X) causes + # "_regex_core.error: nothing to repeat" + self.assertEqual(regex.search("a#comment\n*", "aaa", + flags=regex.X).group(0), "aaa") + + # Hg issue 48: regex.search("(a(?(1)\\1)){4}", "a"*10, + # flags=regex.V1).group(0,1) returns ('aaaaa', 'a') instead of ('aaaaaaaaaa', 'aaaa') + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){1}", + "aaaaaaaaaa").span(0, 1), ((0, 1), (0, 1))) + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){2}", + "aaaaaaaaaa").span(0, 1), ((0, 3), (1, 3))) + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){3}", + "aaaaaaaaaa").span(0, 1), ((0, 6), (3, 6))) + self.assertEqual(regex.search(r"(?V1)(a(?(1)\1)){4}", + "aaaaaaaaaa").span(0, 1), ((0, 10), (6, 10))) + + # Hg issue 49: regex.search("(a)(?<=b(?1))", "baz", regex.V1) returns + # None incorrectly + self.assertEqual(regex.search("(?V1)(a)(?<=b(?1))", "baz").group(0), + "a") + + # Hg issue 50: not all keywords are found by named list with + # overlapping keywords when full Unicode casefolding is required + self.assertEqual(regex.findall(r'(?fi)\L', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05', + keywords=['post','pos']), ['POST', 'Post', 'post', 'po\u017Ft', + 'po\uFB06', 'po\uFB05']) + self.assertEqual(regex.findall(r'(?fi)pos|post', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05'), ['POS', + 'Pos', 'pos', 'po\u017F', 'po\uFB06', 'po\uFB05']) + self.assertEqual(regex.findall(r'(?fi)post|pos', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05'), ['POST', + 'Post', 'post', 'po\u017Ft', 'po\uFB06', 'po\uFB05']) + self.assertEqual(regex.findall(r'(?fi)post|another', + 'POST, Post, post, po\u017Ft, po\uFB06, and po\uFB05'), ['POST', + 'Post', 'post', 'po\u017Ft', 'po\uFB06', 'po\uFB05']) + + # Hg issue 51: regex.search("((a)(?1)|(?2))", "a", flags=regex.V1) + # returns None incorrectly + self.assertEqual(regex.search("(?V1)((a)(?1)|(?2))", "a").group(0, 1, + 2), ('a', 'a', None)) + + # Hg issue 52: regex.search("(\\1xx|){6}", "xx", + # flags=regex.V1).span(0,1) returns incorrect value + self.assertEqual(regex.search(r"(?V1)(\1xx|){6}", "xx").span(0, 1), + ((0, 2), (2, 2))) + + # Hg issue 53: regex.search("(a|)+", "a") causes MemoryError + self.assertEqual(regex.search("(a|)+", "a").group(0, 1), ("a", "")) + + # Hg issue 54: regex.search("(a|)*\\d", "a"*80) causes MemoryError + self.assertEqual(regex.search(r"(a|)*\d", "a" * 80), None) + + # Hg issue 55: regex.search("^(?:a?b?)*$", "ac") take a very long time. + self.assertEqual(regex.search("^(?:a?b?)*$", "ac"), None) + + # Hg issue 58: bad named character escape sequences like "\\N{1}" + # treats as "N" + self.assertRaisesRegex(regex.error, self.UNDEF_CHAR_NAME, lambda: + regex.compile("\\N{1}")) + + # Hg issue 59: regex.search("\\Z", "a\na\n") returns None incorrectly + self.assertEqual(regex.search("\\Z", "a\na\n").span(0), (4, 4)) + + # Hg issue 60: regex.search("(q1|.)*(q2|.)*(x(a|bc)*y){2,}", "xayxay") + # returns None incorrectly + self.assertEqual(regex.search("(q1|.)*(q2|.)*(x(a|bc)*y){2,}", + "xayxay").group(0), "xayxay") + + # Hg issue 61: regex.search("[^a]", "A", regex.I).group(0) returns '' + # incorrectly + self.assertEqual(regex.search("(?i)[^a]", "A"), None) + + # Hg issue 63: regex.search("[[:ascii:]]", "\N{KELVIN SIGN}", + # flags=regex.I|regex.V1) doesn't return None + self.assertEqual(regex.search("(?i)[[:ascii:]]", "\N{KELVIN SIGN}"), + None) + + # Hg issue 66: regex.search("((a|b(?1)c){3,5})", "baaaaca", + # flags=regex.V1).groups() returns ('baaaac', 'baaaac') instead of ('aaaa', 'a') + self.assertEqual(regex.search("((a|b(?1)c){3,5})", "baaaaca").group(0, + 1, 2), ('aaaa', 'aaaa', 'a')) + + # Hg issue 71: non-greedy quantifier in lookbehind + self.assertEqual(regex.findall(r"(?<=:\S+ )\w+", ":9 abc :10 def"), + ['abc', 'def']) + self.assertEqual(regex.findall(r"(?<=:\S* )\w+", ":9 abc :10 def"), + ['abc', 'def']) + self.assertEqual(regex.findall(r"(?<=:\S+? )\w+", ":9 abc :10 def"), + ['abc', 'def']) + self.assertEqual(regex.findall(r"(?<=:\S*? )\w+", ":9 abc :10 def"), + ['abc', 'def']) + + # Hg issue 73: conditional patterns + self.assertEqual(regex.search(r"(?:fe)?male", "female").group(), + "female") + self.assertEqual([m.group() for m in + regex.finditer(r"(fe)?male: h(?(1)(er)|(is)) (\w+)", + "female: her dog; male: his cat. asdsasda")], ['female: her dog', + 'male: his cat']) + + # Hg issue 78: "Captures" doesn't work for recursive calls + self.assertEqual(regex.search(r'(?\((?:[^()]++|(?&rec))*\))', + 'aaa(((1+0)+1)+1)bbb').captures('rec'), ['(1+0)', '((1+0)+1)', + '(((1+0)+1)+1)']) + + # Hg issue 80: Escape characters throws an exception + self.assertRaisesRegex(regex.error, self.BAD_ESCAPE, lambda: + regex.sub('x', '\\', 'x'), ) + + # Hg issue 82: error range does not work + fz = "(CAGCCTCCCATTTCAGAATATACATCC){1a(?b))', "ab").spans("x"), [(1, + 2), (0, 2)]) + + # Hg issue 91: match.expand is extremely slow + # Check that the replacement cache works. + self.assertEqual(regex.sub(r'(-)', lambda m: m.expand(r'x'), 'a-b-c'), + 'axbxc') + + # Hg issue 94: Python crashes when executing regex updates + # pattern.findall + rx = regex.compile(r'\bt(est){i<2}', flags=regex.V1) + self.assertEqual(rx.search("Some text"), None) + self.assertEqual(rx.findall("Some text"), []) + + # Hg issue 95: 'pos' for regex.error + self.assertRaisesRegex(regex.error, self.MULTIPLE_REPEAT, lambda: + regex.compile(r'.???')) + + # Hg issue 97: behaviour of regex.escape's special_only is wrong + # + # Hg issue 244: Make `special_only=True` the default in + # `regex.escape()` + self.assertEqual(regex.escape('foo!?', special_only=False), 'foo\\!\\?') + self.assertEqual(regex.escape('foo!?', special_only=True), 'foo!\\?') + self.assertEqual(regex.escape('foo!?'), 'foo!\\?') + + self.assertEqual(regex.escape(b'foo!?', special_only=False), b'foo\\!\\?') + self.assertEqual(regex.escape(b'foo!?', special_only=True), + b'foo!\\?') + self.assertEqual(regex.escape(b'foo!?'), b'foo!\\?') + + # Hg issue 100: strange results from regex.search + self.assertEqual(regex.search('^([^z]*(?:WWWi|W))?$', + 'WWWi').groups(), ('WWWi', )) + self.assertEqual(regex.search('^([^z]*(?:WWWi|w))?$', + 'WWWi').groups(), ('WWWi', )) + self.assertEqual(regex.search('^([^z]*?(?:WWWi|W))?$', + 'WWWi').groups(), ('WWWi', )) + + # Hg issue 101: findall() broken (seems like memory corruption) + pat = regex.compile(r'xxx', flags=regex.FULLCASE | regex.UNICODE) + self.assertEqual([x.group() for x in pat.finditer('yxxx')], ['xxx']) + self.assertEqual(pat.findall('yxxx'), ['xxx']) + + raw = 'yxxx' + self.assertEqual([x.group() for x in pat.finditer(raw)], ['xxx']) + self.assertEqual(pat.findall(raw), ['xxx']) + + pat = regex.compile(r'xxx', flags=regex.FULLCASE | regex.IGNORECASE | + regex.UNICODE) + self.assertEqual([x.group() for x in pat.finditer('yxxx')], ['xxx']) + self.assertEqual(pat.findall('yxxx'), ['xxx']) + + raw = 'yxxx' + self.assertEqual([x.group() for x in pat.finditer(raw)], ['xxx']) + self.assertEqual(pat.findall(raw), ['xxx']) + + # Hg issue 106: * operator not working correctly with sub() + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub('(?V0).*', 'x', 'test'), 'xx') + else: + self.assertEqual(regex.sub('(?V0).*', 'x', 'test'), 'x') + self.assertEqual(regex.sub('(?V1).*', 'x', 'test'), 'xx') + + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.sub('(?V0).*?', '|', 'test'), '|||||||||') + else: + self.assertEqual(regex.sub('(?V0).*?', '|', 'test'), '|t|e|s|t|') + self.assertEqual(regex.sub('(?V1).*?', '|', 'test'), '|||||||||') + + # Hg issue 112: re: OK, but regex: SystemError + self.assertEqual(regex.sub(r'^(@)\n(?!.*?@)(.*)', + r'\1\n==========\n\2', '@\n', flags=regex.DOTALL), '@\n==========\n') + + # Hg issue 109: Edit distance of fuzzy match + self.assertEqual(regex.match(r'(?:cats|cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats|cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats|cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + + self.assertEqual(regex.match(r'(?:cat){e<=1}', 'caz').fuzzy_counts, + (1, 0, 0)) + self.assertEqual(regex.match(r'(?e)(?:cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match(r'(?b)(?:cat){e<=1}', + 'caz').fuzzy_counts, (1, 0, 0)) + + self.assertEqual(regex.match(r'(?:cats){e<=2}', 'c ats').fuzzy_counts, + (1, 1, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats){e<=2}', + 'c ats').fuzzy_counts, (0, 1, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats){e<=2}', + 'c ats').fuzzy_counts, (0, 1, 0)) + + self.assertEqual(regex.match(r'(?:cats){e<=2}', + 'c a ts').fuzzy_counts, (0, 2, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats){e<=2}', + 'c a ts').fuzzy_counts, (0, 2, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats){e<=2}', + 'c a ts').fuzzy_counts, (0, 2, 0)) + + self.assertEqual(regex.match(r'(?:cats){e<=1}', 'c ats').fuzzy_counts, + (0, 1, 0)) + self.assertEqual(regex.match(r'(?e)(?:cats){e<=1}', + 'c ats').fuzzy_counts, (0, 1, 0)) + self.assertEqual(regex.match(r'(?b)(?:cats){e<=1}', + 'c ats').fuzzy_counts, (0, 1, 0)) + + # Hg issue 115: Infinite loop when processing backreferences + self.assertEqual(regex.findall(r'\bof ([a-z]+) of \1\b', + 'To make use of one of these modules'), []) + + # Hg issue 125: Reference to entire match (\g<0>) in + # Pattern.sub() doesn't work as of 2014.09.22 release. + self.assertEqual(regex.sub(r'x', r'\g<0>', 'x'), 'x') + + # Unreported issue: no such builtin as 'ascii' in Python 2. + self.assertEqual(bool(regex.match(r'a', 'a', regex.DEBUG)), True) + + # Hg issue 131: nested sets behaviour + self.assertEqual(regex.findall(r'(?V1)[[b-e]--cd]', 'abcdef'), ['b', + 'e']) + self.assertEqual(regex.findall(r'(?V1)[b-e--cd]', 'abcdef'), ['b', + 'e']) + self.assertEqual(regex.findall(r'(?V1)[[bcde]--cd]', 'abcdef'), ['b', + 'e']) + self.assertEqual(regex.findall(r'(?V1)[bcde--cd]', 'abcdef'), ['b', + 'e']) + + # Hg issue 132: index out of range on null property \p{} + self.assertRaisesRegex(regex.error, '^unknown property at position 4$', + lambda: regex.compile(r'\p{}')) + + # Issue 23692. + self.assertEqual(regex.match('(?:()|(?(1)()|z)){2}(?(2)a|z)', + 'a').group(0, 1, 2), ('a', '', '')) + self.assertEqual(regex.match('(?:()|(?(1)()|z)){0,2}(?(2)a|z)', + 'a').group(0, 1, 2), ('a', '', '')) + + # Hg issue 137: Posix character class :punct: does not seem to be + # supported. + + # Posix compatibility as recommended here: + # http://www.unicode.org/reports/tr18/#Compatibility_Properties + + # Posix in Unicode. + chars = ''.join(chr(c) for c in range(0x10000)) + + self.assertEqual(ascii(''.join(regex.findall(r'''[[:alnum:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{Alpha}\p{PosixDigit}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:alpha:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Alpha}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:ascii:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{InBasicLatin}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:blank:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{gc=Space_Separator}\t]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:cntrl:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{gc=Control}+''', chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:digit:]]+''', + chars))), ascii(''.join(regex.findall(r'''[0-9]+''', chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:graph:]]+''', + chars))), ascii(''.join(regex.findall(r'''[^\p{Space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:lower:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Lower}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:print:]]+''', + chars))), ascii(''.join(regex.findall(r'''(?V1)[\p{Graph}\p{Blank}--\p{Cntrl}]+''', chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:punct:]]+''', + chars))), + ascii(''.join(regex.findall(r'''(?V1)[\p{gc=Punctuation}\p{gc=Symbol}--\p{Alpha}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:space:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Whitespace}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:upper:]]+''', + chars))), ascii(''.join(regex.findall(r'''\p{Upper}+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:word:]]+''', + chars))), ascii(''.join(regex.findall(r'''[\p{Alpha}\p{gc=Mark}\p{Digit}\p{gc=Connector_Punctuation}\p{Join_Control}]+''', + chars)))) + self.assertEqual(ascii(''.join(regex.findall(r'''[[:xdigit:]]+''', + chars))), ascii(''.join(regex.findall(r'''[0-9A-Fa-f]+''', + chars)))) + + # Posix in ASCII. + chars = bytes(range(0x100)) + + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:alnum:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\p{Alpha}\p{PosixDigit}]+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:alpha:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Alpha}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:ascii:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\x00-\x7F]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:blank:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\p{gc=Space_Separator}\t]+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:cntrl:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{gc=Control}+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:digit:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[0-9]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:graph:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[^\p{Space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:lower:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Lower}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:print:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?aV1)[\p{Graph}\p{Blank}--\p{Cntrl}]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:punct:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?aV1)[\p{gc=Punctuation}\p{gc=Symbol}--\p{Alpha}]+''', + chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:space:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Whitespace}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:upper:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)\p{Upper}+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:word:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[\p{Alpha}\p{gc=Mark}\p{Digit}\p{gc=Connector_Punctuation}\p{Join_Control}]+''', chars)))) + self.assertEqual(ascii(b''.join(regex.findall(br'''(?a)[[:xdigit:]]+''', + chars))), ascii(b''.join(regex.findall(br'''(?a)[0-9A-Fa-f]+''', chars)))) + + # Hg issue 138: grapheme anchored search not working properly. + self.assertEqual(ascii(regex.search(r'\X$', 'ab\u2103').group()), + ascii('\u2103')) + + # Hg issue 139: Regular expression with multiple wildcards where first + # should match empty string does not always work. + self.assertEqual(regex.search("([^L]*)([^R]*R)", "LtR").groups(), ('', + 'LtR')) + + # Hg issue 140: Replace with REVERSE and groups has unexpected + # behavior. + self.assertEqual(regex.sub(r'(.)', r'x\1y', 'ab'), 'xayxby') + self.assertEqual(regex.sub(r'(?r)(.)', r'x\1y', 'ab'), 'xayxby') + self.assertEqual(regex.subf(r'(.)', 'x{1}y', 'ab'), 'xayxby') + self.assertEqual(regex.subf(r'(?r)(.)', 'x{1}y', 'ab'), 'xayxby') + + # Hg issue 141: Crash on a certain partial match. + self.assertEqual(regex.fullmatch('(a)*abc', 'ab', + partial=True).span(), (0, 2)) + self.assertEqual(regex.fullmatch('(a)*abc', 'ab', + partial=True).partial, True) + + # Hg issue 143: Partial matches have incorrect span if prefix is '.' + # wildcard. + self.assertEqual(regex.search('OXRG', 'OOGOX', partial=True).span(), + (3, 5)) + self.assertEqual(regex.search('.XRG', 'OOGOX', partial=True).span(), + (3, 5)) + self.assertEqual(regex.search('.{1,3}XRG', 'OOGOX', + partial=True).span(), (1, 5)) + + # Hg issue 144: Latest version problem with matching 'R|R'. + self.assertEqual(regex.match('R|R', 'R').span(), (0, 1)) + + # Hg issue 146: Forced-fail (?!) works improperly in conditional. + self.assertEqual(regex.match(r'(.)(?(1)(?!))', 'xy'), None) + + # Groups cleared after failure. + self.assertEqual(regex.findall(r'(y)?(\d)(?(1)\b\B)', 'ax1y2z3b'), + [('', '1'), ('', '2'), ('', '3')]) + self.assertEqual(regex.findall(r'(y)?+(\d)(?(1)\b\B)', 'ax1y2z3b'), + [('', '1'), ('', '2'), ('', '3')]) + + # Hg issue 147: Fuzzy match can return match points beyond buffer end. + self.assertEqual([m.span() for m in regex.finditer(r'(?i)(?:error){e}', + 'regex failure')], [(0, 5), (5, 10), (10, 13), (13, 13)]) + self.assertEqual([m.span() for m in + regex.finditer(r'(?fi)(?:error){e}', 'regex failure')], [(0, 5), (5, + 10), (10, 13), (13, 13)]) + + # Hg issue 150: Have an option for POSIX-compatible longest match of + # alternates. + self.assertEqual(regex.search(r'(?p)\d+(\w(\d*)?|[eE]([+-]\d+))', + '10b12')[0], '10b12') + self.assertEqual(regex.search(r'(?p)\d+(\w(\d*)?|[eE]([+-]\d+))', + '10E+12')[0], '10E+12') + + self.assertEqual(regex.search(r'(?p)(\w|ae|oe|ue|ss)', 'ae')[0], 'ae') + self.assertEqual(regex.search(r'(?p)one(self)?(selfsufficient)?', + 'oneselfsufficient')[0], 'oneselfsufficient') + + # Hg issue 151: Request: \K. + self.assertEqual(regex.search(r'(ab\Kcd)', 'abcd').group(0, 1), ('cd', + 'abcd')) + self.assertEqual(regex.findall(r'\w\w\K\w\w', 'abcdefgh'), ['cd', + 'gh']) + self.assertEqual(regex.findall(r'(\w\w\K\w\w)', 'abcdefgh'), ['abcd', + 'efgh']) + + self.assertEqual(regex.search(r'(?r)(ab\Kcd)', 'abcd').group(0, 1), + ('ab', 'abcd')) + self.assertEqual(regex.findall(r'(?r)\w\w\K\w\w', 'abcdefgh'), ['ef', + 'ab']) + self.assertEqual(regex.findall(r'(?r)(\w\w\K\w\w)', 'abcdefgh'), + ['efgh', 'abcd']) + + # Hg issue 152: Request: Request: (?(DEFINE)...). + self.assertEqual(regex.search(r'(?(DEFINE)(?\d+)(?\w+))(?&quant) (?&item)', + '5 elephants')[0], '5 elephants') + + self.assertEqual(regex.search(r'(?&routine)(?(DEFINE)(?.))', 'a').group('routine'), None) + self.assertEqual(regex.search(r'(?&routine)(?(DEFINE)(?.))', 'a').captures('routine'), ['a']) + + # Hg issue 153: Request: (*SKIP). + self.assertEqual(regex.search(r'12(*FAIL)|3', '123')[0], '3') + self.assertEqual(regex.search(r'(?r)12(*FAIL)|3', '123')[0], '3') + + self.assertEqual(regex.search(r'\d+(*PRUNE)\d', '123'), None) + self.assertEqual(regex.search(r'\d+(?=(*PRUNE))\d', '123')[0], '123') + self.assertEqual(regex.search(r'\d+(*PRUNE)bcd|[3d]', '123bcd')[0], + '123bcd') + self.assertEqual(regex.search(r'\d+(*PRUNE)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d+?(*PRUNE)bcd|[3d]', '123bcd')[0], + '3bcd') + self.assertEqual(regex.search(r'\d+?(*PRUNE)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d++(?<=3(*PRUNE))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'\d++(?<=3(*PRUNE))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=(*PRUNE)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=2(*PRUNE)3)zzd|[3d]$', + '124zzd')[0], 'd') + + self.assertEqual(regex.search(r'(?r)\d(*PRUNE)\d+', '123'), None) + self.assertEqual(regex.search(r'(?r)\d(?<=(*PRUNE))\d+', '123')[0], + '123') + self.assertEqual(regex.search(r'(?r)\d+(*PRUNE)bcd|[3d]', + '123bcd')[0], '123bcd') + self.assertEqual(regex.search(r'(?r)\d+(*PRUNE)bcd|[3d]', + '123zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*PRUNE))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*PRUNE))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=(*PRUNE)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=2(*PRUNE)3)zzd|[3d]$', + '124zzd')[0], 'd') + + self.assertEqual(regex.search(r'\d+(*SKIP)bcd|[3d]', '123bcd')[0], + '123bcd') + self.assertEqual(regex.search(r'\d+(*SKIP)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d+?(*SKIP)bcd|[3d]', '123bcd')[0], + '3bcd') + self.assertEqual(regex.search(r'\d+?(*SKIP)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'\d++(?<=3(*SKIP))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'\d++(?<=3(*SKIP))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=(*SKIP)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'\d++(?<=2(*SKIP)3)zzd|[3d]$', + '124zzd')[0], 'd') + + self.assertEqual(regex.search(r'(?r)\d+(*SKIP)bcd|[3d]', '123bcd')[0], + '123bcd') + self.assertEqual(regex.search(r'(?r)\d+(*SKIP)bcd|[3d]', '123zzd')[0], + 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*SKIP))zzd|[4d]$', + '123zzd')[0], '123zzd') + self.assertEqual(regex.search(r'(?r)\d++(?<=3(*SKIP))zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=(*SKIP)3)zzd|[4d]$', + '124zzd')[0], 'd') + self.assertEqual(regex.search(r'(?r)\d++(?<=2(*SKIP)3)zzd|[3d]$', + '124zzd')[0], 'd') + + # Hg issue 154: Segmentation fault 11 when working with an atomic group + text = """June 30, December 31, 2013 2012 +some words follow: +more words and numbers 1,234,567 9,876,542 +more words and numbers 1,234,567 9,876,542""" + self.assertEqual(len(regex.findall(r'(?2014|2013 ?2012)', text)), 1) + + # Hg issue 156: regression on atomic grouping + self.assertEqual(regex.match('1(?>2)', '12').span(), (0, 2)) + + # Hg issue 157: regression: segfault on complex lookaround + self.assertEqual(regex.match(r'(?V1w)(?=(?=[^A-Z]*+[A-Z])(?=[^a-z]*+[a-z]))(?=\D*+\d)(?=\p{Alphanumeric}*+\P{Alphanumeric})\A(?s:.){8,255}+\Z', + 'AAaa11!!')[0], 'AAaa11!!') + + # Hg issue 158: Group issue with (?(DEFINE)...) + TEST_REGEX = regex.compile(r'''(?smx) +(?(DEFINE) + (? + ^,[^,]+, + ) +) + +# Group 2 is defined on this line +^,([^,]+), + +(?:(?!(?&subcat)[\r\n]+(?&subcat)).)+ +''') + + TEST_DATA = ''' +,Cat 1, +,Brand 1, +some +thing +,Brand 2, +other +things +,Cat 2, +,Brand, +Some +thing +''' + + self.assertEqual([m.span(1, 2) for m in + TEST_REGEX.finditer(TEST_DATA)], [((-1, -1), (2, 7)), ((-1, -1), (54, + 59))]) + + # Hg issue 161: Unexpected fuzzy match results + self.assertEqual(regex.search('(abcdefgh){e}', + '******abcdefghijklmnopqrtuvwxyz', regex.BESTMATCH).span(), (6, 14)) + self.assertEqual(regex.search('(abcdefghi){e}', + '******abcdefghijklmnopqrtuvwxyz', regex.BESTMATCH).span(), (6, 15)) + + # Hg issue 163: allow lookarounds in conditionals. + self.assertEqual(regex.match(r'(?:(?=\d)\d+\b|\w+)', '123abc').span(), + (0, 6)) + self.assertEqual(regex.match(r'(?(?=\d)\d+\b|\w+)', '123abc'), None) + self.assertEqual(regex.search(r'(?(?<=love\s)you|(?<=hate\s)her)', + "I love you").span(), (7, 10)) + self.assertEqual(regex.findall(r'(?(?<=love\s)you|(?<=hate\s)her)', + "I love you but I don't hate her either"), ['you', 'her']) + + # Hg issue 180: bug of POSIX matching. + self.assertEqual(regex.search(r'(?p)a*(.*?)', 'aaabbb').group(0, 1), + ('aaabbb', 'bbb')) + self.assertEqual(regex.search(r'(?p)a*(.*)', 'aaabbb').group(0, 1), + ('aaabbb', 'bbb')) + self.assertEqual(regex.sub(r'(?p)a*(.*?)', r'\1', 'aaabbb'), 'bbb') + self.assertEqual(regex.sub(r'(?p)a*(.*)', r'\1', 'aaabbb'), 'bbb') + + # Hg issue 192: Named lists reverse matching doesn't work with + # IGNORECASE and V1 + self.assertEqual(regex.match(r'(?irV0)\L', '21', kw=['1']).span(), + (1, 2)) + self.assertEqual(regex.match(r'(?irV1)\L', '21', kw=['1']).span(), + (1, 2)) + + # Hg issue 193: Alternation and .REVERSE flag. + self.assertEqual(regex.search('a|b', '111a222').span(), (3, 4)) + self.assertEqual(regex.search('(?r)a|b', '111a222').span(), (3, 4)) + + # Hg issue 194: .FULLCASE and Backreference + self.assertEqual(regex.search(r'(?if)<(CLI)><\1>', + '').span(), (0, 10)) + self.assertEqual(regex.search(r'(?if)<(CLI)><\1>', + '').span(), (0, 10)) + self.assertEqual(regex.search(r'(?ifr)<\1><(CLI)>', + '').span(), (0, 10)) + + # Hg issue 195: Pickle (or otherwise serial) the compiled regex + r = regex.compile(r'\L', options=['foo', 'bar']) + p = pickle.dumps(r) + r = pickle.loads(p) + self.assertEqual(r.match('foo').span(), (0, 3)) + + # Hg issue 196: Fuzzy matching on repeated regex not working as + # expected + self.assertEqual(regex.match('(x{6}){e<=1}', 'xxxxxx', + flags=regex.BESTMATCH).span(), (0, 6)) + self.assertEqual(regex.match('(x{6}){e<=1}', 'xxxxx', + flags=regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.match('(x{6}){e<=1}', 'x', + flags=regex.BESTMATCH), None) + self.assertEqual(regex.match('(?r)(x{6}){e<=1}', 'xxxxxx', + flags=regex.BESTMATCH).span(), (0, 6)) + self.assertEqual(regex.match('(?r)(x{6}){e<=1}', 'xxxxx', + flags=regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.match('(?r)(x{6}){e<=1}', 'x', + flags=regex.BESTMATCH), None) + + # Hg issue 197: ValueError in regex.compile + self.assertRaises(regex.error, lambda: + regex.compile(b'00000\\0\\00\\^\50\\00\\U05000000')) + + # Hg issue 198: ValueError in regex.compile + self.assertRaises(regex.error, lambda: regex.compile(b"{e', '22', aa=['121', + '22'])), True) + self.assertEqual(bool(regex.search(r'(?ri)\L', '22', aa=['121', + '22'])), True) + self.assertEqual(bool(regex.search(r'(?fi)\L', '22', aa=['121', + '22'])), True) + self.assertEqual(bool(regex.search(r'(?fri)\L', '22', aa=['121', + '22'])), True) + + # Hg issue 208: Named list, (?ri) flags, Backreference + self.assertEqual(regex.search(r'(?r)\1dog..(?<=(\L))$', 'ccdogcc', + aa=['bcb', 'cc']). span(), (0, 7)) + self.assertEqual(regex.search(r'(?ir)\1dog..(?<=(\L))$', + 'ccdogcc', aa=['bcb', 'cc']). span(), (0, 7)) + + # Hg issue 210: Fuzzy matching and Backreference + self.assertEqual(regex.search(r'(2)(?:\1{5}){e<=1}', + '3222212').span(), (1, 7)) + self.assertEqual(regex.search(r'(\d)(?:\1{5}){e<=1}', + '3222212').span(), (1, 7)) + + # Hg issue 211: Segmentation fault with recursive matches and atomic + # groups + self.assertEqual(regex.match(r'''\A(?P(?>\((?&whole)\)|[+\-]))\Z''', + '((-))').span(), (0, 5)) + self.assertEqual(regex.match(r'''\A(?P(?>\((?&whole)\)|[+\-]))\Z''', + '((-)+)'), None) + + # Hg issue 212: Unexpected matching difference with .*? between re and + # regex + self.assertEqual(regex.match(r"x.*? (.).*\1(.*)\1", + 'x |y| z|').span(), (0, 9)) + self.assertEqual(regex.match(r"\.sr (.*?) (.)(.*)\2(.*)\2(.*)", + r'.sr h |||').span(), (0, 35)) + + # Hg issue 213: Segmentation Fault + a = '"\\xF9\\x80\\xAEqdz\\x95L\\xA7\\x89[\\xFE \\x91)\\xF9]\\xDB\'\\x99\\x09=\\x00\\xFD\\x98\\x22\\xDD\\xF1\\xB6\\xC3 Z\\xB6gv\\xA5x\\x93P\\xE1r\\x14\\x8Cv\\x0C\\xC0w\\x15r\\xFFc%" ' + py_regex_pattern = r'''(?P((?>(?"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``)))) (?P((?>(?"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``))))''' + self.assertEqual(bool(regex.search(py_regex_pattern, a)), False) + + # Hg Issue 216: Invalid match when using negative lookbehind and pipe + self.assertEqual(bool(regex.match('foo(?<=foo)', 'foo')), True) + self.assertEqual(bool(regex.match('foo(?.*\!\w*\:.*)|(?P.*))', + '!')), False) + + # Hg issue 220: Misbehavior of group capture with OR operand + self.assertEqual(regex.match(r'\w*(ea)\w*|\w*e(?!a)\w*', + 'easier').groups(), ('ea', )) + + # Hg issue 225: BESTMATCH in fuzzy match not working + self.assertEqual(regex.search('(^1234$){i,d}', '12234', + regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.search('(^1234$){i,d}', '12234', + regex.BESTMATCH).fuzzy_counts, (0, 1, 0)) + + self.assertEqual(regex.search('(^1234$){s,i,d}', '12234', + regex.BESTMATCH).span(), (0, 5)) + self.assertEqual(regex.search('(^1234$){s,i,d}', '12234', + regex.BESTMATCH).fuzzy_counts, (0, 1, 0)) + + # Hg issue 226: Error matching at start of string + self.assertEqual(regex.search('(^123$){s,i,d}', 'xxxxxxxx123', + regex.BESTMATCH).span(), (0, 11)) + self.assertEqual(regex.search('(^123$){s,i,d}', 'xxxxxxxx123', + regex.BESTMATCH).fuzzy_counts, (0, 8, 0)) + + # Hg issue 227: Incorrect behavior for ? operator with UNICODE + + # IGNORECASE + self.assertEqual(regex.search(r'a?yz', 'xxxxyz', flags=regex.FULLCASE | + regex.IGNORECASE).span(), (4, 6)) + + # Hg issue 230: Is it a bug of (?(DEFINE)...) + self.assertEqual(regex.findall(r'(?:(?![a-d]).)+', 'abcdefgh'), + ['efgh']) + self.assertEqual(regex.findall(r'''(?(DEFINE)(?P(?:(?![a-d]).)))(?&mydef)+''', + 'abcdefgh'), ['efgh']) + + # Hg issue 238: Not fully re backward compatible + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){1,3}', + '"Erm....yes. T..T...Thank you for that."'), [('Erm....', 'Erm', + '....'), ('T...', 'T', '...')]) + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){3}', + '"Erm....yes. T..T...Thank you for that."'), []) + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){2}', + '"Erm....yes. T..T...Thank you for that."'), [('T...', 'T', '...')]) + self.assertEqual(regex.findall(r'((\w{1,3})(\.{2,10})){1}', + '"Erm....yes. T..T...Thank you for that."'), [('Erm....', 'Erm', + '....'), ('T..', 'T', '..'), ('T...', 'T', '...')]) + + # Hg issue 247: Unexpected result with fuzzy matching and lookahead + # expression + self.assertEqual(regex.search(r'(?:ESTONIA(?!\w)){e<=1}', + 'ESTONIAN WORKERS').group(), 'ESTONIAN') + self.assertEqual(regex.search(r'(?:ESTONIA(?=\W)){e<=1}', + 'ESTONIAN WORKERS').group(), 'ESTONIAN') + + self.assertEqual(regex.search(r'(?:(?.))(?&func)', + 'abc').groups(), (None, )) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?&func)', + 'abc').groupdict(), {'func': None}) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?&func)', + 'abc').capturesdict(), {'func': ['a']}) + + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?=(?&func))', + 'abc').groups(), (None, )) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?=(?&func))', + 'abc').groupdict(), {'func': None}) + self.assertEqual(regex.search(r'(?(DEFINE)(?.))(?=(?&func))', + 'abc').capturesdict(), {'func': ['a']}) + + self.assertEqual(regex.search(r'(?(DEFINE)(?.)).(?<=(?&func))', + 'abc').groups(), (None, )) + self.assertEqual(regex.search(r'(?(DEFINE)(?.)).(?<=(?&func))', + 'abc').groupdict(), {'func': None}) + self.assertEqual(regex.search(r'(?(DEFINE)(?.)).(?<=(?&func))', + 'abc').capturesdict(), {'func': ['a']}) + + # Hg issue 271: Comment logic different between Re and Regex + self.assertEqual(bool(regex.match(r'ab(?#comment\))cd', 'abcd')), True) + + # Hg issue 276: Partial Matches yield incorrect matches and bounds + self.assertEqual(regex.search(r'[a-z]+ [a-z]*?:', 'foo bar', + partial=True).span(), (0, 7)) + self.assertEqual(regex.search(r'(?r):[a-z]*? [a-z]+', 'foo bar', + partial=True).span(), (0, 7)) + + # Hg issue 291: Include Script Extensions as a supported Unicode property + self.assertEqual(bool(regex.match(r'(?u)\p{Script:Beng}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script:Bengali}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Bengali}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Beng}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Cakm}', + '\u09EF')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{Script_Extensions:Sylo}', + '\u09EF')), True) + + # Hg issue #293: scx (Script Extensions) property currently matches + # incorrectly + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Latin}', 'P')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Ahom}', 'P')), False) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Common}', '4')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Caucasian_Albanian}', '4')), + False) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Arabic}', '\u062A')), True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Balinese}', '\u062A')), + False) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Devanagari}', '\u091C')), + True) + self.assertEqual(bool(regex.match(r'(?u)\p{scx:Batak}', '\u091C')), False) + + # Hg issue 296: Group references are not taken into account when group is reporting the last match + self.assertEqual(regex.fullmatch('(?P.)*(?&x)', 'abc').captures('x'), + ['a', 'b', 'c']) + self.assertEqual(regex.fullmatch('(?P.)*(?&x)', 'abc').group('x'), + 'b') + + self.assertEqual(regex.fullmatch('(?P.)(?P.)(?P.)', + 'abc').captures('x'), ['a', 'b', 'c']) + self.assertEqual(regex.fullmatch('(?P.)(?P.)(?P.)', + 'abc').group('x'), 'c') + + # Hg issue 299: Partial gives misleading results with "open ended" regexp + self.assertEqual(regex.match('(?:ab)*', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*?', '', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)*+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)+?', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)++', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?:ab)++', 'abab', partial=True).partial, + False) + + self.assertEqual(regex.match('(?r)(?:ab)*', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*?', '', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)*+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)+', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)+', 'abab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)+?', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)++', 'ab', partial=True).partial, + False) + self.assertEqual(regex.match('(?r)(?:ab)++', 'abab', partial=True).partial, + False) + + self.assertEqual(regex.match('a*', '', partial=True).partial, False) + self.assertEqual(regex.match('a*?', '', partial=True).partial, False) + self.assertEqual(regex.match('a*+', '', partial=True).partial, False) + self.assertEqual(regex.match('a+', '', partial=True).partial, True) + self.assertEqual(regex.match('a+?', '', partial=True).partial, True) + self.assertEqual(regex.match('a++', '', partial=True).partial, True) + self.assertEqual(regex.match('a+', 'a', partial=True).partial, False) + self.assertEqual(regex.match('a+?', 'a', partial=True).partial, False) + self.assertEqual(regex.match('a++', 'a', partial=True).partial, False) + + self.assertEqual(regex.match('(?r)a*', '', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a*?', '', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a*+', '', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a+', '', partial=True).partial, True) + self.assertEqual(regex.match('(?r)a+?', '', partial=True).partial, True) + self.assertEqual(regex.match('(?r)a++', '', partial=True).partial, True) + self.assertEqual(regex.match('(?r)a+', 'a', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a+?', 'a', partial=True).partial, False) + self.assertEqual(regex.match('(?r)a++', 'a', partial=True).partial, False) + + self.assertEqual(regex.match(r"(?:\s*\w+'*)+", 'whatever', partial=True).partial, + False) + + # Hg issue 300: segmentation fault + pattern = ('(?PGGCGTCACACTTTGCTATGCCATAGCAT[AG]TTTATCCATAAGA' + 'TTAGCGGATCCTACCTGACGCTTTTTATCGCAACTCTCTACTGTTTCTCCATAACAGAACATATTGA' + 'CTATCCGGTATTACCCGGCATGACAGGAGTAAAA){e<=1}' + '(?P[ACGT]{1059}){e<=2}' + '(?PTAATCGTCTTGTTTGATACACAAGGGTCGCATCTGCGGCCCTTTTGCTTTTTTAAG' + 'TTGTAAGGATATGCCATTCTAGA){e<=0}' + '(?P[ACGT]{18}){e<=0}' + '(?PAGATCGG[CT]AGAGCGTCGTGTAGGGAAAGAGTGTGG){e<=1}') + + text = ('GCACGGCGTCACACTTTGCTATGCCATAGCATATTTATCCATAAGATTAGCGGATCCTACC' + 'TGACGCTTTTTATCGCAACTCTCTACTGTTTCTCCATAACAGAACATATTGACTATCCGGTATTACC' + 'CGGCATGACAGGAGTAAAAATGGCTATCGACGAAAACAAACAGAAAGCGTTGGCGGCAGCACTGGGC' + 'CAGATTGAGAAACAATTTGGTAAAGGCTCCATCATGCGCCTGGGTGAAGACCGTTCCATGGATGTGG' + 'AAACCATCTCTACCGGTTCGCTTTCACTGGATATCGCGCTTGGGGCAGGTGGTCTGCCGATGGGCCG' + 'TATCGTCGAAATCTACGGACCGGAATCTTCCGGTAAAACCACGCTGACGCTGCAGGTGATCGCCGCA' + 'GCGCAGCGTGAAGGTAAAACCTGTGCGTTTATCGATGCTGAACACGCGCTGGACCCAATCTACGCAC' + 'GTAAACTGGGCGTCGATATCGACAACCTGCTGTGCTCCCAGCCGGACACCGGCGAGCAGGCACTGGA' + 'AATCTGTGACGCCCTGGCGCGTTCTGGCGCAGTAGACGTTATCGTCGTTGACTCCGTGGCGGCACTG' + 'ACGCCGAAAGCGGAAATCGAAGGCGAAATCGGCGACTCTCATATGGGCCTTGCGGCACGTATGATGA' + 'GCCAGGCGATGCGTAAGCTGGCGGGTAACCTGAAGCAGTCCAACACGCTGCTGATCTTCATCAACCC' + 'CATCCGTATGAAAATTGGTGTGATGTTCGGCAACCCGGAAACCACTTACCGGTGGTAACGCGCTGAA' + 'ATTCTACGCCTCTGTTCGTCTCGACATCCGTTAAATCGGCGCGGTGAAAGAGGGCGAAAACGTGGTG' + 'GGTAGCGAAACCCGCGTGAAAGTGGTGAAGAACAAAATCGCTGCGCCGTTTAAACAGGCTGAATTCC' + 'AGATCCTCTACGGCGAAGGTATCAACTTCTACCCCGAACTGGTTGACCTGGGCGTAAAAGAGAAGCT' + 'GATCGAGAAAGCAGGCGCGTGGTACAGCTACAAAGGTGAGAAGATCGGTCAGGGTAAAGCGAATGCG' + 'ACTGCCTGGCTGAAATTTAACCCGGAAACCGCGAAAGAGATCGAGTGAAAAGTACGTGAGTTGCTGC' + 'TGAGCAACCCGAACTCAACGCCGGATTTCTCTGTAGATGATAGCGAAGGCGTAGCAGAAACTAACGA' + 'AGATTTTTAATCGTCTTGTTTGATACACAAGGGTCGCATCTGCGGCCCTTTTGCTTTTTTAAGTTGT' + 'AAGGATATGCCATTCTAGACAGTTAACACACCAACAAAGATCGGTAGAGCGTCGTGTAGGGAAAGAG' + 'TGTGGTACC') + + m = regex.search(pattern, text, flags=regex.BESTMATCH) + self.assertEqual(m.fuzzy_counts, (0, 1, 0)) + self.assertEqual(m.fuzzy_changes, ([], [1206], [])) + + # Hg issue 306: Fuzzy match parameters not respecting quantifier scope + self.assertEqual(regex.search(r'(?e)(dogf(((oo){e<1})|((00){e<1}))d){e<2}', + 'dogfood').fuzzy_counts, (0, 0, 0)) + self.assertEqual(regex.search(r'(?e)(dogf(((oo){e<1})|((00){e<1}))d){e<2}', + 'dogfoot').fuzzy_counts, (1, 0, 0)) + + # Hg issue 312: \X not matching graphemes with zero-width-joins + self.assertEqual(regex.findall(r'\X', + '\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466'), + ['\U0001F468\u200D\U0001F469\u200D\U0001F467\u200D\U0001F466']) + + # Hg issue 320: Abnormal performance + self.assertEqual(bool(regex.search(r'(?=a)a', 'a')), True) + self.assertEqual(bool(regex.search(r'(?!b)a', 'a')), True) + + # Hg issue 327: .fullmatch() causes MemoryError + self.assertEqual(regex.fullmatch(r'((\d)*?)*?', '123').span(), (0, 3)) + + # Hg issue 329: Wrong group matches when question mark quantifier is used within a look behind + self.assertEqual(regex.search(r'''(?(DEFINE)(?(?THIS_SHOULD_NOT_MATCHx?)|(?right))).*(?<=(?&mydef).*)''', + 'x right').capturesdict(), {'mydef': ['right'], 'wrong': [], 'right': + ['right']}) + + # Hg issue 338: specifying allowed characters when fuzzy-matching + self.assertEqual(bool(regex.match(r'(?:cat){e<=1:[u]}', 'cut')), True) + self.assertEqual(bool(regex.match(r'(?:cat){e<=1:u}', 'cut')), True) + + # Hg issue 353: fuzzy changes negative indexes + self.assertEqual(regex.search(r'(?be)(AGTGTTCCCCGCGCCAGCGGGGATAAACCG){s<=5,i<=5,d<=5,s+i+d<=10}', + 'TTCCCCGCGCCAGCGGGGATAAACCG').fuzzy_changes, ([], [], [0, 1, 3, 5])) + + # Git issue 364: Contradictory values in fuzzy_counts and fuzzy_changes + self.assertEqual(regex.match(r'(?:bc){e}', 'c').fuzzy_counts, (1, 0, + 1)) + self.assertEqual(regex.match(r'(?:bc){e}', 'c').fuzzy_changes, ([0], + [], [1])) + self.assertEqual(regex.match(r'(?e)(?:bc){e}', 'c').fuzzy_counts, (0, + 0, 1)) + self.assertEqual(regex.match(r'(?e)(?:bc){e}', 'c').fuzzy_changes, + ([], [], [0])) + self.assertEqual(regex.match(r'(?b)(?:bc){e}', 'c').fuzzy_counts, (0, + 0, 1)) + self.assertEqual(regex.match(r'(?b)(?:bc){e}', 'c').fuzzy_changes, + ([], [], [0])) + + # Git issue 370: Confusions about Fuzzy matching behavior + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){e}', + '$ 10,112.111.12').fuzzy_counts, (6, 0, 5)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=1}', + '$ 10,112.111.12').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=1,i<=1,d<=1}', + '$ 10,112.111.12').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=3}', + '$ 10,1a2.111.12').fuzzy_counts, (2, 0, 0)) + self.assertEqual(regex.match('(?e)(?:^(\\$ )?\\d{1,3}(,\\d{3})*(\\.\\d{2})$){s<=2}', + '$ 10,1a2.111.12').fuzzy_counts, (2, 0, 0)) + + self.assertEqual(regex.fullmatch(r'(?e)(?:0?,0(?:,0)?){s<=1,d<=1}', + ',0;0').fuzzy_counts, (1, 0, 0)) + self.assertEqual(regex.fullmatch(r'(?e)(?:0??,0(?:,0)?){s<=1,d<=1}', + ',0;0').fuzzy_counts, (1, 0, 0)) + + # Git issue 371: Specifying character set when fuzzy-matching allows characters not in the set + self.assertEqual(regex.search(r"\b(?e)(?:\d{6,20}){i<=5:[\-\\\/]}\b", + "cat dog starting at 00:01132.000. hello world"), None) + + # Git issue 385: Comments in expressions + self.assertEqual(bool(regex.compile('(?#)')), True) + self.assertEqual(bool(regex.compile('(?x)(?#)')), True) + + # Git issue 394: Unexpected behaviour in fuzzy matching with limited character set with IGNORECASE flag + self.assertEqual(regex.findall(r'(\d+){i<=2:[ab]}', '123X4Y5'), + ['123', '4', '5']) + self.assertEqual(regex.findall(r'(?i)(\d+){i<=2:[ab]}', '123X4Y5'), + ['123', '4', '5']) + + # Git issue 403: Fuzzy matching with wrong distance (unnecessary substitutions) + self.assertEqual(regex.match(r'^(test){e<=5}$', 'terstin', + flags=regex.B).fuzzy_counts, (0, 3, 0)) + + # Git issue 408: regex fails with a quantified backreference but succeeds with repeated backref + self.assertEqual(bool(regex.match(r"(?:(x*)\1\1\1)*x$", "x" * 5)), True) + self.assertEqual(bool(regex.match(r"(?:(x*)\1{3})*x$", "x" * 5)), True) + + # Git issue 415: Fuzzy character restrictions don't apply to insertions at "right edge" + self.assertEqual(regex.match(r't(?:es){s<=1:\d}t', 'te5t').group(), + 'te5t') + self.assertEqual(regex.match(r't(?:es){s<=1:\d}t', 'tezt'), None) + self.assertEqual(regex.match(r't(?:es){i<=1:\d}t', 'tes5t').group(), + 'tes5t') + self.assertEqual(regex.match(r't(?:es){i<=1:\d}t', 'teszt'), None) + self.assertEqual(regex.match(r't(?:es){i<=1:\d}t', + 'tes5t').fuzzy_changes, ([], [3], [])) + self.assertEqual(regex.match(r't(es){i<=1,0.*)(?PCTTCC){e<=1}(?P([ACGT]){4,6})(?PCAATACCGACTCCTCACTGTGT){e<=2}(?P([ACGT]){0,6}$)' + + m = regex.match(pattern, sequence, flags=regex.BESTMATCH) + self.assertEqual(m.span(), (0, 50)) + self.assertEqual(m.groupdict(), {'insert': 'TTCAGACGTGTGCT', 'anchor': 'CTTCC', 'umi': 'GATCT', 'sid': 'CAATACCGACTCCTCACTGTGT', 'end': 'GTCT'}) + + m = regex.match(pattern, sequence, flags=regex.ENHANCEMATCH) + self.assertEqual(m.span(), (0, 50)) + self.assertEqual(m.groupdict(), {'insert': 'TTCAGACGTGTGCT', 'anchor': 'CTTCC', 'umi': 'GATCT', 'sid': 'CAATACCGACTCCTCACTGTGT', 'end': 'GTCT'}) + + # Git issue 433: Disagreement between fuzzy_counts and fuzzy_changes + pattern = r'(?P.*)(?PAACACTGG){e<=1}(?P([AT][CG]){5}){e<=2}(?PGTAACCGAAG){e<=2}(?P([ACGT]){0,6}$)' + + sequence = 'GGAAAACACTGGTCTCAGTCTCGTAACCGAAGTGGTCG' + m = regex.match(pattern, sequence, flags=regex.BESTMATCH) + self.assertEqual(m.fuzzy_counts, (0, 0, 0)) + self.assertEqual(m.fuzzy_changes, ([], [], [])) + + sequence = 'GGAAAACACTGGTCTCAGTCTCGTCCCCGAAGTGGTCG' + m = regex.match(pattern, sequence, flags=regex.BESTMATCH) + self.assertEqual(m.fuzzy_counts, (2, 0, 0)) + self.assertEqual(m.fuzzy_changes, ([24, 25], [], [])) + + # Git issue 439: Unmatched groups: sub vs subf + self.assertEqual(regex.sub(r'(test1)|(test2)', r'matched: \1\2', 'test1'), 'matched: test1') + self.assertEqual(regex.subf(r'(test1)|(test2)', r'matched: {1}{2}', 'test1'), 'matched: test1') + self.assertEqual(regex.search(r'(test1)|(test2)', 'matched: test1').expand(r'matched: \1\2'), 'matched: test1'), + self.assertEqual(regex.search(r'(test1)|(test2)', 'matched: test1').expandf(r'matched: {1}{2}'), 'matched: test1') + + # Git issue 442: Fuzzy regex matching doesn't seem to test insertions correctly + self.assertEqual(regex.search(r"(?:\bha\b){i:[ ]}", "having"), None) + self.assertEqual(regex.search(r"(?:\bha\b){i:[ ]}", "having", flags=regex.I), None) + + # Git issue 467: Scoped inline flags 'a', 'u' and 'L' affect global flags + self.assertEqual(regex.match(r'(?a:\w)\w', 'd\N{CYRILLIC SMALL LETTER ZHE}').span(), (0, 2)) + self.assertEqual(regex.match(r'(?a:\w)(?u:\w)', 'd\N{CYRILLIC SMALL LETTER ZHE}').span(), (0, 2)) + + # Git issue 473: Emoji classified as letter + self.assertEqual(regex.match(r'^\p{LC}+$', '\N{SMILING CAT FACE WITH OPEN MOUTH}'), None) + self.assertEqual(regex.match(r'^\p{So}+$', '\N{SMILING CAT FACE WITH OPEN MOUTH}').span(), (0, 1)) + + # Git issue 474: regex has no equivalent to `re.Match.groups()` for captures + self.assertEqual(regex.match(r'(.)+', 'abc').allcaptures(), (['abc'], ['a', 'b', 'c'])) + self.assertEqual(regex.match(r'(.)+', 'abc').allspans(), ([(0, 3)], [(0, 1), (1, 2), (2, 3)])) + + # Git issue 477: \v for vertical spacing + self.assertEqual(bool(regex.fullmatch(r'\p{HorizSpace}+', '\t \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000')), True) + self.assertEqual(bool(regex.fullmatch(r'\p{VertSpace}+', '\n\v\f\r\x85\u2028\u2029')), True) + + # Git issue 479: Segmentation fault when using conditional pattern + self.assertEqual(regex.match(r'(?(?<=A)|(?(?![^B])C|D))', 'A'), None) + self.assertEqual(regex.search(r'(?(?<=A)|(?(?![^B])C|D))', 'A').span(), (1, 1)) + + # Git issue 494: Backtracking failure matching regex ^a?(a?)b?c\1$ against string abca + self.assertEqual(regex.search(r"^a?(a?)b?c\1$", "abca").span(), (0, 4)) + + # Git issue 498: Conditional negative lookahead inside positive lookahead fails to match + self.assertEqual(regex.match(r'(?(?=a).|..)', 'ab').span(), (0, 1)) + self.assertEqual(regex.match(r'(?(?=b).|..)', 'ab').span(), (0, 2)) + self.assertEqual(regex.match(r'(?(?!a).|..)', 'ab').span(), (0, 2)) + self.assertEqual(regex.match(r'(?(?!b).|..)', 'ab').span(), (0, 1)) + + # Git issue 525: segfault when fuzzy matching empty list + self.assertEqual(regex.match(r"(\L){e<=5}", "blah", foo=[]).span(), (0, 0)) + + # Git issue 527: `VERBOSE`/`X` flag breaks `\N` escapes + self.assertEqual(regex.compile(r'\N{LATIN SMALL LETTER A}').match('a').span(), (0, 1)) + self.assertEqual(regex.compile(r'\N{LATIN SMALL LETTER A}', flags=regex.X).match('a').span(), (0, 1)) + + # Git issue 539: Bug: Partial matching fails on a simple example + self.assertEqual(regex.match(r"[^/]*b/ccc", "b/ccc", partial=True).span(), (0, 5)) + self.assertEqual(regex.match(r"[^/]*b/ccc", "b/ccb", partial=True), None) + self.assertEqual(regex.match(r"[^/]*b/ccc", "b/cc", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"[^/]*b/xyz", "b/xy", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"[^/]*b/xyz", "b/yz", partial=True), None) + + self.assertEqual(regex.match(r"(?i)[^/]*b/ccc", "b/ccc", partial=True).span(), (0, 5)) + self.assertEqual(regex.match(r"(?i)[^/]*b/ccc", "b/ccb", partial=True), None) + self.assertEqual(regex.match(r"(?i)[^/]*b/ccc", "b/cc", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/xy", partial=True).span(), (0, 4)) + self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/yz", partial=True), None) + + # Git issue 546: Partial match not working in some instances with non-greedy capture + self.assertEqual(bool(regex.match(r'.*?', '<', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', '.*?', '', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'x', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo ', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo bar', partial=True)), True) + + # Git issue 551: + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]-a]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]--a]', 'a')), False) + self.assertEqual(bool(regex.match(r'(?V1)[[a-z]--b]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[[\s\S]--b]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[a-[\s\S]]', 'a')), True) + self.assertEqual(bool(regex.match(r'(?V1)[a--[\s\S]]', 'a')), False) + + self.assertEqual(regex.search(r'(?ifu)(H\N{LATIN SMALL LETTER O WITH DIAERESIS}gskolan?)[\\s\\S]*p', + 'Yrkesh\N{LATIN SMALL LETTER O WITH DIAERESIS}gskola . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen . Studie\N{LATIN SMALL LETTER A WITH DIAERESIS}mnen'), + None) + + # Git issue 572: Inline ASCII modifier doesn't seem to affect anything + self.assertEqual(bool(regex.match(r'\d', '\uFF19')), True) + self.assertEqual(bool(regex.match(r'(?a:\d)', '\uFF19')), False) + + # Git issue 575: Issues with ASCII/Unicode modifiers + self.assertEqual(regex.findall('\\d', '9\uFF19'), ['9', '\uff19']) + self.assertEqual(regex.findall('(?u:\\d)', '9\uFF19'), ['9', '\uff19']) + self.assertEqual(regex.findall('(?a:\\d)', '9\uFF19'), ['9']) + + self.assertEqual(regex.findall('\\d', '9\uFF19', flags=regex.U), ['9', '\uff19']) + self.assertEqual(regex.findall('(?u:\\d)', '9\uFF19', flags=regex.U), ['9', '\uff19']) + self.assertEqual(regex.findall('(?a:\\d)', '9\uFF19', flags=regex.U), ['9']) + + self.assertEqual(regex.findall('\\d', '9\uFF19', flags=regex.A), ['9']) + self.assertEqual(regex.findall('(?u:\\d)', '9\uFF19', flags=regex.A), ['9', '\uff19']) + self.assertEqual(regex.findall('(?a:\\d)', '9\uFF19', flags=regex.A), ['9']) + + self.assertEqual(len(regex.findall(r'\p{L}', ''.join(chr(c) for c in range(0x100)), flags=0)), 117) + self.assertEqual(len(regex.findall(r'\p{L}', ''.join(chr(c) for c in range(0x100)), flags=regex.A)), 52) + self.assertEqual(len(regex.findall(r'\p{L}', ''.join(chr(c) for c in range(0x100)), flags=regex.U)), 117) + + self.assertEqual(len(regex.findall(r'(?a:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=0)), 52) + self.assertEqual(len(regex.findall(r'(?a:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.A)), 52) + self.assertEqual(len(regex.findall(r'(?a:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.U)), 52) + + self.assertEqual(len(regex.findall(r'(?u:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=0)), 117) + self.assertEqual(len(regex.findall(r'(?u:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.A)), 117) + self.assertEqual(len(regex.findall(r'(?u:\p{L})', ''.join(chr(c) for c in range(0x100)), flags=regex.U)), 117) + + # Git issue 580: Regression in v2025.7.31: \P{L} no longer matches in simple patterns + self.assertEqual(bool(regex.match(r"\A\P{L}?\p{L}", "hello,")), True) + self.assertEqual(bool(regex.fullmatch(r"\A\P{L}*(?P\p{L}+)\P{L}*\Z", "hello,")), True) + + # Git issue 584: AttributeError: 'AnyAll' object has no attribute 'positive' + self.assertEqual(bool(regex.compile('(\\s|\\S)')), True) + + # Git PR 585: Fix AttributeError: 'AnyAll' object has no attribute '_key' + self.assertEqual(bool(regex.compile('(?:[\\S\\s]|[A-D][M-Z])')), True) + + def test_fuzzy_ext(self): + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', 'e')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', '-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', '-')), + False) + + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', 'ae')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', + 'ae')), True) + self.assertEqual(bool(regex.fullmatch(r'(?:a){e<=1:[a-z]}', 'a-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', + 'a-')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?:ab){e<=1:[a-z]}', 'ae')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:ab){e<=1:[a-z]}', + 'ae')), True) + self.assertEqual(bool(regex.fullmatch(r'(?:ab){e<=1:[a-z]}', 'a-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)(?:ab){e<=1:[a-z]}', + 'a-')), False) + + self.assertEqual(bool(regex.fullmatch(r'(a)\1{e<=1:[a-z]}', 'ae')), + True) + self.assertEqual(bool(regex.fullmatch(r'(?r)\1{e<=1:[a-z]}(a)', + 'ea')), True) + self.assertEqual(bool(regex.fullmatch(r'(a)\1{e<=1:[a-z]}', 'a-')), + False) + self.assertEqual(bool(regex.fullmatch(r'(?r)\1{e<=1:[a-z]}(a)', + '-a')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'ts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'st')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'st')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 'ts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + '-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 's-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + 's-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(?:\N{LATIN SMALL LETTER SHARP S}){e<=1:[a-z]}', + '-s')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'ssst')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'ssts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(\N{LATIN SMALL LETTER SHARP S})', + 'stss')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(\N{LATIN SMALL LETTER SHARP S})', + 'tsss')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'ss-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 'sss-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + '-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(\N{LATIN SMALL LETTER SHARP S})\1{e<=1:[a-z]}', + 's-')), False) + + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}ts')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}st')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(ss)', + 'st\N{LATIN SMALL LETTER SHARP S}')), True) + self.assertEqual(bool(regex.fullmatch(r'(?firu)\1{e<=1:[a-z]}(ss)', + 'ts\N{LATIN SMALL LETTER SHARP S}')), True) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}-s')), False) + self.assertEqual(bool(regex.fullmatch(r'(?fiu)(ss)\1{e<=1:[a-z]}', + '\N{LATIN SMALL LETTER SHARP S}s-')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(ss)\1{e<=1:[a-z]}', + 's-\N{LATIN SMALL LETTER SHARP S}')), False) + self.assertEqual(bool(regex.fullmatch(r'(?firu)(ss)\1{e<=1:[a-z]}', + '-s\N{LATIN SMALL LETTER SHARP S}')), False) + + def test_subscripted_captures(self): + self.assertEqual(regex.match(r'(?P.)+', + 'abc').expandf('{0} {0[0]} {0[-1]}'), 'abc abc abc') + self.assertEqual(regex.match(r'(?P.)+', + 'abc').expandf('{1} {1[0]} {1[1]} {1[2]} {1[-1]} {1[-2]} {1[-3]}'), + 'c a b c c b a') + self.assertEqual(regex.match(r'(?P.)+', + 'abc').expandf('{x} {x[0]} {x[1]} {x[2]} {x[-1]} {x[-2]} {x[-3]}'), + 'c a b c c b a') + + self.assertEqual(regex.subf(r'(?P.)+', r'{0} {0[0]} {0[-1]}', + 'abc'), 'abc abc abc') + self.assertEqual(regex.subf(r'(?P.)+', + '{1} {1[0]} {1[1]} {1[2]} {1[-1]} {1[-2]} {1[-3]}', 'abc'), + 'c a b c c b a') + self.assertEqual(regex.subf(r'(?P.)+', + '{x} {x[0]} {x[1]} {x[2]} {x[-1]} {x[-2]} {x[-3]}', 'abc'), + 'c a b c c b a') + + def test_more_zerowidth(self): + if sys.version_info >= (3, 7, 0): + self.assertEqual(regex.split(r'\b|:+', 'a::bc'), ['', 'a', '', '', + 'bc', '']) + self.assertEqual(regex.sub(r'\b|:+', '-', 'a::bc'), '-a---bc-') + self.assertEqual(regex.findall(r'\b|:+', 'a::bc'), ['', '', '::', + '', '']) + self.assertEqual([m.span() for m in regex.finditer(r'\b|:+', + 'a::bc')], [(0, 0), (1, 1), (1, 3), (3, 3), (5, 5)]) + self.assertEqual([m.span() for m in regex.finditer(r'(?m)^\s*?$', + 'foo\n\n\nbar')], [(4, 4), (4, 5), (5, 5)]) + + def test_line_ending(self): + self.assertEqual(regex.findall(r'\R', '\r\n\n\x0B\f\r\x85\u2028\u2029'), + ['\r\n', '\n', '\x0B', '\f', '\r', '\x85', '\u2028', '\u2029']) + self.assertEqual(regex.findall(br'\R', b'\r\n\n\x0B\f\r\x85'), [b'\r\n', + b'\n', b'\x0B', b'\f', b'\r']) + +def test_main(): + unittest.main(verbosity=2) + +if __name__ == "__main__": + test_main() diff --git a/python/user_packages/Python313/site-packages/requests-2.34.0.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/requests-2.34.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..67db8588217f266eb561f75fae738656325deac9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests-2.34.0.dist-info/licenses/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/python/user_packages/Python313/site-packages/requests-2.34.0.dist-info/licenses/NOTICE b/python/user_packages/Python313/site-packages/requests-2.34.0.dist-info/licenses/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..1ff62db688277b77c83c1766dac7f165364d3528 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests-2.34.0.dist-info/licenses/NOTICE @@ -0,0 +1,2 @@ +Requests +Copyright 2019 Kenneth Reitz diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1b36a8ad7478b0ba3b0338bed55d000adf3ac140 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/__version__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/__version__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c73b4c5be53731118a1d11db7c63032e94d904ab Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/__version__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/_internal_utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/_internal_utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e39df61643e263a5200ae97c2ad050cd5b0720c8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/_internal_utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/_types.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/_types.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25b06e94c2b2b4aac6912ced66b99b78cb775065 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/_types.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/adapters.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/adapters.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f17bc4eca8c3f44372de490a18b9ef0ce755763 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/adapters.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/api.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/api.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18d9fd55431ac7fccc64b768f72ea1e3b51a8d5b Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/api.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/auth.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/auth.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fc9268499c20b262859b6553b80645f768f49508 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/auth.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/certs.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/certs.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9607781ec3b7a4dda64ec1a18503ceb9ba59acd6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/certs.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/compat.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/compat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ced9f708dea2dd250948e142f324f278b801ddc7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/compat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/cookies.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/cookies.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..421f6f7d324948e9a3a3ce46b4243dea9ef1f266 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/cookies.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b1b027defcd9eee4d15594af3f87c9c202356e10 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/help.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/help.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64325caf061967f0db55cf414b973d79e8898980 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/help.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/hooks.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/hooks.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2765ca943ee07787fb64ebf438f5ead5356d7029 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/hooks.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/models.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/models.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1fba97de2e54a4c3bf61077d111744995286f1c0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/models.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/packages.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/packages.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2817d564da095862acb405d98fb439f3dc183fab Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/packages.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/sessions.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/sessions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c842149a12babd8b35cecbcff9062ccd23d7b484 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/sessions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/status_codes.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/status_codes.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a825a4cfb672314b471aca2a6249ed37332253a4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/status_codes.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/structures.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/structures.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2af03ad2fd22b1d615a0a3d76b23824579f4aea2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/structures.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests/__pycache__/utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests/__pycache__/utils.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ae0df6ad1a374d2543eb4bb9bff52593c9a7aa1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests/__pycache__/utils.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..765a42cd0ccf35caae21f61a63a902578d42bf35 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth1_auth.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth1_auth.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..655f1355908f2eaa3b1df37cf230ed23859644a4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth1_auth.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth1_session.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth1_session.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caeba9c4d972ff0b76d52bffa6e2088b0d4947fe Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth1_session.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth2_auth.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth2_auth.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82967e0c9fcc5f9043da1f54386bdf109184ee4d Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth2_auth.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth2_session.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth2_session.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43f398a1043b1e5907c84353eb4f126b0da08584 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/__pycache__/oauth2_session.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__init__.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8815ea0b8eec8630d6cf957f91796df695e365bf --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__init__.py @@ -0,0 +1,9 @@ +# ruff: noqa: F401 +from .facebook import facebook_compliance_fix +from .fitbit import fitbit_compliance_fix +from .slack import slack_compliance_fix +from .instagram import instagram_compliance_fix +from .mailchimp import mailchimp_compliance_fix +from .weibo import weibo_compliance_fix +from .plentymarkets import plentymarkets_compliance_fix +from .ebay import ebay_compliance_fix diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19017d90ff07918acf3403410003bd479591cea4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/douban.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/douban.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b88cfc1e3ed8b1508b1d5fee0c8caf7311a8feee Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/douban.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/ebay.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/ebay.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c4829c73d0247bab0d5c8ea3bb18544eae5d76f Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/ebay.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/facebook.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/facebook.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a804afa42e0cefebef6e4aff6f972d3d830e133 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/facebook.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/fitbit.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/fitbit.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2adca8771d9f137a6fd113ceabeb0deb609cd84 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/fitbit.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/instagram.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/instagram.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dd6cc8023e74767a341b76c9f052034b64f6e408 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/instagram.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/mailchimp.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/mailchimp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cdfe30bd377b0d6923c9d8850c02570773cba287 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/mailchimp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/plentymarkets.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/plentymarkets.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5992b6f36899fc1881bace6a7ccb9bb9f757f85 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/plentymarkets.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/slack.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/slack.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..adc56c624bfd22089cf02e69b36578c037652ab3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/slack.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/weibo.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/weibo.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..171371a222e38ae3877eb5f3dca02242504611c0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/__pycache__/weibo.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/douban.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/douban.py new file mode 100644 index 0000000000000000000000000000000000000000..c8b99c721e9bb09e3a0127bb90e09f53814d714c --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/douban.py @@ -0,0 +1,15 @@ +import json + + +def douban_compliance_fix(session): + def fix_token_type(r): + token = json.loads(r.text) + token.setdefault("token_type", "Bearer") + fixed_token = json.dumps(token) + r._content = fixed_token.encode() + return r + + session._client_default_token_placement = "query" + session.register_compliance_hook("access_token_response", fix_token_type) + + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/ebay.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/ebay.py new file mode 100644 index 0000000000000000000000000000000000000000..ef33f39101bd97ab2926b13289f8ff3886265fb1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/ebay.py @@ -0,0 +1,22 @@ +import json + + +def ebay_compliance_fix(session): + def _compliance_fix(response): + token = json.loads(response.text) + + # eBay responds with non-compliant token types. + # https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html + # https://developer.ebay.com/api-docs/static/oauth-auth-code-grant-request.html + # Modify these to be "Bearer". + if token.get("token_type") in ["Application Access Token", "User Access Token"]: + token["token_type"] = "Bearer" + fixed_token = json.dumps(token) + response._content = fixed_token.encode() + + return response + + session.register_compliance_hook("access_token_response", _compliance_fix) + session.register_compliance_hook("refresh_token_response", _compliance_fix) + + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/facebook.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/facebook.py new file mode 100644 index 0000000000000000000000000000000000000000..f44558a83902a76022c38f2310a7eddb39cee150 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/facebook.py @@ -0,0 +1,27 @@ +from json import dumps +from urllib.parse import parse_qsl + + +def facebook_compliance_fix(session): + def _compliance_fix(r): + # if Facebook claims to be sending us json, let's trust them. + if "application/json" in r.headers.get("content-type", {}): + return r + + # Facebook returns a content-type of text/plain when sending their + # x-www-form-urlencoded responses, along with a 200. If not, let's + # assume we're getting JSON and bail on the fix. + if "text/plain" in r.headers.get("content-type", {}) and r.status_code == 200: + token = dict(parse_qsl(r.text, keep_blank_values=True)) + else: + return r + + expires = token.get("expires") + if expires is not None: + token["expires_in"] = expires + token["token_type"] = "Bearer" + r._content = dumps(token).encode() + return r + + session.register_compliance_hook("access_token_response", _compliance_fix) + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/fitbit.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/fitbit.py new file mode 100644 index 0000000000000000000000000000000000000000..aacc68bfbb1b80be304d21a0f4d4a57cbb7db54b --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/fitbit.py @@ -0,0 +1,23 @@ +""" +The Fitbit API breaks from the OAuth2 RFC standard by returning an "errors" +object list, rather than a single "error" string. This puts hooks in place so +that oauthlib can process an error in the results from access token and refresh +token responses. This is necessary to prevent getting the generic red herring +MissingTokenError. +""" + +from json import loads, dumps + + +def fitbit_compliance_fix(session): + def _missing_error(r): + token = loads(r.text) + if "errors" in token: + # Set the error to the first one we have + token["error"] = token["errors"][0]["errorType"] + r._content = dumps(token).encode() + return r + + session.register_compliance_hook("access_token_response", _missing_error) + session.register_compliance_hook("refresh_token_response", _missing_error) + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/instagram.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/instagram.py new file mode 100644 index 0000000000000000000000000000000000000000..7d5a2ad447eda3bbcefe65f417e1f9d82848c27e --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/instagram.py @@ -0,0 +1,23 @@ +from urllib.parse import urlparse, parse_qs + +from oauthlib.common import add_params_to_uri + + +def instagram_compliance_fix(session): + def _non_compliant_param_name(url, headers, data): + # If the user has already specified the token in the URL + # then there's nothing to do. + # If the specified token is different from ``session.access_token``, + # we assume the user intends to override the access token. + url_query = dict(parse_qs(urlparse(url).query)) + token = url_query.get("access_token") + if token: + # Nothing to do, just return. + return url, headers, data + + token = [("access_token", session.access_token)] + url = add_params_to_uri(url, token) + return url, headers, data + + session.register_compliance_hook("protected_request", _non_compliant_param_name) + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/mailchimp.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/mailchimp.py new file mode 100644 index 0000000000000000000000000000000000000000..0d602659c646203a012f107e5651087762b93d37 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/mailchimp.py @@ -0,0 +1,21 @@ +import json + + +def mailchimp_compliance_fix(session): + def _null_scope(r): + token = json.loads(r.text) + if "scope" in token and token["scope"] is None: + token.pop("scope") + r._content = json.dumps(token).encode() + return r + + def _non_zero_expiration(r): + token = json.loads(r.text) + if "expires_in" in token and token["expires_in"] == 0: + token["expires_in"] = 3600 + r._content = json.dumps(token).encode() + return r + + session.register_compliance_hook("access_token_response", _null_scope) + session.register_compliance_hook("access_token_response", _non_zero_expiration) + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py new file mode 100644 index 0000000000000000000000000000000000000000..859f0566a5be32fb1a8d2f013c8205800bb84e23 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py @@ -0,0 +1,27 @@ +from json import dumps, loads +import re + + +def plentymarkets_compliance_fix(session): + def _to_snake_case(n): + return re.sub("(.)([A-Z][a-z]+)", r"\1_\2", n).lower() + + def _compliance_fix(r): + # Plenty returns the Token in CamelCase instead of _ + if ( + "application/json" in r.headers.get("content-type", {}) + and r.status_code == 200 + ): + token = loads(r.text) + else: + return r + + fixed_token = {} + for k, v in token.items(): + fixed_token[_to_snake_case(k)] = v + + r._content = dumps(fixed_token).encode() + return r + + session.register_compliance_hook("access_token_response", _compliance_fix) + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/slack.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/slack.py new file mode 100644 index 0000000000000000000000000000000000000000..9095a470cd1ccb7783bd3129286310920c1e2b62 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/slack.py @@ -0,0 +1,34 @@ +from urllib.parse import urlparse, parse_qs + +from oauthlib.common import add_params_to_uri + + +def slack_compliance_fix(session): + def _non_compliant_param_name(url, headers, data): + # If the user has already specified the token, either in the URL + # or in a data dictionary, then there's nothing to do. + # If the specified token is different from ``session.access_token``, + # we assume the user intends to override the access token. + url_query = dict(parse_qs(urlparse(url).query)) + token = url_query.get("token") + if not token and isinstance(data, dict): + token = data.get("token") + + if token: + # Nothing to do, just return. + return url, headers, data + + if not data: + data = {"token": session.access_token} + elif isinstance(data, dict): + data["token"] = session.access_token + else: + # ``data`` is something other than a dict: maybe a stream, + # maybe a file object, maybe something else. We can't easily + # modify it, so we'll set the token by modifying the URL instead. + token = [("token", session.access_token)] + url = add_params_to_uri(url, token) + return url, headers, data + + session.register_compliance_hook("protected_request", _non_compliant_param_name) + return session diff --git a/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/weibo.py b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/weibo.py new file mode 100644 index 0000000000000000000000000000000000000000..f1623fd6d768e5c5cdb91485f01a58c184040833 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_oauthlib/compliance_fixes/weibo.py @@ -0,0 +1,13 @@ +from json import loads, dumps + + +def weibo_compliance_fix(session): + def _missing_token_type(r): + token = loads(r.text) + token["token_type"] = "Bearer" + r._content = dumps(token).encode() + return r + + session._client.default_token_placement = "query" + session.register_compliance_hook("access_token_response", _missing_token_type) + return session diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a0c06140d401384cfe6c2bf3d11e73c27112a765 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/_compat.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/_compat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..09149433e692cd768e7faaf21094f6d29e9a0b77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/_compat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3ff6df91b667173ddbabdd07c4cf318f9d00ea8f Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/sessions.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/sessions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff9ae31a94293b0ff2a0ec87381139d8c993120f Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/sessions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/streaming_iterator.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/streaming_iterator.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60c3e5d011298d7dad238209e307e4dc3727b5ee Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/__pycache__/streaming_iterator.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7195f43e3496b5951f3eab7cba53e69e0d99fcb9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +""" +requests-toolbelt.adapters +========================== + +See https://toolbelt.readthedocs.io/ for documentation + +:copyright: (c) 2014 by Ian Cordasco and Cory Benfield +:license: Apache v2.0, see LICENSE for more details +""" + +from .ssl import SSLAdapter +from .source import SourceAddressAdapter + +__all__ = ['SSLAdapter', 'SourceAddressAdapter'] diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d5e842f5f6a7a1c247ee6bb4fe3e2f2ec89809e7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/appengine.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/appengine.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a37970e19736b6fada7f1002b10cd25437d7388b Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/appengine.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/fingerprint.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/fingerprint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25a8f117cbf9ff75c3b094c32af9f162ac1f3651 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/fingerprint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/host_header_ssl.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/host_header_ssl.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11b79f3f767301ddaacfcdaf452367ca46c9b4ad Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/host_header_ssl.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/socket_options.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/socket_options.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..278a267dee426e3c97cf49771168ed62e2210db5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/socket_options.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/source.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/source.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..56ec139ebf863c6dd4251aa28a2e49f9121aba2d Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/source.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/ssl.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/ssl.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8f74eb1ef48ee3d52deeed2bd3e7e9945112c13c Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/ssl.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/x509.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/x509.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eda18b1bc817f632803aebf3f87a35fe4fda7649 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/__pycache__/x509.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/appengine.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/appengine.py new file mode 100644 index 0000000000000000000000000000000000000000..25a70a17625117850c8de99b328e96dc3b67ed65 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/appengine.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- +"""The App Engine Transport Adapter for requests. + +.. versionadded:: 0.6.0 + +This requires a version of requests >= 2.10.0 and Python 2. + +There are two ways to use this library: + +#. If you're using requests directly, you can use code like: + + .. code-block:: python + + >>> import requests + >>> import ssl + >>> import requests.packages.urllib3.contrib.appengine as ul_appengine + >>> from requests_toolbelt.adapters import appengine + >>> s = requests.Session() + >>> if ul_appengine.is_appengine_sandbox(): + ... s.mount('http://', appengine.AppEngineAdapter()) + ... s.mount('https://', appengine.AppEngineAdapter()) + +#. If you depend on external libraries which use requests, you can use code + like: + + .. code-block:: python + + >>> from requests_toolbelt.adapters import appengine + >>> appengine.monkeypatch() + +which will ensure all requests.Session objects use AppEngineAdapter properly. + +You are also able to :ref:`disable certificate validation ` +when monkey-patching. +""" +import requests +import warnings +from requests import adapters +from requests import sessions + +from .. import exceptions as exc +from .._compat import gaecontrib +from .._compat import timeout + + +class AppEngineMROHack(adapters.HTTPAdapter): + """Resolves infinite recursion when monkeypatching. + + This works by injecting itself as the base class of both the + :class:`AppEngineAdapter` and Requests' default HTTPAdapter, which needs to + be done because default HTTPAdapter's MRO is recompiled when we + monkeypatch, at which point this class becomes HTTPAdapter's base class. + In addition, we use an instantiation flag to avoid infinite recursion. + """ + _initialized = False + + def __init__(self, *args, **kwargs): + if not self._initialized: + self._initialized = True + super(AppEngineMROHack, self).__init__(*args, **kwargs) + + +class AppEngineAdapter(AppEngineMROHack, adapters.HTTPAdapter): + """The transport adapter for Requests to use urllib3's GAE support. + + Implements Requests's HTTPAdapter API. + + When deploying to Google's App Engine service, some of Requests' + functionality is broken. There is underlying support for GAE in urllib3. + This functionality, however, is opt-in and needs to be enabled explicitly + for Requests to be able to use it. + """ + + __attrs__ = adapters.HTTPAdapter.__attrs__ + ['_validate_certificate'] + + def __init__(self, validate_certificate=True, *args, **kwargs): + _check_version() + self._validate_certificate = validate_certificate + super(AppEngineAdapter, self).__init__(*args, **kwargs) + + def init_poolmanager(self, connections, maxsize, block=False): + self.poolmanager = _AppEnginePoolManager(self._validate_certificate) + + +class InsecureAppEngineAdapter(AppEngineAdapter): + """An always-insecure GAE adapter for Requests. + + This is a variant of the the transport adapter for Requests to use + urllib3's GAE support that does not validate certificates. Use with + caution! + + .. note:: + The ``validate_certificate`` keyword argument will not be honored here + and is not part of the signature because we always force it to + ``False``. + + See :class:`AppEngineAdapter` for further details. + """ + + def __init__(self, *args, **kwargs): + if kwargs.pop("validate_certificate", False): + warnings.warn("Certificate validation cannot be specified on the " + "InsecureAppEngineAdapter, but was present. This " + "will be ignored and certificate validation will " + "remain off.", exc.IgnoringGAECertificateValidation) + + super(InsecureAppEngineAdapter, self).__init__( + validate_certificate=False, *args, **kwargs) + + +class _AppEnginePoolManager(object): + """Implements urllib3's PoolManager API expected by requests. + + While a real PoolManager map hostnames to reusable Connections, + AppEngine has no concept of a reusable connection to a host. + So instead, this class constructs a small Connection per request, + that is returned to the Adapter and used to access the URL. + """ + + def __init__(self, validate_certificate=True): + self.appengine_manager = gaecontrib.AppEngineManager( + validate_certificate=validate_certificate) + + def connection_from_url(self, url): + return _AppEngineConnection(self.appengine_manager, url) + + def clear(self): + pass + + +class _AppEngineConnection(object): + """Implements urllib3's HTTPConnectionPool API's urlopen(). + + This Connection's urlopen() is called with a host-relative path, + so in order to properly support opening the URL, we need to store + the full URL when this Connection is constructed from the PoolManager. + + This code wraps AppEngineManager.urlopen(), which exposes a different + API than in the original urllib3 urlopen(), and thus needs this adapter. + """ + + def __init__(self, appengine_manager, url): + self.appengine_manager = appengine_manager + self.url = url + + def urlopen(self, method, url, body=None, headers=None, retries=None, + redirect=True, assert_same_host=True, + timeout=timeout.Timeout.DEFAULT_TIMEOUT, + pool_timeout=None, release_conn=None, **response_kw): + # This function's url argument is a host-relative URL, + # but the AppEngineManager expects an absolute URL. + # So we saved out the self.url when the AppEngineConnection + # was constructed, which we then can use down below instead. + + # We once tried to verify our assumptions here, but sometimes the + # passed-in URL differs on url fragments, or "http://a.com" vs "/". + + # urllib3's App Engine adapter only uses Timeout.total, not read or + # connect. + if not timeout.total: + timeout.total = timeout._read or timeout._connect + + # Jump through the hoops necessary to call AppEngineManager's API. + return self.appengine_manager.urlopen( + method, + self.url, + body=body, + headers=headers, + retries=retries, + redirect=redirect, + timeout=timeout, + **response_kw) + + +def monkeypatch(validate_certificate=True): + """Sets up all Sessions to use AppEngineAdapter by default. + + If you don't want to deal with configuring your own Sessions, + or if you use libraries that use requests directly (ie requests.post), + then you may prefer to monkeypatch and auto-configure all Sessions. + + .. warning: : + + If ``validate_certificate`` is ``False``, certification validation will + effectively be disabled for all requests. + """ + _check_version() + # HACK: We should consider modifying urllib3 to support this cleanly, + # so that we can set a module-level variable in the sessions module, + # instead of overriding an imported HTTPAdapter as is done here. + adapter = AppEngineAdapter + if not validate_certificate: + adapter = InsecureAppEngineAdapter + + sessions.HTTPAdapter = adapter + adapters.HTTPAdapter = adapter + + +def _check_version(): + if gaecontrib is None: + raise exc.VersionMismatchError( + "The toolbelt requires at least Requests 2.10.0 to be " + "installed. Version {} was found instead.".format( + requests.__version__ + ) + ) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/fingerprint.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/fingerprint.py new file mode 100644 index 0000000000000000000000000000000000000000..6645d349816cf43055861f893f9f2e3d2f301e91 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/fingerprint.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +"""Submodule containing the implementation for the FingerprintAdapter. + +This file contains an implementation of a Transport Adapter that validates +the fingerprints of SSL certificates presented upon connection. +""" +from requests.adapters import HTTPAdapter + +from .._compat import poolmanager + + +class FingerprintAdapter(HTTPAdapter): + """ + A HTTPS Adapter for Python Requests that verifies certificate fingerprints, + instead of certificate hostnames. + + Example usage: + + .. code-block:: python + + import requests + import ssl + from requests_toolbelt.adapters.fingerprint import FingerprintAdapter + + twitter_fingerprint = '...' + s = requests.Session() + s.mount( + 'https://twitter.com', + FingerprintAdapter(twitter_fingerprint) + ) + + The fingerprint should be provided as a hexadecimal string, optionally + containing colons. + """ + + __attrs__ = HTTPAdapter.__attrs__ + ['fingerprint'] + + def __init__(self, fingerprint, **kwargs): + self.fingerprint = fingerprint + + super(FingerprintAdapter, self).__init__(**kwargs) + + def init_poolmanager(self, connections, maxsize, block=False): + self.poolmanager = poolmanager.PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + assert_fingerprint=self.fingerprint) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/host_header_ssl.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/host_header_ssl.py new file mode 100644 index 0000000000000000000000000000000000000000..f34ed1aa134fb3f1fece5cbb721e95d10c7628d3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/host_header_ssl.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +""" +requests_toolbelt.adapters.host_header_ssl +========================================== + +This file contains an implementation of the HostHeaderSSLAdapter. +""" + +from requests.adapters import HTTPAdapter + + +class HostHeaderSSLAdapter(HTTPAdapter): + """ + A HTTPS Adapter for Python Requests that sets the hostname for certificate + verification based on the Host header. + + This allows requesting the IP address directly via HTTPS without getting + a "hostname doesn't match" exception. + + Example usage: + + >>> s.mount('https://', HostHeaderSSLAdapter()) + >>> s.get("https://93.184.216.34", headers={"Host": "example.org"}) + + """ + + def send(self, request, **kwargs): + # HTTP headers are case-insensitive (RFC 7230) + host_header = None + for header in request.headers: + if header.lower() == "host": + host_header = request.headers[header] + break + + connection_pool_kwargs = self.poolmanager.connection_pool_kw + + if host_header: + connection_pool_kwargs["assert_hostname"] = host_header + elif "assert_hostname" in connection_pool_kwargs: + # an assert_hostname from a previous request may have been left + connection_pool_kwargs.pop("assert_hostname", None) + + return super(HostHeaderSSLAdapter, self).send(request, **kwargs) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/socket_options.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/socket_options.py new file mode 100644 index 0000000000000000000000000000000000000000..86ebe136b448f53fd48a9b8a0142f10b19c81fb4 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/socket_options.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +"""The implementation of the SocketOptionsAdapter.""" +import socket +import warnings +import sys + +import requests +from requests import adapters + +from .._compat import connection +from .._compat import poolmanager +from .. import exceptions as exc + + +class SocketOptionsAdapter(adapters.HTTPAdapter): + """An adapter for requests that allows users to specify socket options. + + Since version 2.4.0 of requests, it is possible to specify a custom list + of socket options that need to be set before establishing the connection. + + Example usage:: + + >>> import socket + >>> import requests + >>> from requests_toolbelt.adapters import socket_options + >>> s = requests.Session() + >>> opts = [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 0)] + >>> adapter = socket_options.SocketOptionsAdapter(socket_options=opts) + >>> s.mount('http://', adapter) + + You can also take advantage of the list of default options on this class + to keep using the original options in addition to your custom options. In + that case, ``opts`` might look like:: + + >>> opts = socket_options.SocketOptionsAdapter.default_options + opts + + """ + + if connection is not None: + default_options = getattr( + connection.HTTPConnection, + 'default_socket_options', + [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)] + ) + else: + default_options = [] + warnings.warn(exc.RequestsVersionTooOld, + "This version of Requests is only compatible with a " + "version of urllib3 which is too old to support " + "setting options on a socket. This adapter is " + "functionally useless.") + + def __init__(self, **kwargs): + self.socket_options = kwargs.pop('socket_options', + self.default_options) + + super(SocketOptionsAdapter, self).__init__(**kwargs) + + def init_poolmanager(self, connections, maxsize, block=False): + if requests.__build__ >= 0x020400: + # NOTE(Ian): Perhaps we should raise a warning + self.poolmanager = poolmanager.PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + socket_options=self.socket_options + ) + else: + super(SocketOptionsAdapter, self).init_poolmanager( + connections, maxsize, block + ) + + +class TCPKeepAliveAdapter(SocketOptionsAdapter): + """An adapter for requests that turns on TCP Keep-Alive by default. + + The adapter sets 4 socket options: + + - ``SOL_SOCKET`` ``SO_KEEPALIVE`` - This turns on TCP Keep-Alive + - ``IPPROTO_TCP`` ``TCP_KEEPINTVL`` 20 - Sets the keep alive interval + - ``IPPROTO_TCP`` ``TCP_KEEPCNT`` 5 - Sets the number of keep alive probes + - ``IPPROTO_TCP`` ``TCP_KEEPIDLE`` 60 - Sets the keep alive time if the + socket library has the ``TCP_KEEPIDLE`` constant + + The latter three can be overridden by keyword arguments (respectively): + + - ``interval`` + - ``count`` + - ``idle`` + + You can use this adapter like so:: + + >>> from requests_toolbelt.adapters import socket_options + >>> tcp = socket_options.TCPKeepAliveAdapter(idle=120, interval=10) + >>> s = requests.Session() + >>> s.mount('http://', tcp) + + """ + + def __init__(self, **kwargs): + socket_options = kwargs.pop('socket_options', + SocketOptionsAdapter.default_options) + idle = kwargs.pop('idle', 60) + interval = kwargs.pop('interval', 20) + count = kwargs.pop('count', 5) + socket_options = socket_options + [ + (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) + ] + + # NOTE(Ian): OSX does not have these constants defined, so we + # set them conditionally. + if getattr(socket, 'TCP_KEEPINTVL', None) is not None: + socket_options += [(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, + interval)] + elif sys.platform == 'darwin': + # On OSX, TCP_KEEPALIVE from netinet/tcp.h is not exported + # by python's socket module + TCP_KEEPALIVE = getattr(socket, 'TCP_KEEPALIVE', 0x10) + socket_options += [(socket.IPPROTO_TCP, TCP_KEEPALIVE, interval)] + + if getattr(socket, 'TCP_KEEPCNT', None) is not None: + socket_options += [(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, count)] + + if getattr(socket, 'TCP_KEEPIDLE', None) is not None: + socket_options += [(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, idle)] + + super(TCPKeepAliveAdapter, self).__init__( + socket_options=socket_options, **kwargs + ) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/source.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/source.py new file mode 100644 index 0000000000000000000000000000000000000000..d3dda797acc29c7024f07d1e6dd7c3e688607573 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/source.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +""" +requests_toolbelt.source_adapter +================================ + +This file contains an implementation of the SourceAddressAdapter originally +demonstrated on the Requests GitHub page. +""" +from requests.adapters import HTTPAdapter + +from .._compat import poolmanager, basestring + + +class SourceAddressAdapter(HTTPAdapter): + """ + A Source Address Adapter for Python Requests that enables you to choose the + local address to bind to. This allows you to send your HTTP requests from a + specific interface and IP address. + + Two address formats are accepted. The first is a string: this will set the + local IP address to the address given in the string, and will also choose a + semi-random high port for the local port number. + + The second is a two-tuple of the form (ip address, port): for example, + ``('10.10.10.10', 8999)``. This will set the local IP address to the first + element, and the local port to the second element. If ``0`` is used as the + port number, a semi-random high port will be selected. + + .. warning:: Setting an explicit local port can have negative interactions + with connection-pooling in Requests: in particular, it risks + the possibility of getting "Address in use" errors. The + string-only argument is generally preferred to the tuple-form. + + Example usage: + + .. code-block:: python + + import requests + from requests_toolbelt.adapters.source import SourceAddressAdapter + + s = requests.Session() + s.mount('http://', SourceAddressAdapter('10.10.10.10')) + s.mount('https://', SourceAddressAdapter(('10.10.10.10', 8999))) + """ + def __init__(self, source_address, **kwargs): + if isinstance(source_address, basestring): + self.source_address = (source_address, 0) + elif isinstance(source_address, tuple): + self.source_address = source_address + else: + raise TypeError( + "source_address must be IP address string or (ip, port) tuple" + ) + + super(SourceAddressAdapter, self).__init__(**kwargs) + + def init_poolmanager(self, connections, maxsize, block=False): + self.poolmanager = poolmanager.PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + source_address=self.source_address) + + def proxy_manager_for(self, *args, **kwargs): + kwargs['source_address'] = self.source_address + return super(SourceAddressAdapter, self).proxy_manager_for( + *args, **kwargs) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/ssl.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/ssl.py new file mode 100644 index 0000000000000000000000000000000000000000..c4a76ae4553984e2b2983a89258704c9e8fd238c --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/ssl.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +""" + +requests_toolbelt.ssl_adapter +============================= + +This file contains an implementation of the SSLAdapter originally demonstrated +in this blog post: +https://lukasa.co.uk/2013/01/Choosing_SSL_Version_In_Requests/ + +""" +import requests + +from requests.adapters import HTTPAdapter + +from .._compat import poolmanager + + +class SSLAdapter(HTTPAdapter): + """ + A HTTPS Adapter for Python Requests that allows the choice of the SSL/TLS + version negotiated by Requests. This can be used either to enforce the + choice of high-security TLS versions (where supported), or to work around + misbehaving servers that fail to correctly negotiate the default TLS + version being offered. + + Example usage: + + >>> import requests + >>> import ssl + >>> from requests_toolbelt import SSLAdapter + >>> s = requests.Session() + >>> s.mount('https://', SSLAdapter(ssl.PROTOCOL_TLSv1)) + + You can replace the chosen protocol with any that are available in the + default Python SSL module. All subsequent requests that match the adapter + prefix will use the chosen SSL version instead of the default. + + This adapter will also attempt to change the SSL/TLS version negotiated by + Requests when using a proxy. However, this may not always be possible: + prior to Requests v2.4.0 the adapter did not have access to the proxy setup + code. In earlier versions of Requests, this adapter will not function + properly when used with proxies. + """ + + __attrs__ = HTTPAdapter.__attrs__ + ['ssl_version'] + + def __init__(self, ssl_version=None, **kwargs): + self.ssl_version = ssl_version + + super(SSLAdapter, self).__init__(**kwargs) + + def init_poolmanager(self, connections, maxsize, block=False): + self.poolmanager = poolmanager.PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + ssl_version=self.ssl_version) + + if requests.__build__ >= 0x020400: + # Earlier versions of requests either don't have this method or, worse, + # don't allow passing arbitrary keyword arguments. As a result, only + # conditionally define this method. + def proxy_manager_for(self, *args, **kwargs): + kwargs['ssl_version'] = self.ssl_version + return super(SSLAdapter, self).proxy_manager_for(*args, **kwargs) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/x509.py b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/x509.py new file mode 100644 index 0000000000000000000000000000000000000000..aff37706aba6ee920aa3f7775134b43e85d48565 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/adapters/x509.py @@ -0,0 +1,196 @@ +# -*- coding: utf-8 -*- +"""A X509Adapter for use with the requests library. + +This file contains an implementation of the X509Adapter that will +allow users to authenticate a request using an arbitrary +X.509 certificate without needing to convert it to a .pem file + +""" + +from OpenSSL.crypto import PKey, X509 +from cryptography import x509 +from cryptography.hazmat.primitives.serialization import (load_pem_private_key, + load_der_private_key) +from cryptography.hazmat.primitives.serialization import Encoding +from cryptography.hazmat.backends import default_backend + +from datetime import datetime +from requests.adapters import HTTPAdapter +import requests + +from .. import exceptions as exc + +""" +importing the protocol constants from _ssl instead of ssl because only the +constants are needed and to handle issues caused by importing from ssl on +the 2.7.x line. +""" +try: + from _ssl import PROTOCOL_TLS as PROTOCOL +except ImportError: + from _ssl import PROTOCOL_SSLv23 as PROTOCOL + + +PyOpenSSLContext = None + + +class X509Adapter(HTTPAdapter): + r"""Adapter for use with X.509 certificates. + + Provides an interface for Requests sessions to contact HTTPS urls and + authenticate with an X.509 cert by implementing the Transport Adapter + interface. This class will need to be manually instantiated and mounted + to the session + + :param pool_connections: The number of urllib3 connection pools to + cache. + :param pool_maxsize: The maximum number of connections to save in the + pool. + :param max_retries: The maximum number of retries each connection + should attempt. Note, this applies only to failed DNS lookups, + socket connections and connection timeouts, never to requests where + data has made it to the server. By default, Requests does not retry + failed connections. If you need granular control over the + conditions under which we retry a request, import urllib3's + ``Retry`` class and pass that instead. + :param pool_block: Whether the connection pool should block for + connections. + + :param bytes cert_bytes: + bytes object containing contents of a cryptography.x509Certificate + object using the encoding specified by the ``encoding`` parameter. + :param bytes pk_bytes: + bytes object containing contents of a object that implements + ``cryptography.hazmat.primitives.serialization.PrivateFormat`` + using the encoding specified by the ``encoding`` parameter. + :param password: + string or utf8 encoded bytes containing the passphrase used for the + private key. None if unencrypted. Defaults to None. + :param encoding: + Enumeration detailing the encoding method used on the ``cert_bytes`` + parameter. Can be either PEM or DER. Defaults to PEM. + :type encoding: + :class: `cryptography.hazmat.primitives.serialization.Encoding` + + Usage:: + + >>> import requests + >>> from requests_toolbelt.adapters.x509 import X509Adapter + >>> s = requests.Session() + >>> a = X509Adapter(max_retries=3, + cert_bytes=b'...', pk_bytes=b'...', encoding='...' + >>> s.mount('https://', a) + """ + + def __init__(self, *args, **kwargs): + self._import_pyopensslcontext() + self._check_version() + cert_bytes = kwargs.pop('cert_bytes', None) + pk_bytes = kwargs.pop('pk_bytes', None) + password = kwargs.pop('password', None) + encoding = kwargs.pop('encoding', Encoding.PEM) + + password_bytes = None + + if cert_bytes is None or not isinstance(cert_bytes, bytes): + raise ValueError('Invalid cert content provided. ' + 'You must provide an X.509 cert ' + 'formatted as a byte array.') + if pk_bytes is None or not isinstance(pk_bytes, bytes): + raise ValueError('Invalid private key content provided. ' + 'You must provide a private key ' + 'formatted as a byte array.') + + if isinstance(password, bytes): + password_bytes = password + elif password: + password_bytes = password.encode('utf8') + + self.ssl_context = create_ssl_context(cert_bytes, pk_bytes, + password_bytes, encoding) + + super(X509Adapter, self).__init__(*args, **kwargs) + + def init_poolmanager(self, *args, **kwargs): + if self.ssl_context: + kwargs['ssl_context'] = self.ssl_context + return super(X509Adapter, self).init_poolmanager(*args, **kwargs) + + def proxy_manager_for(self, *args, **kwargs): + if self.ssl_context: + kwargs['ssl_context'] = self.ssl_context + return super(X509Adapter, self).proxy_manager_for(*args, **kwargs) + + def _import_pyopensslcontext(self): + global PyOpenSSLContext + + if requests.__build__ < 0x021200: + PyOpenSSLContext = None + else: + try: + from requests.packages.urllib3.contrib.pyopenssl \ + import PyOpenSSLContext + except ImportError: + try: + from urllib3.contrib.pyopenssl import PyOpenSSLContext + except ImportError: + PyOpenSSLContext = None + + def _check_version(self): + if PyOpenSSLContext is None: + raise exc.VersionMismatchError( + "The X509Adapter requires at least Requests 2.12.0 to be " + "installed. Version {} was found instead.".format( + requests.__version__ + ) + ) + + +def check_cert_dates(cert): + """Verify that the supplied client cert is not invalid.""" + + now = datetime.utcnow() + if cert.not_valid_after < now or cert.not_valid_before > now: + raise ValueError('Client certificate expired: Not After: ' + '{:%Y-%m-%d %H:%M:%SZ} ' + 'Not Before: {:%Y-%m-%d %H:%M:%SZ}' + .format(cert.not_valid_after, cert.not_valid_before)) + + +def create_ssl_context(cert_byes, pk_bytes, password=None, + encoding=Encoding.PEM): + """Create an SSL Context with the supplied cert/password. + + :param cert_bytes array of bytes containing the cert encoded + using the method supplied in the ``encoding`` parameter + :param pk_bytes array of bytes containing the private key encoded + using the method supplied in the ``encoding`` parameter + :param password array of bytes containing the passphrase to be used + with the supplied private key. None if unencrypted. + Defaults to None. + :param encoding ``cryptography.hazmat.primitives.serialization.Encoding`` + details the encoding method used on the ``cert_bytes`` and + ``pk_bytes`` parameters. Can be either PEM or DER. + Defaults to PEM. + """ + backend = default_backend() + + cert = None + key = None + if encoding == Encoding.PEM: + cert = x509.load_pem_x509_certificate(cert_byes, backend) + key = load_pem_private_key(pk_bytes, password, backend) + elif encoding == Encoding.DER: + cert = x509.load_der_x509_certificate(cert_byes, backend) + key = load_der_private_key(pk_bytes, password, backend) + else: + raise ValueError('Invalid encoding provided: Must be PEM or DER') + + if not (cert and key): + raise ValueError('Cert and key could not be parsed from ' + 'provided data') + check_cert_dates(cert) + ssl_context = PyOpenSSLContext(PROTOCOL) + ssl_context._ctx.use_certificate(X509.from_cryptography(cert)) + ssl_context._ctx.use_privatekey(PKey.from_cryptography_key(key)) + return ssl_context diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e262bd3133ab9ce7889c37d1a213a23aeb0d81d Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/_digest_auth_compat.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/_digest_auth_compat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e42bc59f24823e076f8296f0fe5803fffbec40c2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/_digest_auth_compat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/guess.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/guess.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45dcfc3e0df2037efc04a5f157f35bba9b4d3ab4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/guess.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/handler.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/handler.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cdb9b0e435fe9a0f430aff280c792e380a93b414 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/handler.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/http_proxy_digest.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/http_proxy_digest.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd9382a8a4421f13abbe6fdb14af6d8c2c871fb1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/__pycache__/http_proxy_digest.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/_digest_auth_compat.py b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/_digest_auth_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..285a6a76309a2e1775afe13d7184491f80384b99 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/_digest_auth_compat.py @@ -0,0 +1,29 @@ +"""Provide a compatibility layer for requests.auth.HTTPDigestAuth.""" +import requests + + +class _ThreadingDescriptor(object): + def __init__(self, prop, default): + self.prop = prop + self.default = default + + def __get__(self, obj, objtype=None): + return getattr(obj._thread_local, self.prop, self.default) + + def __set__(self, obj, value): + setattr(obj._thread_local, self.prop, value) + + +class _HTTPDigestAuth(requests.auth.HTTPDigestAuth): + init = _ThreadingDescriptor('init', True) + last_nonce = _ThreadingDescriptor('last_nonce', '') + nonce_count = _ThreadingDescriptor('nonce_count', 0) + chal = _ThreadingDescriptor('chal', {}) + pos = _ThreadingDescriptor('pos', None) + num_401_calls = _ThreadingDescriptor('num_401_calls', 1) + + +if requests.__build__ < 0x020800: + HTTPDigestAuth = requests.auth.HTTPDigestAuth +else: + HTTPDigestAuth = _HTTPDigestAuth diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/guess.py b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/guess.py new file mode 100644 index 0000000000000000000000000000000000000000..ba6de504a85a575b12a24245aec15321c967f7fd --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/guess.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +"""The module containing the code for GuessAuth.""" +from requests import auth +from requests import cookies + +from . import _digest_auth_compat as auth_compat, http_proxy_digest + + +class GuessAuth(auth.AuthBase): + """Guesses the auth type by the WWW-Authentication header.""" + def __init__(self, username, password): + self.username = username + self.password = password + self.auth = None + self.pos = None + + def _handle_basic_auth_401(self, r, kwargs): + if self.pos is not None: + r.request.body.seek(self.pos) + + # Consume content and release the original connection + # to allow our new request to reuse the same one. + r.content + r.raw.release_conn() + prep = r.request.copy() + if not hasattr(prep, '_cookies'): + prep._cookies = cookies.RequestsCookieJar() + cookies.extract_cookies_to_jar(prep._cookies, r.request, r.raw) + prep.prepare_cookies(prep._cookies) + + self.auth = auth.HTTPBasicAuth(self.username, self.password) + prep = self.auth(prep) + _r = r.connection.send(prep, **kwargs) + _r.history.append(r) + _r.request = prep + + return _r + + def _handle_digest_auth_401(self, r, kwargs): + self.auth = auth_compat.HTTPDigestAuth(self.username, self.password) + try: + self.auth.init_per_thread_state() + except AttributeError: + # If we're not on requests 2.8.0+ this method does not exist and + # is not relevant. + pass + + # Check that the attr exists because much older versions of requests + # set this attribute lazily. For example: + # https://github.com/kennethreitz/requests/blob/33735480f77891754304e7f13e3cdf83aaaa76aa/requests/auth.py#L59 + if (hasattr(self.auth, 'num_401_calls') and + self.auth.num_401_calls is None): + self.auth.num_401_calls = 1 + # Digest auth would resend the request by itself. We can take a + # shortcut here. + return self.auth.handle_401(r, **kwargs) + + def handle_401(self, r, **kwargs): + """Resends a request with auth headers, if needed.""" + + www_authenticate = r.headers.get('www-authenticate', '').lower() + + if 'basic' in www_authenticate: + return self._handle_basic_auth_401(r, kwargs) + + if 'digest' in www_authenticate: + return self._handle_digest_auth_401(r, kwargs) + + def __call__(self, request): + if self.auth is not None: + return self.auth(request) + + try: + self.pos = request.body.tell() + except AttributeError: + pass + + request.register_hook('response', self.handle_401) + return request + + +class GuessProxyAuth(GuessAuth): + """ + Guesses the auth type by WWW-Authentication and Proxy-Authentication + headers + """ + def __init__(self, username=None, password=None, + proxy_username=None, proxy_password=None): + super(GuessProxyAuth, self).__init__(username, password) + self.proxy_username = proxy_username + self.proxy_password = proxy_password + self.proxy_auth = None + + def _handle_basic_auth_407(self, r, kwargs): + if self.pos is not None: + r.request.body.seek(self.pos) + + r.content + r.raw.release_conn() + prep = r.request.copy() + if not hasattr(prep, '_cookies'): + prep._cookies = cookies.RequestsCookieJar() + cookies.extract_cookies_to_jar(prep._cookies, r.request, r.raw) + prep.prepare_cookies(prep._cookies) + + self.proxy_auth = auth.HTTPProxyAuth(self.proxy_username, + self.proxy_password) + prep = self.proxy_auth(prep) + _r = r.connection.send(prep, **kwargs) + _r.history.append(r) + _r.request = prep + + return _r + + def _handle_digest_auth_407(self, r, kwargs): + self.proxy_auth = http_proxy_digest.HTTPProxyDigestAuth( + username=self.proxy_username, + password=self.proxy_password) + + try: + self.auth.init_per_thread_state() + except AttributeError: + pass + + return self.proxy_auth.handle_407(r, **kwargs) + + def handle_407(self, r, **kwargs): + proxy_authenticate = r.headers.get('Proxy-Authenticate', '').lower() + + if 'basic' in proxy_authenticate: + return self._handle_basic_auth_407(r, kwargs) + + if 'digest' in proxy_authenticate: + return self._handle_digest_auth_407(r, kwargs) + + def __call__(self, request): + if self.proxy_auth is not None: + request = self.proxy_auth(request) + + try: + self.pos = request.body.tell() + except AttributeError: + pass + + request.register_hook('response', self.handle_407) + return super(GuessProxyAuth, self).__call__(request) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/handler.py b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/handler.py new file mode 100644 index 0000000000000000000000000000000000000000..0b4051a8028acc7904faf40a4b8e7fc78c797951 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/handler.py @@ -0,0 +1,142 @@ +# -*- coding: utf-8 -*- +""" + +requests_toolbelt.auth.handler +============================== + +This holds all of the implementation details of the Authentication Handler. + +""" + +from requests.auth import AuthBase, HTTPBasicAuth +from requests.compat import urlparse, urlunparse + + +class AuthHandler(AuthBase): + + """ + + The ``AuthHandler`` object takes a dictionary of domains paired with + authentication strategies and will use this to determine which credentials + to use when making a request. For example, you could do the following: + + .. code-block:: python + + from requests import HTTPDigestAuth + from requests_toolbelt.auth.handler import AuthHandler + + import requests + + auth = AuthHandler({ + 'https://api.github.com': ('sigmavirus24', 'fakepassword'), + 'https://example.com': HTTPDigestAuth('username', 'password') + }) + + r = requests.get('https://api.github.com/user', auth=auth) + # => + r = requests.get('https://example.com/some/path', auth=auth) + # => + + s = requests.Session() + s.auth = auth + r = s.get('https://api.github.com/user') + # => + + .. warning:: + + :class:`requests.auth.HTTPDigestAuth` is not yet thread-safe. If you + use :class:`AuthHandler` across multiple threads you should + instantiate a new AuthHandler for each thread with a new + HTTPDigestAuth instance for each thread. + + """ + + def __init__(self, strategies): + self.strategies = dict(strategies) + self._make_uniform() + + def __call__(self, request): + auth = self.get_strategy_for(request.url) + return auth(request) + + def __repr__(self): + return ''.format(self.strategies) + + def _make_uniform(self): + existing_strategies = list(self.strategies.items()) + self.strategies = {} + + for (k, v) in existing_strategies: + self.add_strategy(k, v) + + @staticmethod + def _key_from_url(url): + parsed = urlparse(url) + return urlunparse((parsed.scheme.lower(), + parsed.netloc.lower(), + '', '', '', '')) + + def add_strategy(self, domain, strategy): + """Add a new domain and authentication strategy. + + :param str domain: The domain you wish to match against. For example: + ``'https://api.github.com'`` + :param str strategy: The authentication strategy you wish to use for + that domain. For example: ``('username', 'password')`` or + ``requests.HTTPDigestAuth('username', 'password')`` + + .. code-block:: python + + a = AuthHandler({}) + a.add_strategy('https://api.github.com', ('username', 'password')) + + """ + # Turn tuples into Basic Authentication objects + if isinstance(strategy, tuple): + strategy = HTTPBasicAuth(*strategy) + + key = self._key_from_url(domain) + self.strategies[key] = strategy + + def get_strategy_for(self, url): + """Retrieve the authentication strategy for a specified URL. + + :param str url: The full URL you will be making a request against. For + example, ``'https://api.github.com/user'`` + :returns: Callable that adds authentication to a request. + + .. code-block:: python + + import requests + a = AuthHandler({'example.com', ('foo', 'bar')}) + strategy = a.get_strategy_for('http://example.com/example') + assert isinstance(strategy, requests.auth.HTTPBasicAuth) + + """ + key = self._key_from_url(url) + return self.strategies.get(key, NullAuthStrategy()) + + def remove_strategy(self, domain): + """Remove the domain and strategy from the collection of strategies. + + :param str domain: The domain you wish remove. For example, + ``'https://api.github.com'``. + + .. code-block:: python + + a = AuthHandler({'example.com', ('foo', 'bar')}) + a.remove_strategy('example.com') + assert a.strategies == {} + + """ + key = self._key_from_url(domain) + if key in self.strategies: + del self.strategies[key] + + +class NullAuthStrategy(AuthBase): + def __repr__(self): + return '' + + def __call__(self, r): + return r diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/auth/http_proxy_digest.py b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/http_proxy_digest.py new file mode 100644 index 0000000000000000000000000000000000000000..7e1f69ef7efecf7ae0de20220a03223b4216f6e5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/auth/http_proxy_digest.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +"""The module containing HTTPProxyDigestAuth.""" +import re + +from requests import cookies, utils + +from . import _digest_auth_compat as auth + + +class HTTPProxyDigestAuth(auth.HTTPDigestAuth): + """HTTP digest authentication between proxy + + :param stale_rejects: The number of rejects indicate that: + the client may wish to simply retry the request + with a new encrypted response, without reprompting the user for a + new username and password. i.e., retry build_digest_header + :type stale_rejects: int + """ + _pat = re.compile(r'digest ', flags=re.IGNORECASE) + + def __init__(self, *args, **kwargs): + super(HTTPProxyDigestAuth, self).__init__(*args, **kwargs) + self.stale_rejects = 0 + + self.init_per_thread_state() + + @property + def stale_rejects(self): + thread_local = getattr(self, '_thread_local', None) + if thread_local is None: + return self._stale_rejects + return thread_local.stale_rejects + + @stale_rejects.setter + def stale_rejects(self, value): + thread_local = getattr(self, '_thread_local', None) + if thread_local is None: + self._stale_rejects = value + else: + thread_local.stale_rejects = value + + def init_per_thread_state(self): + try: + super(HTTPProxyDigestAuth, self).init_per_thread_state() + except AttributeError: + # If we're not on requests 2.8.0+ this method does not exist + pass + + def handle_407(self, r, **kwargs): + """Handle HTTP 407 only once, otherwise give up + + :param r: current response + :returns: responses, along with the new response + """ + if r.status_code == 407 and self.stale_rejects < 2: + s_auth = r.headers.get("proxy-authenticate") + if s_auth is None: + raise IOError( + "proxy server violated RFC 7235:" + "407 response MUST contain header proxy-authenticate") + elif not self._pat.match(s_auth): + return r + + self.chal = utils.parse_dict_header( + self._pat.sub('', s_auth, count=1)) + + # if we present the user/passwd and still get rejected + # https://tools.ietf.org/html/rfc2617#section-3.2.1 + if ('Proxy-Authorization' in r.request.headers and + 'stale' in self.chal): + if self.chal['stale'].lower() == 'true': # try again + self.stale_rejects += 1 + # wrong user/passwd + elif self.chal['stale'].lower() == 'false': + raise IOError("User or password is invalid") + + # Consume content and release the original connection + # to allow our new request to reuse the same one. + r.content + r.close() + prep = r.request.copy() + cookies.extract_cookies_to_jar(prep._cookies, r.request, r.raw) + prep.prepare_cookies(prep._cookies) + + prep.headers['Proxy-Authorization'] = self.build_digest_header( + prep.method, prep.url) + _r = r.connection.send(prep, **kwargs) + _r.history.append(r) + _r.request = prep + + return _r + else: # give up authenticate + return r + + def __call__(self, r): + self.init_per_thread_state() + # if we have nonce, then just use it, otherwise server will tell us + if self.last_nonce: + r.headers['Proxy-Authorization'] = self.build_digest_header( + r.method, r.url + ) + r.register_hook('response', self.handle_407) + return r diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7c325ea510e497c694d921c7deebae164f646726 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__pycache__/forgetful.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__pycache__/forgetful.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..14a60ed84a1f8ac54b86e9bb5d9086bcdb21d37e Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/__pycache__/forgetful.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/forgetful.py b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/forgetful.py new file mode 100644 index 0000000000000000000000000000000000000000..33203638470956e2eb42b3d518f2be6882ac2079 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/cookies/forgetful.py @@ -0,0 +1,7 @@ +"""The module containing the code for ForgetfulCookieJar.""" +from requests.cookies import RequestsCookieJar + + +class ForgetfulCookieJar(RequestsCookieJar): + def set_cookie(self, *args, **kwargs): + return diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..02f8619e3a90b9c11d4a140604170d1000f91df6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/stream.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/stream.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0f420a2e530a48c6b4d58649494e596a06df407 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/stream.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64d63e5d3069bda61ffbf333e9b44f211bb6a53a Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/__pycache__/tee.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/stream.py b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/stream.py new file mode 100644 index 0000000000000000000000000000000000000000..7253d96e019e46a60aae2644aaf0149a49e337f6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/stream.py @@ -0,0 +1,176 @@ +# -*- coding: utf-8 -*- +"""Utilities for dealing with streamed requests.""" +import os.path +import re + +from .. import exceptions as exc + +# Regular expressions stolen from werkzeug/http.py +# cd2c97bb0a076da2322f11adce0b2731f9193396 L62-L64 +_QUOTED_STRING_RE = r'"[^"\\]*(?:\\.[^"\\]*)*"' +_OPTION_HEADER_PIECE_RE = re.compile( + r';\s*(%s|[^\s;=]+)\s*(?:=\s*(%s|[^;]+))?\s*' % (_QUOTED_STRING_RE, + _QUOTED_STRING_RE) +) +_DEFAULT_CHUNKSIZE = 512 + + +def _get_filename(content_disposition): + for match in _OPTION_HEADER_PIECE_RE.finditer(content_disposition): + k, v = match.groups() + if k == 'filename': + # ignore any directory paths in the filename + return os.path.split(v)[1] + return None + + +def get_download_file_path(response, path): + """ + Given a response and a path, return a file path for a download. + + If a ``path`` parameter is a directory, this function will parse the + ``Content-Disposition`` header on the response to determine the name of the + file as reported by the server, and return a file path in the specified + directory. + + If ``path`` is empty or None, this function will return a path relative + to the process' current working directory. + + If path is a full file path, return it. + + :param response: A Response object from requests + :type response: requests.models.Response + :param str path: Directory or file path. + :returns: full file path to download as + :rtype: str + :raises: :class:`requests_toolbelt.exceptions.StreamingError` + """ + path_is_dir = path and os.path.isdir(path) + + if path and not path_is_dir: + # fully qualified file path + filepath = path + else: + response_filename = _get_filename( + response.headers.get('content-disposition', '') + ) + if not response_filename: + raise exc.StreamingError('No filename given to stream response to') + + if path_is_dir: + # directory to download to + filepath = os.path.join(path, response_filename) + else: + # fallback to downloading to current working directory + filepath = response_filename + + return filepath + + +def stream_response_to_file(response, path=None, chunksize=_DEFAULT_CHUNKSIZE): + """Stream a response body to the specified file. + + Either use the ``path`` provided or use the name provided in the + ``Content-Disposition`` header. + + .. warning:: + + If you pass this function an open file-like object as the ``path`` + parameter, the function will not close that file for you. + + .. warning:: + + This function will not automatically close the response object + passed in as the ``response`` parameter. + + If a ``path`` parameter is a directory, this function will parse the + ``Content-Disposition`` header on the response to determine the name of the + file as reported by the server, and return a file path in the specified + directory. If no ``path`` parameter is supplied, this function will default + to the process' current working directory. + + .. code-block:: python + + import requests + from requests_toolbelt import exceptions + from requests_toolbelt.downloadutils import stream + + r = requests.get(url, stream=True) + try: + filename = stream.stream_response_to_file(r) + except exceptions.StreamingError as e: + # The toolbelt could not find the filename in the + # Content-Disposition + print(e.message) + + You can also specify the filename as a string. This will be passed to + the built-in :func:`open` and we will read the content into the file. + + .. code-block:: python + + import requests + from requests_toolbelt.downloadutils import stream + + r = requests.get(url, stream=True) + filename = stream.stream_response_to_file(r, path='myfile') + + If the calculated download file path already exists, this function will + raise a StreamingError. + + Instead, if you want to manage the file object yourself, you need to + provide either a :class:`io.BytesIO` object or a file opened with the + `'b'` flag. See the two examples below for more details. + + .. code-block:: python + + import requests + from requests_toolbelt.downloadutils import stream + + with open('myfile', 'wb') as fd: + r = requests.get(url, stream=True) + filename = stream.stream_response_to_file(r, path=fd) + + print('{} saved to {}'.format(url, filename)) + + .. code-block:: python + + import io + import requests + from requests_toolbelt.downloadutils import stream + + b = io.BytesIO() + r = requests.get(url, stream=True) + filename = stream.stream_response_to_file(r, path=b) + assert filename is None + + :param response: A Response object from requests + :type response: requests.models.Response + :param path: *(optional)*, Either a string with the path to the location + to save the response content, or a file-like object expecting bytes. + :type path: :class:`str`, or object with a :meth:`write` + :param int chunksize: (optional), Size of chunk to attempt to stream + (default 512B). + :returns: The name of the file, if one can be determined, else None + :rtype: str + :raises: :class:`requests_toolbelt.exceptions.StreamingError` + """ + pre_opened = False + fd = None + filename = None + if path and callable(getattr(path, 'write', None)): + pre_opened = True + fd = path + filename = getattr(fd, 'name', None) + else: + filename = get_download_file_path(response, path) + if os.path.exists(filename): + raise exc.StreamingError("File already exists: %s" % filename) + fd = open(filename, 'wb') + + for chunk in response.iter_content(chunk_size=chunksize): + fd.write(chunk) + + if not pre_opened: + fd.close() + + return filename diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/tee.py b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/tee.py new file mode 100644 index 0000000000000000000000000000000000000000..ecc7d0cddb99a4bf3664fb7b63b81afabbaff614 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/downloadutils/tee.py @@ -0,0 +1,123 @@ +"""Tee function implementations.""" +import io + +_DEFAULT_CHUNKSIZE = 65536 + +__all__ = ['tee', 'tee_to_file', 'tee_to_bytearray'] + + +def _tee(response, callback, chunksize, decode_content): + for chunk in response.raw.stream(amt=chunksize, + decode_content=decode_content): + callback(chunk) + yield chunk + + +def tee(response, fileobject, chunksize=_DEFAULT_CHUNKSIZE, + decode_content=None): + """Stream the response both to the generator and a file. + + This will stream the response body while writing the bytes to + ``fileobject``. + + Example usage: + + .. code-block:: python + + resp = requests.get(url, stream=True) + with open('save_file', 'wb') as save_file: + for chunk in tee(resp, save_file): + # do stuff with chunk + + .. code-block:: python + + import io + + resp = requests.get(url, stream=True) + fileobject = io.BytesIO() + + for chunk in tee(resp, fileobject): + # do stuff with chunk + + :param response: Response from requests. + :type response: requests.Response + :param fileobject: Writable file-like object. + :type fileobject: file, io.BytesIO + :param int chunksize: (optional), Size of chunk to attempt to stream. + :param bool decode_content: (optional), If True, this will decode the + compressed content of the response. + :raises: TypeError if the fileobject wasn't opened with the right mode + or isn't a BytesIO object. + """ + # We will be streaming the raw bytes from over the wire, so we need to + # ensure that writing to the fileobject will preserve those bytes. On + # Python3, if the user passes an io.StringIO, this will fail, so we need + # to check for BytesIO instead. + if not ('b' in getattr(fileobject, 'mode', '') or + isinstance(fileobject, io.BytesIO)): + raise TypeError('tee() will write bytes directly to this fileobject' + ', it must be opened with the "b" flag if it is a file' + ' or inherit from io.BytesIO.') + + return _tee(response, fileobject.write, chunksize, decode_content) + + +def tee_to_file(response, filename, chunksize=_DEFAULT_CHUNKSIZE, + decode_content=None): + """Stream the response both to the generator and a file. + + This will open a file named ``filename`` and stream the response body + while writing the bytes to the opened file object. + + Example usage: + + .. code-block:: python + + resp = requests.get(url, stream=True) + for chunk in tee_to_file(resp, 'save_file'): + # do stuff with chunk + + :param response: Response from requests. + :type response: requests.Response + :param str filename: Name of file in which we write the response content. + :param int chunksize: (optional), Size of chunk to attempt to stream. + :param bool decode_content: (optional), If True, this will decode the + compressed content of the response. + """ + with open(filename, 'wb') as fd: + for chunk in tee(response, fd, chunksize, decode_content): + yield chunk + + +def tee_to_bytearray(response, bytearr, chunksize=_DEFAULT_CHUNKSIZE, + decode_content=None): + """Stream the response both to the generator and a bytearray. + + This will stream the response provided to the function, add them to the + provided :class:`bytearray` and yield them to the user. + + .. note:: + + This uses the :meth:`bytearray.extend` by default instead of passing + the bytearray into the ``readinto`` method. + + Example usage: + + .. code-block:: python + + b = bytearray() + resp = requests.get(url, stream=True) + for chunk in tee_to_bytearray(resp, b): + # do stuff with chunk + + :param response: Response from requests. + :type response: requests.Response + :param bytearray bytearr: Array to add the streamed bytes to. + :param int chunksize: (optional), Size of chunk to attempt to stream. + :param bool decode_content: (optional), If True, this will decode the + compressed content of the response. + """ + if not isinstance(bytearr, bytearray): + raise TypeError('tee_to_bytearray() expects bytearr to be a ' + 'bytearray') + return _tee(response, bytearr.extend, chunksize, decode_content) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d3bced1c85849e4562ce94216e38cea47406ec89 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__init__.py @@ -0,0 +1,31 @@ +""" +requests_toolbelt.multipart +=========================== + +See https://toolbelt.readthedocs.io/ for documentation + +:copyright: (c) 2014 by Ian Cordasco and Cory Benfield +:license: Apache v2.0, see LICENSE for more details +""" + +from .encoder import MultipartEncoder, MultipartEncoderMonitor +from .decoder import MultipartDecoder +from .decoder import ImproperBodyPartContentException +from .decoder import NonMultipartContentTypeException + +__title__ = 'requests-toolbelt' +__authors__ = 'Ian Cordasco, Cory Benfield' +__license__ = 'Apache v2.0' +__copyright__ = 'Copyright 2014 Ian Cordasco, Cory Benfield' + +__all__ = [ + 'MultipartEncoder', + 'MultipartEncoderMonitor', + 'MultipartDecoder', + 'ImproperBodyPartContentException', + 'NonMultipartContentTypeException', + '__title__', + '__authors__', + '__license__', + '__copyright__', +] diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f831cf360ad21dda5ed434efddbbb9b261ff8e76 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/decoder.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/decoder.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cef133d79e505ada8bfcfcb93616fd049ce82752 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/decoder.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/encoder.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/encoder.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80421f8d658e82f0b536b766adafa8e3cc34305e Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/__pycache__/encoder.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/decoder.py b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/decoder.py new file mode 100644 index 0000000000000000000000000000000000000000..2a0d1c46d7bb47c262a6cb30b100f7300512dbb0 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/decoder.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +""" + +requests_toolbelt.multipart.decoder +=================================== + +This holds all the implementation details of the MultipartDecoder + +""" + +import sys +import email.parser +from .encoder import encode_with +from requests.structures import CaseInsensitiveDict + + +def _split_on_find(content, bound): + point = content.find(bound) + return content[:point], content[point + len(bound):] + + +class ImproperBodyPartContentException(Exception): + pass + + +class NonMultipartContentTypeException(Exception): + pass + + +def _header_parser(string, encoding): + major = sys.version_info[0] + if major == 3: + string = string.decode(encoding) + headers = email.parser.HeaderParser().parsestr(string).items() + return ( + (encode_with(k, encoding), encode_with(v, encoding)) + for k, v in headers + ) + + +class BodyPart(object): + """ + + The ``BodyPart`` object is a ``Response``-like interface to an individual + subpart of a multipart response. It is expected that these will + generally be created by objects of the ``MultipartDecoder`` class. + + Like ``Response``, there is a ``CaseInsensitiveDict`` object named headers, + ``content`` to access bytes, ``text`` to access unicode, and ``encoding`` + to access the unicode codec. + + """ + + def __init__(self, content, encoding): + self.encoding = encoding + headers = {} + # Split into header section (if any) and the content + if b'\r\n\r\n' in content: + first, self.content = _split_on_find(content, b'\r\n\r\n') + if first != b'': + headers = _header_parser(first.lstrip(), encoding) + else: + raise ImproperBodyPartContentException( + 'content does not contain CR-LF-CR-LF' + ) + self.headers = CaseInsensitiveDict(headers) + + @property + def text(self): + """Content of the ``BodyPart`` in unicode.""" + return self.content.decode(self.encoding) + + +class MultipartDecoder(object): + """ + + The ``MultipartDecoder`` object parses the multipart payload of + a bytestring into a tuple of ``Response``-like ``BodyPart`` objects. + + The basic usage is:: + + import requests + from requests_toolbelt import MultipartDecoder + + response = requests.get(url) + decoder = MultipartDecoder.from_response(response) + for part in decoder.parts: + print(part.headers['content-type']) + + If the multipart content is not from a response, basic usage is:: + + from requests_toolbelt import MultipartDecoder + + decoder = MultipartDecoder(content, content_type) + for part in decoder.parts: + print(part.headers['content-type']) + + For both these usages, there is an optional ``encoding`` parameter. This is + a string, which is the name of the unicode codec to use (default is + ``'utf-8'``). + + """ + def __init__(self, content, content_type, encoding='utf-8'): + #: Original Content-Type header + self.content_type = content_type + #: Response body encoding + self.encoding = encoding + #: Parsed parts of the multipart response body + self.parts = tuple() + self._find_boundary() + self._parse_body(content) + + def _find_boundary(self): + ct_info = tuple(x.strip() for x in self.content_type.split(';')) + mimetype = ct_info[0] + if mimetype.split('/')[0].lower() != 'multipart': + raise NonMultipartContentTypeException( + "Unexpected mimetype in content-type: '{}'".format(mimetype) + ) + for item in ct_info[1:]: + attr, value = _split_on_find( + item, + '=' + ) + if attr.lower() == 'boundary': + self.boundary = encode_with(value.strip('"'), self.encoding) + + @staticmethod + def _fix_first_part(part, boundary_marker): + bm_len = len(boundary_marker) + if boundary_marker == part[:bm_len]: + return part[bm_len:] + else: + return part + + def _parse_body(self, content): + boundary = b''.join((b'--', self.boundary)) + + def body_part(part): + fixed = MultipartDecoder._fix_first_part(part, boundary) + return BodyPart(fixed, self.encoding) + + def test_part(part): + return (part != b'' and + part != b'\r\n' and + part[:4] != b'--\r\n' and + part != b'--') + + parts = content.split(b''.join((b'\r\n', boundary))) + self.parts = tuple(body_part(x) for x in parts if test_part(x)) + + @classmethod + def from_response(cls, response, encoding='utf-8'): + content = response.content + content_type = response.headers.get('content-type', None) + return cls(content, content_type, encoding) diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/encoder.py b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..2d5396172c4046a53a15af1d480d4c85a903bcec --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/multipart/encoder.py @@ -0,0 +1,655 @@ +# -*- coding: utf-8 -*- +""" + +requests_toolbelt.multipart.encoder +=================================== + +This holds all of the implementation details of the MultipartEncoder + +""" +import contextlib +import io +import os +from uuid import uuid4 + +import requests + +from .._compat import fields + + +class FileNotSupportedError(Exception): + """File not supported error.""" + + +class MultipartEncoder(object): + + """ + + The ``MultipartEncoder`` object is a generic interface to the engine that + will create a ``multipart/form-data`` body for you. + + The basic usage is: + + .. code-block:: python + + import requests + from requests_toolbelt import MultipartEncoder + + encoder = MultipartEncoder({'field': 'value', + 'other_field': 'other_value'}) + r = requests.post('https://httpbin.org/post', data=encoder, + headers={'Content-Type': encoder.content_type}) + + If you do not need to take advantage of streaming the post body, you can + also do: + + .. code-block:: python + + r = requests.post('https://httpbin.org/post', + data=encoder.to_string(), + headers={'Content-Type': encoder.content_type}) + + If you want the encoder to use a specific order, you can use an + OrderedDict or more simply, a list of tuples: + + .. code-block:: python + + encoder = MultipartEncoder([('field', 'value'), + ('other_field', 'other_value')]) + + .. versionchanged:: 0.4.0 + + You can also provide tuples as part values as you would provide them to + requests' ``files`` parameter. + + .. code-block:: python + + encoder = MultipartEncoder({ + 'field': ('file_name', b'{"a": "b"}', 'application/json', + {'X-My-Header': 'my-value'}) + ]) + + .. warning:: + + This object will end up directly in :mod:`httplib`. Currently, + :mod:`httplib` has a hard-coded read size of **8192 bytes**. This + means that it will loop until the file has been read and your upload + could take a while. This is **not** a bug in requests. A feature is + being considered for this object to allow you, the user, to specify + what size should be returned on a read. If you have opinions on this, + please weigh in on `this issue`_. + + .. _this issue: + https://github.com/requests/toolbelt/issues/75 + + """ + + def __init__(self, fields, boundary=None, encoding='utf-8'): + #: Boundary value either passed in by the user or created + self.boundary_value = boundary or uuid4().hex + + # Computed boundary + self.boundary = '--{}'.format(self.boundary_value) + + #: Encoding of the data being passed in + self.encoding = encoding + + # Pre-encoded boundary + self._encoded_boundary = b''.join([ + encode_with(self.boundary, self.encoding), + encode_with('\r\n', self.encoding) + ]) + + #: Fields provided by the user + self.fields = fields + + #: Whether or not the encoder is finished + self.finished = False + + #: Pre-computed parts of the upload + self.parts = [] + + # Pre-computed parts iterator + self._iter_parts = iter([]) + + # The part we're currently working with + self._current_part = None + + # Cached computation of the body's length + self._len = None + + # Our buffer + self._buffer = CustomBytesIO(encoding=encoding) + + # Pre-compute each part's headers + self._prepare_parts() + + # Load boundary into buffer + self._write_boundary() + + @property + def len(self): + """Length of the multipart/form-data body. + + requests will first attempt to get the length of the body by calling + ``len(body)`` and then by checking for the ``len`` attribute. + + On 32-bit systems, the ``__len__`` method cannot return anything + larger than an integer (in C) can hold. If the total size of the body + is even slightly larger than 4GB users will see an OverflowError. This + manifested itself in `bug #80`_. + + As such, we now calculate the length lazily as a property. + + .. _bug #80: + https://github.com/requests/toolbelt/issues/80 + """ + # If _len isn't already calculated, calculate, return, and set it + return self._len or self._calculate_length() + + def __repr__(self): + return ''.format(self.fields) + + def _calculate_length(self): + """ + This uses the parts to calculate the length of the body. + + This returns the calculated length so __len__ can be lazy. + """ + boundary_len = len(self.boundary) # Length of --{boundary} + # boundary length + header length + body length + len('\r\n') * 2 + self._len = sum( + (boundary_len + total_len(p) + 4) for p in self.parts + ) + boundary_len + 4 + return self._len + + def _calculate_load_amount(self, read_size): + """This calculates how many bytes need to be added to the buffer. + + When a consumer read's ``x`` from the buffer, there are two cases to + satisfy: + + 1. Enough data in the buffer to return the requested amount + 2. Not enough data + + This function uses the amount of unread bytes in the buffer and + determines how much the Encoder has to load before it can return the + requested amount of bytes. + + :param int read_size: the number of bytes the consumer requests + :returns: int -- the number of bytes that must be loaded into the + buffer before the read can be satisfied. This will be strictly + non-negative + """ + amount = read_size - total_len(self._buffer) + return amount if amount > 0 else 0 + + def _load(self, amount): + """Load ``amount`` number of bytes into the buffer.""" + self._buffer.smart_truncate() + part = self._current_part or self._next_part() + while amount == -1 or amount > 0: + written = 0 + if part and not part.bytes_left_to_write(): + written += self._write(b'\r\n') + written += self._write_boundary() + part = self._next_part() + + if not part: + written += self._write_closing_boundary() + self.finished = True + break + + written += part.write_to(self._buffer, amount) + + if amount != -1: + amount -= written + + def _next_part(self): + try: + p = self._current_part = next(self._iter_parts) + except StopIteration: + p = None + return p + + def _iter_fields(self): + _fields = self.fields + if hasattr(self.fields, 'items'): + _fields = list(self.fields.items()) + for k, v in _fields: + file_name = None + file_type = None + file_headers = None + if isinstance(v, (list, tuple)): + if len(v) == 2: + file_name, file_pointer = v + elif len(v) == 3: + file_name, file_pointer, file_type = v + else: + file_name, file_pointer, file_type, file_headers = v + else: + file_pointer = v + + field = fields.RequestField(name=k, data=file_pointer, + filename=file_name, + headers=file_headers) + field.make_multipart(content_type=file_type) + yield field + + def _prepare_parts(self): + """This uses the fields provided by the user and creates Part objects. + + It populates the `parts` attribute and uses that to create a + generator for iteration. + """ + enc = self.encoding + self.parts = [Part.from_field(f, enc) for f in self._iter_fields()] + self._iter_parts = iter(self.parts) + + def _write(self, bytes_to_write): + """Write the bytes to the end of the buffer. + + :param bytes bytes_to_write: byte-string (or bytearray) to append to + the buffer + :returns: int -- the number of bytes written + """ + return self._buffer.append(bytes_to_write) + + def _write_boundary(self): + """Write the boundary to the end of the buffer.""" + return self._write(self._encoded_boundary) + + def _write_closing_boundary(self): + """Write the bytes necessary to finish a multipart/form-data body.""" + with reset(self._buffer): + self._buffer.seek(-2, 2) + self._buffer.write(b'--\r\n') + return 2 + + def _write_headers(self, headers): + """Write the current part's headers to the buffer.""" + return self._write(encode_with(headers, self.encoding)) + + @property + def content_type(self): + return str( + 'multipart/form-data; boundary={}'.format(self.boundary_value) + ) + + def to_string(self): + """Return the entirety of the data in the encoder. + + .. note:: + + This simply reads all of the data it can. If you have started + streaming or reading data from the encoder, this method will only + return whatever data is left in the encoder. + + .. note:: + + This method affects the internal state of the encoder. Calling + this method will exhaust the encoder. + + :returns: the multipart message + :rtype: bytes + """ + + return self.read() + + def read(self, size=-1): + """Read data from the streaming encoder. + + :param int size: (optional), If provided, ``read`` will return exactly + that many bytes. If it is not provided, it will return the + remaining bytes. + :returns: bytes + """ + if self.finished: + return self._buffer.read(size) + + bytes_to_load = size + if bytes_to_load != -1 and bytes_to_load is not None: + bytes_to_load = self._calculate_load_amount(int(size)) + + self._load(bytes_to_load) + return self._buffer.read(size) + + +def IDENTITY(monitor): + return monitor + + +class MultipartEncoderMonitor(object): + + """ + An object used to monitor the progress of a :class:`MultipartEncoder`. + + The :class:`MultipartEncoder` should only be responsible for preparing and + streaming the data. For anyone who wishes to monitor it, they shouldn't be + using that instance to manage that as well. Using this class, they can + monitor an encoder and register a callback. The callback receives the + instance of the monitor. + + To use this monitor, you construct your :class:`MultipartEncoder` as you + normally would. + + .. code-block:: python + + from requests_toolbelt import (MultipartEncoder, + MultipartEncoderMonitor) + import requests + + def callback(monitor): + # Do something with this information + pass + + m = MultipartEncoder(fields={'field0': 'value0'}) + monitor = MultipartEncoderMonitor(m, callback) + headers = {'Content-Type': monitor.content_type} + r = requests.post('https://httpbin.org/post', data=monitor, + headers=headers) + + Alternatively, if your use case is very simple, you can use the following + pattern. + + .. code-block:: python + + from requests_toolbelt import MultipartEncoderMonitor + import requests + + def callback(monitor): + # Do something with this information + pass + + monitor = MultipartEncoderMonitor.from_fields( + fields={'field0': 'value0'}, callback + ) + headers = {'Content-Type': montior.content_type} + r = requests.post('https://httpbin.org/post', data=monitor, + headers=headers) + + """ + + def __init__(self, encoder, callback=None): + #: Instance of the :class:`MultipartEncoder` being monitored + self.encoder = encoder + + #: Optionally function to call after a read + self.callback = callback or IDENTITY + + #: Number of bytes already read from the :class:`MultipartEncoder` + #: instance + self.bytes_read = 0 + + #: Avoid the same problem in bug #80 + self.len = self.encoder.len + + @classmethod + def from_fields(cls, fields, boundary=None, encoding='utf-8', + callback=None): + encoder = MultipartEncoder(fields, boundary, encoding) + return cls(encoder, callback) + + @property + def content_type(self): + return self.encoder.content_type + + def to_string(self): + return self.read() + + def read(self, size=-1): + string = self.encoder.read(size) + self.bytes_read += len(string) + self.callback(self) + return string + + +def encode_with(string, encoding): + """Encoding ``string`` with ``encoding`` if necessary. + + :param str string: If string is a bytes object, it will not encode it. + Otherwise, this function will encode it with the provided encoding. + :param str encoding: The encoding with which to encode string. + :returns: encoded bytes object + """ + if not (string is None or isinstance(string, bytes)): + return string.encode(encoding) + return string + + +def readable_data(data, encoding): + """Coerce the data to an object with a ``read`` method.""" + if hasattr(data, 'read'): + return data + + return CustomBytesIO(data, encoding) + + +def total_len(o): + if hasattr(o, '__len__'): + return len(o) + + if hasattr(o, 'len'): + return o.len + + if hasattr(o, 'fileno'): + try: + fileno = o.fileno() + except io.UnsupportedOperation: + pass + else: + return os.fstat(fileno).st_size + + if hasattr(o, 'getvalue'): + # e.g. BytesIO, cStringIO.StringIO + return len(o.getvalue()) + + +@contextlib.contextmanager +def reset(buffer): + """Keep track of the buffer's current position and write to the end. + + This is a context manager meant to be used when adding data to the buffer. + It eliminates the need for every function to be concerned with the + position of the cursor in the buffer. + """ + original_position = buffer.tell() + buffer.seek(0, 2) + yield + buffer.seek(original_position, 0) + + +def coerce_data(data, encoding): + """Ensure that every object's __len__ behaves uniformly.""" + if not isinstance(data, CustomBytesIO): + if hasattr(data, 'getvalue'): + return CustomBytesIO(data.getvalue(), encoding) + + if hasattr(data, 'fileno'): + return FileWrapper(data) + + if not hasattr(data, 'read'): + return CustomBytesIO(data, encoding) + + return data + + +def to_list(fields): + if hasattr(fields, 'items'): + return list(fields.items()) + return list(fields) + + +class Part(object): + def __init__(self, headers, body): + self.headers = headers + self.body = body + self.headers_unread = True + self.len = len(self.headers) + total_len(self.body) + + @classmethod + def from_field(cls, field, encoding): + """Create a part from a Request Field generated by urllib3.""" + headers = encode_with(field.render_headers(), encoding) + body = coerce_data(field.data, encoding) + return cls(headers, body) + + def bytes_left_to_write(self): + """Determine if there are bytes left to write. + + :returns: bool -- ``True`` if there are bytes left to write, otherwise + ``False`` + """ + to_read = 0 + if self.headers_unread: + to_read += len(self.headers) + + return (to_read + total_len(self.body)) > 0 + + def write_to(self, buffer, size): + """Write the requested amount of bytes to the buffer provided. + + The number of bytes written may exceed size on the first read since we + load the headers ambitiously. + + :param CustomBytesIO buffer: buffer we want to write bytes to + :param int size: number of bytes requested to be written to the buffer + :returns: int -- number of bytes actually written + """ + written = 0 + if self.headers_unread: + written += buffer.append(self.headers) + self.headers_unread = False + + while total_len(self.body) > 0 and (size == -1 or written < size): + amount_to_read = size + if size != -1: + amount_to_read = size - written + written += buffer.append(self.body.read(amount_to_read)) + + return written + + +class CustomBytesIO(io.BytesIO): + def __init__(self, buffer=None, encoding='utf-8'): + buffer = encode_with(buffer, encoding) + super(CustomBytesIO, self).__init__(buffer) + + def _get_end(self): + current_pos = self.tell() + self.seek(0, 2) + length = self.tell() + self.seek(current_pos, 0) + return length + + @property + def len(self): + length = self._get_end() + return length - self.tell() + + def append(self, bytes): + with reset(self): + written = self.write(bytes) + return written + + def smart_truncate(self): + to_be_read = total_len(self) + already_read = self._get_end() - to_be_read + + if already_read >= to_be_read: + old_bytes = self.read() + self.seek(0, 0) + self.truncate() + self.write(old_bytes) + self.seek(0, 0) # We want to be at the beginning + + +class FileWrapper(object): + def __init__(self, file_object): + self.fd = file_object + + @property + def len(self): + return total_len(self.fd) - self.fd.tell() + + def read(self, length=-1): + return self.fd.read(length) + + +class FileFromURLWrapper(object): + """File from URL wrapper. + + The :class:`FileFromURLWrapper` object gives you the ability to stream file + from provided URL in chunks by :class:`MultipartEncoder`. + Provide a stateless solution for streaming file from one server to another. + You can use the :class:`FileFromURLWrapper` without a session or with + a session as demonstated by the examples below: + + .. code-block:: python + # no session + + import requests + from requests_toolbelt import MultipartEncoder, FileFromURLWrapper + + url = 'https://httpbin.org/image/png' + streaming_encoder = MultipartEncoder( + fields={ + 'file': FileFromURLWrapper(url) + } + ) + r = requests.post( + 'https://httpbin.org/post', data=streaming_encoder, + headers={'Content-Type': streaming_encoder.content_type} + ) + + .. code-block:: python + # using a session + + import requests + from requests_toolbelt import MultipartEncoder, FileFromURLWrapper + + session = requests.Session() + url = 'https://httpbin.org/image/png' + streaming_encoder = MultipartEncoder( + fields={ + 'file': FileFromURLWrapper(url, session=session) + } + ) + r = session.post( + 'https://httpbin.org/post', data=streaming_encoder, + headers={'Content-Type': streaming_encoder.content_type} + ) + + """ + + def __init__(self, file_url, session=None): + self.session = session or requests.Session() + requested_file = self._request_for_file(file_url) + self.len = int(requested_file.headers['content-length']) + self.raw_data = requested_file.raw + + def _request_for_file(self, file_url): + """Make call for file under provided URL.""" + response = self.session.get(file_url, stream=True) + content_length = response.headers.get('content-length', None) + if content_length is None: + error_msg = ( + "Data from provided URL {url} is not supported. Lack of " + "content-length Header in requested file response.".format( + url=file_url) + ) + raise FileNotSupportedError(error_msg) + elif not content_length.isdigit(): + error_msg = ( + "Data from provided URL {url} is not supported. content-length" + " header value is not a digit.".format(url=file_url) + ) + raise FileNotSupportedError(error_msg) + return response + + def read(self, chunk_size): + """Read file in chunks.""" + chunk_size = chunk_size if chunk_size >= 0 else self.len + chunk = self.raw_data.read(chunk_size) or b'' + self.len -= len(chunk) if chunk else 0 # left to read + return chunk diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..984f1e8014ba15c93500f55086ab892dc9b46755 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__init__.py @@ -0,0 +1,97 @@ +""" +This module provides the API for ``requests_toolbelt.threaded``. + +The module provides a clean and simple API for making requests via a thread +pool. The thread pool will use sessions for increased performance. + +A simple use-case is: + +.. code-block:: python + + from requests_toolbelt import threaded + + urls_to_get = [{ + 'url': 'https://api.github.com/users/sigmavirus24', + 'method': 'GET', + }, { + 'url': 'https://api.github.com/repos/requests/toolbelt', + 'method': 'GET', + }, { + 'url': 'https://google.com', + 'method': 'GET', + }] + responses, errors = threaded.map(urls_to_get) + +By default, the threaded submodule will detect the number of CPUs your +computer has and use that if no other number of processes is selected. To +change this, always use the keyword argument ``num_processes``. Using the +above example, we would expand it like so: + +.. code-block:: python + + responses, errors = threaded.map(urls_to_get, num_processes=10) + +You can also customize how a :class:`requests.Session` is initialized by +creating a callback function: + +.. code-block:: python + + from requests_toolbelt import user_agent + + def initialize_session(session): + session.headers['User-Agent'] = user_agent('my-scraper', '0.1') + session.headers['Accept'] = 'application/json' + + responses, errors = threaded.map(urls_to_get, + initializer=initialize_session) + +.. autofunction:: requests_toolbelt.threaded.map + +Inspiration is blatantly drawn from the standard library's multiprocessing +library. See the following references: + +- multiprocessing's `pool source`_ + +- map and map_async `inspiration`_ + +.. _pool source: + https://hg.python.org/cpython/file/8ef4f75a8018/Lib/multiprocessing/pool.py +.. _inspiration: + https://hg.python.org/cpython/file/8ef4f75a8018/Lib/multiprocessing/pool.py#l340 +""" +from . import pool +from .._compat import queue + + +def map(requests, **kwargs): + r"""Simple interface to the threaded Pool object. + + This function takes a list of dictionaries representing requests to make + using Sessions in threads and returns a tuple where the first item is + a generator of successful responses and the second is a generator of + exceptions. + + :param list requests: + Collection of dictionaries representing requests to make with the Pool + object. + :param \*\*kwargs: + Keyword arguments that are passed to the + :class:`~requests_toolbelt.threaded.pool.Pool` object. + :returns: Tuple of responses and exceptions from the pool + :rtype: (:class:`~requests_toolbelt.threaded.pool.ThreadResponse`, + :class:`~requests_toolbelt.threaded.pool.ThreadException`) + """ + if not (requests and all(isinstance(r, dict) for r in requests)): + raise ValueError('map expects a list of dictionaries.') + + # Build our queue of requests + job_queue = queue.Queue() + for request in requests: + job_queue.put(request) + + # Ensure the user doesn't try to pass their own job_queue + kwargs['job_queue'] = job_queue + + threadpool = pool.Pool(**kwargs) + threadpool.join_all() + return threadpool.responses(), threadpool.exceptions() diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e708051fdfdee6f5249d6a8fd75abaaa4fbb1ad Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/pool.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/pool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..157fb0c3d87d73bc55dc6f316df1e07c0b3f57ec Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/pool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/thread.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/thread.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..481647a8b4a7e489078aae06d599fa80875e68e1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/__pycache__/thread.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/pool.py b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/pool.py new file mode 100644 index 0000000000000000000000000000000000000000..1fe81461a9b4491c4f03411a889ccabdf235b9d6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/pool.py @@ -0,0 +1,211 @@ +"""Module implementing the Pool for :mod:``requests_toolbelt.threaded``.""" +import multiprocessing +import requests + +from . import thread +from .._compat import queue + + +class Pool(object): + """Pool that manages the threads containing sessions. + + :param queue: + The queue you're expected to use to which you should add items. + :type queue: queue.Queue + :param initializer: + Function used to initialize an instance of ``session``. + :type initializer: collections.Callable + :param auth_generator: + Function used to generate new auth credentials for the session. + :type auth_generator: collections.Callable + :param int num_process: + Number of threads to create. + :param session: + :type session: requests.Session + """ + + def __init__(self, job_queue, initializer=None, auth_generator=None, + num_processes=None, session=requests.Session): + if num_processes is None: + num_processes = multiprocessing.cpu_count() or 1 + + if num_processes < 1: + raise ValueError("Number of processes should at least be 1.") + + self._job_queue = job_queue + self._response_queue = queue.Queue() + self._exc_queue = queue.Queue() + self._processes = num_processes + self._initializer = initializer or _identity + self._auth = auth_generator or _identity + self._session = session + self._pool = [ + thread.SessionThread(self._new_session(), self._job_queue, + self._response_queue, self._exc_queue) + for _ in range(self._processes) + ] + + def _new_session(self): + return self._auth(self._initializer(self._session())) + + @classmethod + def from_exceptions(cls, exceptions, **kwargs): + r"""Create a :class:`~Pool` from an :class:`~ThreadException`\ s. + + Provided an iterable that provides :class:`~ThreadException` objects, + this classmethod will generate a new pool to retry the requests that + caused the exceptions. + + :param exceptions: + Iterable that returns :class:`~ThreadException` + :type exceptions: iterable + :param kwargs: + Keyword arguments passed to the :class:`~Pool` initializer. + :returns: An initialized :class:`~Pool` object. + :rtype: :class:`~Pool` + """ + job_queue = queue.Queue() + for exc in exceptions: + job_queue.put(exc.request_kwargs) + + return cls(job_queue=job_queue, **kwargs) + + @classmethod + def from_urls(cls, urls, request_kwargs=None, **kwargs): + """Create a :class:`~Pool` from an iterable of URLs. + + :param urls: + Iterable that returns URLs with which we create a pool. + :type urls: iterable + :param dict request_kwargs: + Dictionary of other keyword arguments to provide to the request + method. + :param kwargs: + Keyword arguments passed to the :class:`~Pool` initializer. + :returns: An initialized :class:`~Pool` object. + :rtype: :class:`~Pool` + """ + request_dict = {'method': 'GET'} + request_dict.update(request_kwargs or {}) + job_queue = queue.Queue() + for url in urls: + job = request_dict.copy() + job.update({'url': url}) + job_queue.put(job) + + return cls(job_queue=job_queue, **kwargs) + + def exceptions(self): + """Iterate over all the exceptions in the pool. + + :returns: Generator of :class:`~ThreadException` + """ + while True: + exc = self.get_exception() + if exc is None: + break + yield exc + + def get_exception(self): + """Get an exception from the pool. + + :rtype: :class:`~ThreadException` + """ + try: + (request, exc) = self._exc_queue.get_nowait() + except queue.Empty: + return None + else: + return ThreadException(request, exc) + + def get_response(self): + """Get a response from the pool. + + :rtype: :class:`~ThreadResponse` + """ + try: + (request, response) = self._response_queue.get_nowait() + except queue.Empty: + return None + else: + return ThreadResponse(request, response) + + def responses(self): + """Iterate over all the responses in the pool. + + :returns: Generator of :class:`~ThreadResponse` + """ + while True: + resp = self.get_response() + if resp is None: + break + yield resp + + def join_all(self): + """Join all the threads to the master thread.""" + for session_thread in self._pool: + session_thread.join() + + +class ThreadProxy(object): + proxied_attr = None + + def __getattr__(self, attr): + """Proxy attribute accesses to the proxied object.""" + get = object.__getattribute__ + if attr not in self.attrs: + response = get(self, self.proxied_attr) + return getattr(response, attr) + else: + return get(self, attr) + + +class ThreadResponse(ThreadProxy): + """A wrapper around a requests Response object. + + This will proxy most attribute access actions to the Response object. For + example, if you wanted the parsed JSON from the response, you might do: + + .. code-block:: python + + thread_response = pool.get_response() + json = thread_response.json() + + """ + proxied_attr = 'response' + attrs = frozenset(['request_kwargs', 'response']) + + def __init__(self, request_kwargs, response): + #: The original keyword arguments provided to the queue + self.request_kwargs = request_kwargs + #: The wrapped response + self.response = response + + +class ThreadException(ThreadProxy): + """A wrapper around an exception raised during a request. + + This will proxy most attribute access actions to the exception object. For + example, if you wanted the message from the exception, you might do: + + .. code-block:: python + + thread_exc = pool.get_exception() + msg = thread_exc.message + + """ + proxied_attr = 'exception' + attrs = frozenset(['request_kwargs', 'exception']) + + def __init__(self, request_kwargs, exception): + #: The original keyword arguments provided to the queue + self.request_kwargs = request_kwargs + #: The captured and wrapped exception + self.exception = exception + + +def _identity(session_obj): + return session_obj + + +__all__ = ['ThreadException', 'ThreadResponse', 'Pool'] diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/thread.py b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/thread.py new file mode 100644 index 0000000000000000000000000000000000000000..542813c1fdb7de6fa1bedc55c0601a35c5f44abf --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/threaded/thread.py @@ -0,0 +1,53 @@ +"""Module containing the SessionThread class.""" +import threading +import uuid + +import requests.exceptions as exc + +from .._compat import queue + + +class SessionThread(object): + def __init__(self, initialized_session, job_queue, response_queue, + exception_queue): + self._session = initialized_session + self._jobs = job_queue + self._create_worker() + self._responses = response_queue + self._exceptions = exception_queue + + def _create_worker(self): + self._worker = threading.Thread( + target=self._make_request, + name=uuid.uuid4(), + ) + self._worker.daemon = True + self._worker._state = 0 + self._worker.start() + + def _handle_request(self, kwargs): + try: + response = self._session.request(**kwargs) + except exc.RequestException as e: + self._exceptions.put((kwargs, e)) + else: + self._responses.put((kwargs, response)) + finally: + self._jobs.task_done() + + def _make_request(self): + while True: + try: + kwargs = self._jobs.get_nowait() + except queue.Empty: + break + + self._handle_request(kwargs) + + def is_alive(self): + """Proxy to the thread's ``is_alive`` method.""" + return self._worker.is_alive() + + def join(self): + """Join this thread to the master thread.""" + self._worker.join() diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__init__.py b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6941625b471f4ce54d7e1be3aa5e9120f2183f4a Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/deprecated.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/deprecated.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50fdb4a17687353e80e921eab2e3fce6fca31754 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/deprecated.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/dump.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/dump.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4130e1454a40bfdaeb1ea584912aa79f9dafcd08 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/dump.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/formdata.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/formdata.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a3b655ddcb08caad4c20d89728962b0360b90e77 Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/formdata.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/user_agent.cpython-313.pyc b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/user_agent.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0fa3852de8186aa7eaf6e51f89955e34485b5aa Binary files /dev/null and b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/__pycache__/user_agent.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/deprecated.py b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/deprecated.py new file mode 100644 index 0000000000000000000000000000000000000000..c935783bdcf9c2233295f11c9c389b72524345ab --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/deprecated.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +"""A collection of functions deprecated in requests.utils.""" +import re +import sys + +from requests import utils + +find_charset = re.compile( + br']', flags=re.I +).findall + +find_pragma = re.compile( + br']', flags=re.I +).findall + +find_xml = re.compile( + br'^<\?xml.*?encoding=["\']*(.+?)["\'>]' +).findall + + +def get_encodings_from_content(content): + """Return encodings from given content string. + + .. code-block:: python + + import requests + from requests_toolbelt.utils import deprecated + + r = requests.get(url) + encodings = deprecated.get_encodings_from_content(r) + + :param content: bytestring to extract encodings from + :type content: bytes + :return: encodings detected in the provided content + :rtype: list(str) + """ + encodings = (find_charset(content) + find_pragma(content) + + find_xml(content)) + if (3, 0) <= sys.version_info < (4, 0): + encodings = [encoding.decode('utf8') for encoding in encodings] + return encodings + + +def get_unicode_from_response(response): + """Return the requested content back in unicode. + + This will first attempt to retrieve the encoding from the response + headers. If that fails, it will use + :func:`requests_toolbelt.utils.deprecated.get_encodings_from_content` + to determine encodings from HTML elements. + + .. code-block:: python + + import requests + from requests_toolbelt.utils import deprecated + + r = requests.get(url) + text = deprecated.get_unicode_from_response(r) + + :param response: Response object to get unicode content from. + :type response: requests.models.Response + """ + tried_encodings = set() + + # Try charset from content-type + encoding = utils.get_encoding_from_headers(response.headers) + + if encoding: + try: + return str(response.content, encoding) + except UnicodeError: + tried_encodings.add(encoding.lower()) + + encodings = get_encodings_from_content(response.content) + + for _encoding in encodings: + _encoding = _encoding.lower() + if _encoding in tried_encodings: + continue + try: + return str(response.content, _encoding) + except UnicodeError: + tried_encodings.add(_encoding) + + # Fall back: + if encoding: + try: + return str(response.content, encoding, errors='replace') + except TypeError: + pass + return response.text diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/dump.py b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/dump.py new file mode 100644 index 0000000000000000000000000000000000000000..dec0e376648287ca0a331e5f8d60f2ca73970030 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/dump.py @@ -0,0 +1,198 @@ +"""This module provides functions for dumping information about responses.""" +import collections + +from requests import compat + + +__all__ = ('dump_response', 'dump_all') + +HTTP_VERSIONS = { + 9: b'0.9', + 10: b'1.0', + 11: b'1.1', +} + +_PrefixSettings = collections.namedtuple('PrefixSettings', + ['request', 'response']) + + +class PrefixSettings(_PrefixSettings): + def __new__(cls, request, response): + request = _coerce_to_bytes(request) + response = _coerce_to_bytes(response) + return super(PrefixSettings, cls).__new__(cls, request, response) + + +def _get_proxy_information(response): + if getattr(response.connection, 'proxy_manager', False): + proxy_info = {} + request_url = response.request.url + if request_url.startswith('https://'): + proxy_info['method'] = 'CONNECT' + + proxy_info['request_path'] = request_url + return proxy_info + return None + + +def _format_header(name, value): + return (_coerce_to_bytes(name) + b': ' + _coerce_to_bytes(value) + + b'\r\n') + + +def _build_request_path(url, proxy_info): + uri = compat.urlparse(url) + proxy_url = proxy_info.get('request_path') + if proxy_url is not None: + request_path = _coerce_to_bytes(proxy_url) + return request_path, uri + + request_path = _coerce_to_bytes(uri.path) + if uri.query: + request_path += b'?' + _coerce_to_bytes(uri.query) + + return request_path, uri + + +def _dump_request_data(request, prefixes, bytearr, proxy_info=None): + if proxy_info is None: + proxy_info = {} + + prefix = prefixes.request + method = _coerce_to_bytes(proxy_info.pop('method', request.method)) + request_path, uri = _build_request_path(request.url, proxy_info) + + # HTTP/1.1 + bytearr.extend(prefix + method + b' ' + request_path + b' HTTP/1.1\r\n') + + # Host: OR host header specified by user + headers = request.headers.copy() + host_header = _coerce_to_bytes(headers.pop('Host', uri.netloc)) + bytearr.extend(prefix + b'Host: ' + host_header + b'\r\n') + + for name, value in headers.items(): + bytearr.extend(prefix + _format_header(name, value)) + + bytearr.extend(prefix + b'\r\n') + if request.body: + if isinstance(request.body, compat.basestring): + bytearr.extend(prefix + _coerce_to_bytes(request.body)) + else: + # In the event that the body is a file-like object, let's not try + # to read everything into memory. + bytearr.extend(b'<< Request body is not a string-like type >>') + bytearr.extend(b'\r\n') + bytearr.extend(b'\r\n') + + +def _dump_response_data(response, prefixes, bytearr): + prefix = prefixes.response + # Let's interact almost entirely with urllib3's response + raw = response.raw + + # Let's convert the version int from httplib to bytes + version_str = HTTP_VERSIONS.get(raw.version, b'?') + + # HTTP/ + bytearr.extend(prefix + b'HTTP/' + version_str + b' ' + + str(raw.status).encode('ascii') + b' ' + + _coerce_to_bytes(response.reason) + b'\r\n') + + headers = raw.headers + for name in headers.keys(): + for value in headers.getlist(name): + bytearr.extend(prefix + _format_header(name, value)) + + bytearr.extend(prefix + b'\r\n') + + bytearr.extend(response.content) + + +def _coerce_to_bytes(data): + if not isinstance(data, bytes) and hasattr(data, 'encode'): + data = data.encode('utf-8') + # Don't bail out with an exception if data is None + return data if data is not None else b'' + + +def dump_response(response, request_prefix=b'< ', response_prefix=b'> ', + data_array=None): + """Dump a single request-response cycle's information. + + This will take a response object and dump only the data that requests can + see for that single request-response cycle. + + Example:: + + import requests + from requests_toolbelt.utils import dump + + resp = requests.get('https://api.github.com/users/sigmavirus24') + data = dump.dump_response(resp) + print(data.decode('utf-8')) + + :param response: + The response to format + :type response: :class:`requests.Response` + :param request_prefix: (*optional*) + Bytes to prefix each line of the request data + :type request_prefix: :class:`bytes` + :param response_prefix: (*optional*) + Bytes to prefix each line of the response data + :type response_prefix: :class:`bytes` + :param data_array: (*optional*) + Bytearray to which we append the request-response cycle data + :type data_array: :class:`bytearray` + :returns: Formatted bytes of request and response information. + :rtype: :class:`bytearray` + """ + data = data_array if data_array is not None else bytearray() + prefixes = PrefixSettings(request_prefix, response_prefix) + + if not hasattr(response, 'request'): + raise ValueError('Response has no associated request') + + proxy_info = _get_proxy_information(response) + _dump_request_data(response.request, prefixes, data, + proxy_info=proxy_info) + _dump_response_data(response, prefixes, data) + return data + + +def dump_all(response, request_prefix=b'< ', response_prefix=b'> '): + """Dump all requests and responses including redirects. + + This takes the response returned by requests and will dump all + request-response pairs in the redirect history in order followed by the + final request-response. + + Example:: + + import requests + from requests_toolbelt.utils import dump + + resp = requests.get('https://httpbin.org/redirect/5') + data = dump.dump_all(resp) + print(data.decode('utf-8')) + + :param response: + The response to format + :type response: :class:`requests.Response` + :param request_prefix: (*optional*) + Bytes to prefix each line of the request data + :type request_prefix: :class:`bytes` + :param response_prefix: (*optional*) + Bytes to prefix each line of the response data + :type response_prefix: :class:`bytes` + :returns: Formatted bytes of request and response information. + :rtype: :class:`bytearray` + """ + data = bytearray() + + history = list(response.history[:]) + history.append(response) + + for response in history: + dump_response(response, request_prefix, response_prefix, data) + + return data diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/formdata.py b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/formdata.py new file mode 100644 index 0000000000000000000000000000000000000000..b0a909d24c175f63e133f1cfb64adf90154afca6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/formdata.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +"""Implementation of nested form-data encoding function(s).""" +from .._compat import basestring +from .._compat import urlencode as _urlencode + + +__all__ = ('urlencode',) + + +def urlencode(query, *args, **kwargs): + """Handle nested form-data queries and serialize them appropriately. + + There are times when a website expects a nested form data query to be sent + but, the standard library's urlencode function does not appropriately + handle the nested structures. In that case, you need this function which + will flatten the structure first and then properly encode it for you. + + When using this to send data in the body of a request, make sure you + specify the appropriate Content-Type header for the request. + + .. code-block:: python + + import requests + from requests_toolbelt.utils import formdata + + query = { + 'my_dict': { + 'foo': 'bar', + 'biz': 'baz", + }, + 'a': 'b', + } + + resp = requests.get(url, params=formdata.urlencode(query)) + # or + resp = requests.post( + url, + data=formdata.urlencode(query), + headers={ + 'Content-Type': 'application/x-www-form-urlencoded' + }, + ) + + Similarly, you can specify a list of nested tuples, e.g., + + .. code-block:: python + + import requests + from requests_toolbelt.utils import formdata + + query = [ + ('my_list', [ + ('foo', 'bar'), + ('biz', 'baz'), + ]), + ('a', 'b'), + ] + + resp = requests.get(url, params=formdata.urlencode(query)) + # or + resp = requests.post( + url, + data=formdata.urlencode(query), + headers={ + 'Content-Type': 'application/x-www-form-urlencoded' + }, + ) + + For additional parameter and return information, see the official + `urlencode`_ documentation. + + .. _urlencode: + https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode + """ + expand_classes = (dict, list, tuple) + original_query_list = _to_kv_list(query) + + if not all(_is_two_tuple(i) for i in original_query_list): + raise ValueError("Expected query to be able to be converted to a " + "list comprised of length 2 tuples.") + + query_list = original_query_list + while any(isinstance(v, expand_classes) for _, v in query_list): + query_list = _expand_query_values(query_list) + + return _urlencode(query_list, *args, **kwargs) + + +def _to_kv_list(dict_or_list): + if hasattr(dict_or_list, 'items'): + return list(dict_or_list.items()) + return dict_or_list + + +def _is_two_tuple(item): + return isinstance(item, (list, tuple)) and len(item) == 2 + + +def _expand_query_values(original_query_list): + query_list = [] + for key, value in original_query_list: + if isinstance(value, basestring): + query_list.append((key, value)) + else: + key_fmt = key + '[%s]' + value_list = _to_kv_list(value) + query_list.extend((key_fmt % k, v) for k, v in value_list) + return query_list diff --git a/python/user_packages/Python313/site-packages/requests_toolbelt/utils/user_agent.py b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/user_agent.py new file mode 100644 index 0000000000000000000000000000000000000000..e9636a41c802e6680e429207515e336a44f8dbbc --- /dev/null +++ b/python/user_packages/Python313/site-packages/requests_toolbelt/utils/user_agent.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +import collections +import platform +import sys + + +def user_agent(name, version, extras=None): + """Return an internet-friendly user_agent string. + + The majority of this code has been wilfully stolen from the equivalent + function in Requests. + + :param name: The intended name of the user-agent, e.g. "python-requests". + :param version: The version of the user-agent, e.g. "0.0.1". + :param extras: List of two-item tuples that are added to the user-agent + string. + :returns: Formatted user-agent string + :rtype: str + """ + if extras is None: + extras = [] + + return UserAgentBuilder( + name, version + ).include_extras( + extras + ).include_implementation( + ).include_system().build() + + +class UserAgentBuilder(object): + """Class to provide a greater level of control than :func:`user_agent`. + + This is used by :func:`user_agent` to build its User-Agent string. + + .. code-block:: python + + user_agent_str = UserAgentBuilder( + name='requests-toolbelt', + version='17.4.0', + ).include_implementation( + ).include_system( + ).include_extras([ + ('requests', '2.14.2'), + ('urllib3', '1.21.2'), + ]).build() + + """ + + format_string = '%s/%s' + + def __init__(self, name, version): + """Initialize our builder with the name and version of our user agent. + + :param str name: + Name of our user-agent. + :param str version: + The version string for user-agent. + """ + self._pieces = collections.deque([(name, version)]) + + def build(self): + """Finalize the User-Agent string. + + :returns: + Formatted User-Agent string. + :rtype: + str + """ + return " ".join([self.format_string % piece for piece in self._pieces]) + + def include_extras(self, extras): + """Include extra portions of the User-Agent. + + :param list extras: + list of tuples of extra-name and extra-version + """ + if any(len(extra) != 2 for extra in extras): + raise ValueError('Extras should be a sequence of two item tuples.') + + self._pieces.extend(extras) + return self + + def include_implementation(self): + """Append the implementation string to the user-agent string. + + This adds the the information that you're using CPython 2.7.13 to the + User-Agent. + """ + self._pieces.append(_implementation_tuple()) + return self + + def include_system(self): + """Append the information about the Operating System.""" + self._pieces.append(_platform_tuple()) + return self + + +def _implementation_tuple(): + """Return the tuple of interpreter name and version. + + Returns a string that provides both the name and the version of the Python + implementation currently running. For example, on CPython 2.7.5 it will + return "CPython/2.7.5". + + This function works best on CPython and PyPy: in particular, it probably + doesn't work for Jython or IronPython. Future investigation should be done + to work out the correct shape of the code for those platforms. + """ + implementation = platform.python_implementation() + + if implementation == 'CPython': + implementation_version = platform.python_version() + elif implementation == 'PyPy': + implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major, + sys.pypy_version_info.minor, + sys.pypy_version_info.micro) + if sys.pypy_version_info.releaselevel != 'final': + implementation_version = ''.join([ + implementation_version, sys.pypy_version_info.releaselevel + ]) + elif implementation == 'Jython': + implementation_version = platform.python_version() # Complete Guess + elif implementation == 'IronPython': + implementation_version = platform.python_version() # Complete Guess + else: + implementation_version = 'Unknown' + + return (implementation, implementation_version) + + +def _implementation_string(): + return "%s/%s" % _implementation_tuple() + + +def _platform_tuple(): + try: + p_system = platform.system() + p_release = platform.release() + except IOError: + p_system = 'Unknown' + p_release = 'Unknown' + return (p_system, p_release) diff --git a/python/user_packages/Python313/site-packages/rich-15.0.0.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/rich-15.0.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4415505566f261c802b671426be529a31f914137 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich-15.0.0.dist-info/licenses/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020 Will McGugan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..828e24fd6525f813484f805bbb38c683d58e9ace Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/__main__.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/__main__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54aa49fcdb810a1689c07c91b56ab4b3435ddb91 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/__main__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_emoji_replace.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_emoji_replace.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7cb2b19619108a5728cddd91f00739a6befa3bee Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_emoji_replace.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_export_format.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_export_format.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..375955935dd4f56b1bf57127d85a7bb7002ab144 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_export_format.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_extension.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_extension.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f73d83e11ef44fa264ca39a48468379606fdb1b2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_extension.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_fileno.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_fileno.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79980807b32de3914e7cfcaa63c02853803ec1ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_fileno.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_inspect.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_inspect.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..982454c87e4b2fb11862204ed7168c3fa6b31821 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_inspect.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_log_render.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_log_render.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51f57850b0624c4df2014eb58fe5cc5684a2dd49 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_log_render.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_loop.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_loop.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2ce4ff35462bd848c4be8571424daf799bf9568 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_loop.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_null_file.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_null_file.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f39e7ff8380227772cf69154482b0ea08212008 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_null_file.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_palettes.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_palettes.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..121536d4c371830725bb931c5158a6953c5db39c Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_palettes.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_pick.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_pick.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c003933e63a4e8626c384a88ce1e120553e4b7eb Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_pick.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_ratio.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_ratio.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..974a80e39fbd9d217783790138005de57768d585 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_ratio.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_spinners.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_spinners.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f130aee5b174d2e070f3640ad8c73c19f786268 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_spinners.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_stack.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_stack.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..358e6b94009d541d67c53789584f9c829a46a57a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_stack.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_timer.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_timer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a450d3a808bb56edf64103bf211b089524e95922 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_timer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_win32_console.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_win32_console.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8e24aa8930fe022b24f68d5229a0cab40d57b8b Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_win32_console.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_windows.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_windows.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ea2059bd5894f6bbb5da0beeb18b41ce08e18fe Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_windows.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_windows_renderer.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_windows_renderer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e3e8c3e0a93fa35400b04f00b157d5cfd02d18f Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_windows_renderer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/_wrap.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/_wrap.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..650c32b8b0e65377dd5821293c567cb5fc3d4bc2 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/_wrap.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/abc.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/abc.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90625928f42c459cecd108a1f42834b4a03a5f95 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/abc.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/align.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/align.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2bb7868ab7898d8a84d4ba232db48109402be291 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/align.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/ansi.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/ansi.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49e3af71f0dfa428420c9d06103e4dc30746b905 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/ansi.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/bar.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/bar.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0769ab40cc9f45afb927daad0bdea695c6d3e369 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/bar.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/box.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/box.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ef3298df443c85e8329f1cca6814305ec12ef875 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/box.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/cells.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/cells.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3c92628c5ac8cdd3d5a494b8a61883ce89517fe Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/cells.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/color.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/color.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ccaa0c7a040a9c7f44c12ffd1a7d7deb1493c224 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/color.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/color_triplet.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/color_triplet.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6123bc1eb292d00e6570990ef26839489aca3af3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/color_triplet.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/columns.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/columns.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ccb7e9d9c0ded45b2a9ee2389b1c9dd6b2495df Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/columns.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/constrain.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/constrain.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..441fd88990a4659b4500972f090a430d8530527a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/constrain.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/containers.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/containers.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a67913e4cad24d7a4941296fda4f14b412e041b1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/containers.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/control.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/control.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0fd3dfd3fb4f4483dfffaee3f0dc4797801af369 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/control.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/default_styles.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/default_styles.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b75f95b52f17fe32cc6ade06f495fe47b2ee4d1e Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/default_styles.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/diagnose.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/diagnose.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b21975aa5d0795a7491d208b7838d0037d9ff321 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/diagnose.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/emoji.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/emoji.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e49183b8f26f3053d046f1ff0d02f9b8f0aa54d Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/emoji.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/errors.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/errors.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9135db4863d8adb7bcb590edac34716be57051ac Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/errors.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/file_proxy.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/file_proxy.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a69b40894b4b7ca720f99213ef7b5bb457d6e48d Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/file_proxy.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/filesize.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/filesize.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c9b0e35a08619aa13df859277583006906a876a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/filesize.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/highlighter.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/highlighter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85fda9068c4fa4bb9cfb8e7689402fc327db3f18 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/highlighter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/json.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/json.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..445bf79f963a4ad35d8d6c03151ff8cfb448d50f Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/json.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/jupyter.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/jupyter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7959053ed2755571d2475c3cf635f496ceb7228e Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/jupyter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/layout.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/layout.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52708d9696a5e610bdf61c34b2f5dadc58147864 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/layout.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/live.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/live.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee1d75f3b7d07e7beb0761aebb0740828a3017b9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/live.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/live_render.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/live_render.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34ca9b18381974d78d39afb9a811e92513b8cbac Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/live_render.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/logging.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/logging.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7253f98dfc5eb1abfe8e4f7b4624c1ba9f48a195 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/logging.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/markdown.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/markdown.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..244db294142b5bbe6cb3b587402f83296a5442af Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/markdown.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/markup.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/markup.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..571c3aadb45d8163e4eeb97ced5bdb581a60dc0e Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/markup.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/measure.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/measure.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81b719498464470a80d96507a540e9a7952d1d11 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/measure.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/padding.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/padding.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..789d27ecb84eb0239d8713129d7edd07ff9f179a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/padding.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/pager.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/pager.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..179e1a642c90be7ec87b9bab9bb3324d7f61a30b Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/pager.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/palette.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/palette.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0fcafcaf09e757ea6c0a701774b4b6026b12f868 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/palette.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/panel.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/panel.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..75b87c7fa3a345fa2355993a11ba0190892180ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/panel.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/pretty.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/pretty.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..393aa8e427a577ab1243ac651bae7ddf2143c4a5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/pretty.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/progress.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/progress.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7452efefda23204a4c13410899cd56513e619f68 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/progress.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/progress_bar.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/progress_bar.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b42dda15b4197c401dad172792da620598986d1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/progress_bar.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/prompt.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/prompt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3522dabfc3a2f2c20e46e82b20c54d4634480253 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/prompt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/protocol.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/protocol.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..055e131c41b9218a5e61f547c9ad6d420be104b7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/protocol.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/region.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/region.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d65507facc135c93221b5e0ddfc15422b0e2a48 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/region.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/repr.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/repr.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1d5c3e788bf44e1d1389d3d6353938b439bdef9a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/repr.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/rule.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/rule.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d7bdbe3c830fc00528dd93921a96263796da985e Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/rule.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/scope.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/scope.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a881d5b25e8f23e21380bc3782748565f1f6bb5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/scope.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/screen.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/screen.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecaa9f9fe08490ff78aa5c2db57db1f7945c9091 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/screen.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/segment.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/segment.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..22d2eb194ef4e801e542586cb55bbd0c7b204169 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/segment.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/spinner.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/spinner.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec0ec1debf6a2b363038ad93d1f867ba206a6789 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/spinner.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/status.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/status.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f152c36bfa62a66733e591a4c76978f8192a988c Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/status.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/style.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/style.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8268da8a891db55b08b1a47a488dc467f7d27dc8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/style.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/styled.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/styled.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6de898c700712a8db462cc4735fdf476e0a649a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/styled.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/syntax.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/syntax.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ba9f06cea7fb6f2820e70c142af65e948bb49ef Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/syntax.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/table.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/table.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3389206974c54279adc2c16033b8eddcc257be97 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/table.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/terminal_theme.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/terminal_theme.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fc82441d17eaf350588d7fc743228a71106b0326 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/terminal_theme.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/text.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/text.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..42bc8160442b460a2f8aa39a2c03fd6a0cf3f13f Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/text.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/theme.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/theme.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3ef568f9a30163958174d004ea3c9a75de01b30a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/theme.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/themes.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/themes.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8b309bfd575c682eae6d5114efc06662ad798bfe Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/themes.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/traceback.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/traceback.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b4a56be120b0b98aa988fd8de6df05a4214657da Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/traceback.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/__pycache__/tree.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/__pycache__/tree.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7372ed7fd73f42ebb64a67bceeeab9e37fa225a4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/__pycache__/tree.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__init__.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ce54baef4e5124dd7c9e711604d00dcb001749c9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/__init__.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +import bisect +import os +import sys + +if sys.version_info[:2] >= (3, 9): + from functools import cache +else: + from functools import lru_cache as cache # pragma: no cover + +from importlib import import_module +from typing import TYPE_CHECKING, cast + +from rich._unicode_data._versions import VERSIONS + +if TYPE_CHECKING: + from rich.cells import CellTable + +VERSION_ORDER = sorted( + [ + tuple( + map(int, version.split(".")), + ) + for version in VERSIONS + ] +) +VERSION_SET = frozenset(VERSIONS) + + +def _parse_version(version: str) -> tuple[int, int, int]: + """Parse a version string into a tuple of 3 integers. + + Args: + version: A version string. + + Raises: + ValueError: If the version string is invalid. + + Returns: + A tuple of 3 integers. + """ + version_integers: tuple[int, ...] + try: + version_integers = tuple( + map(int, version.split(".")), + ) + except ValueError: + raise ValueError( + f"unicode version string {version!r} is badly formatted" + ) from None + while len(version_integers) < 3: + version_integers = version_integers + (0,) + triple = cast("tuple[int, int, int]", version_integers[:3]) + return triple + + +@cache +def load(unicode_version: str = "auto") -> CellTable: + """Load a cell table for the given unicode version. + + Args: + unicode_version: Unicode version, or `None` to auto-detect. + + """ + if unicode_version == "auto": + unicode_version = os.environ.get("UNICODE_VERSION", "latest") + try: + _parse_version(unicode_version) + except ValueError: + # The environment variable is invalid + # Fallback to using the latest version seems reasonable + unicode_version = "latest" + + if unicode_version == "latest": + version = VERSIONS[-1] + else: + try: + version_numbers = _parse_version(unicode_version) + except ValueError: + version_numbers = _parse_version(VERSIONS[-1]) + major, minor, patch = version_numbers + version = f"{major}.{minor}.{patch}" + if version not in VERSION_SET: + insert_position = bisect.bisect_left(VERSION_ORDER, version_numbers) + version = VERSIONS[max(0, insert_position - 1)] + + version_path_component = version.replace(".", "-") + module_name = f".unicode{version_path_component}" + module = import_module(module_name, "rich._unicode_data") + if TYPE_CHECKING: + assert isinstance(module.cell_table, CellTable) + return module.cell_table diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c1dccc2023348e15ec42ebc22d7dba85ce3eb100 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/_versions.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/_versions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..61b7180d17bb9664cffd9c6492f730baf0106499 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/_versions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode10-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode10-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de08dfc6bdc42f556094cc0a97dc3cd0c4b0e597 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode10-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode11-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode11-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e397081ec391fc63e5853307434d291f410feb96 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode11-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode12-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode12-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bc7864d7ba059c399a928a842831beecba0b9ee Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode12-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode12-1-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode12-1-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b94e66eee99dea21afe4a98188f0a241821fe1c Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode12-1-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode13-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode13-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f67013941bc832d8872bcb7441812a604b8cd257 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode13-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode14-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode14-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f1acd6973c0a86dafeec9dddf8201a3027d34df Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode14-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode15-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode15-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e45ec39cb78502c9fc244718f6bca91afcf1f2f9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode15-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode15-1-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode15-1-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f2f5d82088eaf054da237a6c4e7b6bb011eb07b Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode15-1-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode16-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode16-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..deda3c6be6c8df5516b6f49a8a09bacbfef0a3ce Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode16-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode17-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode17-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f23435b04c89ed706c20cef4dedcc960fc45a3f Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode17-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode4-1-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode4-1-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d50dc4afb0d7c40c21bff85df63b362e3cb7436 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode4-1-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0b3928ee42e4cb98ca0d527a27b294ab84358d4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-1-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-1-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a48702e53cac2068258550f8554f812f716000b Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-1-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-2-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-2-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a294fa212475471acbf4f85e16f304dd77d5362 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode5-2-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9f74883db0ad2d9ac793977a4b2f5544051c054 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-1-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-1-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e7e367414c94f9b6dabff88bbbb276840a47296 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-1-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-2-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-2-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbced0296b2777a5261d13ff500dc5696235f61a Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-2-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-3-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-3-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..07d182d2ce36805765670dfd5821509b4c6a0850 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode6-3-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode7-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode7-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3277443bc1899bf0bc1f4dcc0842844e064d34c4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode7-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode8-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode8-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..052b0d7ce43b10f5225cf0a0431e832db13c1939 Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode8-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode9-0-0.cpython-313.pyc b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode9-0-0.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8ad1dd9ba9f49557437721756cffe51ca6cc96e Binary files /dev/null and b/python/user_packages/Python313/site-packages/rich/_unicode_data/__pycache__/unicode9-0-0.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/_versions.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/_versions.py new file mode 100644 index 0000000000000000000000000000000000000000..be98418d13d224ccd94f97f0ce8e31fe43f63540 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/_versions.py @@ -0,0 +1,23 @@ +VERSIONS = ( + "4.1.0", + "5.0.0", + "5.1.0", + "5.2.0", + "6.0.0", + "6.1.0", + "6.2.0", + "6.3.0", + "7.0.0", + "8.0.0", + "9.0.0", + "10.0.0", + "11.0.0", + "12.0.0", + "12.1.0", + "13.0.0", + "14.0.0", + "15.0.0", + "15.1.0", + "16.0.0", + "17.0.0", +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode10-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode10-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..f318087837c2cfb464c7bb9979f7ed067bc71bea --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode10-0-0.py @@ -0,0 +1,611 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "10.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2260, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7415, 7417, 0), + (7616, 7673, 0), + (7675, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12590, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70090, 70092, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70460, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (94176, 94177, 2), + (94208, 100332, 2), + (100352, 101106, 2), + (110592, 110878, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128747, 128748, 2), + (128756, 128760, 2), + (129296, 129342, 2), + (129344, 129356, 2), + (129360, 129387, 2), + (129408, 129431, 2), + (129472, 129472, 2), + (129488, 129510, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode11-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode11-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..058bb342cac0eb3cae529a0a1933c89dabaa5fbd --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode11-0-0.py @@ -0,0 +1,625 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "11.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2259, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7415, 7417, 0), + (7616, 7673, 0), + (7675, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69446, 69456, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (94176, 94177, 2), + (94208, 100337, 2), + (100352, 101106, 2), + (110592, 110878, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128747, 128748, 2), + (128756, 128761, 2), + (129296, 129342, 2), + (129344, 129392, 2), + (129395, 129398, 2), + (129402, 129402, 2), + (129404, 129442, 2), + (129456, 129465, 2), + (129472, 129474, 2), + (129488, 129535, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode12-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode12-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..7b0022513d4517f1704e3f54c3dcc7a4f8816773 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode12-0-0.py @@ -0,0 +1,637 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "12.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2259, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7673, 0), + (7675, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69446, 69456, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (78896, 78904, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94208, 100343, 2), + (100352, 101106, 2), + (110592, 110878, 2), + (110928, 110930, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123184, 123190, 0), + (123628, 123631, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128725, 2), + (128747, 128748, 2), + (128756, 128762, 2), + (128992, 129003, 2), + (129293, 129393, 2), + (129395, 129398, 2), + (129402, 129442, 2), + (129445, 129450, 2), + (129454, 129482, 2), + (129485, 129535, 2), + (129648, 129651, 2), + (129656, 129658, 2), + (129664, 129666, 2), + (129680, 129685, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode12-1-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode12-1-0.py new file mode 100644 index 0000000000000000000000000000000000000000..2dbcf3794e45d16f46ce68d81f5eea63e39aa42d --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode12-1-0.py @@ -0,0 +1,636 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "12.1.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2259, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7673, 0), + (7675, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69446, 69456, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (78896, 78904, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94208, 100343, 2), + (100352, 101106, 2), + (110592, 110878, 2), + (110928, 110930, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123184, 123190, 0), + (123628, 123631, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128725, 2), + (128747, 128748, 2), + (128756, 128762, 2), + (128992, 129003, 2), + (129293, 129393, 2), + (129395, 129398, 2), + (129402, 129442, 2), + (129445, 129450, 2), + (129454, 129482, 2), + (129485, 129535, 2), + (129648, 129651, 2), + (129656, 129658, 2), + (129664, 129666, 2), + (129680, 129685, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode13-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode13-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..13fbc74b0ac34d1c28f5ee77359a520512bf7e8a --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode13-0-0.py @@ -0,0 +1,648 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "13.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2259, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2901, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3457, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6848, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7673, 0), + (7675, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43052, 43052, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69291, 69292, 0), + (69446, 69456, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70094, 70095, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (71984, 71989, 0), + (71991, 71992, 0), + (71995, 71998, 0), + (72000, 72000, 0), + (72002, 72003, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (78896, 78904, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94180, 94180, 0), + (94192, 94193, 0), + (94208, 100343, 2), + (100352, 101589, 2), + (101632, 101640, 2), + (110592, 110878, 2), + (110928, 110930, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123184, 123190, 0), + (123628, 123631, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128727, 2), + (128747, 128748, 2), + (128756, 128764, 2), + (128992, 129003, 2), + (129292, 129338, 2), + (129340, 129349, 2), + (129351, 129400, 2), + (129402, 129483, 2), + (129485, 129535, 2), + (129648, 129652, 2), + (129656, 129658, 2), + (129664, 129670, 2), + (129680, 129704, 2), + (129712, 129718, 2), + (129728, 129730, 2), + (129744, 129750, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode14-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode14-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..9fa9e29e7f3027b8aafbd59731fab0d70bd05c5d --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode14-0-0.py @@ -0,0 +1,661 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "14.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2200, 2207, 0), + (2250, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2901, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3132, 3132, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3457, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5909, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6159, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6862, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43052, 43052, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69291, 69292, 0), + (69446, 69456, 0), + (69506, 69509, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69744, 69744, 0), + (69747, 69748, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69826, 69826, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70094, 70095, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (71984, 71989, 0), + (71991, 71992, 0), + (71995, 71998, 0), + (72000, 72000, 0), + (72002, 72003, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (78896, 78904, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94180, 94180, 0), + (94192, 94193, 0), + (94208, 100343, 2), + (100352, 101589, 2), + (101632, 101640, 2), + (110576, 110579, 2), + (110581, 110587, 2), + (110589, 110590, 2), + (110592, 110882, 2), + (110928, 110930, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (118528, 118573, 0), + (118576, 118598, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123184, 123190, 0), + (123566, 123566, 0), + (123628, 123631, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128727, 2), + (128733, 128735, 2), + (128747, 128748, 2), + (128756, 128764, 2), + (128992, 129003, 2), + (129008, 129008, 2), + (129292, 129338, 2), + (129340, 129349, 2), + (129351, 129535, 2), + (129648, 129652, 2), + (129656, 129660, 2), + (129664, 129670, 2), + (129680, 129708, 2), + (129712, 129722, 2), + (129728, 129733, 2), + (129744, 129753, 2), + (129760, 129767, 2), + (129776, 129782, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode15-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode15-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..84dd5be9365bb226620059b80353dd1ce26f8064 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode15-0-0.py @@ -0,0 +1,671 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "15.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2200, 2207, 0), + (2250, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2901, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3132, 3132, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3315, 3315, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3457, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3790, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5909, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6159, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6862, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43052, 43052, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69291, 69292, 0), + (69373, 69375, 0), + (69446, 69456, 0), + (69506, 69509, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69744, 69744, 0), + (69747, 69748, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69826, 69826, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70094, 70095, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70209, 70209, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (71984, 71989, 0), + (71991, 71992, 0), + (71995, 71998, 0), + (72000, 72000, 0), + (72002, 72003, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (73472, 73473, 0), + (73475, 73475, 0), + (73524, 73530, 0), + (73534, 73538, 0), + (78896, 78912, 0), + (78919, 78933, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94180, 94180, 0), + (94192, 94193, 0), + (94208, 100343, 2), + (100352, 101589, 2), + (101632, 101640, 2), + (110576, 110579, 2), + (110581, 110587, 2), + (110589, 110590, 2), + (110592, 110882, 2), + (110898, 110898, 2), + (110928, 110930, 2), + (110933, 110933, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (118528, 118573, 0), + (118576, 118598, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123023, 123023, 0), + (123184, 123190, 0), + (123566, 123566, 0), + (123628, 123631, 0), + (124140, 124143, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128727, 2), + (128732, 128735, 2), + (128747, 128748, 2), + (128756, 128764, 2), + (128992, 129003, 2), + (129008, 129008, 2), + (129292, 129338, 2), + (129340, 129349, 2), + (129351, 129535, 2), + (129648, 129660, 2), + (129664, 129672, 2), + (129680, 129725, 2), + (129727, 129733, 2), + (129742, 129755, 2), + (129760, 129768, 2), + (129776, 129784, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode15-1-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode15-1-0.py new file mode 100644 index 0000000000000000000000000000000000000000..aa9f2c3e3170538c22fda8d0df91d488c232131f --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode15-1-0.py @@ -0,0 +1,670 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "15.1.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2200, 2207, 0), + (2250, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2901, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3132, 3132, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3315, 3315, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3457, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3790, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5909, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6159, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6862, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12771, 2), + (12783, 12830, 2), + (12832, 12871, 2), + (12880, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43052, 43052, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (69291, 69292, 0), + (69373, 69375, 0), + (69446, 69456, 0), + (69506, 69509, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69744, 69744, 0), + (69747, 69748, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69826, 69826, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70094, 70095, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70209, 70209, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (71984, 71989, 0), + (71991, 71992, 0), + (71995, 71998, 0), + (72000, 72000, 0), + (72002, 72003, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (73472, 73473, 0), + (73475, 73475, 0), + (73524, 73530, 0), + (73534, 73538, 0), + (78896, 78912, 0), + (78919, 78933, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94180, 94180, 0), + (94192, 94193, 0), + (94208, 100343, 2), + (100352, 101589, 2), + (101632, 101640, 2), + (110576, 110579, 2), + (110581, 110587, 2), + (110589, 110590, 2), + (110592, 110882, 2), + (110898, 110898, 2), + (110928, 110930, 2), + (110933, 110933, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (118528, 118573, 0), + (118576, 118598, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123023, 123023, 0), + (123184, 123190, 0), + (123566, 123566, 0), + (123628, 123631, 0), + (124140, 124143, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128727, 2), + (128732, 128735, 2), + (128747, 128748, 2), + (128756, 128764, 2), + (128992, 129003, 2), + (129008, 129008, 2), + (129292, 129338, 2), + (129340, 129349, 2), + (129351, 129535, 2), + (129648, 129660, 2), + (129664, 129672, 2), + (129680, 129725, 2), + (129727, 129733, 2), + (129742, 129755, 2), + (129760, 129768, 2), + (129776, 129784, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode16-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode16-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..b3fe2359dfc70e6c8e13be5c6e74887ba581338e --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode16-0-0.py @@ -0,0 +1,683 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "16.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2199, 2207, 0), + (2250, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2901, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3132, 3132, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3315, 3315, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3457, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3790, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5909, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6159, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6862, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9776, 9783, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9866, 9871, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12773, 2), + (12783, 12830, 2), + (12832, 12871, 2), + (12880, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43052, 43052, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (68969, 68973, 0), + (69291, 69292, 0), + (69372, 69375, 0), + (69446, 69456, 0), + (69506, 69509, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69744, 69744, 0), + (69747, 69748, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69826, 69826, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70094, 70095, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70209, 70209, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70584, 70592, 0), + (70594, 70594, 0), + (70597, 70597, 0), + (70599, 70602, 0), + (70604, 70608, 0), + (70610, 70610, 0), + (70625, 70626, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (71984, 71989, 0), + (71991, 71992, 0), + (71995, 71998, 0), + (72000, 72000, 0), + (72002, 72003, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (73472, 73473, 0), + (73475, 73475, 0), + (73524, 73530, 0), + (73534, 73538, 0), + (73562, 73562, 0), + (78896, 78912, 0), + (78919, 78933, 0), + (90398, 90415, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94180, 94180, 0), + (94192, 94193, 0), + (94208, 100343, 2), + (100352, 101589, 2), + (101631, 101640, 2), + (110576, 110579, 2), + (110581, 110587, 2), + (110589, 110590, 2), + (110592, 110882, 2), + (110898, 110898, 2), + (110928, 110930, 2), + (110933, 110933, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (118528, 118573, 0), + (118576, 118598, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (119552, 119638, 2), + (119648, 119670, 2), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123023, 123023, 0), + (123184, 123190, 0), + (123566, 123566, 0), + (123628, 123631, 0), + (124140, 124143, 0), + (124398, 124399, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128727, 2), + (128732, 128735, 2), + (128747, 128748, 2), + (128756, 128764, 2), + (128992, 129003, 2), + (129008, 129008, 2), + (129292, 129338, 2), + (129340, 129349, 2), + (129351, 129535, 2), + (129648, 129660, 2), + (129664, 129673, 2), + (129679, 129734, 2), + (129742, 129756, 2), + (129759, 129769, 2), + (129776, 129784, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode17-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode17-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..4108bb44de77d023d5b9dadf3601ad1141f7aeae --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode17-0-0.py @@ -0,0 +1,691 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "17.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2045, 2045, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2199, 2207, 0), + (2250, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2558, 2558, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2810, 2815, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2901, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3076, 0), + (3132, 3132, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3315, 3315, 0), + (3328, 3331, 0), + (3387, 3388, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3457, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3772, 0), + (3784, 3790, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5909, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6159, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6877, 0), + (6880, 6891, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7412, 7412, 0), + (7415, 7417, 0), + (7616, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9776, 9783, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9866, 9871, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12591, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12773, 2), + (12783, 12830, 2), + (12832, 12871, 2), + (12880, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43052, 43052, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43263, 43263, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (68900, 68903, 0), + (68969, 68973, 0), + (69291, 69292, 0), + (69370, 69375, 0), + (69446, 69456, 0), + (69506, 69509, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69744, 69744, 0), + (69747, 69748, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69826, 69826, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (69957, 69958, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70089, 70092, 0), + (70094, 70095, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70209, 70209, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70459, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70584, 70592, 0), + (70594, 70594, 0), + (70597, 70597, 0), + (70599, 70602, 0), + (70604, 70608, 0), + (70610, 70610, 0), + (70625, 70626, 0), + (70709, 70726, 0), + (70750, 70750, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (71724, 71738, 0), + (71984, 71989, 0), + (71991, 71992, 0), + (71995, 71998, 0), + (72000, 72000, 0), + (72002, 72003, 0), + (72145, 72151, 0), + (72154, 72160, 0), + (72164, 72164, 0), + (72193, 72202, 0), + (72243, 72249, 0), + (72251, 72254, 0), + (72263, 72263, 0), + (72273, 72283, 0), + (72330, 72345, 0), + (72544, 72551, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (73009, 73014, 0), + (73018, 73018, 0), + (73020, 73021, 0), + (73023, 73029, 0), + (73031, 73031, 0), + (73098, 73102, 0), + (73104, 73105, 0), + (73107, 73111, 0), + (73459, 73462, 0), + (73472, 73473, 0), + (73475, 73475, 0), + (73524, 73530, 0), + (73534, 73538, 0), + (73562, 73562, 0), + (78896, 78912, 0), + (78919, 78933, 0), + (90398, 90415, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94031, 94031, 0), + (94033, 94087, 0), + (94095, 94098, 0), + (94176, 94179, 2), + (94180, 94180, 0), + (94192, 94193, 0), + (94194, 94198, 2), + (94208, 101589, 2), + (101631, 101662, 2), + (101760, 101874, 2), + (110576, 110579, 2), + (110581, 110587, 2), + (110589, 110590, 2), + (110592, 110882, 2), + (110898, 110898, 2), + (110928, 110930, 2), + (110933, 110933, 2), + (110948, 110951, 2), + (110960, 111355, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (118528, 118573, 0), + (118576, 118598, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (119552, 119638, 2), + (119648, 119670, 2), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (123023, 123023, 0), + (123184, 123190, 0), + (123566, 123566, 0), + (123628, 123631, 0), + (124140, 124143, 0), + (124398, 124399, 0), + (124643, 124643, 0), + (124646, 124646, 0), + (124654, 124655, 0), + (124661, 124661, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127584, 127589, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128725, 128728, 2), + (128732, 128735, 2), + (128747, 128748, 2), + (128756, 128764, 2), + (128992, 129003, 2), + (129008, 129008, 2), + (129292, 129338, 2), + (129340, 129349, 2), + (129351, 129535, 2), + (129648, 129660, 2), + (129664, 129674, 2), + (129678, 129734, 2), + (129736, 129736, 2), + (129741, 129756, 2), + (129759, 129770, 2), + (129775, 129784, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode4-1-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode4-1-0.py new file mode 100644 index 0000000000000000000000000000000000000000..23ff5cf1d0cccdc6fe6503c410e900c4d83eb49a --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode4-1-0.py @@ -0,0 +1,425 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "4.1.0", + [ + (0, 8, 0), + (14, 31, 0), + (127, 132, 0), + (134, 159, 0), + (768, 879, 0), + (1155, 1158, 0), + (1160, 1161, 0), + (1425, 1465, 0), + (1467, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1539, 0), + (1552, 1557, 0), + (1611, 1630, 0), + (1648, 1648, 0), + (1750, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2305, 2307, 0), + (2364, 2364, 0), + (2366, 2381, 0), + (2385, 2388, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2672, 2673, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2883, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3330, 3331, 0), + (3390, 3395, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3984, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4140, 4146, 0), + (4150, 4153, 0), + (4182, 4185, 0), + (4352, 4441, 2), + (4447, 4447, 2), + (4448, 4607, 0), + (4959, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (7616, 7619, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8427, 0), + (9001, 9002, 2), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12588, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12727, 2), + (12736, 12751, 2), + (12784, 12830, 2), + (12832, 12867, 2), + (12880, 13054, 2), + (13056, 19893, 2), + (19968, 40891, 2), + (40960, 42124, 2), + (42128, 42182, 2), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (44032, 55203, 2), + (55216, 57343, 0), + (63744, 64045, 2), + (64048, 64106, 2), + (64112, 64217, 2), + (64286, 64286, 0), + (64976, 65007, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65059, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (65534, 65535, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (131070, 131071, 0), + (131072, 196605, 2), + (196606, 196607, 0), + (196608, 262141, 2), + (262142, 262143, 0), + (327678, 327679, 0), + (393214, 393215, 0), + (458750, 458751, 0), + (524286, 524287, 0), + (589822, 589823, 0), + (655358, 655359, 0), + (720894, 720895, 0), + (786430, 786431, 0), + (851966, 851967, 0), + (917502, 921599, 0), + (983038, 983039, 0), + (1048574, 1048575, 0), + (1114110, 1114111, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..599fb785709d40ca23eee7e8e9cbededc8ad389b --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-0-0.py @@ -0,0 +1,430 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "5.0.0", + [ + (0, 8, 0), + (14, 31, 0), + (127, 132, 0), + (134, 159, 0), + (768, 879, 0), + (1155, 1158, 0), + (1160, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1539, 0), + (1552, 1557, 0), + (1611, 1630, 0), + (1648, 1648, 0), + (1750, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2305, 2307, 0), + (2364, 2364, 0), + (2366, 2381, 0), + (2385, 2388, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2672, 2673, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2883, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3395, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3984, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4140, 4146, 0), + (4150, 4153, 0), + (4182, 4185, 0), + (4352, 4441, 2), + (4447, 4447, 2), + (4448, 4607, 0), + (4959, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7616, 7626, 0), + (7678, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8431, 0), + (9001, 9002, 2), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12588, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12727, 2), + (12736, 12751, 2), + (12784, 12830, 2), + (12832, 12867, 2), + (12880, 13054, 2), + (13056, 19893, 2), + (19968, 40891, 2), + (40960, 42124, 2), + (42128, 42182, 2), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (44032, 55203, 2), + (55216, 57343, 0), + (63744, 64045, 2), + (64048, 64106, 2), + (64112, 64217, 2), + (64286, 64286, 0), + (64976, 65007, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65059, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (65534, 65535, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (131070, 131071, 0), + (131072, 196605, 2), + (196606, 196607, 0), + (196608, 262141, 2), + (262142, 262143, 0), + (327678, 327679, 0), + (393214, 393215, 0), + (458750, 458751, 0), + (524286, 524287, 0), + (589822, 589823, 0), + (655358, 655359, 0), + (720894, 720895, 0), + (786430, 786431, 0), + (851966, 851967, 0), + (917502, 921599, 0), + (983038, 983039, 0), + (1048574, 1048575, 0), + (1114110, 1114111, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-1-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-1-0.py new file mode 100644 index 0000000000000000000000000000000000000000..016e7825eccd6b87410741db79948bb0b99ea921 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-1-0.py @@ -0,0 +1,433 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "5.1.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1539, 0), + (1552, 1562, 0), + (1611, 1630, 0), + (1648, 1648, 0), + (1750, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2305, 2307, 0), + (2364, 2364, 0), + (2366, 2381, 0), + (2385, 2388, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3984, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4352, 4441, 2), + (4447, 4447, 2), + (4448, 4607, 0), + (4959, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7082, 0), + (7204, 7223, 0), + (7616, 7654, 0), + (7678, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12727, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12867, 2), + (12880, 13054, 2), + (13056, 19893, 2), + (19968, 40899, 2), + (40960, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42620, 42621, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64045, 2), + (64048, 64106, 2), + (64112, 64217, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65062, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-2-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-2-0.py new file mode 100644 index 0000000000000000000000000000000000000000..e984f12e95eed5eb67cedad1d3b92f5f23c718ed --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode5-2-0.py @@ -0,0 +1,461 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "5.2.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1539, 0), + (1552, 1562, 0), + (1611, 1630, 0), + (1648, 1648, 0), + (1750, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2304, 2307, 0), + (2364, 2364, 0), + (2366, 2382, 0), + (2385, 2389, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3984, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4959, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7082, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7410, 0), + (7616, 7654, 0), + (7677, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12727, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42620, 42621, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43643, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65062, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (69760, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (127488, 127488, 2), + (127504, 127537, 2), + (127552, 127560, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..8d5abb455c390f585f67ed844e3fa18510d92a28 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-0-0.py @@ -0,0 +1,469 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "6.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1539, 0), + (1552, 1562, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1757, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2304, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7082, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7410, 0), + (7616, 7654, 0), + (7676, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42620, 42621, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43643, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65062, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69760, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (110592, 110593, 2), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (127488, 127490, 2), + (127504, 127546, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-1-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-1-0.py new file mode 100644 index 0000000000000000000000000000000000000000..29d3e9298806c875b8969195a1cb6a39c9918cb9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-1-0.py @@ -0,0 +1,480 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "6.1.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1540, 0), + (1552, 1562, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1757, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2276, 2302, 0), + (2304, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7616, 7654, 0), + (7676, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42655, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43643, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65062, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69760, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (71339, 71351, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (110592, 110593, 2), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (127488, 127490, 2), + (127504, 127546, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-2-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-2-0.py new file mode 100644 index 0000000000000000000000000000000000000000..d0cda351a493664500d0179ab6dac7b2f978c69d --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-2-0.py @@ -0,0 +1,480 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "6.2.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1540, 0), + (1552, 1562, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1757, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2276, 2302, 0), + (2304, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6157, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7616, 7654, 0), + (7676, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42655, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43643, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65062, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69760, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (71339, 71351, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (110592, 110593, 2), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (127488, 127490, 2), + (127504, 127546, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-3-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-3-0.py new file mode 100644 index 0000000000000000000000000000000000000000..cffb7ee942eb8f175e182d0105c4e356ad8519fb --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode6-3-0.py @@ -0,0 +1,481 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "6.3.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1540, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1757, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2276, 2302, 0), + (2304, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3073, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3202, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3330, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7616, 7654, 0), + (7676, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42655, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43643, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65062, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69760, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (71339, 71351, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (110592, 110593, 2), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (127488, 127490, 2), + (127504, 127546, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode7-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode7-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..996478ac24a54b844beb0d209fe43db9a7a2a014 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode7-0-0.py @@ -0,0 +1,507 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "7.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1541, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1757, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2276, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3329, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6576, 6592, 0), + (6600, 6601, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7416, 7417, 0), + (7616, 7669, 0), + (7676, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42655, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65069, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70188, 70199, 0), + (70367, 70378, 0), + (70401, 70403, 0), + (70460, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (110592, 110593, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (125136, 125142, 0), + (127488, 127490, 2), + (127504, 127546, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode8-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode8-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..ae34a382a6a8b486c5fc2d4c6491cd6c3ab56d77 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode8-0-0.py @@ -0,0 +1,515 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "8.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1536, 1541, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1757, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1807, 1807, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3329, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7416, 7417, 0), + (7616, 7669, 0), + (7676, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (9001, 9002, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43204, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69821, 69821, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70090, 70092, 0), + (70188, 70199, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70460, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (110592, 110593, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (125136, 125142, 0), + (127488, 127490, 2), + (127504, 127546, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127995, 127999, 0), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode9-0-0.py b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode9-0-0.py new file mode 100644 index 0000000000000000000000000000000000000000..b15f67d44eb15e2388aa52089922eaf77916d578 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rich/_unicode_data/unicode9-0-0.py @@ -0,0 +1,598 @@ +# Auto generated by tools/make_width_tables.py +# Data from wcwidth project (https://github.com/jquast/wcwidth) + +from rich.cells import CellTable + +cell_table = CellTable( + "9.0.0", + [ + (0, 0, 0), + (768, 879, 0), + (1155, 1161, 0), + (1425, 1469, 0), + (1471, 1471, 0), + (1473, 1474, 0), + (1476, 1477, 0), + (1479, 1479, 0), + (1552, 1562, 0), + (1564, 1564, 0), + (1611, 1631, 0), + (1648, 1648, 0), + (1750, 1756, 0), + (1759, 1764, 0), + (1767, 1768, 0), + (1770, 1773, 0), + (1809, 1809, 0), + (1840, 1866, 0), + (1958, 1968, 0), + (2027, 2035, 0), + (2070, 2073, 0), + (2075, 2083, 0), + (2085, 2087, 0), + (2089, 2093, 0), + (2137, 2139, 0), + (2260, 2273, 0), + (2275, 2307, 0), + (2362, 2364, 0), + (2366, 2383, 0), + (2385, 2391, 0), + (2402, 2403, 0), + (2433, 2435, 0), + (2492, 2492, 0), + (2494, 2500, 0), + (2503, 2504, 0), + (2507, 2509, 0), + (2519, 2519, 0), + (2530, 2531, 0), + (2561, 2563, 0), + (2620, 2620, 0), + (2622, 2626, 0), + (2631, 2632, 0), + (2635, 2637, 0), + (2641, 2641, 0), + (2672, 2673, 0), + (2677, 2677, 0), + (2689, 2691, 0), + (2748, 2748, 0), + (2750, 2757, 0), + (2759, 2761, 0), + (2763, 2765, 0), + (2786, 2787, 0), + (2817, 2819, 0), + (2876, 2876, 0), + (2878, 2884, 0), + (2887, 2888, 0), + (2891, 2893, 0), + (2902, 2903, 0), + (2914, 2915, 0), + (2946, 2946, 0), + (3006, 3010, 0), + (3014, 3016, 0), + (3018, 3021, 0), + (3031, 3031, 0), + (3072, 3075, 0), + (3134, 3140, 0), + (3142, 3144, 0), + (3146, 3149, 0), + (3157, 3158, 0), + (3170, 3171, 0), + (3201, 3203, 0), + (3260, 3260, 0), + (3262, 3268, 0), + (3270, 3272, 0), + (3274, 3277, 0), + (3285, 3286, 0), + (3298, 3299, 0), + (3329, 3331, 0), + (3390, 3396, 0), + (3398, 3400, 0), + (3402, 3405, 0), + (3415, 3415, 0), + (3426, 3427, 0), + (3458, 3459, 0), + (3530, 3530, 0), + (3535, 3540, 0), + (3542, 3542, 0), + (3544, 3551, 0), + (3570, 3571, 0), + (3633, 3633, 0), + (3636, 3642, 0), + (3655, 3662, 0), + (3761, 3761, 0), + (3764, 3769, 0), + (3771, 3772, 0), + (3784, 3789, 0), + (3864, 3865, 0), + (3893, 3893, 0), + (3895, 3895, 0), + (3897, 3897, 0), + (3902, 3903, 0), + (3953, 3972, 0), + (3974, 3975, 0), + (3981, 3991, 0), + (3993, 4028, 0), + (4038, 4038, 0), + (4139, 4158, 0), + (4182, 4185, 0), + (4190, 4192, 0), + (4194, 4196, 0), + (4199, 4205, 0), + (4209, 4212, 0), + (4226, 4237, 0), + (4239, 4239, 0), + (4250, 4253, 0), + (4352, 4447, 2), + (4448, 4607, 0), + (4957, 4959, 0), + (5906, 5908, 0), + (5938, 5940, 0), + (5970, 5971, 0), + (6002, 6003, 0), + (6068, 6099, 0), + (6109, 6109, 0), + (6155, 6158, 0), + (6277, 6278, 0), + (6313, 6313, 0), + (6432, 6443, 0), + (6448, 6459, 0), + (6679, 6683, 0), + (6741, 6750, 0), + (6752, 6780, 0), + (6783, 6783, 0), + (6832, 6846, 0), + (6912, 6916, 0), + (6964, 6980, 0), + (7019, 7027, 0), + (7040, 7042, 0), + (7073, 7085, 0), + (7142, 7155, 0), + (7204, 7223, 0), + (7376, 7378, 0), + (7380, 7400, 0), + (7405, 7405, 0), + (7410, 7412, 0), + (7416, 7417, 0), + (7616, 7669, 0), + (7675, 7679, 0), + (8203, 8207, 0), + (8232, 8238, 0), + (8288, 8303, 0), + (8400, 8432, 0), + (8986, 8987, 2), + (9001, 9002, 2), + (9193, 9196, 2), + (9200, 9200, 2), + (9203, 9203, 2), + (9725, 9726, 2), + (9748, 9749, 2), + (9800, 9811, 2), + (9855, 9855, 2), + (9875, 9875, 2), + (9889, 9889, 2), + (9898, 9899, 2), + (9917, 9918, 2), + (9924, 9925, 2), + (9934, 9934, 2), + (9940, 9940, 2), + (9962, 9962, 2), + (9970, 9971, 2), + (9973, 9973, 2), + (9978, 9978, 2), + (9981, 9981, 2), + (9989, 9989, 2), + (9994, 9995, 2), + (10024, 10024, 2), + (10060, 10060, 2), + (10062, 10062, 2), + (10067, 10069, 2), + (10071, 10071, 2), + (10133, 10135, 2), + (10160, 10160, 2), + (10175, 10175, 2), + (11035, 11036, 2), + (11088, 11088, 2), + (11093, 11093, 2), + (11503, 11505, 0), + (11647, 11647, 0), + (11744, 11775, 0), + (11904, 11929, 2), + (11931, 12019, 2), + (12032, 12245, 2), + (12272, 12283, 2), + (12288, 12329, 2), + (12330, 12335, 0), + (12336, 12350, 2), + (12353, 12438, 2), + (12441, 12442, 0), + (12443, 12543, 2), + (12549, 12589, 2), + (12593, 12643, 2), + (12644, 12644, 0), + (12645, 12686, 2), + (12688, 12730, 2), + (12736, 12771, 2), + (12784, 12830, 2), + (12832, 12871, 2), + (12880, 13054, 2), + (13056, 19903, 2), + (19968, 42124, 2), + (42128, 42182, 2), + (42607, 42610, 0), + (42612, 42621, 0), + (42654, 42655, 0), + (42736, 42737, 0), + (43010, 43010, 0), + (43014, 43014, 0), + (43019, 43019, 0), + (43043, 43047, 0), + (43136, 43137, 0), + (43188, 43205, 0), + (43232, 43249, 0), + (43302, 43309, 0), + (43335, 43347, 0), + (43360, 43388, 2), + (43392, 43395, 0), + (43443, 43456, 0), + (43493, 43493, 0), + (43561, 43574, 0), + (43587, 43587, 0), + (43596, 43597, 0), + (43643, 43645, 0), + (43696, 43696, 0), + (43698, 43700, 0), + (43703, 43704, 0), + (43710, 43711, 0), + (43713, 43713, 0), + (43755, 43759, 0), + (43765, 43766, 0), + (44003, 44010, 0), + (44012, 44013, 0), + (44032, 55203, 2), + (55216, 55295, 0), + (63744, 64255, 2), + (64286, 64286, 0), + (65024, 65039, 0), + (65040, 65049, 2), + (65056, 65071, 0), + (65072, 65106, 2), + (65108, 65126, 2), + (65128, 65131, 2), + (65279, 65279, 0), + (65281, 65376, 2), + (65440, 65440, 0), + (65504, 65510, 2), + (65520, 65531, 0), + (66045, 66045, 0), + (66272, 66272, 0), + (66422, 66426, 0), + (68097, 68099, 0), + (68101, 68102, 0), + (68108, 68111, 0), + (68152, 68154, 0), + (68159, 68159, 0), + (68325, 68326, 0), + (69632, 69634, 0), + (69688, 69702, 0), + (69759, 69762, 0), + (69808, 69818, 0), + (69888, 69890, 0), + (69927, 69940, 0), + (70003, 70003, 0), + (70016, 70018, 0), + (70067, 70080, 0), + (70090, 70092, 0), + (70188, 70199, 0), + (70206, 70206, 0), + (70367, 70378, 0), + (70400, 70403, 0), + (70460, 70460, 0), + (70462, 70468, 0), + (70471, 70472, 0), + (70475, 70477, 0), + (70487, 70487, 0), + (70498, 70499, 0), + (70502, 70508, 0), + (70512, 70516, 0), + (70709, 70726, 0), + (70832, 70851, 0), + (71087, 71093, 0), + (71096, 71104, 0), + (71132, 71133, 0), + (71216, 71232, 0), + (71339, 71351, 0), + (71453, 71467, 0), + (72751, 72758, 0), + (72760, 72767, 0), + (72850, 72871, 0), + (72873, 72886, 0), + (92912, 92916, 0), + (92976, 92982, 0), + (94033, 94078, 0), + (94095, 94098, 0), + (94176, 94176, 2), + (94208, 100332, 2), + (100352, 101106, 2), + (110592, 110593, 2), + (113821, 113822, 0), + (113824, 113827, 0), + (119141, 119145, 0), + (119149, 119170, 0), + (119173, 119179, 0), + (119210, 119213, 0), + (119362, 119364, 0), + (121344, 121398, 0), + (121403, 121452, 0), + (121461, 121461, 0), + (121476, 121476, 0), + (121499, 121503, 0), + (121505, 121519, 0), + (122880, 122886, 0), + (122888, 122904, 0), + (122907, 122913, 0), + (122915, 122916, 0), + (122918, 122922, 0), + (125136, 125142, 0), + (125252, 125258, 0), + (126980, 126980, 2), + (127183, 127183, 2), + (127374, 127374, 2), + (127377, 127386, 2), + (127488, 127490, 2), + (127504, 127547, 2), + (127552, 127560, 2), + (127568, 127569, 2), + (127744, 127776, 2), + (127789, 127797, 2), + (127799, 127868, 2), + (127870, 127891, 2), + (127904, 127946, 2), + (127951, 127955, 2), + (127968, 127984, 2), + (127988, 127988, 2), + (127992, 127994, 2), + (127995, 127999, 0), + (128000, 128062, 2), + (128064, 128064, 2), + (128066, 128252, 2), + (128255, 128317, 2), + (128331, 128334, 2), + (128336, 128359, 2), + (128378, 128378, 2), + (128405, 128406, 2), + (128420, 128420, 2), + (128507, 128591, 2), + (128640, 128709, 2), + (128716, 128716, 2), + (128720, 128722, 2), + (128747, 128748, 2), + (128756, 128758, 2), + (129296, 129310, 2), + (129312, 129319, 2), + (129328, 129328, 2), + (129331, 129342, 2), + (129344, 129355, 2), + (129360, 129374, 2), + (129408, 129425, 2), + (129472, 129472, 2), + (131072, 196605, 2), + (196608, 262141, 2), + (917504, 921599, 0), + ], + frozenset( + [ + "#", + "*", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "©", + "®", + "‼", + "⁉", + "™", + "ℹ", + "↔", + "↕", + "↖", + "↗", + "↘", + "↙", + "↩", + "↪", + "⌨", + "⏏", + "⏭", + "⏮", + "⏯", + "⏱", + "⏲", + "⏸", + "⏹", + "⏺", + "Ⓜ", + "▪", + "▫", + "▶", + "◀", + "◻", + "◼", + "☀", + "☁", + "☂", + "☃", + "☄", + "☎", + "☑", + "☘", + "☝", + "☠", + "☢", + "☣", + "☦", + "☪", + "☮", + "☯", + "☸", + "☹", + "☺", + "♀", + "♂", + "♟", + "♠", + "♣", + "♥", + "♦", + "♨", + "♻", + "♾", + "⚒", + "⚔", + "⚕", + "⚖", + "⚗", + "⚙", + "⚛", + "⚜", + "⚠", + "⚧", + "⚰", + "⚱", + "⛈", + "⛏", + "⛑", + "⛓", + "⛩", + "⛰", + "⛱", + "⛴", + "⛷", + "⛸", + "⛹", + "✂", + "✈", + "✉", + "✌", + "✍", + "✏", + "✒", + "✔", + "✖", + "✝", + "✡", + "✳", + "✴", + "❄", + "❇", + "❣", + "❤", + "➡", + "⤴", + "⤵", + "⬅", + "⬆", + "⬇", + "🅰", + "🅱", + "🅾", + "🅿", + "🌡", + "🌤", + "🌥", + "🌦", + "🌧", + "🌨", + "🌩", + "🌪", + "🌫", + "🌬", + "🌶", + "🍽", + "🎖", + "🎗", + "🎙", + "🎚", + "🎛", + "🎞", + "🎟", + "🏋", + "🏌", + "🏍", + "🏎", + "🏔", + "🏕", + "🏖", + "🏗", + "🏘", + "🏙", + "🏚", + "🏛", + "🏜", + "🏝", + "🏞", + "🏟", + "🏳", + "🏵", + "🏷", + "🐿", + "👁", + "📽", + "🕉", + "🕊", + "🕯", + "🕰", + "🕳", + "🕴", + "🕵", + "🕶", + "🕷", + "🕸", + "🕹", + "🖇", + "🖊", + "🖋", + "🖌", + "🖍", + "🖐", + "🖥", + "🖨", + "🖱", + "🖲", + "🖼", + "🗂", + "🗃", + "🗄", + "🗑", + "🗒", + "🗓", + "🗜", + "🗝", + "🗞", + "🗡", + "🗣", + "🗨", + "🗯", + "🗳", + "🗺", + "🛋", + "🛍", + "🛎", + "🛏", + "🛠", + "🛡", + "🛢", + "🛣", + "🛤", + "🛥", + "🛩", + "🛰", + "🛳", + ] + ), +) diff --git a/python/user_packages/Python313/site-packages/rpds/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/rpds/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92e25faeb23db5cfdbeeece6409aea629eccea7b Binary files /dev/null and b/python/user_packages/Python313/site-packages/rpds/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/rpds_py-0.30.0.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/rpds_py-0.30.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9a3970a75793bcf642507d42ffafaf2986e84075 --- /dev/null +++ b/python/user_packages/Python313/site-packages/rpds_py-0.30.0.dist-info/licenses/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Julian Berman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__init__.py b/python/user_packages/Python313/site-packages/ruamel/yaml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c548ffd4a229de003d0d4e55cd3a348b986ba9e3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/__init__.py @@ -0,0 +1,51 @@ + +from __future__ import annotations + +if False: # MYPY + from typing import Dict, Any # NOQA + +_package_data = dict( + full_package_name='ruamel.yaml', + version_info=(0, 19, 1), + __version__='0.19.1', + version_timestamp='2026-01-02 17:17:31', + author='Anthon van der Neut', + author_email='a.van.der.neut@ruamel.eu', + description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA + entry_points=None, + since=2014, + extras_require={ + 'oldlibyaml' : ['ruamel.yaml.clib; platform_python_implementation=="CPython"'], # NOQA + 'libyaml' : ['ruamel.yaml.clibz>=0.3.7; platform_python_implementation=="CPython"'], # NOQA + 'jinja2': ['ruamel.yaml.jinja2>=0.2'], + 'docs': ['ryd', 'mercurial>5.7'], + }, + classifiers=[ + 'Programming Language :: Python :: Implementation :: CPython', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Text Processing :: Markup', + 'Typing :: Typed', + ], + keywords='yaml 1.2 parser round-trip preserve quotes order config', + url_doc='https://yaml.dev/doc/{full_package_name}', + tox=dict( + env='*', + fl8excl='_test/lib,branch_default', + ), + # universal=True, + supported=[(3, 9)], # minimum +) # type: Dict[Any, Any] + + +version_info = _package_data['version_info'] +__version__ = _package_data['__version__'] + +try: + from .cyaml import * # NOQA + + __with_libyaml__ = True +except (ImportError, ValueError): # for Jython + __with_libyaml__ = False + __yaml_lib = None + +from ruamel.yaml.main import * # NOQA diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..74838e94fe763d00d76aa4c8851873c9db5c4a0d Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/anchor.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/anchor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94a90523bfb2386067a5d7d5147791b803328326 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/anchor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/comments.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/comments.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4432855698aec7369dda0fc90269ffb0983c1b62 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/comments.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/compat.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/compat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..901f658b9b91079b997e3690f3415338822b42e6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/compat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/composer.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/composer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d84b59b9a76dc7749eb43597be12e79f8b7b8cf7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/composer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/configobjwalker.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/configobjwalker.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..06f24e3ab335c331d10b99954ecf5a93b64eecfb Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/configobjwalker.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/constructor.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/constructor.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2282923347e1695c33a19ca6cc71d880f27494cb Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/constructor.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/cyaml.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/cyaml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47057709d4652ea5777f5d81efcf5d2d3b8c73a3 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/cyaml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/docinfo.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/docinfo.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..97235fad42191831fcc816b079bca400b4c46703 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/docinfo.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/dumper.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/dumper.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce27ae39323cf2c4f9fd345f6f48aee0e7122858 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/dumper.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/emitter.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/emitter.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d085e55a74f00a8d73b997942286474b6fee78a7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/emitter.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/error.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/error.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d2ab971be44585a014b65ca30620ef68982c275 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/error.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/events.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/events.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff0c78a7712a3a4c1ad3cb81b6a3af63c533cf0e Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/events.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/loader.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/loader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab994c0a7e323ba10a2163ceec3e07ef71c4874a Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/loader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/main.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/main.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c5ce3e01c72bee8688c2f02d89b63dd039cf8e39 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/main.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/mergevalue.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/mergevalue.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1327e9237f1a2bc8d6edb54d916aa4a92fb5c9f6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/mergevalue.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/nodes.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/nodes.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..381284468e69408ae920105fe5eb83a8b9338df9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/nodes.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/parser.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/parser.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0138a9ed6d3903f35b313937835cafb01a797d2a Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/parser.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/reader.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/reader.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d01d1ddf5a7cb63cba7f6043e63bd09188f11646 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/reader.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/representer.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/representer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8f1455db38e37036af6629cd030af4cf891ac0d Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/representer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/resolver.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/resolver.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b29436a4c561f943c0bd83eab8444002b475c6ac Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/resolver.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarbool.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarbool.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8349533c32e921564f7c0ec4c53176ddb7e2822 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarbool.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarfloat.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarfloat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8c9b7d09b10847b551039c32c2c307160fa63931 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarfloat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarint.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarint.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab112d9e08e0b5a4368c8b4e7289b0c769d2207f Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarint.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarstring.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarstring.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34cbd59475479ef790c72dd75c830f36084bb21b Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scalarstring.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scanner.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scanner.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea912b3c416e9c7e018c0ff2b28e377b79cd0c8f Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/scanner.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/serializer.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/serializer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8c618bac50ea352e4dd03acabd12c3e4fe45368 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/serializer.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/tag.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/tag.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b119575c42af88dbe0a0248ac14d02a8b57b7e47 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/tag.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/timestamp.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/timestamp.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d588d700a31ea766ad1cd63ed5db92d6602a8a20 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/timestamp.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/tokens.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/tokens.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..942533e67987a0ab961b7c540fd095e09fe28d62 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/tokens.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/util.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/util.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f8f104390bca214e0d8201543bef3df10f0c49e Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/__pycache__/util.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/anchor.py b/python/user_packages/Python313/site-packages/ruamel/yaml/anchor.py new file mode 100644 index 0000000000000000000000000000000000000000..4f342f3e0b9f14619bf633ec8cc20e9c555f1384 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/anchor.py @@ -0,0 +1,20 @@ + +from __future__ import annotations + +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, Iterator # NOQA + +anchor_attrib = '_yaml_anchor' + + +class Anchor: + __slots__ = 'value', 'always_dump' + attrib = anchor_attrib + + def __init__(self) -> None: + self.value = None + self.always_dump = False + + def __repr__(self) -> Any: + ad = ', (always dump)' if self.always_dump else "" + return f'Anchor({self.value!r}{ad})' diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__init__.py b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fac072851adebc37e97fcf094748de8d87371510 Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__pycache__/setup.cpython-313.pyc b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__pycache__/setup.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c10578e466a167e790ca427c0200dfb37084af6a Binary files /dev/null and b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/__pycache__/setup.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/setup.py b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..8e59069f5a92651eb3648477933ed228b9e5fe6b --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/clibz/setup.py @@ -0,0 +1,44 @@ + +import sys +from setuptools import Extension +from setuptools import setup + +base = 'https://sourceforge.net/p/ruamel-yaml-clibz/' + +setup( + name='ruamel.yaml.clibz', + version='0.3.7', + python_requires='>=3.9', + build_zig=True, + author='Anthon van der Neut', + author_email='a.van.der.neut@ruamel.eu', + description='C version of reader, parser and emitter for ruamel.yaml, compiled with Zig,' + ' derived from libyaml', + long_description=open('README.md', encoding='utf-8').read(), + long_description_content_type="text/markdown", + project_urls=dict( + Home=base, + Source=f'{base}code/ci/default/tree/', + Tracker=f'{base}tickets/', + Documentation='https://yaml.dev/doc/ruamel.yaml.clibz', + ), + license='MIT', + ext_modules=[Extension( + name='_ruamel_yaml_clibz', + sources=[ + '_ruamel_yaml_clibz.c', + 'api.c', + 'writer.c', + 'dumper.c', + 'loader.c', + 'reader.c', + 'scanner.c', + 'parser.c', + 'emitter.c', + ], + extra_compile_args=[ + # '-O', 'Debug', + ], + )], + # setup_requires=[] if 'egg_info' in sys.argv else ['setuptools-zig>=0.5.1', 'ziglang<0.16'], +) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/comments.py b/python/user_packages/Python313/site-packages/ruamel/yaml/comments.py new file mode 100644 index 0000000000000000000000000000000000000000..489284fa8d5a17206c096dfc11320e2eda8ba754 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/comments.py @@ -0,0 +1,1208 @@ + +from __future__ import annotations + +""" +stuff to deal with comments and formatting on dict/list/ordereddict/set +these are not really related, formatting could be factored out as +a separate base +""" + +import sys +import copy + + +from ruamel.yaml.compat import ordereddict +from ruamel.yaml.compat import MutableSliceableSequence, nprintf # NOQA +from ruamel.yaml.scalarstring import ScalarString +from ruamel.yaml.anchor import Anchor +from ruamel.yaml.tag import Tag + +from collections.abc import MutableSet, Sized, Set, Mapping + +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, Iterator # NOQA + +# fmt: off +__all__ = ['CommentedSeq', 'CommentedKeySeq', + 'CommentedMap', 'CommentedOrderedMap', + 'CommentedSet', 'comment_attrib', 'merge_attrib', + 'TaggedScalar', + 'C_POST', 'C_PRE', 'C_SPLIT_ON_FIRST_BLANK', 'C_BLANK_LINE_PRESERVE_SPACE', + ] +# fmt: on + +# splitting of comments by the scanner +# an EOLC (End-Of-Line Comment) is preceded by some token +# an FLC (Full Line Comment) is a comment not preceded by a token, i.e. # is +# the first non-blank on line +# a BL is a blank line i.e. empty or spaces/tabs only +# bits 0 and 1 are combined, you can choose only one +C_POST = 0b00 +C_PRE = 0b01 +C_SPLIT_ON_FIRST_BLANK = 0b10 # as C_POST, but if blank line then C_PRE all lines before +# first blank goes to POST even if no following real FLC +# (first blank -> first of post) +# 0b11 -> reserved for future use +C_BLANK_LINE_PRESERVE_SPACE = 0b100 +# C_EOL_PRESERVE_SPACE2 = 0b1000 + + +class IDX: + # temporary auto increment, so rearranging is easier + def __init__(self) -> None: + self._idx = 0 + + def __call__(self) -> Any: + x = self._idx + self._idx += 1 + return x + + def __str__(self) -> Any: + return str(self._idx) + + +cidx = IDX() + +# more or less in order of subjective expected likelyhood +# the _POST and _PRE ones are lists themselves +C_VALUE_EOL = C_ELEM_EOL = cidx() +C_KEY_EOL = cidx() +C_KEY_PRE = C_ELEM_PRE = cidx() # not this is not value +C_VALUE_POST = C_ELEM_POST = cidx() # not this is not value +C_VALUE_PRE = cidx() +C_KEY_POST = cidx() +C_TAG_EOL = cidx() +C_TAG_POST = cidx() +C_TAG_PRE = cidx() +C_ANCHOR_EOL = cidx() +C_ANCHOR_POST = cidx() +C_ANCHOR_PRE = cidx() + + +comment_attrib = '_yaml_comment' +format_attrib = '_yaml_format' +line_col_attrib = '_yaml_line_col' +merge_attrib = '_yaml_merge' + + +class Comment: + # using sys.getsize tested the Comment objects, __slots__ makes them bigger + # and adding self.end did not matter + __slots__ = 'comment', '_items', '_post', '_pre' + attrib = comment_attrib + + def __init__(self, old: bool = True) -> None: + self._pre = None if old else [] # type: ignore + self.comment = None # [post, [pre]] + # map key (mapping/omap/dict) or index (sequence/list) to a list of + # dict: post_key, pre_key, post_value, pre_value + # list: pre item, post item + self._items: Dict[Any, Any] = {} + # self._start = [] # should not put these on first item + self._post: List[Any] = [] # end of document comments + + def __str__(self) -> str: + if bool(self._post): + end = ',\n end=' + str(self._post) + else: + end = "" + return f'Comment(comment={self.comment},\n items={self._items}{end})' + + def _old__repr__(self) -> str: + if bool(self._post): + end = ',\n end=' + str(self._post) + else: + end = "" + try: + ln = max([len(str(k)) for k in self._items]) + 1 + except ValueError: + ln = '' # type: ignore + it = ' '.join([f'{str(k) + ":":{ln}} {v}\n' for k, v in self._items.items()]) + if it: + it = '\n ' + it + ' ' + return f'Comment(\n start={self.comment},\n items={{{it}}}{end})' + + def __repr__(self) -> str: + if self._pre is None: + return self._old__repr__() + if bool(self._post): + end = ',\n end=' + repr(self._post) + else: + end = "" + try: + ln = max([len(str(k)) for k in self._items]) + 1 + except ValueError: + ln = '' # type: ignore + it = ' '.join([f'{str(k) + ":":{ln}} {v}\n' for k, v in self._items.items()]) + if it: + it = '\n ' + it + ' ' + return f'Comment(\n pre={self.pre},\n items={{{it}}}{end})' + + @property + def items(self) -> Any: + return self._items + + @property + def end(self) -> Any: + return self._post + + @end.setter + def end(self, value: Any) -> None: + self._post = value + + @property + def pre(self) -> Any: + return self._pre + + @pre.setter + def pre(self, value: Any) -> None: + self._pre = value + + def get(self, item: Any, pos: Any) -> Any: + x = self._items.get(item) + if x is None or len(x) < pos: + return None + return x[pos] # can be None + + def set(self, item: Any, pos: Any, value: Any) -> Any: + x = self._items.get(item) + if x is None: + self._items[item] = x = [None] * (pos + 1) + else: + while len(x) <= pos: + x.append(None) + assert x[pos] is None + x[pos] = value + + def __contains__(self, x: Any) -> Any: + # test if a substring is in any of the attached comments + if self.comment: + if self.comment[0] and x in self.comment[0].value: + return True + if self.comment[1]: + for c in self.comment[1]: + if x in c.value: + return True + for value in self.items.values(): + if not value: + continue + for c in value: + if c and x in c.value: + return True + if self.end: + for c in self.end: + if x in c.value: + return True + return False + + +# to distinguish key from None +class NotNone: + pass # NOQA + + +class Format: + __slots__ = ('_flow_style',) + attrib = format_attrib + + def __init__(self) -> None: + self._flow_style: Any = None + + def set_flow_style(self) -> None: + self._flow_style = True + + def set_block_style(self) -> None: + self._flow_style = False + + def flow_style(self, default: Optional[Any] = None) -> Any: + """if default (the flow_style) is None, the flow style tacked on to + the object explicitly will be taken. If that is None as well the + default flow style rules the format down the line, or the type + of the constituent values (simple -> flow, map/list -> block)""" + if self._flow_style is None: + return default + return self._flow_style + + def __repr__(self) -> str: + return f'Format({self._flow_style})' + + +class LineCol: + """ + line and column information wrt document, values start at zero (0) + """ + + attrib = line_col_attrib + + def __init__(self) -> None: + self.line = None + self.col = None + self.data: Optional[Dict[Any, Any]] = None + + def add_kv_line_col(self, key: Any, data: Any) -> None: + if self.data is None: + self.data = {} + self.data[key] = data + + def key(self, k: Any) -> Any: + return self._kv(k, 0, 1) + + def value(self, k: Any) -> Any: + return self._kv(k, 2, 3) + + def _kv(self, k: Any, x0: Any, x1: Any) -> Any: + if self.data is None: + return None + data = self.data[k] + return data[x0], data[x1] + + def item(self, idx: Any) -> Any: + if self.data is None: + return None + return self.data[idx][0], self.data[idx][1] + + def add_idx_line_col(self, key: Any, data: Any) -> None: + if self.data is None: + self.data = {} + self.data[key] = data + + def __repr__(self) -> str: + return f'LineCol({self.line}, {self.col})' + + +class CommentedBase: + @property + def ca(self): + # type: () -> Any + if not hasattr(self, Comment.attrib): + setattr(self, Comment.attrib, Comment()) + return getattr(self, Comment.attrib) + + def yaml_end_comment_extend(self, comment: Any, clear: bool = False) -> None: + if comment is None: + return + if clear or self.ca.end is None: + self.ca.end = [] + self.ca.end.extend(comment) + + def yaml_key_comment_extend(self, key: Any, comment: Any, clear: bool = False) -> None: + r = self.ca._items.setdefault(key, [None, None, None, None]) + if clear or r[1] is None: + if comment[1] is not None: + assert isinstance(comment[1], list) + r[1] = comment[1] + else: + r[1].extend(comment[0]) + r[0] = comment[0] + + def yaml_value_comment_extend(self, key: Any, comment: Any, clear: bool = False) -> None: + r = self.ca._items.setdefault(key, [None, None, None, None]) + if clear or r[3] is None: + if comment[1] is not None: + assert isinstance(comment[1], list) + r[3] = comment[1] + else: + r[3].extend(comment[0]) + r[2] = comment[0] + + def yaml_set_start_comment(self, comment: Any, indent: Any = 0) -> None: + """overwrites any preceding comment lines on an object + expects comment to be without `#` and possible have multiple lines + """ + from .error import CommentMark + from .tokens import CommentToken + + pre_comments = self._yaml_clear_pre_comment() # type: ignore + if comment[-1] == '\n': + comment = comment[:-1] # strip final newline if there + start_mark = CommentMark(indent) + for com in comment.split('\n'): + c = com.strip() + if len(c) > 0 and c[0] != '#': + com = '# ' + com + pre_comments.append(CommentToken(com + '\n', start_mark)) + + def yaml_set_comment_before_after_key( + self, + key: Any, + before: Any = None, + indent: Any = 0, + after: Any = None, + after_indent: Any = None, + ) -> None: + """ + expects comment (before/after) to be without `#` and possible have multiple lines + """ + from ruamel.yaml.error import CommentMark + from ruamel.yaml.tokens import CommentToken + + def comment_token(s: Any, mark: Any) -> Any: + # handle empty lines as having no comment + return CommentToken(('# ' if s else "") + s + '\n', mark) + + if after_indent is None: + after_indent = indent + 2 + if before and (len(before) > 1) and before[-1] == '\n': + before = before[:-1] # strip final newline if there + if after and after[-1] == '\n': + after = after[:-1] # strip final newline if there + start_mark = CommentMark(indent) + c = self.ca.items.setdefault(key, [None, [], None, None]) + if before is not None: + if c[1] is None: + c[1] = [] + if before == '\n': + c[1].append(comment_token("", start_mark)) # type: ignore + else: + for com in before.split('\n'): + c[1].append(comment_token(com, start_mark)) # type: ignore + if after: + start_mark = CommentMark(after_indent) + if c[3] is None: + c[3] = [] + for com in after.split('\n'): + c[3].append(comment_token(com, start_mark)) # type: ignore + + @property + def fa(self) -> Any: + """format attribute + + set_flow_style()/set_block_style()""" + if not hasattr(self, Format.attrib): + setattr(self, Format.attrib, Format()) + return getattr(self, Format.attrib) + + def yaml_add_eol_comment( + self, comment: Any, key: Optional[Any] = NotNone, column: Optional[Any] = None, + ) -> None: + """ + there is a problem as eol comments should start with ' #' + (but at the beginning of the line the space doesn't have to be before + the #. The column index is for the # mark + """ + from .tokens import CommentToken + from .error import CommentMark + + if column is None: + try: + column = self._yaml_get_column(key) + except AttributeError: + column = 0 + if comment[0] != '#': + comment = '# ' + comment + if column is None: + if comment[0] == '#': + comment = ' ' + comment + column = 0 + start_mark = CommentMark(column) + ct = [CommentToken(comment, start_mark), None] + self._yaml_add_eol_comment(ct, key=key) + + @property + def lc(self) -> Any: + if not hasattr(self, LineCol.attrib): + setattr(self, LineCol.attrib, LineCol()) + return getattr(self, LineCol.attrib) + + def _yaml_set_line_col(self, line: Any, col: Any) -> None: + self.lc.line = line + self.lc.col = col + + def _yaml_set_kv_line_col(self, key: Any, data: Any) -> None: + self.lc.add_kv_line_col(key, data) + + def _yaml_set_idx_line_col(self, key: Any, data: Any) -> None: + self.lc.add_idx_line_col(key, data) + + @property + def anchor(self) -> Any: + if not hasattr(self, Anchor.attrib): + setattr(self, Anchor.attrib, Anchor()) + return getattr(self, Anchor.attrib) + + def yaml_anchor(self) -> Any: + if not hasattr(self, Anchor.attrib): + return None + return self.anchor + + def yaml_set_anchor(self, value: Any, always_dump: bool = False) -> None: + self.anchor.value = value + self.anchor.always_dump = always_dump + + @property + def tag(self) -> Any: + if not hasattr(self, Tag.attrib): + setattr(self, Tag.attrib, Tag()) + return getattr(self, Tag.attrib) + + def yaml_set_ctag(self, value: Tag) -> None: + setattr(self, Tag.attrib, value) + + def copy_attributes(self, t: Any, memo: Any = None) -> Any: + """ + copies the YAML related attributes, not e.g. .values + returns target + """ + # fmt: off + for a in [Comment.attrib, Format.attrib, LineCol.attrib, Anchor.attrib, + Tag.attrib, merge_attrib]: + if hasattr(self, a): + if memo is not None: + setattr(t, a, copy.deepcopy(getattr(self, a, memo))) + else: + setattr(t, a, getattr(self, a)) + return t + # fmt: on + + def _yaml_add_eol_comment(self, comment: Any, key: Any) -> None: + raise NotImplementedError + + def _yaml_get_pre_comment(self) -> Any: + raise NotImplementedError + + def _yaml_get_column(self, key: Any) -> Any: + raise NotImplementedError + + +class CommentedSeq(MutableSliceableSequence, list, CommentedBase): # type: ignore + __slots__ = (Comment.attrib, '_lst') + + def __init__(self, *args: Any, **kw: Any) -> None: + list.__init__(self, *args, **kw) + + def __getsingleitem__(self, idx: Any) -> Any: + return list.__getitem__(self, idx) + + def __setsingleitem__(self, idx: Any, value: Any) -> None: + # try to preserve the scalarstring type if setting an existing key to a new value + if idx < len(self): + if ( + isinstance(value, str) + and not isinstance(value, ScalarString) + and isinstance(self[idx], ScalarString) + ): + value = type(self[idx])(value) + list.__setitem__(self, idx, value) + + def __delsingleitem__(self, idx: Any = None) -> Any: + list.__delitem__(self, idx) + self.ca.items.pop(idx, None) # might not be there -> default value + for list_index in sorted(self.ca.items): + if list_index < idx: + continue + self.ca.items[list_index - 1] = self.ca.items.pop(list_index) + + def __len__(self) -> int: + return list.__len__(self) + + def insert(self, idx: Any, val: Any) -> None: + """the comments after the insertion have to move forward""" + list.insert(self, idx, val) + for list_index in sorted(self.ca.items, reverse=True): + if list_index < idx: + break + self.ca.items[list_index + 1] = self.ca.items.pop(list_index) + + def extend(self, val: Any) -> None: + list.extend(self, val) + + def __eq__(self, other: Any) -> bool: + return list.__eq__(self, other) + + def _yaml_add_comment(self, comment: Any, key: Optional[Any] = NotNone) -> None: + if key is not NotNone: + self.yaml_key_comment_extend(key, comment) + else: + self.ca.comment = comment + + def _yaml_add_eol_comment(self, comment: Any, key: Any) -> None: + self._yaml_add_comment(comment, key=key) + + def _yaml_get_columnX(self, key: Any) -> Any: + return self.ca.items[key][0].start_mark.column + + def _yaml_get_column(self, key: Any) -> Any: + column = None + sel_idx = None + pre, post = key - 1, key + 1 + if pre in self.ca.items: + sel_idx = pre + elif post in self.ca.items: + sel_idx = post + else: + # self.ca.items is not ordered + for row_idx, _k1 in enumerate(self): + if row_idx >= key: + break + if row_idx not in self.ca.items: + continue + sel_idx = row_idx + if sel_idx is not None: + column = self._yaml_get_columnX(sel_idx) + return column + + def _yaml_get_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + pre_comments = self.ca.comment[1] + return pre_comments + + def _yaml_clear_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + self.ca.comment[1] = pre_comments + return pre_comments + + def __deepcopy__(self, memo: Any) -> Any: + res = self.__class__() + memo[id(self)] = res + for k in self: + res.append(copy.deepcopy(k, memo)) + self.copy_attributes(res, memo=memo) + return res + + def __add__(self, other: Any) -> Any: + return list.__add__(self, other) + + def sort(self, key: Any = None, reverse: bool = False) -> None: + if key is None: + tmp_lst = sorted(zip(self, range(len(self))), reverse=reverse) + list.__init__(self, [x[0] for x in tmp_lst]) + else: + tmp_lst = sorted( + zip(map(key, list.__iter__(self)), range(len(self))), reverse=reverse, + ) + list.__init__(self, [list.__getitem__(self, x[1]) for x in tmp_lst]) + itm = self.ca.items + self.ca._items = {} + for idx, x in enumerate(tmp_lst): + old_index = x[1] + if old_index in itm: + self.ca.items[idx] = itm[old_index] + + def __repr__(self) -> Any: + return list.__repr__(self) + + +class CommentedKeySeq(tuple, CommentedBase): # type: ignore + """This primarily exists to be able to roundtrip keys that are sequences""" + + def _yaml_add_comment(self, comment: Any, key: Optional[Any] = NotNone) -> None: + if key is not NotNone: + self.yaml_key_comment_extend(key, comment) + else: + self.ca.comment = comment + + def _yaml_add_eol_comment(self, comment: Any, key: Any) -> None: + self._yaml_add_comment(comment, key=key) + + def _yaml_get_columnX(self, key: Any) -> Any: + return self.ca.items[key][0].start_mark.column + + def _yaml_get_column(self, key: Any) -> Any: + column = None + sel_idx = None + pre, post = key - 1, key + 1 + if pre in self.ca.items: + sel_idx = pre + elif post in self.ca.items: + sel_idx = post + else: + # self.ca.items is not ordered + for row_idx, _k1 in enumerate(self): + if row_idx >= key: + break + if row_idx not in self.ca.items: + continue + sel_idx = row_idx + if sel_idx is not None: + column = self._yaml_get_columnX(sel_idx) + return column + + def _yaml_get_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + pre_comments = self.ca.comment[1] + return pre_comments + + def _yaml_clear_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + self.ca.comment[1] = pre_comments + return pre_comments + + +class CommentedMapView(Sized): + __slots__ = ('_mapping',) + + def __init__(self, mapping: Any) -> None: + self._mapping = mapping + + def __len__(self) -> int: + count = len(self._mapping) + return count + + +class CommentedMapKeysView(CommentedMapView, Set): # type: ignore + __slots__ = () + + @classmethod + def _from_iterable(self, it: Any) -> Any: + return set(it) + + def __contains__(self, key: Any) -> Any: + return key in self._mapping + + def __iter__(self) -> Any: + # yield from self._mapping # not in py27, pypy + # for x in self._mapping._keys(): + for x in self._mapping: + yield x + + +class CommentedMapItemsView(CommentedMapView, Set): # type: ignore + __slots__ = () + + @classmethod + def _from_iterable(self, it: Any) -> Any: + return set(it) + + def __contains__(self, item: Any) -> Any: + key, value = item + try: + v = self._mapping[key] + except KeyError: + return False + else: + return v == value + + def __iter__(self) -> Any: + for key in self._mapping._keys(): + yield (key, self._mapping[key]) + + +class CommentedMapValuesView(CommentedMapView): + __slots__ = () + + def __contains__(self, value: Any) -> Any: + for key in self._mapping: + if value == self._mapping[key]: + return True + return False + + def __iter__(self) -> Any: + for key in self._mapping._keys(): + yield self._mapping[key] + + +class CommentedMap(ordereddict, CommentedBase): + __slots__ = (Comment.attrib, '_ok', '_ref') + + def __init__(self, *args: Any, **kw: Any) -> None: + self._ok: MutableSet[Any] = set() # own keys + self._ref: List[CommentedMap] = [] + ordereddict.__init__(self, *args, **kw) + + def _yaml_add_comment( + self, comment: Any, key: Optional[Any] = NotNone, value: Optional[Any] = NotNone, + ) -> None: + """values is set to key to indicate a value attachment of comment""" + if key is not NotNone: + self.yaml_key_comment_extend(key, comment) + return + if value is not NotNone: + self.yaml_value_comment_extend(value, comment) + else: + self.ca.comment = comment + + def _yaml_add_eol_comment(self, comment: Any, key: Any) -> None: + """add on the value line, with value specified by the key""" + self._yaml_add_comment(comment, value=key) + + def _yaml_get_columnX(self, key: Any) -> Any: + return self.ca.items[key][2].start_mark.column + + def _yaml_get_column(self, key: Any) -> Any: + column = None + sel_idx = None + pre, post, last = None, None, None + for x in self: + if pre is not None and x != key: + post = x + break + if x == key: + pre = last + last = x + if pre in self.ca.items: + sel_idx = pre + elif post in self.ca.items: + sel_idx = post + else: + # self.ca.items is not ordered + for k1 in self: + if k1 >= key: + break + if k1 not in self.ca.items: + continue + sel_idx = k1 + if sel_idx is not None: + column = self._yaml_get_columnX(sel_idx) + return column + + def _yaml_get_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + pre_comments = self.ca.comment[1] + return pre_comments + + def _yaml_clear_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + self.ca.comment[1] = pre_comments + return pre_comments + + def update(self, *vals: Any, **kw: Any) -> None: + try: + ordereddict.update(self, *vals, **kw) + except TypeError: + # probably a dict that is used + for x in vals[0]: + self[x] = vals[0][x] + if vals: + try: + self._ok.update(vals[0].keys()) # type: ignore + except AttributeError: + # assume one argument that is a list/tuple of two element lists/tuples + for x in vals[0]: + self._ok.add(x[0]) + if kw: + self._ok.update(*kw.keys()) # type: ignore + + def insert(self, pos: Any, key: Any, value: Any, comment: Optional[Any] = None) -> None: + """insert key value into given position, as defined by source YAML + attach comment if provided + """ + if key in self._ok: + del self[key] + keys = [k for k in self.keys() if k in self._ok] + try: + merge_value = getattr(self, merge_attrib) + merge_pos = merge_value.merge_pos + except (AttributeError, IndexError): + merge_pos = -1 + if merge_pos >= 0: + if merge_pos >= pos: + # getattr(self, merge_attrib)[0] = (merge_pos + 1, ma0[1]) + merge_value.merge_pos += 1 + idx_min = pos + idx_max = len(self._ok) + else: + idx_min = pos - 1 + idx_max = len(self._ok) + else: + idx_min = pos + idx_max = len(self._ok) + self[key] = value # at the end + # print(f'{idx_min=} {idx_max=}') + for idx in range(idx_min, idx_max): + self.move_to_end(keys[idx]) + self._ok.add(key) + # for referer in self._ref: + # for keytmp in keys: + # referer.update_key_value(keytmp) + if comment is not None: + self.yaml_add_eol_comment(comment, key=key) + + def mlget(self, key: Any, default: Any = None, list_ok: Any = False) -> Any: + """multi-level get that expects dicts within dicts""" + if not isinstance(key, list): + return self.get(key, default) + # assume that the key is a list of recursively accessible dicts + + def get_one_level(key_list: Any, level: Any, d: Any) -> Any: + if not list_ok: + assert isinstance(d, dict) + if level >= len(key_list): + if level > len(key_list): + raise IndexError + return d[key_list[level - 1]] + return get_one_level(key_list, level + 1, d[key_list[level - 1]]) + + try: + return get_one_level(key, 1, self) + except KeyError: + return default + except (TypeError, IndexError): + if not list_ok: + raise + return default + + def __getitem__(self, key: Any) -> Any: + try: + return ordereddict.__getitem__(self, key) + except KeyError: + for merged in getattr(self, merge_attrib, []): + # if isinstance(merged, tuple): + # if key in merged[1]: + # return merged[1][key] + # else: + if True: + if key in merged: + return merged[key] + raise + + def __setitem__(self, key: Any, value: Any) -> None: + # try to preserve the scalarstring type if setting an existing key to a new value + if key in self: + if ( + isinstance(value, str) + and not isinstance(value, ScalarString) + and isinstance(self[key], ScalarString) + ): + value = type(self[key])(value) + ordereddict.__setitem__(self, key, value) + self._ok.add(key) + + def _unmerged_contains(self, key: Any) -> Any: + if key in self._ok: + return True + return None + + def __contains__(self, key: Any) -> bool: + return bool(ordereddict.__contains__(self, key)) + + def get(self, key: Any, default: Any = None) -> Any: + try: + return self.__getitem__(key) + except: # NOQA + return default + + def __repr__(self) -> Any: + res = '{' + sep = '' + for k, v in self.items(): + res += f'{sep}{k!r}: {v!r}' + if not sep: + sep = ', ' + res += '}' + return res + + def non_merged_items(self) -> Any: + for x in ordereddict.__iter__(self): + if x in self._ok: + yield x, ordereddict.__getitem__(self, x) + + def __delitem__(self, key: Any) -> None: + # for merged in getattr(self, merge_attrib, []): + # if key in merged[1]: + # value = merged[1][key] + # break + # else: + # # not found in merged in stuff + # ordereddict.__delitem__(self, key) + # for referer in self._ref: + # referer.update=_key_value(key) + # return + # + # ordereddict.__setitem__(self, key, value) # merge might have different value + # self._ok.discard(key) + + try: + merge_value = getattr(self, merge_attrib) + merge_pos = merge_value.merge_pos + except AttributeError: + merge_pos = -1 + if merge_pos >= 0: + try: + pos = list(ordereddict.keys(self)).index(key) + # the merge is not in the dict, so don't use >= + if merge_pos > pos: + merge_value.merge_pos -= 1 + except ValueError: + pass # let the removal of the key throw a "normal" error + self._ok.discard(key) + ordereddict.__delitem__(self, key) + for referer in self._ref: + referer.update_key_value(key) + + def __iter__(self) -> Any: + for x in ordereddict.__iter__(self): + yield x + + def pop(self, key: Any, default: Any = NotNone) -> Any: + try: + result = self[key] + except KeyError: + if default is NotNone: + raise + return default + del self[key] + return result + + def _keys(self) -> Any: + for x in ordereddict.__iter__(self): + yield x + + def __len__(self) -> int: + return int(ordereddict.__len__(self)) + + def __eq__(self, other: Any) -> bool: + return bool(dict(self) == other) + + def keys(self) -> Any: + return CommentedMapKeysView(self) + + def values(self) -> Any: + return CommentedMapValuesView(self) + + def _items(self) -> Any: + for x in ordereddict.__iter__(self): + yield x, ordereddict.__getitem__(self, x) + + def items(self) -> Any: + return CommentedMapItemsView(self) + + @property + def merge(self) -> Any: + if not hasattr(self, merge_attrib): + setattr(self, merge_attrib, []) + return getattr(self, merge_attrib) + + def copy(self) -> Any: + x = type(self)() # update doesn't work + for k, v in self._items(): + x[k] = v + self.copy_attributes(x) + return x + + def add_referent(self, cm: Any) -> None: + if cm not in self._ref: + self._ref.append(cm) + + def add_yaml_merge(self, value: Any) -> None: + assert not hasattr(self, merge_attrib) + setattr(self, merge_attrib, value) + for v in value: + # if isinstance(v, tuple): + # assert len(v) == 2 + # # print('vvv', v, type(v[1])) + # v[1].add_referent(self) + # for k1, v1 in v[1].items(): + # if ordereddict.__contains__(self, k1): + # continue + # ordereddict.__setitem__(self, k1, v1) + # else: + if True: + v.add_referent(self) + for k1, v1 in v.items(): + if ordereddict.__contains__(self, k1): + continue + ordereddict.__setitem__(self, k1, v1) + + def update_key_value(self, key: Any) -> None: + if key in self._ok: + return + for v in self.merge: + if key in v[1]: + ordereddict.__setitem__(self, key, v[1][key]) + return + ordereddict.__delitem__(self, key) + + def __deepcopy__(self, memo: Any) -> Any: + res = self.__class__() + memo[id(self)] = res + for k in self: + res[k] = copy.deepcopy(self[k], memo) + self.copy_attributes(res, memo=memo) + return res + + +# based on brownie mappings +@classmethod # type: ignore +def raise_immutable(cls: Any, *args: Any, **kwargs: Any) -> None: + raise TypeError(f'{cls.__name__} objects are immutable') + + +class CommentedKeyMap(CommentedBase, Mapping): # type: ignore + __slots__ = Comment.attrib, '_od' + """This primarily exists to be able to roundtrip keys that are mappings""" + + def __init__(self, *args: Any, **kw: Any) -> None: + if hasattr(self, '_od'): + raise_immutable(self) + try: + self._od = ordereddict(*args, **kw) + except TypeError: + raise + + __delitem__ = __setitem__ = clear = pop = popitem = setdefault = update = raise_immutable + + # need to implement __getitem__, __iter__ and __len__ + def __getitem__(self, index: Any) -> Any: + return self._od[index] + + def __iter__(self) -> Iterator[Any]: + for x in self._od.__iter__(): + yield x + + def __len__(self) -> int: + return len(self._od) + + def __hash__(self) -> Any: + return hash(tuple(self.items())) + + def __repr__(self) -> Any: + if not hasattr(self, merge_attrib): + return self._od.__repr__() + return 'ordereddict(' + repr(list(self._od.items())) + ')' + + @classmethod + def fromkeys(keys: Any, v: Any = None) -> Any: + return CommentedKeyMap(dict.fromkeys(keys, v)) + + def _yaml_add_comment(self, comment: Any, key: Optional[Any] = NotNone) -> None: + if key is not NotNone: + self.yaml_key_comment_extend(key, comment) + else: + self.ca.comment = comment + + def _yaml_add_eol_comment(self, comment: Any, key: Any) -> None: + self._yaml_add_comment(comment, key=key) + + def _yaml_get_columnX(self, key: Any) -> Any: + return self.ca.items[key][0].start_mark.column + + def _yaml_get_column(self, key: Any) -> Any: + column = None + sel_idx = None + pre, post = key - 1, key + 1 + if pre in self.ca.items: + sel_idx = pre + elif post in self.ca.items: + sel_idx = post + else: + # self.ca.items is not ordered + for row_idx, _k1 in enumerate(self): + if row_idx >= key: + break + if row_idx not in self.ca.items: + continue + sel_idx = row_idx + if sel_idx is not None: + column = self._yaml_get_columnX(sel_idx) + return column + + def _yaml_get_pre_comment(self) -> Any: + pre_comments: List[Any] = [] + if self.ca.comment is None: + self.ca.comment = [None, pre_comments] + else: + self.ca.comment[1] = pre_comments + return pre_comments + + +class CommentedOrderedMap(CommentedMap): + __slots__ = (Comment.attrib,) + + +class CommentedSet(MutableSet, CommentedBase): # type: ignore # NOQA + __slots__ = Comment.attrib, 'odict' + + def __init__(self, values: Any = None) -> None: + self.odict = ordereddict() + MutableSet.__init__(self) + if values is not None: + self |= values + + def _yaml_add_comment( + self, comment: Any, key: Optional[Any] = NotNone, value: Optional[Any] = NotNone, + ) -> None: + """values is set to key to indicate a value attachment of comment""" + if key is not NotNone: + self.yaml_key_comment_extend(key, comment) + return + if value is not NotNone: + self.yaml_value_comment_extend(value, comment) + else: + self.ca.comment = comment + + def _yaml_add_eol_comment(self, comment: Any, key: Any) -> None: + """add on the value line, with value specified by the key""" + self._yaml_add_comment(comment, value=key) + + def add(self, value: Any) -> None: + """Add an element.""" + self.odict[value] = None + + def discard(self, value: Any) -> None: + """Remove an element. Do not raise an exception if absent.""" + del self.odict[value] + + def __contains__(self, x: Any) -> Any: + return x in self.odict + + def __iter__(self) -> Any: + for x in self.odict: + yield x + + def __len__(self) -> int: + return len(self.odict) + + def __repr__(self) -> str: + return f'set({self.odict.keys()!r})' + + +class TaggedScalar(CommentedBase): + # the value and style attributes are set during roundtrip construction + def __init__(self, value: Any = None, style: Any = None, tag: Any = None) -> None: + self.value = value + self.style = style + if tag is not None: + if isinstance(tag, str): + tag = Tag(suffix=tag) + self.yaml_set_ctag(tag) + + def __str__(self) -> Any: + return self.value + + def count(self, s: str, start: Optional[int] = None, end: Optional[int] = None) -> Any: + return self.value.count(s, start, end) + + def __getitem__(self, pos: int) -> Any: + return self.value[pos] + + def __repr__(self) -> str: + return f'TaggedScalar(value={self.value!r}, style={self.style!r}, tag={self.tag!r})' + + +def dump_comments(d: Any, name: str = "", sep: str = '.', out: Any = sys.stdout) -> None: + """ + recursively dump comments, all but the toplevel preceded by the path + in dotted form x.0.a + """ + if isinstance(d, dict) and hasattr(d, 'ca'): + if name: + out.write(f'{name} {type(d)}\n') + out.write(f'{d.ca!r}\n') + for k in d: + dump_comments(d[k], name=(name + sep + str(k)) if name else k, sep=sep, out=out) + elif isinstance(d, list) and hasattr(d, 'ca'): + if name: + out.write(f'{name} {type(d)}\n') + out.write(f'{d.ca!r}\n') + for idx, k in enumerate(d): + dump_comments( + k, name=(name + sep + str(idx)) if name else str(idx), sep=sep, out=out, + ) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/compat.py b/python/user_packages/Python313/site-packages/ruamel/yaml/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..063aa536c602939357535e7ddd6b08222ed32504 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/compat.py @@ -0,0 +1,236 @@ + +from __future__ import annotations + +# partially from package six by Benjamin Peterson + +import sys +import os +import io +from abc import abstractmethod +import collections.abc + + +from ruamel.yaml.docinfo import Version # NOQA +# fmt: off +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, BinaryIO, IO, Text, Tuple # NOQA + from typing import Optional # NOQA + try: + from typing import SupportsIndex as SupportsIndex # in order to reexport for mypy + except ImportError: + SupportsIndex = int # type: ignore + + StreamType = Any + StreamTextType = StreamType + VersionType = Union[str , Tuple[int, int] , List[int] , Version , None] +# fmt: on + +_DEFAULT_YAML_VERSION = (1, 2) + +try: + from collections import OrderedDict +except ImportError: + from ordereddict import OrderedDict # type: ignore + + # to get the right name import ... as ordereddict doesn't do that + + +class ordereddict(OrderedDict): # type: ignore + if not hasattr(OrderedDict, 'insert'): + + def insert(self, pos: int, key: Any, value: Any) -> None: + if pos >= len(self): + self[key] = value + return + od = ordereddict() + od.update(self) + for k in od: + del self[k] + for index, old_key in enumerate(od): + if pos == index: + self[key] = value + self[old_key] = od[old_key] + + +StringIO = io.StringIO +BytesIO = io.BytesIO + + +builtins_module = 'builtins' + + +def with_metaclass(meta: Any, *bases: Any) -> Any: + """Create a base class with a metaclass.""" + return meta('NewBase', bases, {}) + + +DBG_TOKEN = 1 +DBG_EVENT = 2 +DBG_NODE = 4 + + +_debug: Optional[int] = None +if 'RUAMEL_DEBUG' in os.environ: + _debugx = os.environ.get('RUAMEL_DEBUG') + if _debugx is None: + _debug = 0 + else: + _debug = int(_debugx) + + +if bool(_debug): + + class ObjectCounter: + def __init__(self) -> None: + self.map: Dict[Any, Any] = {} + + def __call__(self, k: Any) -> None: + self.map[k] = self.map.get(k, 0) + 1 + + def dump(self) -> None: + for k in sorted(self.map): + sys.stdout.write(f'{k} -> {self.map[k]}') + + object_counter = ObjectCounter() + + +# used from yaml util when testing +def dbg(val: Any = None) -> Any: + debug = _debug + if debug is None: + # set to true or false + _debugx = os.environ.get('YAMLDEBUG') + if _debugx is None: + debug = 0 + else: + debug = int(_debugx) + if val is None: + return debug + return debug & val + + +class Nprint: + def __init__(self, file_name: Any = None) -> None: + self._max_print: Any = None + self._count: Any = None + self._file_name = file_name + + def __call__(self, *args: Any, **kw: Any) -> None: + if not bool(_debug): + return + import traceback + + out = sys.stdout if self._file_name is None else open(self._file_name, 'a') + dbgprint = print # to fool checking for print statements by dv utility + kw1 = kw.copy() + kw1['file'] = out + dbgprint(*args, **kw1) + out.flush() + if self._max_print is not None: + if self._count is None: + self._count = self._max_print + self._count -= 1 + if self._count == 0: + dbgprint('forced exit\n') + traceback.print_stack() + out.flush() + sys.exit(0) + if self._file_name: + out.close() + + def set_max_print(self, i: int) -> None: + self._max_print = i + self._count = None + + def fp(self, mode: str = 'a') -> Any: + out = sys.stdout if self._file_name is None else open(self._file_name, mode) + return out + + +nprint = Nprint() +nprintf = Nprint('/var/tmp/ruamel.yaml.log') + +# char checkers following production rules + + +def check_namespace_char(ch: Any) -> bool: + if '\x21' <= ch <= '\x7E': # ! to ~ + return True + if '\xA0' <= ch <= '\uD7FF': + return True + if ('\uE000' <= ch <= '\uFFFD') and ch != '\uFEFF': # excl. byte order mark + return True + if '\U00010000' <= ch <= '\U0010FFFF': + return True + return False + + +def check_anchorname_char(ch: Any) -> bool: + if ch in ',[]{}': + return False + return check_namespace_char(ch) + + +def version_tnf(t1: Any, t2: Any = None) -> Any: + """ + return True if ruamel.yaml version_info < t1, None if t2 is specified and bigger else False + """ + from ruamel.yaml import version_info # NOQA + + if version_info < t1: + return True + if t2 is not None and version_info < t2: + return None + return False + + +class MutableSliceableSequence(collections.abc.MutableSequence): # type: ignore + __slots__ = () + + def __getitem__(self, index: Any) -> Any: + if not isinstance(index, slice): + return self.__getsingleitem__(index) + return type(self)([self[i] for i in range(*index.indices(len(self)))]) # type: ignore + + def __setitem__(self, index: Any, value: Any) -> None: + if not isinstance(index, slice): + return self.__setsingleitem__(index, value) + assert iter(value) + # nprint(index.start, index.stop, index.step, index.indices(len(self))) + if index.step is None: + del self[index.start : index.stop] + for elem in reversed(value): + self.insert(0 if index.start is None else index.start, elem) + else: + range_parms = index.indices(len(self)) + nr_assigned_items = (range_parms[1] - range_parms[0] - 1) // range_parms[2] + 1 + # need to test before changing, in case TypeError is caught + if nr_assigned_items < len(value): + raise TypeError( + f'too many elements in value {nr_assigned_items} < {len(value)}', + ) + elif nr_assigned_items > len(value): + raise TypeError( + f'not enough elements in value {nr_assigned_items} > {len(value)}', + ) + for idx, i in enumerate(range(*range_parms)): + self[i] = value[idx] + + def __delitem__(self, index: Any) -> None: + if not isinstance(index, slice): + return self.__delsingleitem__(index) + # nprint(index.start, index.stop, index.step, index.indices(len(self))) + for i in reversed(range(*index.indices(len(self)))): + del self[i] + + @abstractmethod + def __getsingleitem__(self, index: Any) -> Any: + raise IndexError + + @abstractmethod + def __setsingleitem__(self, index: Any, value: Any) -> None: + raise IndexError + + @abstractmethod + def __delsingleitem__(self, index: Any) -> None: + raise IndexError diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/composer.py b/python/user_packages/Python313/site-packages/ruamel/yaml/composer.py new file mode 100644 index 0000000000000000000000000000000000000000..65e47318d43cb13cd760d4d6850cf11cf8e356d8 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/composer.py @@ -0,0 +1,246 @@ + +from __future__ import annotations + +import warnings + +from ruamel.yaml.error import MarkedYAMLError, ReusedAnchorWarning +from ruamel.yaml.compat import nprint, nprintf # NOQA + +from ruamel.yaml.events import ( + StreamStartEvent, + StreamEndEvent, + MappingStartEvent, + MappingEndEvent, + SequenceStartEvent, + SequenceEndEvent, + AliasEvent, + ScalarEvent, +) +from ruamel.yaml.nodes import MappingNode, ScalarNode, SequenceNode + +if False: # MYPY + from typing import Any, Dict, Optional, List # NOQA + +__all__ = ['Composer', 'ComposerError', 'MaxDepthExceededError'] + + +class ComposerError(MarkedYAMLError): + pass + + +class MaxDepthExceededError(MarkedYAMLError): + pass + + +class Composer: + def __init__(self, loader: Any = None) -> None: + self.loader = loader + if self.loader is not None and getattr(self.loader, '_composer', None) is None: + self.loader._composer = self + self.anchors: Dict[Any, Any] = {} + self.warn_double_anchors = True + self.depth = 0 + + @property + def parser(self) -> Any: + if hasattr(self.loader, 'typ'): + self.loader.parser + return self.loader._parser + + @property + def resolver(self) -> Any: + # assert self.loader._resolver is not None + if hasattr(self.loader, 'typ'): + self.loader.resolver + return self.loader._resolver + + def check_node(self) -> Any: + # Drop the STREAM-START event. + if self.parser.check_event(StreamStartEvent): + self.parser.get_event() + + # If there are more documents available? + return not self.parser.check_event(StreamEndEvent) + + def get_node(self) -> Any: + # Get the root node of the next document. + if not self.parser.check_event(StreamEndEvent): + return self.compose_document() + + def get_single_node(self) -> Any: + # Drop the STREAM-START event. + self.parser.get_event() + + # Compose a document if the stream is not empty. + document: Any = None + if not self.parser.check_event(StreamEndEvent): + document = self.compose_document() + + # Ensure that the stream contains no more documents. + if not self.parser.check_event(StreamEndEvent): + event = self.parser.get_event() + raise ComposerError( + 'expected a single document in the stream', + document.start_mark, + 'but found another document', + event.start_mark, + ) + + # Drop the STREAM-END event. + self.parser.get_event() + + return document + + def compose_document(self: Any) -> Any: + self.anchors = {} + # Drop the DOCUMENT-START event. + self.parser.get_event() + + # Compose the root node. + node = self.compose_node(None, None) + + # Drop the DOCUMENT-END event. + self.parser.get_event() + + return node + + def return_alias(self, a: Any) -> Any: + return a + + def compose_node(self, parent: Any, index: Any) -> Any: + if self.parser.check_event(AliasEvent): + event = self.parser.get_event() + alias = event.anchor + if alias not in self.anchors: + raise ComposerError( + None, None, f'found undefined alias {alias!r}', event.start_mark, + ) + return self.return_alias(self.anchors[alias]) + self.depth += 1 + event = self.parser.peek_event() + if self.loader.max_depth and self.depth > self.loader.max_depth: + raise MaxDepthExceededError( + None, + None, + f'maximum depth of data structure exceeded ({self.depth}), ' + 'if necessary increase YAML().max_depth', + event.start_mark, + ) + anchor = event.anchor + if anchor is not None: # have an anchor + if self.warn_double_anchors and anchor in self.anchors: + ws = ( + f'\nfound duplicate anchor {anchor!r}\n' + f'first occurrence {self.anchors[anchor].start_mark}\n' + f'second occurrence {event.start_mark}' + ) + warnings.warn(ws, ReusedAnchorWarning, stacklevel=2) + self.resolver.descend_resolver(parent, index) + if self.parser.check_event(ScalarEvent): + node = self.compose_scalar_node(anchor) + elif self.parser.check_event(SequenceStartEvent): + node = self.compose_sequence_node(anchor) + elif self.parser.check_event(MappingStartEvent): + node = self.compose_mapping_node(anchor) + self.resolver.ascend_resolver() + self.depth -= 1 + return node + + def compose_scalar_node(self, anchor: Any) -> Any: + event = self.parser.get_event() + tag = event.ctag + if tag is None or str(tag) == '!': + tag = self.resolver.resolve(ScalarNode, event.value, event.implicit) + assert not isinstance(tag, str) + # e.g tag.yaml.org,2002:str + node = ScalarNode( + tag, + event.value, + event.start_mark, + event.end_mark, + style=event.style, + comment=event.comment, + anchor=anchor, + ) + if anchor is not None: + self.anchors[anchor] = node + return node + + def compose_sequence_node(self, anchor: Any) -> Any: + start_event = self.parser.get_event() + tag = start_event.ctag + if tag is None or str(tag) == '!': + tag = self.resolver.resolve(SequenceNode, None, start_event.implicit) + assert not isinstance(tag, str) + node = SequenceNode( + tag, + [], + start_event.start_mark, + None, + flow_style=start_event.flow_style, + comment=start_event.comment, + anchor=anchor, + ) + if anchor is not None: + self.anchors[anchor] = node + index = 0 + while not self.parser.check_event(SequenceEndEvent): + node.value.append(self.compose_node(node, index)) + index += 1 + end_event = self.parser.get_event() + if node.flow_style is True and end_event.comment is not None: + if node.comment is not None: + x = node.flow_style + nprint( + f'Warning: unexpected end_event commment in sequence node {x}\n', + ' if possible, please report an issue with reproducable data/code', + ) + node.comment = end_event.comment + node.end_mark = end_event.end_mark + self.check_end_doc_comment(end_event, node) + return node + + def compose_mapping_node(self, anchor: Any) -> Any: + start_event = self.parser.get_event() + tag = start_event.ctag + if tag is None or str(tag) == '!': + tag = self.resolver.resolve(MappingNode, None, start_event.implicit) + assert not isinstance(tag, str) + node = MappingNode( + tag, + [], + start_event.start_mark, + None, + flow_style=start_event.flow_style, + comment=start_event.comment, + anchor=anchor, + ) + if anchor is not None: + self.anchors[anchor] = node + while not self.parser.check_event(MappingEndEvent): + # key_event = self.parser.peek_event() + item_key = self.compose_node(node, None) + # if item_key in node.value: + # raise ComposerError("while composing a mapping", + # start_event.start_mark, + # "found duplicate key", key_event.start_mark) + item_value = self.compose_node(node, item_key) + # node.value[item_key] = item_value + node.value.append((item_key, item_value)) + end_event = self.parser.get_event() + if node.flow_style is True and end_event.comment is not None: + node.comment = end_event.comment + node.end_mark = end_event.end_mark + self.check_end_doc_comment(end_event, node) + return node + + def check_end_doc_comment(self, end_event: Any, node: Any) -> None: + if end_event.comment and end_event.comment[1]: + # pre comments on an end_event, no following to move to + if node.comment is None: + node.comment = [None, None] + assert not isinstance(node, ScalarEvent) + # this is a post comment on a mapping node, add as third element + # in the list + node.comment.append(end_event.comment[1]) + end_event.comment[1] = None diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/configobjwalker.py b/python/user_packages/Python313/site-packages/ruamel/yaml/configobjwalker.py new file mode 100644 index 0000000000000000000000000000000000000000..236666c414f64b85fc84ce9c403453ddeebdb970 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/configobjwalker.py @@ -0,0 +1,17 @@ + +from __future__ import annotations + +import warnings + +from ruamel.yaml.util import configobj_walker as new_configobj_walker + +if False: # MYPY + from typing import Any + + +def configobj_walker(cfg: Any) -> Any: + warnings.warn( + 'configobj_walker has moved to ruamel.yaml.util, please update your code', + stacklevel=2, + ) + return new_configobj_walker(cfg) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/constructor.py b/python/user_packages/Python313/site-packages/ruamel/yaml/constructor.py new file mode 100644 index 0000000000000000000000000000000000000000..12c19cdbb8b55b0895d75a5ee26e8bce31455383 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/constructor.py @@ -0,0 +1,1724 @@ + +from __future__ import annotations + +import datetime +from datetime import timedelta as TimeDelta +import binascii +import sys +import types +import warnings +from collections.abc import Hashable, MutableSequence, MutableMapping + +# fmt: off +from ruamel.yaml.error import (MarkedYAMLError, MarkedYAMLFutureWarning, + MantissaNoDotYAML1_1Warning) +from ruamel.yaml.nodes import * # NOQA +from ruamel.yaml.nodes import (SequenceNode, MappingNode, ScalarNode) +from ruamel.yaml.compat import (builtins_module, # NOQA + nprint, nprintf, version_tnf) +from ruamel.yaml.compat import ordereddict + +from ruamel.yaml.tag import Tag +from ruamel.yaml.comments import * # NOQA +from ruamel.yaml.comments import (CommentedMap, CommentedOrderedMap, CommentedSet, + CommentedKeySeq, CommentedSeq, TaggedScalar, + CommentedKeyMap, + C_KEY_PRE, C_KEY_EOL, C_KEY_POST, + C_VALUE_PRE, C_VALUE_EOL, C_VALUE_POST, + ) +from ruamel.yaml.scalarstring import (SingleQuotedScalarString, DoubleQuotedScalarString, + LiteralScalarString, FoldedScalarString, + PlainScalarString, ScalarString) +from ruamel.yaml.scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt +from ruamel.yaml.scalarfloat import ScalarFloat +from ruamel.yaml.scalarbool import ScalarBoolean +from ruamel.yaml.timestamp import TimeStamp +from ruamel.yaml.util import timestamp_regexp, create_timestamp + +if False: # MYPY + from typing import Any, Dict, List, Set, Iterator, Union, Optional # NOQA + + +__all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor', + 'ConstructorError', 'RoundTripConstructor'] +# fmt: on + + +class ConstructorError(MarkedYAMLError): + pass + + +class DuplicateKeyFutureWarning(MarkedYAMLFutureWarning): + pass + + +DUPKEY_URL = 'https://yaml.dev/doc/ruamel.yaml/api/#Duplicate_keys' + + +class DuplicateKeyError(MarkedYAMLError): + pass + + +class BaseConstructor: + + yaml_constructors = {} # type: Dict[Any, Any] + yaml_multi_constructors = {} # type: Dict[Any, Any] + + def __init__(self, preserve_quotes: Optional[bool] = None, loader: Any = None) -> None: + self.loader = loader + if self.loader is not None and getattr(self.loader, '_constructor', None) is None: + self.loader._constructor = self + self.loader = loader + self.yaml_base_dict_type = dict + self.yaml_base_list_type = list + self.constructed_objects: Dict[Any, Any] = {} + self.recursive_objects: Dict[Any, Any] = {} + self.state_generators: List[Any] = [] + self.deep_construct = False + self._preserve_quotes = preserve_quotes + self.allow_duplicate_keys = version_tnf((0, 15, 1), (0, 16)) + + @property + def composer(self) -> Any: + if hasattr(self.loader, 'typ'): + return self.loader.composer + try: + return self.loader._composer + except AttributeError: + sys.stdout.write(f'slt {type(self)}\n') + sys.stdout.write(f'slc {self.loader._composer}\n') + sys.stdout.write(f'{dir(self)}\n') + raise + + @property + def resolver(self) -> Any: + if hasattr(self.loader, 'typ'): + return self.loader.resolver + return self.loader._resolver + + @property + def scanner(self) -> Any: + # needed to get to the expanded comments + if hasattr(self.loader, 'typ'): + return self.loader.scanner + return self.loader._scanner + + def check_data(self) -> Any: + # If there are more documents available? + return self.composer.check_node() + + def get_data(self) -> Any: + # Construct and return the next document. + if self.composer.check_node(): + return self.construct_document(self.composer.get_node()) + + def get_single_data(self) -> Any: + # Ensure that the stream contains a single document and construct it. + node = self.composer.get_single_node() + if node is not None: + return self.construct_document(node) + return None + + def construct_document(self, node: Any) -> Any: + data = self.construct_object(node) + while bool(self.state_generators): + state_generators = self.state_generators + self.state_generators = [] + for generator in state_generators: + for _dummy in generator: + pass + self.constructed_objects = {} + self.recursive_objects = {} + self.deep_construct = False + return data + + def construct_object(self, node: Any, deep: bool = False) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + if node in self.constructed_objects: + return self.constructed_objects[node] + if deep: + old_deep = self.deep_construct + self.deep_construct = True + if node in self.recursive_objects: + return self.recursive_objects[node] + # raise ConstructorError( + # None, None, 'found unconstructable recursive node', node.start_mark + # ) + self.recursive_objects[node] = None + data = self.construct_non_recursive_object(node) + + self.constructed_objects[node] = data + del self.recursive_objects[node] + if deep: + self.deep_construct = old_deep + return data + + def construct_non_recursive_object(self, node: Any, tag: Optional[str] = None) -> Any: + constructor: Any = None + tag_suffix = None + if tag is None: + tag = node.tag + if tag in self.yaml_constructors: + constructor = self.yaml_constructors[tag] + else: + for tag_prefix in self.yaml_multi_constructors: + if tag.startswith(tag_prefix): + tag_suffix = tag[len(tag_prefix) :] + constructor = self.yaml_multi_constructors[tag_prefix] + break + else: + if None in self.yaml_multi_constructors: + tag_suffix = tag + constructor = self.yaml_multi_constructors[None] + elif None in self.yaml_constructors: + constructor = self.yaml_constructors[None] + elif isinstance(node, ScalarNode): + constructor = self.__class__.construct_scalar + elif isinstance(node, SequenceNode): + constructor = self.__class__.construct_sequence + elif isinstance(node, MappingNode): + constructor = self.__class__.construct_mapping + if tag_suffix is None: + data = constructor(self, node) + else: + data = constructor(self, tag_suffix, node) + if isinstance(data, types.GeneratorType): + generator = data + data = next(generator) + if self.deep_construct: + for _dummy in generator: + pass + else: + self.state_generators.append(generator) + return data + + def construct_scalar(self, node: Any) -> Any: + if not isinstance(node, ScalarNode): + raise ConstructorError( + None, None, f'expected a scalar node, but found {node.id!s}', node.start_mark, + ) + return node.value + + def construct_sequence(self, node: Any, deep: bool = False) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + if not isinstance(node, SequenceNode): + raise ConstructorError( + None, + None, + f'expected a sequence node, but found {node.id!s}', + node.start_mark, + ) + return [self.construct_object(child, deep=deep) for child in node.value] + + def construct_mapping(self, node: Any, deep: bool = False) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + if not isinstance(node, MappingNode): + raise ConstructorError( + None, None, f'expected a mapping node, but found {node.id!s}', node.start_mark, + ) + total_mapping = self.yaml_base_dict_type() + if getattr(node, 'merge', None) is not None: + todo = [(node.merge, False), (node.value, False)] + else: + todo = [(node.value, True)] + for values, check in todo: + mapping: Dict[Any, Any] = self.yaml_base_dict_type() + for key_node, value_node in values: + # keys can be list -> deep + key = self.construct_object(key_node, deep=True) + # lists are not hashable, but tuples are + if not isinstance(key, Hashable): + if isinstance(key, list): + key = tuple(key) + if not isinstance(key, Hashable): + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + 'found unhashable key', + key_node.start_mark, + ) + + value = self.construct_object(value_node, deep=deep) + if check: + if self.check_mapping_key(node, key_node, mapping, key, value): + mapping[key] = value + else: + mapping[key] = value + total_mapping.update(mapping) + return total_mapping + + def check_mapping_key( + self, node: Any, key_node: Any, mapping: Any, key: Any, value: Any, + ) -> bool: + """return True if key is unique""" + if key in mapping: + if not self.allow_duplicate_keys: + mk = mapping.get(key) + args = [ + 'while constructing a mapping', + node.start_mark, + f'found duplicate key "{key}" with value "{value}" ' + f'(original value: "{mk}")', + key_node.start_mark, + f""" + To suppress this check see: + {DUPKEY_URL} + """, + """\ + Duplicate keys will become an error in future releases, and are errors + by default when using the new API. + """, + ] + if self.allow_duplicate_keys is None: + warnings.warn(DuplicateKeyFutureWarning(*args), stacklevel=1) + else: + raise DuplicateKeyError(*args) + return False + return True + + def check_set_key(self: Any, node: Any, key_node: Any, setting: Any, key: Any) -> None: + if key in setting: + if not self.allow_duplicate_keys: + args = [ + 'while constructing a set', + node.start_mark, + f'found duplicate key "{key}"', + key_node.start_mark, + f""" + To suppress this check see: + {DUPKEY_URL} + """, + """\ + Duplicate keys will become an error in future releases, and are errors + by default when using the new API. + """, + ] + if self.allow_duplicate_keys is None: + warnings.warn(DuplicateKeyFutureWarning(*args), stacklevel=1) + else: + raise DuplicateKeyError(*args) + + def construct_pairs(self, node: Any, deep: bool = False) -> Any: + if not isinstance(node, MappingNode): + raise ConstructorError( + None, None, f'expected a mapping node, but found {node.id!s}', node.start_mark, + ) + pairs = [] + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + value = self.construct_object(value_node, deep=deep) + pairs.append((key, value)) + return pairs + + # ToDo: putting stuff on the class makes it global, consider making this to work on an + # instance variable once function load is dropped. + @classmethod + def add_constructor(cls, tag: Any, constructor: Any) -> Any: + if isinstance(tag, Tag): + tag = str(tag) + if 'yaml_constructors' not in cls.__dict__: + cls.yaml_constructors = cls.yaml_constructors.copy() + ret_val = cls.yaml_constructors.get(tag, None) + cls.yaml_constructors[tag] = constructor + return ret_val + + @classmethod + def add_multi_constructor(cls, tag_prefix: Any, multi_constructor: Any) -> None: + if 'yaml_multi_constructors' not in cls.__dict__: + cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy() + cls.yaml_multi_constructors[tag_prefix] = multi_constructor + + @classmethod + def add_default_constructor( + cls, tag: str, method: Any = None, tag_base: str = 'tag:yaml.org,2002:', + ) -> None: + if not tag.startswith('tag:'): + if method is None: + method = 'construct_yaml_' + tag + tag = tag_base + tag + cls.add_constructor(tag, getattr(cls, method)) + + +class SafeConstructor(BaseConstructor): + def construct_scalar(self, node: Any) -> Any: + if isinstance(node, MappingNode): + for key_node, value_node in node.value: + if key_node.tag == 'tag:yaml.org,2002:value': + return self.construct_scalar(value_node) + return BaseConstructor.construct_scalar(self, node) + + def flatten_mapping(self, node: Any) -> Any: # SafeConstructor + """ + This implements the merge key feature http://yaml.org/type/merge.html + by inserting keys from the merge dict/list of dicts if not yet + available in this node + """ + merge: List[Any] = [] + index = 0 + while index < len(node.value): + key_node, value_node = node.value[index] + if key_node.tag == 'tag:yaml.org,2002:merge': + if merge: # double << key + if self.allow_duplicate_keys: + del node.value[index] + index += 1 + continue + args = [ + 'while constructing a mapping', + node.start_mark, + 'found duplicate merge key "<<"', + key_node.start_mark, + """\ + Duplicate merge keys are never allowed, not even when + `.allow_duplicate_keys` is set to True + """, + ] + raise DuplicateKeyError(*args) + del node.value[index] + if isinstance(value_node, MappingNode): + self.flatten_mapping(value_node) + merge.extend(value_node.value) + elif isinstance(value_node, SequenceNode): + submerge = [] + for subnode in value_node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + f'expected a mapping for merging, but found {subnode.id!s}', + subnode.start_mark, + ) + self.flatten_mapping(subnode) + submerge.append(subnode.value) + submerge.reverse() + for value in submerge: + merge.extend(value) + else: + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + 'expected a mapping or list of mappings for merging, ' + f'but found {value_node.id!s}', + value_node.start_mark, + ) + elif key_node.tag == 'tag:yaml.org,2002:value': + key_node.tag = 'tag:yaml.org,2002:str' + index += 1 + else: + index += 1 + if bool(merge): + node.merge = merge # separate merge keys to be able to update without duplicate + node.value = merge + node.value + + def construct_mapping(self, node: Any, deep: bool = False) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + if isinstance(node, MappingNode): + self.flatten_mapping(node) + return BaseConstructor.construct_mapping(self, node, deep=deep) + + def construct_yaml_null(self, node: Any) -> Any: + self.construct_scalar(node) + return None + + # YAML 1.2 spec doesn't mention yes/no etc any more, 1.1 does + bool_values = { + 'yes': True, + 'no': False, + 'y': True, + 'n': False, + 'true': True, + 'false': False, + 'on': True, + 'off': False, + } + + def construct_yaml_bool(self, node: Any) -> bool: + value = self.construct_scalar(node) + return self.bool_values[value.lower()] + + def construct_yaml_int(self, node: Any) -> int: + value_s = self.construct_scalar(node) + value_s = value_s.replace('_', "") + sign = +1 + if value_s[0] == '-': + sign = -1 + if value_s[0] in '+-': + value_s = value_s[1:] + if value_s == '0': + return 0 + elif value_s.startswith('0b'): + return sign * int(value_s[2:], 2) + elif value_s.startswith('0x'): + return sign * int(value_s[2:], 16) + elif value_s.startswith('0o'): + return sign * int(value_s[2:], 8) + elif self.resolver.processing_version == (1, 1) and value_s[0] == '0': + return sign * int(value_s, 8) + elif self.resolver.processing_version == (1, 1) and ':' in value_s: + digits = [int(part) for part in value_s.split(':')] + digits.reverse() + base = 1 + value = 0 + for digit in digits: + value += digit * base + base *= 60 + return sign * value + else: + return sign * int(value_s) + + inf_value = 1e300 + while inf_value != inf_value * inf_value: + inf_value *= inf_value + nan_value = -inf_value / inf_value # Trying to make a quiet NaN (like C99). + + def construct_yaml_float(self, node: Any) -> float: + value_so = self.construct_scalar(node) + value_s = value_so.replace('_', "").lower() + sign = +1 + if value_s[0] == '-': + sign = -1 + if value_s[0] in '+-': + value_s = value_s[1:] + if value_s == '.inf': + return sign * self.inf_value + elif value_s == '.nan': + return self.nan_value + elif self.resolver.processing_version != (1, 2) and ':' in value_s: + digits = [float(part) for part in value_s.split(':')] + digits.reverse() + base = 1 + value = 0.0 + for digit in digits: + value += digit * base + base *= 60 + return sign * value + else: + if self.resolver.processing_version != (1, 2) and 'e' in value_s: + # value_s is lower case independent of input + mantissa, exponent = value_s.split('e') + if '.' not in mantissa: + warnings.warn(MantissaNoDotYAML1_1Warning(node, value_so), stacklevel=1) + return sign * float(value_s) + + def construct_yaml_binary(self, node: Any) -> Any: + import base64 + + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError( + None, + None, + f'failed to convert base64 data into ascii: {exc!s}', + node.start_mark, + ) + try: + return base64.decodebytes(value) + except binascii.Error as exc: + raise ConstructorError( + None, None, f'failed to decode base64 data: {exc!s}', node.start_mark, + ) + + timestamp_regexp = timestamp_regexp # moved to util 0.17.17 + + def construct_yaml_timestamp(self, node: Any, values: Any = None) -> Any: + if values is None: + try: + match = self.timestamp_regexp.match(node.value) + except TypeError: + match = None + if match is None: + raise ConstructorError( + None, + None, + f'failed to construct timestamp from "{node.value}"', + node.start_mark, + ) + values = match.groupdict() + return create_timestamp(**values) + + def construct_yaml_omap(self, node: Any) -> Any: + # Note: we do now check for duplicate keys + omap = ordereddict() + yield omap + if not isinstance(node, SequenceNode): + raise ConstructorError( + 'while constructing an ordered map', + node.start_mark, + f'expected a sequence, but found {node.id!s}', + node.start_mark, + ) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError( + 'while constructing an ordered map', + node.start_mark, + f'expected a mapping of length 1, but found {subnode.id!s}', + subnode.start_mark, + ) + if len(subnode.value) != 1: + raise ConstructorError( + 'while constructing an ordered map', + node.start_mark, + f'expected a single mapping item, but found {len(subnode.value):d} items', + subnode.start_mark, + ) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + assert key not in omap + value = self.construct_object(value_node) + omap[key] = value + + def construct_yaml_pairs(self, node: Any) -> Any: + # Note: the same code as `construct_yaml_omap`. + pairs: List[Any] = [] + yield pairs + if not isinstance(node, SequenceNode): + raise ConstructorError( + 'while constructing pairs', + node.start_mark, + f'expected a sequence, but found {node.id!s}', + node.start_mark, + ) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError( + 'while constructing pairs', + node.start_mark, + f'expected a mapping of length 1, but found {subnode.id!s}', + subnode.start_mark, + ) + if len(subnode.value) != 1: + raise ConstructorError( + 'while constructing pairs', + node.start_mark, + f'expected a single mapping item, but found {len(subnode.value):d} items', + subnode.start_mark, + ) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + pairs.append((key, value)) + + def construct_yaml_set(self, node: Any) -> Any: + data: Set[Any] = set() + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_str(self, node: Any) -> Any: + value = self.construct_scalar(node) + return value + + def construct_yaml_seq(self, node: Any) -> Any: + data: List[Any] = self.yaml_base_list_type() + yield data + data.extend(self.construct_sequence(node)) + + def construct_yaml_map(self, node: Any) -> Any: + data: Dict[Any, Any] = self.yaml_base_dict_type() + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_object(self, node: Any, cls: Any) -> Any: + data = cls.__new__(cls) + yield data + if hasattr(data, '__setstate__'): + state = self.construct_mapping(node, deep=True) + data.__setstate__(state) + else: + state = self.construct_mapping(node) + data.__dict__.update(state) + + def construct_undefined(self, node: Any) -> None: + raise ConstructorError( + None, + None, + f'could not determine a constructor for the tag {node.tag!r}', + node.start_mark, + ) + + +for tag in 'null bool int float binary timestamp omap pairs set str seq map'.split(): + SafeConstructor.add_default_constructor(tag) + +SafeConstructor.add_constructor(None, SafeConstructor.construct_undefined) + + +class Constructor(SafeConstructor): + def construct_python_str(self, node: Any) -> Any: + return self.construct_scalar(node) + + def construct_python_unicode(self, node: Any) -> Any: + return self.construct_scalar(node) + + def construct_python_bytes(self, node: Any) -> Any: + import base64 + + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError( + None, + None, + f'failed to convert base64 data into ascii: {exc!s}', + node.start_mark, + ) + try: + return base64.decodebytes(value) + except binascii.Error as exc: + raise ConstructorError( + None, None, f'failed to decode base64 data: {exc!s}', node.start_mark, + ) + + def construct_python_long(self, node: Any) -> int: + val = self.construct_yaml_int(node) + return val + + def construct_python_complex(self, node: Any) -> Any: + return complex(self.construct_scalar(node)) + + def construct_python_tuple(self, node: Any) -> Any: + return tuple(self.construct_sequence(node)) + + def find_python_module(self, name: Any, mark: Any) -> Any: + if not name: + raise ConstructorError( + 'while constructing a Python module', + mark, + 'expected non-empty name appended to the tag', + mark, + ) + try: + __import__(name) + except ImportError as exc: + raise ConstructorError( + 'while constructing a Python module', + mark, + f'cannot find module {name!r} ({exc!s})', + mark, + ) + return sys.modules[name] + + def find_python_name(self, name: Any, mark: Any) -> Any: + if not name: + raise ConstructorError( + 'while constructing a Python object', + mark, + 'expected non-empty name appended to the tag', + mark, + ) + if '.' in name: + lname = name.split('.') + lmodule_name = lname + lobject_name: List[Any] = [] + while len(lmodule_name) > 1: + lobject_name.insert(0, lmodule_name.pop()) + module_name = '.'.join(lmodule_name) + try: + __import__(module_name) + # object_name = '.'.join(object_name) + break + except ImportError: + continue + else: + module_name = builtins_module + lobject_name = [name] + try: + __import__(module_name) + except ImportError as exc: + raise ConstructorError( + 'while constructing a Python object', + mark, + f'cannot find module {module_name!r} ({exc!s})', + mark, + ) + module = sys.modules[module_name] + object_name = '.'.join(lobject_name) + obj = module + while lobject_name: + if not hasattr(obj, lobject_name[0]): + + raise ConstructorError( + 'while constructing a Python object', + mark, + f'cannot find {object_name!r} in the module {module.__name__!r}', + mark, + ) + obj = getattr(obj, lobject_name.pop(0)) + return obj + + def construct_python_name(self, suffix: Any, node: Any) -> Any: + value = self.construct_scalar(node) + if value: + raise ConstructorError( + 'while constructing a Python name', + node.start_mark, + f'expected the empty value, but found {value!r}', + node.start_mark, + ) + return self.find_python_name(suffix, node.start_mark) + + def construct_python_module(self, suffix: Any, node: Any) -> Any: + value = self.construct_scalar(node) + if value: + raise ConstructorError( + 'while constructing a Python module', + node.start_mark, + f'expected the empty value, but found {value!r}', + node.start_mark, + ) + return self.find_python_module(suffix, node.start_mark) + + def make_python_instance( + self, suffix: Any, node: Any, args: Any = None, kwds: Any = None, newobj: bool = False, + ) -> Any: + if not args: + args = [] + if not kwds: + kwds = {} + cls = self.find_python_name(suffix, node.start_mark) + if newobj and isinstance(cls, type): + return cls.__new__(cls, *args, **kwds) + else: + return cls(*args, **kwds) + + def set_python_instance_state(self, instance: Any, state: Any) -> None: + if hasattr(instance, '__setstate__'): + instance.__setstate__(state) + else: + slotstate: Dict[Any, Any] = {} + if isinstance(state, tuple) and len(state) == 2: + state, slotstate = state + if hasattr(instance, '__dict__'): + instance.__dict__.update(state) + elif state: + slotstate.update(state) + for key, value in slotstate.items(): + setattr(instance, key, value) + + def construct_python_object(self, suffix: Any, node: Any) -> Any: + # Format: + # !!python/object:module.name { ... state ... } + instance = self.make_python_instance(suffix, node, newobj=True) + self.recursive_objects[node] = instance + yield instance + deep = hasattr(instance, '__setstate__') + state = self.construct_mapping(node, deep=deep) + self.set_python_instance_state(instance, state) + + def construct_python_object_apply( + self, suffix: Any, node: Any, newobj: bool = False, + ) -> Any: + # Format: + # !!python/object/apply # (or !!python/object/new) + # args: [ ... arguments ... ] + # kwds: { ... keywords ... } + # state: ... state ... + # listitems: [ ... listitems ... ] + # dictitems: { ... dictitems ... } + # or short format: + # !!python/object/apply [ ... arguments ... ] + # The difference between !!python/object/apply and !!python/object/new + # is how an object is created, check make_python_instance for details. + if isinstance(node, SequenceNode): + args = self.construct_sequence(node, deep=True) + kwds: Dict[Any, Any] = {} + state: Dict[Any, Any] = {} + listitems: List[Any] = [] + dictitems: Dict[Any, Any] = {} + else: + value = self.construct_mapping(node, deep=True) + args = value.get('args', []) + kwds = value.get('kwds', {}) + state = value.get('state', {}) + listitems = value.get('listitems', []) + dictitems = value.get('dictitems', {}) + instance = self.make_python_instance(suffix, node, args, kwds, newobj) + if bool(state): + self.set_python_instance_state(instance, state) + if bool(listitems): + instance.extend(listitems) + if bool(dictitems): + for key in dictitems: + instance[key] = dictitems[key] + return instance + + def construct_python_object_new(self, suffix: Any, node: Any) -> Any: + return self.construct_python_object_apply(suffix, node, newobj=True) + + @classmethod + def add_default_constructor( + cls, tag: str, method: Any = None, tag_base: str = 'tag:yaml.org,2002:python/', + ) -> None: + if not tag.startswith('tag:'): + if method is None: + method = 'construct_yaml_' + tag + tag = tag_base + tag + cls.add_constructor(tag, getattr(cls, method)) + + +Constructor.add_constructor('tag:yaml.org,2002:python/none', Constructor.construct_yaml_null) + +Constructor.add_constructor('tag:yaml.org,2002:python/bool', Constructor.construct_yaml_bool) + +Constructor.add_constructor('tag:yaml.org,2002:python/str', Constructor.construct_python_str) + +Constructor.add_constructor( + 'tag:yaml.org,2002:python/unicode', Constructor.construct_python_unicode, +) + +Constructor.add_constructor( + 'tag:yaml.org,2002:python/bytes', Constructor.construct_python_bytes, +) + +Constructor.add_constructor('tag:yaml.org,2002:python/int', Constructor.construct_yaml_int) + +Constructor.add_constructor('tag:yaml.org,2002:python/long', Constructor.construct_python_long) + +Constructor.add_constructor('tag:yaml.org,2002:python/float', Constructor.construct_yaml_float) + +Constructor.add_constructor( + 'tag:yaml.org,2002:python/complex', Constructor.construct_python_complex, +) + +Constructor.add_constructor('tag:yaml.org,2002:python/list', Constructor.construct_yaml_seq) + +Constructor.add_constructor( + 'tag:yaml.org,2002:python/tuple', Constructor.construct_python_tuple, +) +# for tag in 'bool str unicode bytes int long float complex tuple'.split(): +# Constructor.add_default_constructor(tag) + +Constructor.add_constructor('tag:yaml.org,2002:python/dict', Constructor.construct_yaml_map) + +Constructor.add_multi_constructor( + 'tag:yaml.org,2002:python/name:', Constructor.construct_python_name, +) + +Constructor.add_multi_constructor( + 'tag:yaml.org,2002:python/module:', Constructor.construct_python_module, +) + +Constructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object:', Constructor.construct_python_object, +) + +Constructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/apply:', Constructor.construct_python_object_apply, +) + +Constructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/new:', Constructor.construct_python_object_new, +) + + +class RoundTripConstructor(SafeConstructor): + """need to store the comments on the node itself, + as well as on the items + """ + + def comment(self, idx: Any) -> Any: + assert self.loader.comment_handling is not None + x = self.scanner.comments[idx] + x.set_assigned() + return x + + def comments(self, list_of_comments: Any, idx: Optional[Any] = None) -> Any: + # hand in the comment and optional pre, eol, post segment + if list_of_comments is None: + return [] + if idx is not None: + if list_of_comments[idx] is None: + return [] + list_of_comments = list_of_comments[idx] + for x in list_of_comments: + yield self.comment(x) + + def construct_scalar(self, node: Any) -> Any: + if not isinstance(node, ScalarNode): + raise ConstructorError( + None, None, f'expected a scalar node, but found {node.id!s}', node.start_mark, + ) + + if node.style == '|' and isinstance(node.value, str): + lss = LiteralScalarString(node.value, anchor=node.anchor) + if self.loader and self.loader.comment_handling is None: + if node.comment and node.comment[1]: + lss.comment = node.comment[1][0] # type: ignore + else: + # NEWCMNT + if node.comment is not None and node.comment[1]: + # nprintf('>>>>nc1', node.comment) + # EOL comment after | + lss.comment = self.comment(node.comment[1][0]) # type: ignore + return lss + if node.style == '>' and isinstance(node.value, str): + fold_positions: List[int] = [] + idx = -1 + while True: + idx = node.value.find('\a', idx + 1) + if idx < 0: + break + fold_positions.append(idx - len(fold_positions)) + fss = FoldedScalarString(node.value.replace('\a', ''), anchor=node.anchor) + if self.loader and self.loader.comment_handling is None: + if node.comment and node.comment[1]: + fss.comment = node.comment[1][0] # type: ignore + else: + # NEWCMNT + if node.comment is not None and node.comment[1]: + # nprintf('>>>>nc2', node.comment) + # EOL comment after > + fss.comment = self.comment(node.comment[1][0]) # type: ignore + if fold_positions: + fss.fold_pos = fold_positions # type: ignore + return fss + elif bool(self._preserve_quotes) and isinstance(node.value, str): + if node.style == "'": + return SingleQuotedScalarString(node.value, anchor=node.anchor) + if node.style == '"': + return DoubleQuotedScalarString(node.value, anchor=node.anchor) + # if node.ctag: + # data2 = TaggedScalar() + # data2.value = node.value + # data2.style = node.style + # data2.yaml_set_ctag(node.ctag) + # if node.anchor: + # from ruamel.yaml.serializer import templated_id + + # if not templated_id(node.anchor): + # data2.yaml_set_anchor(node.anchor, always_dump=True) + # return data2 + if node.anchor: + return PlainScalarString(node.value, anchor=node.anchor) + return node.value + + def construct_yaml_int(self, node: Any) -> Any: + width: Any = None + value_su = self.construct_scalar(node) + try: + sx = value_su.rstrip('_') + underscore: Any = [len(sx) - sx.rindex('_') - 1, False, False] + except ValueError: + underscore = None + except IndexError: + underscore = None + value_s = value_su.replace('_', "") + sign = +1 + if value_s[0] in '+-': + if value_s[0] == '-': + sign = -1 + value_s = value_s[1:] + if value_s.startswith('0b'): + if self.resolver.processing_version > (1, 1) and value_s[2] == '0': + width = len(value_s[2:]) + if underscore is not None: + underscore[1] = value_su[2] == '_' + underscore[2] = len(value_su[2:]) > 1 and value_su[-1] == '_' + return BinaryInt( + sign * int(value_s[2:], 2), + width=width, + underscore=underscore, + anchor=node.anchor, + ) + elif value_s.startswith('0x'): + # default to lower-case if no a-fA-F in string + if self.resolver.processing_version > (1, 1) and value_s[2] == '0': + width = len(value_s[2:]) + hex_fun: Any = HexInt + for ch in value_s[2:]: + if ch in 'ABCDEF': # first non-digit is capital + hex_fun = HexCapsInt + break + if ch in 'abcdef': + break + if underscore is not None: + underscore[1] = value_su[2] == '_' + underscore[2] = len(value_su[2:]) > 1 and value_su[-1] == '_' + return hex_fun( + sign * int(value_s[2:], 16), + width=width, + underscore=underscore, + anchor=node.anchor, + ) + elif value_s.startswith('0o'): + if self.resolver.processing_version > (1, 1) and value_s[2] == '0': + width = len(value_s[2:]) + if underscore is not None: + underscore[1] = value_su[2] == '_' + underscore[2] = len(value_su[2:]) > 1 and value_su[-1] == '_' + return OctalInt( + sign * int(value_s[2:], 8), + width=width, + underscore=underscore, + anchor=node.anchor, + ) + elif ( + self.resolver.processing_version != (1, 2) + and len(value_s) > 1 + and value_s[0] == '0' + ): + return OctalInt( + sign * int(value_s, 8), width=width, underscore=underscore, anchor=node.anchor, + ) + elif self.resolver.processing_version != (1, 2) and ':' in value_s: + digits = [int(part) for part in value_s.split(':')] + digits.reverse() + base = 1 + value = 0 + for digit in digits: + value += digit * base + base *= 60 + return sign * value + elif self.resolver.processing_version > (1, 1) and value_s[0] == '0': + # not an octal, an integer with leading zero(s) + if underscore is not None: + # cannot have a leading underscore + underscore[2] = len(value_su) > 1 and value_su[-1] == '_' + return ScalarInt( + sign * int(value_s), + width=len(value_s), + underscore=underscore, + anchor=node.anchor, + ) + elif underscore: + # cannot have a leading underscore + underscore[2] = len(value_su) > 1 and value_su[-1] == '_' + return ScalarInt( + sign * int(value_s), width=None, underscore=underscore, anchor=node.anchor, + ) + elif node.anchor: + return ScalarInt(sign * int(value_s), width=None, anchor=node.anchor) + else: + return sign * int(value_s) + + def construct_yaml_float(self, node: Any) -> Any: + def leading_zeros(v: Any) -> int: + lead0 = 0 + idx = 0 + while idx < len(v) and v[idx] in '0.': + if v[idx] == '0': + lead0 += 1 + idx += 1 + return lead0 + + # underscore = None + m_sign: Any = False + value_so = self.construct_scalar(node) + value_s = value_so.replace('_', "").lower() + sign = +1 + if value_s[0] == '-': + sign = -1 + if value_s[0] in '+-': + m_sign = value_s[0] + value_s = value_s[1:] + if value_s == '.inf': + return sign * self.inf_value + if value_s == '.nan': + return self.nan_value + if self.resolver.processing_version != (1, 2) and ':' in value_s: + digits = [float(part) for part in value_s.split(':')] + digits.reverse() + base = 1 + value = 0.0 + for digit in digits: + value += digit * base + base *= 60 + return sign * value + if 'e' in value_s: + try: + mantissa, exponent = value_so.split('e') + exp = 'e' + except ValueError: + mantissa, exponent = value_so.split('E') + exp = 'E' + if self.resolver.processing_version != (1, 2): + # value_s is lower case independent of input + if '.' not in mantissa: + warnings.warn(MantissaNoDotYAML1_1Warning(node, value_so), stacklevel=1) + lead0 = leading_zeros(mantissa) + width = len(mantissa) + prec = mantissa.find('.') + if m_sign: + width -= 1 + e_width = len(exponent) + e_sign = exponent[0] in '+-' + # nprint('sf', width, prec, m_sign, exp, e_width, e_sign) + return ScalarFloat( + sign * float(value_s), + width=width, + prec=prec, + m_sign=m_sign, + m_lead0=lead0, + exp=exp, + e_width=e_width, + e_sign=e_sign, + anchor=node.anchor, + ) + width = len(value_so) + # you can't use index, !!float 42 would be a float without a dot + prec = value_so.find('.') + lead0 = leading_zeros(value_so) + return ScalarFloat( + sign * float(value_s), + width=width, + prec=prec, + m_sign=m_sign, + m_lead0=lead0, + anchor=node.anchor, + ) + + def construct_yaml_str(self, node: Any) -> Any: + if node.ctag.handle: + value = self.construct_unknown(node) + else: + value = self.construct_scalar(node) + if isinstance(value, ScalarString): + return value + return value + + def construct_rt_sequence(self, node: Any, seqtyp: Any, deep: bool = False) -> Any: + if not isinstance(node, SequenceNode): + raise ConstructorError( + None, + None, + f'expected a sequence node, but found {node.id!s}', + node.start_mark, + ) + ret_val = [] + if self.loader and self.loader.comment_handling is None: + if node.comment: + seqtyp._yaml_add_comment(node.comment[:2]) + if len(node.comment) > 2: + # this happens e.g. if you have a sequence element that is a flow-style + # mapping and that has no EOL comment but a following commentline or + # empty line + seqtyp.yaml_end_comment_extend(node.comment[2], clear=True) + else: + # NEWCMNT + if node.comment: + nprintf('nc3', node.comment) + if node.anchor: + from ruamel.yaml.serializer import templated_id + + if not templated_id(node.anchor): + seqtyp.yaml_set_anchor(node.anchor) + for idx, child in enumerate(node.value): + if child.comment: + seqtyp._yaml_add_comment(child.comment, key=idx) + child.comment = None # if moved to sequence remove from child + ret_val.append(self.construct_object(child, deep=deep)) + seqtyp._yaml_set_idx_line_col( + idx, [child.start_mark.line, child.start_mark.column], + ) + return ret_val + + def flatten_mapping(self, node: Any) -> Any: # RTConstructor + """ + This implements the merge key feature http://yaml.org/type/merge.html + by referencing the merge dict/list of dicts + """ + from ruamel.yaml.mergevalue import MergeValue + + def constructed(value_node: Any) -> Any: + # If the contents of a merge are defined within the + # merge marker, then they won't have been constructed + # yet. But if they were already constructed, we need to use + # the existing object. + if value_node in self.constructed_objects: + value = self.constructed_objects[value_node] + else: + value = self.construct_object(value_node, deep=True) + return value + + # merge = [] + # merge_map_list: List[Any] = [] + merge_map_list = MergeValue() + index = 0 + while index < len(node.value): + key_node, value_node = node.value[index] + if key_node.tag == 'tag:yaml.org,2002:merge': + if len(merge_map_list): # double << key + args = [ + 'while constructing a mapping', + node.start_mark, + 'found duplicate merge key "<<"', + key_node.start_mark, + """\ + Duplicate merge keys are never allowed, not even when + `.allow_duplicate_keys` is set to True + """, + ] + raise DuplicateKeyError(*args) + del node.value[index] + merge_map_list.merge_pos = index + if isinstance(value_node, MappingNode): + merge_map_list.append(constructed(value_node)) + elif isinstance(value_node, SequenceNode): + # submerge = [] + merge_map_list.set_sequence(constructed(value_node)) + for subnode in value_node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + f'expected a mapping for merging, but found {subnode.id!s}', + subnode.start_mark, + ) + merge_map_list.append(constructed(subnode)) + else: + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + 'expected a mapping or list of mappings for merging, ' + f'but found {value_node.id!s}', + value_node.start_mark, + ) + elif key_node.tag == 'tag:yaml.org,2002:value': + key_node.tag = 'tag:yaml.org,2002:str' + index += 1 + else: + index += 1 + return merge_map_list + # if merge: + # node.value = merge + node.value + + def _sentinel(self) -> None: + pass + + # RoundTrip + def construct_mapping(self, node: Any, maptyp: Any, deep: bool = False) -> Any: # type: ignore # NOQA + if not isinstance(node, MappingNode): + raise ConstructorError( + None, None, f'expected a mapping node, but found {node.id!s}', node.start_mark, + ) + merge_map = self.flatten_mapping(node) + # mapping = {} + if self.loader and self.loader.comment_handling is None: + if node.comment: + maptyp._yaml_add_comment(node.comment[:2]) + if len(node.comment) > 2: + maptyp.yaml_end_comment_extend(node.comment[2], clear=True) + else: + # NEWCMNT + if node.comment: + # nprintf('nc4', node.comment, node.start_mark) + if maptyp.ca.pre is None: + maptyp.ca.pre = [] + for cmnt in self.comments(node.comment, 0): + maptyp.ca.pre.append(cmnt) + if node.anchor: + from ruamel.yaml.serializer import templated_id + + if not templated_id(node.anchor): + maptyp.yaml_set_anchor(node.anchor) + last_key, last_value = None, self._sentinel + for key_node, value_node in node.value: + # keys can be list -> deep + key = self.construct_object(key_node, deep=True) + # lists are not hashable, but tuples are + if not isinstance(key, Hashable): + if isinstance(key, MutableSequence): + key_s = CommentedKeySeq(key) + if key_node.flow_style is True: + key_s.fa.set_flow_style() + elif key_node.flow_style is False: + key_s.fa.set_block_style() + key_s._yaml_set_line_col(key.lc.line, key.lc.col) # type: ignore + key = key_s + elif isinstance(key, MutableMapping): + key_m = CommentedKeyMap(key) + if key_node.flow_style is True: + key_m.fa.set_flow_style() + elif key_node.flow_style is False: + key_m.fa.set_block_style() + key_m._yaml_set_line_col(key.lc.line, key.lc.col) # type: ignore + key = key_m + if not isinstance(key, Hashable): + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + 'found unhashable key', + key_node.start_mark, + ) + value = self.construct_object(value_node, deep=deep) + if self.check_mapping_key(node, key_node, maptyp, key, value): + if self.loader and self.loader.comment_handling is None: + if key_node.comment and len(key_node.comment) > 4 and key_node.comment[4]: + if last_value is None: + key_node.comment[0] = key_node.comment.pop(4) + maptyp._yaml_add_comment(key_node.comment, value=last_key) + else: + key_node.comment[2] = key_node.comment.pop(4) + maptyp._yaml_add_comment(key_node.comment, key=key) + key_node.comment = None + if key_node.comment: + maptyp._yaml_add_comment(key_node.comment, key=key) + if value_node.comment: + maptyp._yaml_add_comment(value_node.comment, value=key) + else: + # NEWCMNT + if key_node.comment: + # nprintf('nc5a', key, key_node.comment) + if key_node.comment[0]: + maptyp.ca.set(key, C_KEY_PRE, key_node.comment[0]) + if key_node.comment[1]: + maptyp.ca.set(key, C_KEY_EOL, key_node.comment[1]) + if key_node.comment[2]: + maptyp.ca.set(key, C_KEY_POST, key_node.comment[2]) + if value_node.comment: + nprintf('nc5b', key, value_node.comment) + if value_node.comment[0]: + maptyp.ca.set(key, C_VALUE_PRE, value_node.comment[0]) + if value_node.comment[1]: + maptyp.ca.set(key, C_VALUE_EOL, value_node.comment[1]) + if value_node.comment[2]: + maptyp.ca.set(key, C_VALUE_POST, value_node.comment[2]) + maptyp._yaml_set_kv_line_col( + key, + [ + key_node.start_mark.line, + key_node.start_mark.column, + value_node.start_mark.line, + value_node.start_mark.column, + ], + ) + maptyp[key] = value + last_key, last_value = key, value # could use indexing + # do this last, or <<: before a key will prevent insertion in instances + # of collections.OrderedDict (as they have no __contains__ + if merge_map: + maptyp.add_yaml_merge(merge_map) + + def construct_setting(self, node: Any, typ: Any, deep: bool = False) -> Any: + if not isinstance(node, MappingNode): + raise ConstructorError( + None, None, f'expected a mapping node, but found {node.id!s}', node.start_mark, + ) + if self.loader and self.loader.comment_handling is None: + if node.comment: + typ._yaml_add_comment(node.comment[:2]) + if len(node.comment) > 2: + typ.yaml_end_comment_extend(node.comment[2], clear=True) + else: + # NEWCMNT + if node.comment: + nprintf('nc6', node.comment) + if node.anchor: + from ruamel.yaml.serializer import templated_id + + if not templated_id(node.anchor): + typ.yaml_set_anchor(node.anchor) + for key_node, value_node in node.value: + # keys can be list -> deep + key = self.construct_object(key_node, deep=True) + # lists are not hashable, but tuples are + if not isinstance(key, Hashable): + if isinstance(key, list): + key = tuple(key) + if not isinstance(key, Hashable): + raise ConstructorError( + 'while constructing a mapping', + node.start_mark, + 'found unhashable key', + key_node.start_mark, + ) + # construct but should be null + value = self.construct_object(value_node, deep=deep) # NOQA + self.check_set_key(node, key_node, typ, key) + if self.loader and self.loader.comment_handling is None: + if key_node.comment: + typ._yaml_add_comment(key_node.comment, key=key) + if value_node.comment: + typ._yaml_add_comment(value_node.comment, value=key) + else: + # NEWCMNT + if key_node.comment: + nprintf('nc7a', key_node.comment) + if value_node.comment: + nprintf('nc7b', value_node.comment) + typ.add(key) + + def construct_yaml_seq(self, node: Any) -> Iterator[CommentedSeq]: + data = CommentedSeq() + data._yaml_set_line_col(node.start_mark.line, node.start_mark.column) + # if node.comment: + # data._yaml_add_comment(node.comment) + yield data + data.extend(self.construct_rt_sequence(node, data)) + self.set_collection_style(data, node) + + def construct_yaml_map(self, node: Any) -> Iterator[CommentedMap]: + data = CommentedMap() + data._yaml_set_line_col(node.start_mark.line, node.start_mark.column) + yield data + self.construct_mapping(node, data, deep=True) + self.set_collection_style(data, node) + + def set_collection_style(self, data: Any, node: Any) -> None: + if len(data) == 0: + return + if node.flow_style is True: + data.fa.set_flow_style() + elif node.flow_style is False: + data.fa.set_block_style() + + def construct_yaml_object(self, node: Any, cls: Any) -> Any: + from dataclasses import is_dataclass, InitVar, MISSING + + data = cls.__new__(cls) + yield data + if hasattr(data, '__setstate__'): + state = SafeConstructor.construct_mapping(self, node, deep=True) + data.__setstate__(state) + elif is_dataclass(data): + mapping = SafeConstructor.construct_mapping(self, node, deep=True) + init_var_defaults = {} + for field in data.__dataclass_fields__.values(): + # nprintf('field', field, field.default is MISSING, isinstance(field.type, InitVar)) # NOQA + # in 3.7, InitVar is a singleton + if ( + isinstance(field.type, InitVar) + or field.type is InitVar + # this following is for handling from __future__ import allocations + or (isinstance(field.type, str) and field.type.startswith('InitVar')) + ) and field.default is not MISSING: + init_var_defaults[field.name] = field.default + for attr, value in mapping.items(): + if attr not in init_var_defaults: + setattr(data, attr, value) + post_init = getattr(data, '__post_init__', None) + if post_init is not None: + kw = {} + for name, default in init_var_defaults.items(): + kw[name] = mapping.get(name, default) + post_init(**kw) + for field in data.__dataclass_fields__.values(): + if field.name not in mapping and field.default_factory is not MISSING: + setattr(data, field.name, field.default_factory()) + else: + state = SafeConstructor.construct_mapping(self, node) + if hasattr(data, '__attrs_attrs__'): # issue 394 + data.__init__(**state) + else: + data.__dict__.update(state) + if node.anchor: + from ruamel.yaml.serializer import templated_id + from ruamel.yaml.anchor import Anchor + + if not templated_id(node.anchor): + if not hasattr(data, Anchor.attrib): + a = Anchor() + setattr(data, Anchor.attrib, a) + else: + a = getattr(data, Anchor.attrib) + a.value = node.anchor + + def construct_yaml_omap(self, node: Any) -> Iterator[CommentedOrderedMap]: + # Note: we do now check for duplicate keys + omap = CommentedOrderedMap() + omap._yaml_set_line_col(node.start_mark.line, node.start_mark.column) + if node.flow_style is True: + omap.fa.set_flow_style() + elif node.flow_style is False: + omap.fa.set_block_style() + yield omap + if self.loader and self.loader.comment_handling is None: + if node.comment: + omap._yaml_add_comment(node.comment[:2]) + if len(node.comment) > 2: + omap.yaml_end_comment_extend(node.comment[2], clear=True) + else: + # NEWCMNT + if node.comment: + nprintf('nc8', node.comment) + if not isinstance(node, SequenceNode): + raise ConstructorError( + 'while constructing an ordered map', + node.start_mark, + f'expected a sequence, but found {node.id!s}', + node.start_mark, + ) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError( + 'while constructing an ordered map', + node.start_mark, + f'expected a mapping of length 1, but found {subnode.id!s}', + subnode.start_mark, + ) + if len(subnode.value) != 1: + raise ConstructorError( + 'while constructing an ordered map', + node.start_mark, + f'expected a single mapping item, but found {len(subnode.value):d} items', + subnode.start_mark, + ) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + assert key not in omap + value = self.construct_object(value_node) + if self.loader and self.loader.comment_handling is None: + if key_node.comment: + omap._yaml_add_comment(key_node.comment, key=key) + if subnode.comment: + omap._yaml_add_comment(subnode.comment, key=key) + if value_node.comment: + omap._yaml_add_comment(value_node.comment, value=key) + else: + # NEWCMNT + if key_node.comment: + nprintf('nc9a', key_node.comment) + if subnode.comment: + nprintf('nc9b', subnode.comment) + if value_node.comment: + nprintf('nc9c', value_node.comment) + omap[key] = value + + def construct_yaml_set(self, node: Any) -> Iterator[CommentedSet]: + data = CommentedSet() + data._yaml_set_line_col(node.start_mark.line, node.start_mark.column) + if node.flow_style is True: + data.fa.set_flow_style() + elif node.flow_style is False: + data.fa.set_block_style() + yield data + self.construct_setting(node, data) + + def construct_unknown( + self, node: Any, + ) -> Iterator[Union[CommentedMap, TaggedScalar, CommentedSeq]]: + try: + if isinstance(node, MappingNode): + data = CommentedMap() + data._yaml_set_line_col(node.start_mark.line, node.start_mark.column) + if node.flow_style is True: + data.fa.set_flow_style() + elif node.flow_style is False: + data.fa.set_block_style() + data.yaml_set_ctag(node.ctag) + yield data + if node.anchor: + from ruamel.yaml.serializer import templated_id + + if not templated_id(node.anchor): + data.yaml_set_anchor(node.anchor) + self.construct_mapping(node, data) + return + elif isinstance(node, ScalarNode): + data2 = TaggedScalar() + data2.value = self.construct_scalar(node) + data2.style = node.style + data2.yaml_set_ctag(node.ctag) + yield data2 + if node.anchor: + from ruamel.yaml.serializer import templated_id + + if not templated_id(node.anchor): + data2.yaml_set_anchor(node.anchor, always_dump=True) + return + elif isinstance(node, SequenceNode): + data3 = CommentedSeq() + data3._yaml_set_line_col(node.start_mark.line, node.start_mark.column) + if node.flow_style is True: + data3.fa.set_flow_style() + elif node.flow_style is False: + data3.fa.set_block_style() + data3.yaml_set_ctag(node.ctag) + yield data3 + if node.anchor: + from ruamel.yaml.serializer import templated_id + + if not templated_id(node.anchor): + data3.yaml_set_anchor(node.anchor) + data3.extend(self.construct_sequence(node)) + return + except: # NOQA + pass + raise ConstructorError( + None, + None, + f'could not determine a constructor for the tag {node.tag!r}', + node.start_mark, + ) + + def construct_yaml_timestamp( + self, node: Any, values: Any = None, + ) -> Union[datetime.date, datetime.datetime, TimeStamp]: + try: + match = self.timestamp_regexp.match(node.value) + except TypeError: + match = None + if match is None: + raise ConstructorError( + None, + None, + f'failed to construct timestamp from "{node.value}"', + node.start_mark, + ) + values = match.groupdict() + if not values['hour']: + return create_timestamp(**values) + # return SafeConstructor.construct_yaml_timestamp(self, node, values) + for part in ['t', 'tz_sign', 'tz_hour', 'tz_minute']: + if values[part]: + break + else: + return create_timestamp(**values) + # return SafeConstructor.construct_yaml_timestamp(self, node, values) + # print('>>>>>>>> here', values) + dd = create_timestamp(**values) # this has tzinfo + delta = None + if values['tz_sign']: + hours = values['tz_hour'] + tz_hour = int(hours) + minutes = values['tz_minute'] + tz_minute = int(minutes) if minutes else 0 + # ToDo: double work, replace with extraction from dd.tzinfo + delta = TimeDelta(hours=tz_hour, minutes=tz_minute) + if values['tz_sign'] == '-': + delta = -delta + if isinstance(dd, datetime.datetime): + data = TimeStamp( + dd.year, dd.month, dd.day, dd.hour, dd.minute, dd.second, dd.microsecond, dd.tzinfo, # NOQA + ) + else: + # ToDo: make this into a DateStamp? + data = TimeStamp(dd.year, dd.month, dd.day, 0, 0, 0, 0) + return data + if delta: + data._yaml['delta'] = delta + tz = values['tz_sign'] + values['tz_hour'] + if values['tz_minute']: + tz += ':' + values['tz_minute'] + data._yaml['tz'] = tz + else: + if values['tz']: # no delta + data._yaml['tz'] = values['tz'] + if values['t']: + data._yaml['t'] = True + return data + + def construct_yaml_sbool(self, node: Any) -> Union[bool, ScalarBoolean]: + b = SafeConstructor.construct_yaml_bool(self, node) + if node.anchor: + return ScalarBoolean(b, anchor=node.anchor) + return b + + +RoundTripConstructor.add_default_constructor('bool', method='construct_yaml_sbool') + +for tag in 'null int float binary timestamp omap pairs set str seq map'.split(): + RoundTripConstructor.add_default_constructor(tag) + +RoundTripConstructor.add_constructor(None, RoundTripConstructor.construct_unknown) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/cyaml.py b/python/user_packages/Python313/site-packages/ruamel/yaml/cyaml.py new file mode 100644 index 0000000000000000000000000000000000000000..4b04faa313935048a4b558372945a9dcedd4a13b --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/cyaml.py @@ -0,0 +1,204 @@ + +from __future__ import annotations + +if False: # MYPY + from typing import Any, Optional + from ruamel.yaml.compat import StreamTextType, StreamType, VersionType # NOQA + +__yaml_lib: Optional[str] = None +try: + from _ruamel_yaml import CParser, CEmitter # type: ignore + __yaml_lib = 'clib' +except ModuleNotFoundError: + from _ruamel_yaml_clibz import CParser, CEmitter # type: ignore + __yaml_lib = 'clibz' + +from ruamel.yaml.constructor import Constructor, BaseConstructor, SafeConstructor # NOQA +from ruamel.yaml.representer import Representer, SafeRepresenter, BaseRepresenter # NOQA +from ruamel.yaml.resolver import Resolver, BaseResolver # NOQA + + +__all__ = ['CBaseLoader', 'CSafeLoader', 'CLoader', 'CBaseDumper', 'CSafeDumper', 'CDumper', + '__yaml_lib'] + + +# this includes some hacks to solve the usage of resolver by lower level +# parts of the parser + + +class CBaseLoader(CParser, BaseConstructor, BaseResolver): # type: ignore + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + CParser.__init__(self, stream) + self._parser = self._composer = self + BaseConstructor.__init__(self, loader=self) + BaseResolver.__init__(self, loadumper=self) + # self.descend_resolver = self._resolver.descend_resolver + # self.ascend_resolver = self._resolver.ascend_resolver + # self.resolve = self._resolver.resolve + + +class CSafeLoader(CParser, SafeConstructor, Resolver): # type: ignore + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + CParser.__init__(self, stream) + self._parser = self._composer = self + SafeConstructor.__init__(self, loader=self) + Resolver.__init__(self, loadumper=self) + # self.descend_resolver = self._resolver.descend_resolver + # self.ascend_resolver = self._resolver.ascend_resolver + # self.resolve = self._resolver.resolve + + +class CLoader(CParser, Constructor, Resolver): # type: ignore + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + CParser.__init__(self, stream) + self._parser = self._composer = self + Constructor.__init__(self, loader=self) + Resolver.__init__(self, loadumper=self) + # self.descend_resolver = self._resolver.descend_resolver + # self.ascend_resolver = self._resolver.ascend_resolver + # self.resolve = self._resolver.resolve + + +class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): # type: ignore + def __init__( + self: StreamType, + stream: Any, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + CEmitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + encoding=encoding, + allow_unicode=allow_unicode, + line_break=line_break, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + ) + self._emitter = self._serializer = self._representer = self + BaseRepresenter.__init__( + self, + default_style=default_style, + default_flow_style=default_flow_style, + dumper=self, + ) + BaseResolver.__init__(self, loadumper=self) + + +class CSafeDumper(CEmitter, SafeRepresenter, Resolver): # type: ignore + def __init__( + self: StreamType, + stream: Any, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + self._emitter = self._serializer = self._representer = self + CEmitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + encoding=encoding, + allow_unicode=allow_unicode, + line_break=line_break, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + ) + self._emitter = self._serializer = self._representer = self + SafeRepresenter.__init__( + self, default_style=default_style, default_flow_style=default_flow_style, + ) + Resolver.__init__(self) + + +class CDumper(CEmitter, Representer, Resolver): # type: ignore + def __init__( + self: StreamType, + stream: Any, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + CEmitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + encoding=encoding, + allow_unicode=allow_unicode, + line_break=line_break, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + ) + self._emitter = self._serializer = self._representer = self + Representer.__init__( + self, default_style=default_style, default_flow_style=default_flow_style, + ) + Resolver.__init__(self) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/docinfo.py b/python/user_packages/Python313/site-packages/ruamel/yaml/docinfo.py new file mode 100644 index 0000000000000000000000000000000000000000..1c9254bc14eca594005c39b78524c5a689c4ca96 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/docinfo.py @@ -0,0 +1,130 @@ + +from __future__ import annotations + +""" +DocInfo + +Although it was possible to read tag directives before this, all handle/prefix +pairs for all documents in all streams were stored in one dictionary per +YAML instance, making it impossible to distinguish where such a pair came +from without sublassing the scanner. + +ToDo: +DocInfo can be used by a yaml dumper to dump a class +- if connected to the root of a data structure +- if provided to the dumper? +""" + +if False: # MYPY + from typing import Optional, Tuple, Any + +# from dataclasses import dataclass, field, MISSING # NOQA + + +# @dataclass(order=True, frozen=True) +class Version: + # major: int + # minor: int + def __init__(self, major: int, minor: int) -> None: + self._major = major + self._minor = minor + + @property + def major(self) -> int: + return self._major + + @property + def minor(self) -> int: + return self._minor + + def __eq__(self, v: Any) -> bool: + if not isinstance(v, Version): + return False + return self._major == v._major and self._minor == v._minor + + def __lt__(self, v: Version) -> bool: + if self._major < v._major: + return True + if self._major > v._major: + return False + return self._minor < v._minor + + def __le__(self, v: Version) -> bool: + if self._major < v._major: + return True + if self._major > v._major: + return False + return self._minor <= v._minor + + def __gt__(self, v: Version) -> bool: + if self._major > v._major: + return True + if self._major < v._major: + return False + return self._minor > v._minor + + def __ge__(self, v: Version) -> bool: + if self._major > v._major: + return True + if self._major < v._major: + return False + return self._minor >= v._minor + + +def version( + major: int | str | Tuple[int, int] | None, + minor: Optional[int] = None, +) -> Optional[Version]: + if major is None: + assert minor is None + return None + if isinstance(major, str): + assert minor is None + parts = major.split('.') + assert len(parts) == 2 + return Version(int(parts[0]), int(parts[1])) + elif isinstance(major, tuple): + assert minor is None + assert len(major) == 2 + major, minor = major + assert minor is not None + return Version(major, minor) + + +# @dataclass(frozen=True) +class Tag: + # handle: str + # prefix: str + def __init__(self, handle: str, prefix: str) -> None: + self._handle = handle + self._prefix = prefix + + @property + def handle(self) -> str: + return self._handle + + @property + def prefix(self) -> str: + return self._prefix + + +# @dataclass +class DocInfo: + """ + Store document information, can be used for analysis of a loaded YAML document + requested_version: if explicitly set before load + doc_version: from %YAML directive + tags: from %TAG directives in scanned order + """ + # requested_version: Optional[Version] = None + # doc_version: Optional[Version] = None + # tags: list[Tag] = field(default_factory=list) + def __init__( + self, + requested_version: Optional[Version] = None, + doc_version: Optional[Version] = None, + tags: Optional[list[Tag]] = None, + ): + self.requested_version = requested_version + self.doc_version = doc_version + self.tags = [] if tags is None else tags diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/dumper.py b/python/user_packages/Python313/site-packages/ruamel/yaml/dumper.py new file mode 100644 index 0000000000000000000000000000000000000000..ece94298c52adff5852dac17c4b5f76ebcbdf59a --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/dumper.py @@ -0,0 +1,220 @@ + +from __future__ import annotations + +from ruamel.yaml.emitter import Emitter +from ruamel.yaml.serializer import Serializer +from ruamel.yaml.representer import ( + Representer, + SafeRepresenter, + BaseRepresenter, + RoundTripRepresenter, +) +from ruamel.yaml.resolver import Resolver, BaseResolver, VersionedResolver + +if False: # MYPY + from typing import Any, Dict, List, Union, Optional # NOQA + from ruamel.yaml.compat import StreamType, VersionType # NOQA + +__all__ = ['BaseDumper', 'SafeDumper', 'Dumper', 'RoundTripDumper'] + + +class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): + def __init__( + self: Any, + stream: StreamType, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + Emitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + allow_unicode=allow_unicode, + line_break=line_break, + block_seq_indent=block_seq_indent, + dumper=self, + ) + Serializer.__init__( + self, + encoding=encoding, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + dumper=self, + ) + BaseRepresenter.__init__( + self, + default_style=default_style, + default_flow_style=default_flow_style, + dumper=self, + ) + BaseResolver.__init__(self, loadumper=self) + + +class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): + def __init__( + self, + stream: StreamType, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + Emitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + allow_unicode=allow_unicode, + line_break=line_break, + block_seq_indent=block_seq_indent, + dumper=self, + ) + Serializer.__init__( + self, + encoding=encoding, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + dumper=self, + ) + SafeRepresenter.__init__( + self, + default_style=default_style, + default_flow_style=default_flow_style, + dumper=self, + ) + Resolver.__init__(self, loadumper=self) + + +class Dumper(Emitter, Serializer, Representer, Resolver): + def __init__( + self, + stream: StreamType, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + Emitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + allow_unicode=allow_unicode, + line_break=line_break, + block_seq_indent=block_seq_indent, + dumper=self, + ) + Serializer.__init__( + self, + encoding=encoding, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + dumper=self, + ) + Representer.__init__( + self, + default_style=default_style, + default_flow_style=default_flow_style, + dumper=self, + ) + Resolver.__init__(self, loadumper=self) + + +class RoundTripDumper(Emitter, Serializer, RoundTripRepresenter, VersionedResolver): + def __init__( + self, + stream: StreamType, + default_style: Any = None, + default_flow_style: Optional[bool] = None, + canonical: Optional[int] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + Emitter.__init__( + self, + stream, + canonical=canonical, + indent=indent, + width=width, + allow_unicode=allow_unicode, + line_break=line_break, + block_seq_indent=block_seq_indent, + top_level_colon_align=top_level_colon_align, + prefix_colon=prefix_colon, + dumper=self, + ) + Serializer.__init__( + self, + encoding=encoding, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + dumper=self, + ) + RoundTripRepresenter.__init__( + self, + default_style=default_style, + default_flow_style=default_flow_style, + dumper=self, + ) + VersionedResolver.__init__(self, loader=self) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/emitter.py b/python/user_packages/Python313/site-packages/ruamel/yaml/emitter.py new file mode 100644 index 0000000000000000000000000000000000000000..51c8b12e68f2b9abc01509ac121cc552f3deb55e --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/emitter.py @@ -0,0 +1,1802 @@ + +from __future__ import annotations + +# Emitter expects events obeying the following grammar: +# stream ::= STREAM-START document* STREAM-END +# document ::= DOCUMENT-START node DOCUMENT-END +# node ::= SCALAR | sequence | mapping +# sequence ::= SEQUENCE-START node* SEQUENCE-END +# mapping ::= MAPPING-START (node node)* MAPPING-END + +import sys +from ruamel.yaml.error import YAMLError, YAMLStreamError +from ruamel.yaml.events import * # NOQA + +# fmt: off +from ruamel.yaml.compat import nprint, dbg, DBG_EVENT, \ + check_anchorname_char, nprintf # NOQA +# fmt: on + + +if False: # MYPY + from typing import Any, Dict, List, Union, Text, Tuple, Optional # NOQA + from ruamel.yaml.compat import StreamType # NOQA + +__all__ = ['Emitter', 'EmitterError'] + + +class EmitterError(YAMLError): + pass + + +class ScalarAnalysis: + def __init__( + self, + scalar: Any, + empty: Any, + multiline: Any, + allow_flow_plain: bool, + allow_block_plain: bool, + allow_single_quoted: bool, + allow_double_quoted: bool, + allow_block: bool, + ) -> None: + self.scalar = scalar + self.empty = empty + self.multiline = multiline + self.allow_flow_plain = allow_flow_plain + self.allow_block_plain = allow_block_plain + self.allow_single_quoted = allow_single_quoted + self.allow_double_quoted = allow_double_quoted + self.allow_block = allow_block + + def __repr__(self) -> str: + return f'scalar={self.scalar!r}, empty={self.empty}, multiline={self.multiline}, allow_flow_plain={self.allow_flow_plain}, allow_block_plain={self.allow_block_plain}, allow_single_quoted={self.allow_single_quoted}, allow_double_quoted={self.allow_double_quoted}, allow_block={self.allow_block}' # NOQA + + +class Indents: + # replacement for the list based stack of None/int + def __init__(self) -> None: + self.values: List[Tuple[Any, bool]] = [] + + def append(self, val: Any, seq: Any) -> None: + self.values.append((val, seq)) + + def pop(self) -> Any: + return self.values.pop()[0] + + def seq_seq(self) -> bool: + try: + if self.values[-2][1] and self.values[-1][1]: + return True + except IndexError: + pass + return False + + def last_seq(self) -> bool: + # return the seq(uence) value for the element added before the last one + # in increase_indent() + try: + return self.values[-2][1] + except IndexError: + return False + + def seq_flow_align( + self, seq_indent: int, column: int, pre_comment: Optional[bool] = False, + ) -> int: + # extra spaces because of dash + # nprint('seq_flow_align', self.values, pre_comment) + if len(self.values) < 2 or not self.values[-1][1]: + if len(self.values) == 0 or not pre_comment: + return 0 + base = self.values[-1][0] if self.values[-1][0] is not None else 0 + if pre_comment: + return base + seq_indent # type: ignore + # return (len(self.values)) * seq_indent + # -1 for the dash + return base + seq_indent - column - 1 # type: ignore + + def __len__(self) -> int: + return len(self.values) + + +class Emitter: + # fmt: off + DEFAULT_TAG_PREFIXES = { + '!': '!', + 'tag:yaml.org,2002:': '!!', + '!!': '!!', + } + # fmt: on + + MAX_SIMPLE_KEY_LENGTH = 128 + flow_seq_start = '[' + flow_seq_end = ']' + flow_seq_separator = ',' + flow_map_start = '{' + flow_map_end = '}' + flow_map_separator = ',' + + def __init__( + self, + stream: StreamType, + canonical: Any = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + block_seq_indent: Optional[int] = None, + top_level_colon_align: Optional[bool] = None, + prefix_colon: Any = None, + brace_single_entry_mapping_in_flow_sequence: Optional[bool] = None, + dumper: Any = None, + ) -> None: + # NOQA + self.dumper = dumper + if self.dumper is not None and getattr(self.dumper, '_emitter', None) is None: + self.dumper._emitter = self + self.stream = stream + + # Encoding can be overriden by STREAM-START. + self.encoding: Optional[Text] = None + self.allow_space_break = None + + # Emitter is a state machine with a stack of states to handle nested + # structures. + self.states: List[Any] = [] + self.state: Any = self.expect_stream_start + + # Current event and the event queue. + self.events: List[Any] = [] + self.event: Any = None + + # The current indentation level and the stack of previous indents. + self.indents = Indents() + self.indent: Optional[int] = None + + # flow_context is an expanding/shrinking list consisting of '{' and '[' + # for each unclosed flow context. If empty list that means block context + self.flow_context: List[Text] = [] + + # Contexts. + self.root_context = False + self.sequence_context = False + self.mapping_context = False + self.simple_key_context = False + + # Characteristics of the last emitted character: + # - current position. + # - is it a whitespace? + # - is it an indention character + # (indentation space, '-', '?', or ':')? + self.line = 0 + self.column = 0 + self.whitespace = True + self.indention = True + self.compact_seq_seq = True # dash after dash + self.compact_seq_map = True # key after dash + # self.compact_ms = False # dash after key, only when excplicit key with ? + self.no_newline: Optional[bool] = None # set if directly after `- ` + + # Whether the document requires an explicit document end indicator + self.open_ended = False + + # colon handling + self.colon = ':' + self.prefixed_colon = self.colon if prefix_colon is None else prefix_colon + self.colon + # single entry mappings in flow sequence + self.brace_single_entry_mapping_in_flow_sequence = ( + brace_single_entry_mapping_in_flow_sequence # NOQA + ) + + # Formatting details. + self.canonical = canonical + self.allow_unicode = allow_unicode + # set to False to get "\Uxxxxxxxx" for non-basic unicode like emojis + self.unicode_supplementary = sys.maxunicode > 0xFFFF + self.sequence_dash_offset = block_seq_indent if block_seq_indent else 0 + self.top_level_colon_align = top_level_colon_align + self.best_sequence_indent = 2 + self.requested_indent = indent # specific for literal zero indent + if indent and 1 < indent < 10: + self.best_sequence_indent = indent + self.best_map_indent = self.best_sequence_indent + # if self.best_sequence_indent < self.sequence_dash_offset + 1: + # self.best_sequence_indent = self.sequence_dash_offset + 1 + self.best_width = 80 + if width and width > self.best_sequence_indent * 2: + self.best_width = width + self.best_line_break: Any = '\n' + if line_break in ['\r', '\n', '\r\n']: + self.best_line_break = line_break + + # Tag prefixes. + self.tag_prefixes: Any = None + + # Prepared anchor and tag. + self.prepared_anchor: Any = None + self.prepared_tag: Any = None + + # Scalar analysis and style. + self.analysis: Any = None + self.style: Any = None + + self.scalar_after_indicator = True # write a scalar on the same line as `---` + + self.alt_null = 'null' + + @property + def stream(self) -> Any: + try: + return self._stream + except AttributeError: + raise YAMLStreamError('output stream needs to be specified') + + @stream.setter + def stream(self, val: Any) -> None: + if val is None: + return + if not hasattr(val, 'write'): + raise YAMLStreamError('stream argument needs to have a write() method') + self._stream = val + + @property + def serializer(self) -> Any: + try: + if hasattr(self.dumper, 'typ'): + return self.dumper.serializer + return self.dumper._serializer + except AttributeError: + return self # cyaml + + @property + def flow_level(self) -> int: + return len(self.flow_context) + + def dispose(self) -> None: + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def emit(self, event: Any) -> None: + if dbg(DBG_EVENT): + nprint(event) + self.events.append(event) + while not self.need_more_events(): + self.event = self.events.pop(0) + self.state() + self.event = None + + # In some cases, we wait for a few next events before emitting. + + def need_more_events(self) -> bool: + if not self.events: + return True + event = self.events[0] + if isinstance(event, DocumentStartEvent): + return self.need_events(1) + elif isinstance(event, SequenceStartEvent): + return self.need_events(2) + elif isinstance(event, MappingStartEvent): + return self.need_events(3) + else: + return False + + def need_events(self, count: int) -> bool: + level = 0 + for event in self.events[1:]: + if isinstance(event, (DocumentStartEvent, CollectionStartEvent)): + level += 1 + elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)): + level -= 1 + elif isinstance(event, StreamEndEvent): + level = -1 + if level < 0: + return False + return len(self.events) < count + 1 + + def increase_indent( + self, flow: bool = False, sequence: Optional[bool] = None, indentless: bool = False, + ) -> None: + self.indents.append(self.indent, sequence) + if self.indent is None: # top level + if flow: + # self.indent = self.best_sequence_indent if self.indents.last_seq() else \ + # self.best_map_indent + # self.indent = self.best_sequence_indent + self.indent = self.requested_indent + else: + self.indent = 0 + elif not indentless: + self.indent += ( + self.best_sequence_indent if self.indents.last_seq() else self.best_map_indent + ) + # if self.indents.last_seq(): + # if self.indent == 0: # top level block sequence + # self.indent = self.best_sequence_indent - self.sequence_dash_offset + # else: + # self.indent += self.best_sequence_indent + # else: + # self.indent += self.best_map_indent + + # States. + + # Stream handlers. + + def expect_stream_start(self) -> None: + if isinstance(self.event, StreamStartEvent): + if self.event.encoding and not hasattr(self.stream, 'encoding'): + self.encoding = self.event.encoding + self.write_stream_start() + self.state = self.expect_first_document_start + else: + raise EmitterError(f'expected StreamStartEvent, but got {self.event!s}') + + def expect_nothing(self) -> None: + raise EmitterError(f'expected nothing, but got {self.event!s}') + + # Document handlers. + + def expect_first_document_start(self) -> Any: + return self.expect_document_start(first=True) + + def expect_document_start(self, first: bool = False) -> None: + if isinstance(self.event, DocumentStartEvent): + if (self.event.version or self.event.tags) and self.open_ended: + self.write_indicator('...', True) + self.write_indent() + if self.event.version: + version_text = self.prepare_version(self.event.version) + self.write_version_directive(version_text) + self.tag_prefixes = self.DEFAULT_TAG_PREFIXES.copy() + if self.event.tags: + handles = sorted(self.event.tags.keys()) + for handle in handles: + prefix = self.event.tags[handle] + self.tag_prefixes[prefix] = handle + handle_text = self.prepare_tag_handle(handle) + prefix_text = self.prepare_tag_prefix(prefix) + self.write_tag_directive(handle_text, prefix_text) + implicit = ( + first + and not self.event.explicit + and not self.canonical + and not self.event.version + and not self.event.tags + and not self.check_empty_document() + ) + if not implicit: + self.write_indent() + self.write_indicator('---', True) + if self.canonical: + self.write_indent() + self.state = self.expect_document_root + elif isinstance(self.event, StreamEndEvent): + if self.open_ended: + self.write_indicator('...', True) + self.write_indent() + self.write_stream_end() + self.state = self.expect_nothing + else: + raise EmitterError(f'expected DocumentStartEvent, but got {self.event!s}') + + def expect_document_end(self) -> None: + if isinstance(self.event, DocumentEndEvent): + self.write_indent() + if self.event.explicit: + self.write_indicator('...', True) + self.write_indent() + self.flush_stream() + self.state = self.expect_document_start + else: + raise EmitterError(f'expected DocumentEndEvent, but got {self.event!s}') + + def expect_document_root(self) -> None: + self.states.append(self.expect_document_end) + self.expect_node(root=True) + + # Node handlers. + + def expect_node( + self, + root: bool = False, + sequence: bool = False, + mapping: bool = False, + simple_key: bool = False, + ) -> None: + self.root_context = root + self.sequence_context = sequence # not used in PyYAML + force_flow_indent = False + self.mapping_context = mapping + self.simple_key_context = simple_key + if isinstance(self.event, AliasEvent): + self.expect_alias() + elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): + if ( + self.process_anchor('&') + and isinstance(self.event, ScalarEvent) + and self.sequence_context + ): + self.sequence_context = False + if ( + root + and isinstance(self.event, ScalarEvent) + and not self.scalar_after_indicator + ): + self.write_indent() + self.process_tag() + if isinstance(self.event, ScalarEvent): + # nprint('@', self.indention, self.no_newline, self.column) + self.expect_scalar() + elif isinstance(self.event, SequenceStartEvent): + i2, n2 = self.indention, self.no_newline # NOQA + if self.event.comment: + if self.event.flow_style is False: + if self.write_post_comment(self.event): + self.indention = False + self.no_newline = True + if self.event.flow_style: + column = self.column + if self.write_pre_comment(self.event): + if self.event.flow_style: + # force_flow_indent = True + force_flow_indent = not self.indents.values[-1][1] + self.indention = i2 + self.no_newline = not self.indention + if self.event.flow_style: + self.column = column + if ( + self.flow_level + or self.canonical + or self.event.flow_style + or self.check_empty_sequence() + ): + self.expect_flow_sequence(force_flow_indent) + else: + self.expect_block_sequence() + if self.indents.seq_seq(): + # - - + self.indention = True + self.no_newline = False + elif isinstance(self.event, MappingStartEvent): + if self.event.flow_style is False and self.event.comment: + self.write_post_comment(self.event) + if self.event.comment and self.event.comment[1]: + self.write_pre_comment(self.event) + if self.event.flow_style and self.indents.values: + force_flow_indent = not self.indents.values[-1][1] + if ( + self.flow_level + or self.canonical + or self.event.flow_style + or self.check_empty_mapping() + ): + self.expect_flow_mapping( + single=self.event.nr_items == 1, force_flow_indent=force_flow_indent, + ) + else: + self.expect_block_mapping() + else: + raise EmitterError(f'expected NodeEvent, but got {self.event!s}') + + def expect_alias(self) -> None: + if self.event.anchor is None: + raise EmitterError('anchor is not specified for alias') + self.process_anchor('*') + self.state = self.states.pop() + + def expect_scalar(self) -> None: + self.increase_indent(flow=True) + self.process_scalar() + self.indent = self.indents.pop() + self.state = self.states.pop() + + # Flow sequence handlers. + + def expect_flow_sequence(self, force_flow_indent: Optional[bool] = False) -> None: + if force_flow_indent: + self.increase_indent(flow=True, sequence=True) + ind = self.indents.seq_flow_align( + self.best_sequence_indent, self.column, force_flow_indent, + ) + self.write_indicator(' ' * ind + self.flow_seq_start, True, whitespace=True) + if not force_flow_indent: + self.increase_indent(flow=True, sequence=True) + self.flow_context.append('[') + self.state = self.expect_first_flow_sequence_item + + def expect_first_flow_sequence_item(self) -> None: + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + popped = self.flow_context.pop() + assert popped == '[' + self.write_indicator(self.flow_seq_end, False) + if self.event.comment and self.event.comment[0]: + # eol comment on empty flow sequence + self.write_post_comment(self.event) + elif self.flow_level == 0: + self.write_line_break() + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + def expect_flow_sequence_item(self) -> None: + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + popped = self.flow_context.pop() + assert popped == '[' + if self.canonical: + # ToDo: so-39595807, maybe add a space to the flow_seq_separator + # and strip the last space, if space then indent, else do not + # not sure that [1,2,3] is a valid YAML seq + self.write_indicator(self.flow_seq_separator, False) + self.write_indent() + self.write_indicator(self.flow_seq_end, False) + if self.event.comment and self.event.comment[0]: + # eol comment on flow sequence + self.write_post_comment(self.event) + else: + self.no_newline = False + self.state = self.states.pop() + else: + self.write_indicator(self.flow_seq_separator, False) + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + # Flow mapping handlers. + + def expect_flow_mapping( + self, single: Optional[bool] = False, force_flow_indent: Optional[bool] = False, + ) -> None: + if force_flow_indent: + self.increase_indent(flow=True, sequence=False) + ind = self.indents.seq_flow_align( + self.best_sequence_indent, self.column, force_flow_indent, + ) + map_init = self.flow_map_start + if ( + single + and self.flow_level + and self.flow_context[-1] == '[' + and not self.canonical + and not self.brace_single_entry_mapping_in_flow_sequence + ): + # single map item with flow context, no curly braces necessary + map_init = '' + self.write_indicator(' ' * ind + map_init, True, whitespace=True) + self.flow_context.append(map_init) + if not force_flow_indent: + self.increase_indent(flow=True, sequence=False) + self.state = self.expect_first_flow_mapping_key + + def expect_first_flow_mapping_key(self) -> None: + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + popped = self.flow_context.pop() + assert popped == '{' # empty flow mapping + self.write_indicator(self.flow_map_end, False) + if self.event.comment and self.event.comment[0]: + # eol comment on empty mapping + self.write_post_comment(self.event) + elif self.flow_level == 0: + self.write_line_break() + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_key(self) -> None: + if isinstance(self.event, MappingEndEvent): + # if self.event.comment and self.event.comment[1]: + # self.write_pre_comment(self.event) + self.indent = self.indents.pop() + popped = self.flow_context.pop() + assert popped in ['{', ''] + if self.canonical: + self.write_indicator(self.flow_map_separator, False) + self.write_indent() + if popped != '': + self.write_indicator(self.flow_map_end, False) + if self.event.comment and self.event.comment[0]: + # eol comment on flow mapping, never reached on empty mappings + self.write_post_comment(self.event) + else: + self.no_newline = False + self.state = self.states.pop() + else: + self.write_indicator(self.flow_map_separator, False) + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_simple_value(self) -> None: + if getattr(self.event, 'style', '?') != '-': # suppress for flow style sets + self.write_indicator(self.prefixed_colon, False) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + def expect_flow_mapping_value(self) -> None: + if self.canonical or self.column > self.best_width: + self.write_indent() + self.write_indicator(self.prefixed_colon, True) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + # Block sequence handlers. + + def expect_block_sequence(self) -> None: + if self.mapping_context: + indentless = not self.indention + else: + indentless = False + if not self.compact_seq_seq and self.column != 0: + self.write_line_break() + self.increase_indent(flow=False, sequence=True, indentless=indentless) + self.state = self.expect_first_block_sequence_item + + def expect_first_block_sequence_item(self) -> Any: + return self.expect_block_sequence_item(first=True) + + def expect_block_sequence_item(self, first: bool = False) -> None: + if not first and isinstance(self.event, SequenceEndEvent): + if self.event.comment and self.event.comment[1]: + # final comments on a block list e.g. empty line + self.write_pre_comment(self.event) + self.indent = self.indents.pop() + self.state = self.states.pop() + self.no_newline = False + else: + if self.event.comment and self.event.comment[1]: + self.write_pre_comment(self.event) + nonl = self.no_newline if self.column == 0 else False + self.write_indent() + ind = self.sequence_dash_offset # if len(self.indents) > 1 else 0 + self.write_indicator(' ' * ind + '-', True, indention=True) + if nonl or self.sequence_dash_offset + 2 > self.best_sequence_indent: + self.no_newline = True + self.states.append(self.expect_block_sequence_item) + self.expect_node(sequence=True) + + # Block mapping handlers. + + def expect_block_mapping(self) -> None: + if not self.mapping_context and not (self.compact_seq_map or self.column == 0): + self.write_line_break() + self.increase_indent(flow=False, sequence=False) + self.state = self.expect_first_block_mapping_key + + def expect_first_block_mapping_key(self) -> None: + return self.expect_block_mapping_key(first=True) + + def expect_block_mapping_key(self, first: Any = False) -> None: + if not first and isinstance(self.event, MappingEndEvent): + if self.event.comment and self.event.comment[1]: + # final comments from a doc + self.write_pre_comment(self.event) + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + if self.event.comment and self.event.comment[1]: + # final comments from a doc + self.write_pre_comment(self.event) + self.write_indent() + if self.check_simple_key(): + if not isinstance( + self.event, (SequenceStartEvent, MappingStartEvent), + ): # sequence keys + try: + if self.event.style == '?': + self.write_indicator('?', True, indention=True) + except AttributeError: # aliases have no style + pass + self.states.append(self.expect_block_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + # test on style for alias in !!set + if isinstance(self.event, AliasEvent) and not self.event.style == '?': + self.stream.write(' ') + else: + self.write_indicator('?', True, indention=True) + self.states.append(self.expect_block_mapping_value) + self.expect_node(mapping=True) + + def expect_block_mapping_simple_value(self) -> None: + if getattr(self.event, 'style', None) != '?': + # prefix = '' + if self.indent == 0 and self.top_level_colon_align is not None: + # write non-prefixed colon + c = ' ' * (self.top_level_colon_align - self.column) + self.colon + else: + c = self.prefixed_colon + self.write_indicator(c, False) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + def expect_block_mapping_value(self) -> None: + self.write_indent() + self.write_indicator(self.prefixed_colon, True, indention=True) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + # Checkers. + + def check_empty_sequence(self) -> bool: + return ( + isinstance(self.event, SequenceStartEvent) + and bool(self.events) + and isinstance(self.events[0], SequenceEndEvent) + ) + + def check_empty_mapping(self) -> bool: + return ( + isinstance(self.event, MappingStartEvent) + and bool(self.events) + and isinstance(self.events[0], MappingEndEvent) + ) + + def check_empty_document(self) -> bool: + if not isinstance(self.event, DocumentStartEvent) or not self.events: + return False + event = self.events[0] + return ( + isinstance(event, ScalarEvent) + and event.anchor is None + and event.tag is None + and event.implicit + and event.value == "" + ) + + def check_simple_key(self) -> bool: + length = 0 + if isinstance(self.event, NodeEvent) and self.event.anchor is not None: + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + length += len(self.prepared_anchor) + if ( + isinstance(self.event, (ScalarEvent, CollectionStartEvent)) + and self.event.tag is not None + ): + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(self.event.ctag) + length += len(self.prepared_tag) + if isinstance(self.event, ScalarEvent): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + length += len(self.analysis.scalar) + return length < self.MAX_SIMPLE_KEY_LENGTH and ( + isinstance(self.event, AliasEvent) + or (isinstance(self.event, SequenceStartEvent) and self.event.flow_style is True) + or (isinstance(self.event, MappingStartEvent) and self.event.flow_style is True) + or ( + isinstance(self.event, ScalarEvent) + # if there is an explicit style for an empty string, it is a simple key + and not (self.analysis.empty and self.style and self.style not in '\'"') + and not self.analysis.multiline + ) + or self.check_empty_sequence() + or self.check_empty_mapping() + ) + + # Anchor, Tag, and Scalar processors. + + def process_anchor(self, indicator: Any) -> bool: + if self.event.anchor is None: + self.prepared_anchor = None + return False + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + if self.prepared_anchor: + self.write_indicator(indicator + self.prepared_anchor, True) + # issue 288 + self.no_newline = False + self.prepared_anchor = None + return True + + def process_tag(self) -> None: + tag = self.event.tag + if isinstance(self.event, ScalarEvent): + if self.style is None: + self.style = self.choose_scalar_style() + if ( + self.event.value == '' + and self.style == "'" + and tag == 'tag:yaml.org,2002:null' + and self.alt_null is not None + ): + self.event.value = self.alt_null + self.analysis = None + self.style = self.choose_scalar_style() + if (not self.canonical or tag is None) and ( + (self.style == "" and self.event.implicit[0]) + or (self.style != "" and self.event.implicit[1]) + ): + self.prepared_tag = None + return + if self.event.implicit[0] and tag is None: + tag = '!' + self.prepared_tag = None + else: + if (not self.canonical or tag is None) and self.event.implicit: + self.prepared_tag = None + return + if tag is None: + raise EmitterError('tag is not specified') + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(self.event.ctag) + if self.prepared_tag: + self.write_indicator(self.prepared_tag, True) + if ( + self.sequence_context + and not self.flow_level + and isinstance(self.event, ScalarEvent) + ): + self.no_newline = True + self.prepared_tag = None + + def choose_scalar_style(self) -> Any: + # issue 449 needs this otherwise emits single quoted empty string + if self.event.value == '' and self.event.ctag.handle == '!!': + return None + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.event.style == '"' or self.canonical: + return '"' + if (not self.event.style or self.event.style == '?' or self.event.style == '-') and ( + self.event.implicit[0] or not self.event.implicit[2] + ): + if not ( + self.simple_key_context and (self.analysis.empty or self.analysis.multiline) + ) and ( + self.flow_level + and self.analysis.allow_flow_plain + or (not self.flow_level and self.analysis.allow_block_plain) + ): + return "" + if self.event.style == '-': + return "" + self.analysis.allow_block = True + if self.event.style and self.event.style in '|>': + if ( + not self.flow_level + and not self.simple_key_context + and self.analysis.allow_block + ): + return self.event.style + if not self.event.style and self.analysis.allow_double_quoted: + if "'" in self.event.value or '\n' in self.event.value: + return '"' + if not self.event.style or self.event.style == "'": + if self.analysis.allow_single_quoted and not ( + self.simple_key_context and self.analysis.multiline + ): + return "'" + return '"' + + def process_scalar(self) -> None: + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.style is None: + self.style = self.choose_scalar_style() + split = not self.simple_key_context + # if self.analysis.multiline and split \ + # and (not self.style or self.style in '\'\"'): + # self.write_indent() + # nprint('xx', self.sequence_context, self.flow_level) + if self.sequence_context and not self.flow_level: + self.write_indent() + if self.style == '"': + self.write_double_quoted(self.analysis.scalar, split) + elif self.style == "'": + self.write_single_quoted(self.analysis.scalar, split) + elif self.style == '>': + try: + cmx = self.event.comment[1][0] + except (IndexError, TypeError) as e: # NOQA + cmx = "" + self.write_folded(self.analysis.scalar, cmx) + if ( + self.event.comment + and self.event.comment[0] + and self.event.comment[0].column >= self.indent + ): + # comment following a folded scalar must dedent (issue 376) + self.event.comment[0].column = self.indent - 1 # type: ignore + elif self.style == '|': + # self.write_literal(self.analysis.scalar, self.event.comment) + try: + cmx = self.event.comment[1][0] + except (IndexError, TypeError): + cmx = "" + self.write_literal(self.analysis.scalar, cmx) + if ( + self.event.comment + and self.event.comment[0] + and self.event.comment[0].column >= self.indent + ): + # comment following a literal scalar must dedent (issue 376) + self.event.comment[0].column = self.indent - 1 # type: ignore + else: + self.write_plain(self.analysis.scalar, split) + self.analysis = None + self.style = None + if self.event.comment: + self.write_post_comment(self.event) + + # Analyzers. + + def prepare_version(self, version: Any) -> Any: + major, minor = version + if major != 1: + raise EmitterError(f'unsupported YAML version: {major:d}.{minor:d}') + return f'{major:d}.{minor:d}' + + def prepare_tag_handle(self, handle: Any) -> Any: + if not handle: + raise EmitterError('tag handle must not be empty') + if handle[0] != '!' or handle[-1] != '!': + raise EmitterError(f"tag handle must start and end with '!': {handle!r}") + for ch in handle[1:-1]: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' or ch in '-_'): + raise EmitterError(f'invalid character {ch!r} in the tag handle: {handle!r}') + return handle + + def prepare_tag_prefix(self, prefix: Any) -> Any: + if not prefix: + raise EmitterError('tag prefix must not be empty') + chunks: List[Any] = [] + start = end = 0 + if prefix[0] == '!': + end = 1 + ch_set = "-;/?:@&=+$,_.~*'()[]" + if self.dumper: + version = getattr(self.dumper, 'version', (1, 2)) + if version is None or version >= (1, 2): + ch_set += '#' + while end < len(prefix): + ch = prefix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' or ch in ch_set: + end += 1 + else: + if start < end: + chunks.append(prefix[start:end]) + start = end = end + 1 + data = ch + for ch in data: + chunks.append(f'%{ord(ch):02X}') + if start < end: + chunks.append(prefix[start:end]) + return "".join(chunks) + + def prepare_tag(self, tag: Any) -> Any: + if not tag: + raise EmitterError('tag must not be empty') + tag = str(tag) + if tag == '!' or tag == '!!': + return tag + handle = None + suffix = tag + prefixes = sorted(self.tag_prefixes.keys()) + for prefix in prefixes: + if tag.startswith(prefix) and (prefix == '!' or len(prefix) < len(tag)): + handle = self.tag_prefixes[prefix] + suffix = tag[len(prefix) :] + chunks: List[Any] = [] + start = end = 0 + ch_set = "-;/?:@&=+$,_.~*'()[]" + if self.dumper: + version = getattr(self.dumper, 'version', (1, 2)) + if version is None or version >= (1, 2): + ch_set += '#' + while end < len(suffix): + ch = suffix[end] + if ( + '0' <= ch <= '9' + or 'A' <= ch <= 'Z' + or 'a' <= ch <= 'z' + or ch in ch_set + or (ch == '!' and handle != '!') + ): + end += 1 + else: + if start < end: + chunks.append(suffix[start:end]) + start = end = end + 1 + data = ch + for ch in data: + chunks.append(f'%{ord(ch):02X}') + if start < end: + chunks.append(suffix[start:end]) + suffix_text = "".join(chunks) + if handle: + return f'{handle!s}{suffix_text!s}' + else: + return f'!<{suffix_text!s}>' + + def prepare_anchor(self, anchor: Any) -> Any: + if not anchor: + raise EmitterError('anchor must not be empty') + for ch in anchor: + if not check_anchorname_char(ch): + raise EmitterError(f'invalid character {ch!r} in the anchor: {anchor!r}') + return anchor + + def analyze_scalar(self, scalar: Any) -> Any: + # Empty scalar is a special case. + if not scalar: + return ScalarAnalysis( + scalar=scalar, + empty=True, + multiline=False, + allow_flow_plain=False, + allow_block_plain=True, + allow_single_quoted=True, + allow_double_quoted=True, + allow_block=False, + ) + + # Indicators and special characters. + block_indicators = False + flow_indicators = False + line_breaks = False + special_characters = False + + # Important whitespace combinations. + leading_space = False + leading_break = False + trailing_space = False + trailing_break = False + break_space = False + space_break = False + + # Check document indicators. + if scalar.startswith('---') or scalar.startswith('...'): + block_indicators = True + flow_indicators = True + + # First character or preceded by a whitespace. + preceeded_by_whitespace = True + + # Last character or followed by a whitespace. + followed_by_whitespace = len(scalar) == 1 or scalar[1] in '\0 \t\r\n\x85\u2028\u2029' + + # The previous character is a space. + previous_space = False + + # The previous character is a break. + previous_break = False + + index = 0 + while index < len(scalar): + ch = scalar[index] + + # Check for indicators. + if index == 0: + # Leading indicators are special characters. + if ch in '#,[]{}&*!|>\'"%@`': + flow_indicators = True + block_indicators = True + if ch in '?:': # ToDo + if self.serializer.use_version == (1, 1): + flow_indicators = True + elif len(scalar) == 1: # single character + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '-' and followed_by_whitespace: + flow_indicators = True + block_indicators = True + else: + # Some indicators cannot appear within a scalar as well. + if ch in ',[]{}': # http://yaml.org/spec/1.2/spec.html#id2788859 + flow_indicators = True + if ch == '?' and self.serializer.use_version == (1, 1): + flow_indicators = True + if ch == ':': + if followed_by_whitespace: + flow_indicators = True + block_indicators = True + if ch == '#' and preceeded_by_whitespace: + flow_indicators = True + block_indicators = True + + # Check for line breaks, special, and unicode characters. + if ch in '\n\x85\u2028\u2029': + line_breaks = True + if not (ch == '\n' or '\x20' <= ch <= '\x7E'): + if ( + ch == '\x85' + or '\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD' + or (self.unicode_supplementary and ('\U00010000' <= ch <= '\U0010FFFF')) + ) and ch != '\uFEFF': + # unicode_characters = True + if not self.allow_unicode: + special_characters = True + else: + special_characters = True + + # Detect important whitespace combinations. + if ch == ' ': + if index == 0: + leading_space = True + if index == len(scalar) - 1: + trailing_space = True + if previous_break: + break_space = True + previous_space = True + previous_break = False + elif ch in '\n\x85\u2028\u2029': + if index == 0: + leading_break = True + if index == len(scalar) - 1: + trailing_break = True + if previous_space: + space_break = True + previous_space = False + previous_break = True + else: + previous_space = False + previous_break = False + + # Prepare for the next character. + index += 1 + preceeded_by_whitespace = ch in '\0 \t\r\n\x85\u2028\u2029' + followed_by_whitespace = ( + index + 1 >= len(scalar) or scalar[index + 1] in '\0 \t\r\n\x85\u2028\u2029' + ) + + # Let's decide what styles are allowed. + allow_flow_plain = True + allow_block_plain = True + allow_single_quoted = True + allow_double_quoted = True + allow_block = True + + # Leading and trailing whitespaces are bad for plain scalars. + if leading_space or leading_break or trailing_space or trailing_break: + allow_flow_plain = allow_block_plain = False + + # We do not permit trailing spaces for block scalars. + if trailing_space: + allow_block = False + + # Spaces at the beginning of a new line are only acceptable for block + # scalars. + if break_space: + allow_flow_plain = allow_block_plain = allow_single_quoted = False + + # Spaces followed by breaks, as well as special character are only + # allowed for double quoted scalars. + if special_characters: + allow_flow_plain = allow_block_plain = allow_single_quoted = allow_block = False + elif space_break: + allow_flow_plain = allow_block_plain = allow_single_quoted = False + if not self.allow_space_break: + allow_block = False + + # Although the plain scalar writer supports breaks, we never emit + # multiline plain scalars. + if line_breaks: + allow_flow_plain = allow_block_plain = False + + # Flow indicators are forbidden for flow plain scalars. + if flow_indicators: + allow_flow_plain = False + + # Block indicators are forbidden for block plain scalars. + if block_indicators: + allow_block_plain = False + + return ScalarAnalysis( + scalar=scalar, + empty=False, + multiline=line_breaks, + allow_flow_plain=allow_flow_plain, + allow_block_plain=allow_block_plain, + allow_single_quoted=allow_single_quoted, + allow_double_quoted=allow_double_quoted, + allow_block=allow_block, + ) + + # Writers. + + def flush_stream(self) -> None: + if hasattr(self.stream, 'flush'): + self.stream.flush() + + def write_stream_start(self) -> None: + # Write BOM if needed. + if self.encoding and self.encoding.startswith('utf-16'): + self.stream.write('\uFEFF'.encode(self.encoding)) + + def write_stream_end(self) -> None: + self.flush_stream() + + def write_indicator( + self, + indicator: Any, + need_whitespace: Any, + whitespace: bool = False, + indention: bool = False, + ) -> None: + if self.whitespace or not need_whitespace: + data = indicator + else: + data = ' ' + indicator + self.whitespace = whitespace + self.indention = self.indention and indention + self.column += len(data) + self.open_ended = False + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + + def write_indent(self) -> None: + indent = self.indent or 0 + if ( + not self.indention + or self.column > indent + or (self.column == indent and not self.whitespace) + ): + if bool(self.no_newline): + self.no_newline = False + else: + self.write_line_break() + if self.column < indent: + self.whitespace = True + data = ' ' * (indent - self.column) + self.column = indent + if self.encoding: + data = data.encode(self.encoding) # type: ignore + self.stream.write(data) + + def write_line_break(self, data: Any = None) -> None: + if data is None: + data = self.best_line_break + self.whitespace = True + self.indention = True + self.line += 1 + self.column = 0 + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + + def write_version_directive(self, version_text: Any) -> None: + data: Any = f'%YAML {version_text!s}' + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + def write_tag_directive(self, handle_text: Any, prefix_text: Any) -> None: + data: Any = f'%TAG {handle_text!s} {prefix_text!s}' + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + # Scalar streams. + + def write_single_quoted(self, text: Any, split: Any = True) -> None: + if self.root_context: + if self.requested_indent is not None: + self.write_line_break() + if self.requested_indent != 0: + self.write_indent() + self.write_indicator("'", True) + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch is None or ch != ' ': + if ( + start + 1 == end + and self.column > self.best_width + and split + and start != 0 + and end != len(text) + ): + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029' or ch == "'": + if start < end: + data = text[start:end] + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch == "'": + data = "''" + self.column += 2 + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + start = end + 1 + if ch is not None: + spaces = ch == ' ' + breaks = ch in '\n\x85\u2028\u2029' + end += 1 + self.write_indicator("'", False) + + ESCAPE_REPLACEMENTS = { + '\0': '0', + '\x07': 'a', + '\x08': 'b', + '\x09': 't', + '\x0A': 'n', + '\x0B': 'v', + '\x0C': 'f', + '\x0D': 'r', + '\x1B': 'e', + '"': '"', + '\\': '\\', + '\x85': 'N', + '\xA0': '_', + '\u2028': 'L', + '\u2029': 'P', + } + + def write_double_quoted(self, text: Any, split: Any = True) -> None: + """ + a newline, as written by self.write_indent(), might need to be escaped with a backslash + as on reading this will produce a possibly unwanted space. + """ + if self.root_context: + if self.requested_indent is not None: + self.write_line_break() + if self.requested_indent != 0: + self.write_indent() + self.write_indicator('"', True) + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if ( + ch is None + or ch in '"\\\x85\u2028\u2029\uFEFF' + or not ( + '\x20' <= ch <= '\x7E' + or ( + self.allow_unicode + and ( + ('\xA0' <= ch <= '\uD7FF') + or ('\uE000' <= ch <= '\uFFFD') + or ('\U00010000' <= ch <= '\U0010FFFF') + ) + ) + ) + ): + if start < end: + data = text[start:end] + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + if ch in self.ESCAPE_REPLACEMENTS: + data = '\\' + self.ESCAPE_REPLACEMENTS[ch] + elif ch <= '\xFF': + data = '\\x%02X' % ord(ch) + elif ch <= '\uFFFF': + data = '\\u%04X' % ord(ch) + else: + data = '\\U%08X' % ord(ch) + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + start = end + 1 + if ( + 0 < end < len(text) - 1 + and (ch == ' ' or start >= end) + and self.column + (end - start) > self.best_width + and split + ): + # SO https://stackoverflow.com/a/75634614/1307905 + # data = text[start:end] + u'\\' # <<< replaced with following lines + need_backslash = True + if len(text) > end: + try: + space_pos = text.index(' ', end) + try: + space_pos = text.index('\n', end, space_pos) + except (ValueError, IndexError): + pass + # nprint('backslash?', space_pos, repr(text[:space_pos]), repr(text[space_pos:]), (text[space_pos] == '\n' and text[space_pos+1] == ' ')) # NOQA + if (text[space_pos] == '\n' and text[space_pos + 1] != ' '): + pass + elif ( + '"' not in text[end:space_pos] + and "'" not in text[end:space_pos] + # and text[space_pos + 1] != ' ' + and text[space_pos + 1] not in ' \n' + and text[end - 1 : end + 1] != ' ' + and start != end + ): + need_backslash = False + except (ValueError, IndexError): + pass + data = text[start:end] + ('\\' if need_backslash else '') + if start < end: + start = end + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + self.write_indent() + self.whitespace = False + self.indention = False + if text[start] == ' ': + if not need_backslash: + # remove leading space it will load from the newline + start += 1 + # data = u'\\' # <<< replaced with following line + data = '\\' if need_backslash else '' + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + end += 1 + self.write_indicator('"', False) + + def determine_block_hints(self, text: Any) -> Any: + indent = 0 + indicator = '' + hints = '' + if text: + if text[0] in ' \n\x85\u2028\u2029': + indent = 2 + hints += str(indent) + elif self.root_context: + for end in ['---', '...']: + position = -1 + pos = 0 + while position == -1: + pos = text.find(end, pos) + if pos == -1: + break + if pos != 0: + if text[pos - 1] != '\n': + pos += 1 + continue + try: + if text[pos + len(end)] in ' \r\n': + position = pos + break + except IndexError: + pass + pos += 1 + if position != -1: + break + if position != -1: + indent = 2 + if text[-1] not in '\n\x85\u2028\u2029': + indicator = '-' + elif len(text) == 1 or text[-2] in '\n\x85\u2028\u2029': + indicator = '+' + hints += indicator + return hints, indent, indicator + + def write_folded(self, text: Any, comment: Any) -> None: + hints, _indent, _indicator = self.determine_block_hints(text) + if not isinstance(comment, str): + comment = '' + self.write_indicator('>' + hints + comment, True) + if _indicator == '+': + self.open_ended = True + self.write_line_break() + leading_space = True + spaces = False + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029\a': + if ( + not leading_space + and ch is not None + and ch != ' ' + and text[start] == '\n' + ): + self.write_line_break() + leading_space = ch == ' ' + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + elif spaces: + if ch != ' ': + if start + 1 == end and self.column > self.best_width: + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029\a': + data = text[start:end] + self.column += len(data) + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + if ch == '\a': + if end < (len(text) - 1) and not text[end + 2].isspace(): + self.write_line_break() + self.write_indent() + end += 2 # \a and the space that is inserted on the fold + else: + raise EmitterError('unexcpected fold indicator \\a before space') + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = ch in '\n\x85\u2028\u2029' + spaces = ch == ' ' + end += 1 + + def write_literal(self, text: Any, comment: Any = None) -> None: + hints, _indent, _indicator = self.determine_block_hints(text) + # if comment is not None: + # try: + # hints += comment[1][0] + # except (TypeError, IndexError) as e: + # pass + if not isinstance(comment, str): + comment = '' + self.write_indicator('|' + hints + comment, True) + # try: + # nprintf('selfev', comment) + # cmx = comment[1][0] + # if cmx: + # self.stream.write(cmx) + # except (TypeError, IndexError) as e: + # pass + if _indicator == '+': + self.open_ended = True + self.write_line_break() + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + if self.root_context: + idnx = self.indent if self.indent is not None else 0 + self.stream.write(' ' * (_indent + idnx)) + else: + self.write_indent() + start = end + else: + if ch is None or ch in '\n\x85\u2028\u2029': + data = text[start:end] + if bool(self.encoding): + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = ch in '\n\x85\u2028\u2029' + end += 1 + + def write_plain(self, text: Any, split: Any = True) -> None: + if self.root_context: + if self.requested_indent is not None: + self.write_line_break() + if self.requested_indent != 0: + self.write_indent() + else: + self.open_ended = True + if not text: + return + if not self.whitespace: + data = ' ' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) # type: ignore + self.stream.write(data) + self.whitespace = False + self.indention = False + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + # ToDo: there is an empty space at the end of the wrapped line, if that line + # does not exceed self.best_width, that space is superfluous if wrapping is on + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch != ' ': + if start + 1 == end and self.column >= self.best_width and split: + self.write_indent() + self.whitespace = False + self.indention = False + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) # type: ignore + self.stream.write(data) + start = end + elif breaks: + if ch not in '\n\x85\u2028\u2029': # type: ignore + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + self.whitespace = False + self.indention = False + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + if ( + (len(data) + self.column) > self.best_width + and self.indent is not None + and self.column > self.indent + ): + # words longer than line length get a line of their own + self.write_indent() + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) # type: ignore + try: + self.stream.write(data) + except: # NOQA + sys.stdout.write(repr(data) + '\n') + raise + start = end + if ch is not None: + spaces = ch == ' ' + breaks = ch in '\n\x85\u2028\u2029' + end += 1 + + def write_comment(self, comment: Any, pre: bool = False) -> None: + value = comment.value + # nprintf(f'{self.column:02d} {comment.start_mark.column:02d} {value!r}') + if not pre and value[-1] == '\n': + value = value[:-1] + try: + # get original column position + col = comment.start_mark.column + if comment.value and comment.value.startswith('\n'): + # never inject extra spaces if the comment starts with a newline + # and not a real comment (e.g. if you have an empty line following a key-value + col = self.column + elif col < self.column + 1: + ValueError + except ValueError: + col = self.column + 1 + # nprint('post_comment', self.line, self.column, value) + try: + # at least one space if the current column >= the start column of the comment + # but not at the start of a line + nr_spaces = col - self.column + if self.column and value.strip() and nr_spaces < 1 and value[0] != '\n': + nr_spaces = 1 + value = ' ' * nr_spaces + value + try: + if bool(self.encoding): + value = value.encode(self.encoding) + except UnicodeDecodeError: + pass + self.stream.write(value) + except TypeError: + raise + if not pre: + self.write_line_break() + + def write_pre_comment(self, event: Any) -> bool: + if event.comment is None: + return False + comments = event.comment[1] + if comments is None: + return False + try: + start_events = (MappingStartEvent, SequenceStartEvent) + for comment in comments: + if isinstance(event, start_events) and getattr(comment, 'pre_done', None): + continue + if self.column != 0: + self.write_line_break() + self.write_comment(comment, pre=True) + if isinstance(event, start_events): + comment.pre_done = True + except TypeError: + sys.stdout.write(f'eventtt {type(event)} {event}') + raise + return True + + def write_post_comment(self, event: Any) -> bool: + if self.event.comment[0] is None: + return False + comment = event.comment[0] + self.write_comment(comment) + return True + + +class RoundTripEmitter(Emitter): + def prepare_tag(self, ctag: Any) -> Any: + if not ctag: + raise EmitterError('tag must not be empty') + tag = str(ctag) + if tag == '!' or tag == '!!': + return tag + handle = ctag.handle + suffix = ctag.suffix + prefixes = sorted(self.tag_prefixes.keys()) + # print('handling', repr(tag), repr(suffix), repr(handle)) + if handle is None: + for prefix in prefixes: + if tag.startswith(prefix) and (prefix == '!' or len(prefix) < len(tag)): + handle = self.tag_prefixes[prefix] + suffix = suffix[len(prefix) :] + if handle: + return f'{handle!s}{suffix!s}' + else: + return f'!<{suffix!s}>' diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/error.py b/python/user_packages/Python313/site-packages/ruamel/yaml/error.py new file mode 100644 index 0000000000000000000000000000000000000000..1f1e1f5b6b82825b3e793da47412ae3ebad9c3f1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/error.py @@ -0,0 +1,328 @@ + +from __future__ import annotations + +import warnings +# import textwrap + +if False: # MYPY + from typing import Any, Dict, Optional, List, Text # NOQA + + +__all__ = [ + 'FileMark', + 'StringMark', + 'CommentMark', + 'YAMLError', + 'MarkedYAMLError', + 'ReusedAnchorWarning', + 'UnsafeLoaderWarning', + 'MarkedYAMLWarning', + 'MarkedYAMLFutureWarning', +] + + +class StreamMark: + __slots__ = 'name', 'index', 'line', 'column' + + def __init__(self, name: Any, index: int, line: int, column: int) -> None: + self.name = name + self.index = index + self.line = line + self.column = column + + def __str__(self) -> Any: + where = f' in "{self.name!s}", line {self.line + 1:d}, column {self.column + 1:d}' + return where + + def __eq__(self, other: Any) -> bool: + if self.line != other.line or self.column != other.column: + return False + if self.name != other.name or self.index != other.index: + return False + return True + + def __ne__(self, other: Any) -> bool: + return not self.__eq__(other) + + +class FileMark(StreamMark): + __slots__ = () + + +class StringMark(StreamMark): + __slots__ = 'name', 'index', 'line', 'column', 'buffer', 'pointer' + + def __init__( + self, name: Any, index: int, line: int, column: int, buffer: Any, pointer: Any, + ) -> None: + StreamMark.__init__(self, name, index, line, column) + self.buffer = buffer + self.pointer = pointer + + def get_snippet(self, indent: int = 4, max_length: int = 75) -> Any: + if self.buffer is None: # always False + return None + head = "" + start = self.pointer + while start > 0 and self.buffer[start - 1] not in '\0\r\n\x85\u2028\u2029': + start -= 1 + if self.pointer - start > max_length / 2 - 1: + head = ' ... ' + start += 5 + break + tail = "" + end = self.pointer + while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': + end += 1 + if end - self.pointer > max_length / 2 - 1: + tail = ' ... ' + end -= 5 + break + snippet = self.buffer[start:end] + caret = '^' + caret = f'^ (line: {self.line + 1})' + return ( + ' ' * indent + + head + + snippet + + tail + + '\n' + + ' ' * (indent + self.pointer - start + len(head)) + + caret + ) + + def __str__(self) -> Any: + snippet = self.get_snippet() + where = f' in "{self.name!s}", line {self.line + 1:d}, column {self.column + 1:d}' + if snippet is not None: + where += ':\n' + snippet + return where + + def __repr__(self) -> Any: + snippet = self.get_snippet() + where = f' in "{self.name!s}", line {self.line + 1:d}, column {self.column + 1:d}' + if snippet is not None: + where += ':\n' + snippet + return where + + +class CommentMark: + __slots__ = ('column',) + + def __init__(self, column: Any) -> None: + self.column = column + + +class YAMLError(Exception): + pass + + +class MarkedYAMLError(YAMLError): + def __init__( # NOQA + self, + context: Any = None, + context_mark: Any = None, + problem: Any = None, + problem_mark: Any = None, + note: Any = None, + warn: Any = None, + ) -> None: + self.context = context + self.context_mark = context_mark + self.problem = problem + self.problem_mark = problem_mark + self.note = note + # warn is ignored + + def __str__(self) -> Any: + lines: list[str] = [] + if self.context is not None: + lines.append(self.context) + if self.context_mark is not None and ( + self.problem is None + or self.problem_mark is None + or self.context_mark.name != self.problem_mark.name + or self.context_mark.line != self.problem_mark.line + or self.context_mark.column != self.problem_mark.column + ): + lines.append(str(self.context_mark)) + if self.problem is not None: + lines.append(self.problem) + if self.problem_mark is not None: + lines.append(str(self.problem_mark)) + # if self.note is not None and self.note: + # note = textwrap.dedent(self.note) + # lines.append(note) + self.check_append(lines, self.note) + return '\n'.join(lines) + + def check_append(self, lines: list[str], val: Optional[str]) -> None: + if val is None or not val: + return + import textwrap + + note = textwrap.dedent(val) + lines.append(note) + + +class YAMLStreamError(Exception): + pass + + +class YAMLWarning(Warning): + pass + + +class MarkedYAMLWarning(YAMLWarning): + def __init__( # NOQA + self, + context: Any = None, + context_mark: Any = None, + problem: Any = None, + problem_mark: Any = None, + note: Any = None, + warn: Any = None, + ) -> None: + self.context = context + self.context_mark = context_mark + self.problem = problem + self.problem_mark = problem_mark + self.note = note + self.warn = warn + + def __str__(self) -> Any: + lines: List[str] = [] + if self.context is not None: + lines.append(self.context) + if self.context_mark is not None and ( + self.problem is None + or self.problem_mark is None + or self.context_mark.name != self.problem_mark.name + or self.context_mark.line != self.problem_mark.line + or self.context_mark.column != self.problem_mark.column + ): + lines.append(str(self.context_mark)) + if self.problem is not None: + lines.append(self.problem) + if self.problem_mark is not None: + lines.append(str(self.problem_mark)) + # if self.note is not None and self.note: + # note = textwrap.dedent(self.note) + # lines.append(note) + self.check_append(lines, self.note) + # if self.warn is not None and self.warn: + # warn = textwrap.dedent(self.warn) + # lines.append(warn) + self.check_append(lines, self.warn) + return '\n'.join(lines) + + def check_append(self, lines: list[str], val: Optional[str]) -> None: + if val is None or not val: + return + import textwrap + + note = textwrap.dedent(val) + lines.append(note) + + +class ReusedAnchorWarning(YAMLWarning): + pass + + +class UnsafeLoaderWarning(YAMLWarning): + text = """ +The default 'Loader' for 'load(stream)' without further arguments can be unsafe. +Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK. +Alternatively include the following in your code: + + import warnings + warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning) + +In most other cases you should consider using 'safe_load(stream)'""" + pass + + +warnings.simplefilter('once', UnsafeLoaderWarning) + + +class MantissaNoDotYAML1_1Warning(YAMLWarning): + def __init__(self, node: Any, flt_str: Any) -> None: # NOQA + self.node = node + self.flt = flt_str + + def __str__(self) -> Any: + line = self.node.start_mark.line + col = self.node.start_mark.column + return f""" +In YAML 1.1 floating point values should have a dot ('.') in their mantissa. +See the Floating-Point Language-Independent Type for YAML™ Version 1.1 specification +( http://yaml.org/type/float.html ). This dot is not required for JSON nor for YAML 1.2 + +Correct your float: "{self.flt}" on line: {line}, column: {col} + +or alternatively include the following in your code: + + import warnings + warnings.simplefilter('ignore', ruamel.yaml.error.MantissaNoDotYAML1_1Warning) + +""" + + +warnings.simplefilter('once', MantissaNoDotYAML1_1Warning) + + +class YAMLFutureWarning(Warning): + pass + + +class MarkedYAMLFutureWarning(YAMLFutureWarning): + def __init__( # NOQA + self, + context: Any = None, + context_mark: Any = None, + problem: Any = None, + problem_mark: Any = None, + note: Any = None, + warn: Any = None, + ) -> None: + self.context = context + self.context_mark = context_mark + self.problem = problem + self.problem_mark = problem_mark + self.note = note + self.warn = warn + + def __str__(self) -> Any: + lines: List[str] = [] + if self.context is not None: + lines.append(self.context) + + if self.context_mark is not None and ( + self.problem is None + or self.problem_mark is None + or self.context_mark.name != self.problem_mark.name + or self.context_mark.line != self.problem_mark.line + or self.context_mark.column != self.problem_mark.column + ): + lines.append(str(self.context_mark)) + if self.problem is not None: + lines.append(self.problem) + if self.problem_mark is not None: + lines.append(str(self.problem_mark)) + # if self.note is not None and self.note: + # note = textwrap.dedent(self.note) + # lines.append(note) + self.check_append(lines, self.note) + # if self.warn is not None and self.warn: + # warn = textwrap.dedent(self.warn) + # lines.append(warn) + self.check_append(lines, self.warn) + return '\n'.join(lines) + + def check_append(self, lines: list[str], val: Optional[str]) -> None: + if val is None or not val: + return + import textwrap + + note = textwrap.dedent(val) + lines.append(note) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/events.py b/python/user_packages/Python313/site-packages/ruamel/yaml/events.py new file mode 100644 index 0000000000000000000000000000000000000000..42af96cec23a823fa91b6079fb93af479ab947f1 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/events.py @@ -0,0 +1,266 @@ + +from __future__ import annotations + +# Abstract classes. + +if False: # MYPY + from typing import Any, Dict, Optional, List # NOQA +from ruamel.yaml.tag import Tag + +SHOW_LINES = False + + +def CommentCheck() -> None: + pass + + +class Event: + __slots__ = 'start_mark', 'end_mark', 'comment' + crepr = 'Unspecified Event' + + def __init__( + self, start_mark: Any = None, end_mark: Any = None, comment: Any = CommentCheck, + ) -> None: + self.start_mark = start_mark + self.end_mark = end_mark + # assert comment is not CommentCheck + if comment is CommentCheck: + comment = None + self.comment = comment + + def __repr__(self) -> Any: + if True: + arguments = [] + if hasattr(self, 'value'): + # if you use repr(getattr(self, 'value')) then flake8 complains about + # abuse of getattr with a constant. When you change to self.value + # then mypy throws an error + arguments.append(repr(self.value)) + for key in ['anchor', 'tag', 'implicit', 'flow_style', 'style']: + v = getattr(self, key, None) + if v is not None: + arguments.append(f'{key!s}={v!r}') + if self.comment not in [None, CommentCheck]: + arguments.append(f'comment={self.comment!r}') + if SHOW_LINES: + arguments.append( + f'({self.start_mark.line}:{self.start_mark.column}/' + f'{self.end_mark.line}:{self.end_mark.column})', + ) + arguments = ', '.join(arguments) # type: ignore + else: + attributes = [ + key + for key in ['anchor', 'tag', 'implicit', 'value', 'flow_style', 'style'] + if hasattr(self, key) + ] + arguments = ', '.join([f'{key!s}={getattr(self, key)!r}' for key in attributes]) + if self.comment not in [None, CommentCheck]: + arguments += f', comment={self.comment!r}' + return f'{self.__class__.__name__!s}({arguments!s})' + + def compact_repr(self) -> str: + return f'{self.crepr}' + + +class NodeEvent(Event): + __slots__ = ('anchor',) + + def __init__( + self, anchor: Any, start_mark: Any = None, end_mark: Any = None, comment: Any = None, + ) -> None: + Event.__init__(self, start_mark, end_mark, comment) + self.anchor = anchor + + +class CollectionStartEvent(NodeEvent): + __slots__ = 'ctag', 'implicit', 'flow_style', 'nr_items' + + def __init__( + self, + anchor: Any, + tag: Any, + implicit: Any, + start_mark: Any = None, + end_mark: Any = None, + flow_style: Any = None, + comment: Any = None, + nr_items: Optional[int] = None, + ) -> None: + NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) + self.ctag = tag + self.implicit = implicit + self.flow_style = flow_style + self.nr_items = nr_items + + @property + def tag(self) -> Optional[str]: + return None if self.ctag is None else str(self.ctag) + + +class CollectionEndEvent(Event): + __slots__ = () + + +# Implementations. + + +class StreamStartEvent(Event): + __slots__ = ('encoding',) + crepr = '+STR' + + def __init__( + self, + start_mark: Any = None, + end_mark: Any = None, + encoding: Any = None, + comment: Any = None, + ) -> None: + Event.__init__(self, start_mark, end_mark, comment) + self.encoding = encoding + + +class StreamEndEvent(Event): + __slots__ = () + crepr = '-STR' + + +class DocumentStartEvent(Event): + __slots__ = 'explicit', 'version', 'tags' + crepr = '+DOC' + + def __init__( + self, + start_mark: Any = None, + end_mark: Any = None, + explicit: Any = None, + version: Any = None, + tags: Any = None, + comment: Any = None, + ) -> None: + Event.__init__(self, start_mark, end_mark, comment) + self.explicit = explicit + self.version = version + self.tags = tags + + def compact_repr(self) -> str: + start = ' ---' if self.explicit else '' + return f'{self.crepr}{start}' + + +class DocumentEndEvent(Event): + __slots__ = ('explicit',) + crepr = '-DOC' + + def __init__( + self, + start_mark: Any = None, + end_mark: Any = None, + explicit: Any = None, + comment: Any = None, + ) -> None: + Event.__init__(self, start_mark, end_mark, comment) + self.explicit = explicit + + def compact_repr(self) -> str: + end = ' ...' if self.explicit else '' + return f'{self.crepr}{end}' + + +class AliasEvent(NodeEvent): + __slots__ = 'style' + crepr = '=ALI' + + def __init__( + self, + anchor: Any, + start_mark: Any = None, + end_mark: Any = None, + style: Any = None, + comment: Any = None, + ) -> None: + NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) + self.style = style + + def compact_repr(self) -> str: + return f'{self.crepr} *{self.anchor}' + + +class ScalarEvent(NodeEvent): + __slots__ = 'ctag', 'implicit', 'value', 'style' + crepr = '=VAL' + + def __init__( + self, + anchor: Any, + tag: Any, + implicit: Any, + value: Any, + start_mark: Any = None, + end_mark: Any = None, + style: Any = None, + comment: Any = None, + ) -> None: + NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) + self.ctag = tag + self.implicit = implicit + self.value = value + self.style = style + + @property + def tag(self) -> Optional[str]: + return None if self.ctag is None else str(self.ctag) + + @tag.setter + def tag(self, val: Any) -> None: + if isinstance(val, str): + val = Tag(suffix=val) + self.ctag = val + + def compact_repr(self) -> str: + style = ':' if self.style is None else self.style + anchor = f'&{self.anchor} ' if self.anchor else '' + tag = f'<{self.tag!s}> ' if self.tag else '' + value = self.value + for ch, rep in [ + ('\\', '\\\\'), + ('\t', '\\t'), + ('\n', '\\n'), + ('\a', ''), # remove from folded + ('\r', '\\r'), + ('\b', '\\b'), + ]: + value = value.replace(ch, rep) + return f'{self.crepr} {anchor}{tag}{style}{value}' + + +class SequenceStartEvent(CollectionStartEvent): + __slots__ = () + crepr = '+SEQ' + + def compact_repr(self) -> str: + flow = ' []' if self.flow_style else '' + anchor = f' &{self.anchor}' if self.anchor else '' + tag = f' <{self.tag!s}>' if self.tag else '' + return f'{self.crepr}{flow}{anchor}{tag}' + + +class SequenceEndEvent(CollectionEndEvent): + __slots__ = () + crepr = '-SEQ' + + +class MappingStartEvent(CollectionStartEvent): + __slots__ = () + crepr = '+MAP' + + def compact_repr(self) -> str: + flow = ' {}' if self.flow_style else '' + anchor = f' &{self.anchor}' if self.anchor else '' + tag = f' <{self.tag!s}>' if self.tag else '' + return f'{self.crepr}{flow}{anchor}{tag}' + + +class MappingEndEvent(CollectionEndEvent): + __slots__ = () + crepr = '-MAP' diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/loader.py b/python/user_packages/Python313/site-packages/ruamel/yaml/loader.py new file mode 100644 index 0000000000000000000000000000000000000000..84068563d41bd91400044f14ee57446b8aa2afc9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/loader.py @@ -0,0 +1,92 @@ + +from __future__ import annotations + +from ruamel.yaml.reader import Reader +from ruamel.yaml.scanner import Scanner, RoundTripScanner +from ruamel.yaml.parser import Parser, RoundTripParser +from ruamel.yaml.composer import Composer +from ruamel.yaml.constructor import ( + BaseConstructor, + SafeConstructor, + Constructor, + RoundTripConstructor, +) +from ruamel.yaml.resolver import VersionedResolver + +if False: # MYPY + from typing import Any, Dict, List, Union, Optional # NOQA + from ruamel.yaml.compat import StreamTextType, VersionType # NOQA + +__all__ = ['BaseLoader', 'SafeLoader', 'Loader', 'RoundTripLoader'] + + +class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, VersionedResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + self.comment_handling = None + Reader.__init__(self, stream, loader=self) + Scanner.__init__(self, loader=self) + Parser.__init__(self, loader=self) + Composer.__init__(self, loader=self) + BaseConstructor.__init__(self, loader=self) + VersionedResolver.__init__(self, version, loader=self) + + +class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, VersionedResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + self.comment_handling = None + Reader.__init__(self, stream, loader=self) + Scanner.__init__(self, loader=self) + Parser.__init__(self, loader=self) + Composer.__init__(self, loader=self) + SafeConstructor.__init__(self, loader=self) + VersionedResolver.__init__(self, version, loader=self) + + +class Loader(Reader, Scanner, Parser, Composer, Constructor, VersionedResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + self.comment_handling = None + Reader.__init__(self, stream, loader=self) + Scanner.__init__(self, loader=self) + Parser.__init__(self, loader=self) + Composer.__init__(self, loader=self) + Constructor.__init__(self, loader=self) + VersionedResolver.__init__(self, version, loader=self) + + +class RoundTripLoader( + Reader, + RoundTripScanner, + RoundTripParser, + Composer, + RoundTripConstructor, + VersionedResolver, +): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, + ) -> None: + # self.reader = Reader.__init__(self, stream) + self.comment_handling = None # issue 385 + Reader.__init__(self, stream, loader=self) + RoundTripScanner.__init__(self, loader=self) + RoundTripParser.__init__(self, loader=self) + Composer.__init__(self, loader=self) + RoundTripConstructor.__init__(self, preserve_quotes=preserve_quotes, loader=self) + VersionedResolver.__init__(self, version, loader=self) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/main.py b/python/user_packages/Python313/site-packages/ruamel/yaml/main.py new file mode 100644 index 0000000000000000000000000000000000000000..d67d497af62bd9f6189d7c70a10860aaefdc3a3b --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/main.py @@ -0,0 +1,1518 @@ + +from __future__ import annotations + +import sys +import os +import warnings +import glob +from importlib import import_module + + +import ruamel.yaml +from ruamel.yaml.error import UnsafeLoaderWarning, YAMLError # NOQA + +from ruamel.yaml.tokens import * # NOQA +from ruamel.yaml.events import * # NOQA +from ruamel.yaml.nodes import * # NOQA + +from ruamel.yaml.loader import BaseLoader, SafeLoader, Loader, RoundTripLoader # NOQA +from ruamel.yaml.dumper import BaseDumper, SafeDumper, Dumper, RoundTripDumper # NOQA +from ruamel.yaml.compat import StringIO, BytesIO, with_metaclass, nprint, nprintf # NOQA +from ruamel.yaml.resolver import VersionedResolver, Resolver # NOQA +from ruamel.yaml.representer import ( + BaseRepresenter, + SafeRepresenter, + Representer, + RoundTripRepresenter, +) +from ruamel.yaml.constructor import ( + BaseConstructor, + SafeConstructor, + Constructor, + RoundTripConstructor, +) +from ruamel.yaml.loader import Loader as UnsafeLoader # NOQA +from ruamel.yaml.comments import CommentedMap, CommentedSeq, C_PRE +from ruamel.yaml.docinfo import DocInfo, version, Version + +from typing import List, Set, Dict, Tuple, Union, Any, Callable, Optional, Text, Type # NOQA +if False: # MYPY + from ruamel.yaml.compat import StreamType, StreamTextType, VersionType # NOQA + from types import TracebackType + from pathlib import Path + +try: + from _ruamel_yaml import CParser, CEmitter # type: ignore +except: # NOQA + CParser = CEmitter = None + +# import io + + +# YAML is an acronym, i.e. spoken: rhymes with "camel". And thus a +# subset of abbreviations, which should be all caps according to PEP8 + + +class YAML: + def __init__( + self: Any, + *, + typ: Optional[Union[List[Text], Text]] = None, + pure: Any = False, + output: Any = None, + plug_ins: Any = None, + ) -> None: # input=None, + """ + typ: 'rt'/None -> RoundTripLoader/RoundTripDumper, (default) + 'safe' -> SafeLoader/SafeDumper, + 'unsafe' -> normal/unsafe Loader/Dumper (pending deprecation) + 'full' -> full Dumper only, including python built-ins that are + potentially unsafe to load + 'base' -> baseloader + pure: if True only use Python modules + input/output: needed to work as context manager + plug_ins: a list of plug-in files + """ + + self.typ = ['rt'] if typ is None else (typ if isinstance(typ, list) else [typ]) + self.pure = pure + + # self._input = input + self._output = output + self._context_manager: Any = None + + self.plug_ins: List[Any] = [] + for pu in ([] if plug_ins is None else plug_ins) + self.official_plug_ins(): + file_name = pu.replace(os.sep, '.') + self.plug_ins.append(import_module(file_name)) + self.Resolver: Any = ruamel.yaml.resolver.VersionedResolver + self.allow_unicode = True + self.Reader: Any = None + self.Representer: Any = None + self.Constructor: Any = None + self.Scanner: Any = None + self.Serializer: Any = None + self.default_flow_style: Any = None + self.comment_handling = None + self.max_depth = 0 + typ_found = 1 + setup_rt = False + if 'rt' in self.typ: + setup_rt = True + elif 'safe' in self.typ: + self.Emitter = ( + ruamel.yaml.emitter.Emitter if pure or CEmitter is None else CEmitter + ) + self.Representer = ruamel.yaml.representer.SafeRepresenter + self.Parser = ruamel.yaml.parser.Parser if pure or CParser is None else CParser + self.Composer = ruamel.yaml.composer.Composer + self.Constructor = ruamel.yaml.constructor.SafeConstructor + elif 'base' in self.typ: + self.Emitter = ruamel.yaml.emitter.Emitter + self.Representer = ruamel.yaml.representer.BaseRepresenter + self.Parser = ruamel.yaml.parser.Parser if pure or CParser is None else CParser + self.Composer = ruamel.yaml.composer.Composer + self.Constructor = ruamel.yaml.constructor.BaseConstructor + elif 'unsafe' in self.typ: + warnings.warn( + "\nyou should no longer specify 'unsafe'.\nFor **dumping only** use yaml=YAML(typ='full')\n", # NOQA + PendingDeprecationWarning, + stacklevel=2, + ) + self.Emitter = ( + ruamel.yaml.emitter.Emitter if pure or CEmitter is None else CEmitter + ) + self.Representer = ruamel.yaml.representer.Representer + self.Parser = ruamel.yaml.parser.Parser if pure or CParser is None else CParser + self.Composer = ruamel.yaml.composer.Composer + self.Constructor = ruamel.yaml.constructor.Constructor + elif 'full' in self.typ: + self.Emitter = ( + ruamel.yaml.emitter.Emitter if pure or CEmitter is None else CEmitter + ) + self.Representer = ruamel.yaml.representer.Representer + self.Parser = ruamel.yaml.parser.Parser if pure or CParser is None else CParser + # self.Composer = ruamel.yaml.composer.Composer + # self.Constructor = ruamel.yaml.constructor.Constructor + elif 'rtsc' in self.typ: + self.default_flow_style = False + # no optimized rt-dumper yet + self.Emitter = ruamel.yaml.emitter.RoundTripEmitter + self.Serializer = ruamel.yaml.serializer.Serializer + self.Representer = ruamel.yaml.representer.RoundTripRepresenter + self.Scanner = ruamel.yaml.scanner.RoundTripScannerSC + # no optimized rt-parser yet + self.Parser = ruamel.yaml.parser.RoundTripParserSC + self.Composer = ruamel.yaml.composer.Composer + self.Constructor = ruamel.yaml.constructor.RoundTripConstructor + self.comment_handling = C_PRE + else: + setup_rt = True + typ_found = 0 + if setup_rt: + self.default_flow_style = False + # no optimized rt-dumper yet + self.Emitter = ruamel.yaml.emitter.RoundTripEmitter + self.Serializer = ruamel.yaml.serializer.Serializer + self.Representer = ruamel.yaml.representer.RoundTripRepresenter + self.Scanner = ruamel.yaml.scanner.RoundTripScanner + # no optimized rt-parser yet + self.Parser = ruamel.yaml.parser.RoundTripParser + self.Composer = ruamel.yaml.composer.Composer + self.Constructor = ruamel.yaml.constructor.RoundTripConstructor + del setup_rt + self.stream = None + self.canonical = None + self.old_indent = None + self.width: Union[int, None] = None + self.line_break = None + + self.map_indent: Union[int, None] = None + self.sequence_indent: Union[int, None] = None + self.sequence_dash_offset: int = 0 + self.compact_seq_seq = None + self.compact_seq_map = None + self.sort_base_mapping_type_on_output = None # default: sort + + self.top_level_colon_align = None + self.prefix_colon = None + self._version: Optional[Any] = None + self.preserve_quotes: Optional[bool] = None + self.allow_duplicate_keys = False # duplicate keys in map, set + self.encoding = 'utf-8' + self.explicit_start: Union[bool, None] = None + self.explicit_end: Union[bool, None] = None + self._tags = None + self.doc_infos: List[DocInfo] = [] + self.default_style = None + self.top_level_block_style_scalar_no_indent_error_1_1 = False + # directives end indicator with single scalar document + self.scalar_after_indicator: Optional[bool] = None + # [a, b: 1, c: {d: 2}] vs. [a, {b: 1}, {c: {d: 2}}] + self.brace_single_entry_mapping_in_flow_sequence = False + for module in self.plug_ins: + if getattr(module, 'typ', None) in self.typ: + typ_found += 1 + module.init_typ(self) + break + if typ_found == 0: + raise NotImplementedError( + f'typ "{self.typ}" not recognised (need to install plug-in?)', + ) + + @property + def reader(self) -> Any: + try: + return self._reader # type: ignore + except AttributeError: + self._reader = self.Reader(None, loader=self) + return self._reader + + @property + def scanner(self) -> Any: + try: + return self._scanner # type: ignore + except AttributeError: + if self.Scanner is None: + raise + self._scanner = self.Scanner(loader=self) + return self._scanner + + @property + def parser(self) -> Any: + attr = '_' + sys._getframe().f_code.co_name + if not hasattr(self, attr): + if self.Parser is not CParser: + setattr(self, attr, self.Parser(loader=self)) + else: + if getattr(self, '_stream', None) is None: + # wait for the stream + return None + else: + # if not hasattr(self._stream, 'read') and hasattr(self._stream, 'open'): + # # pathlib.Path() instance + # setattr(self, attr, CParser(self._stream)) + # else: + setattr(self, attr, CParser(self._stream)) + # self._parser = self._composer = self + # nprint('scanner', self.loader.scanner) + + return getattr(self, attr) + + @property + def composer(self) -> Any: + attr = '_' + sys._getframe().f_code.co_name + if not hasattr(self, attr): + setattr(self, attr, self.Composer(loader=self)) + return getattr(self, attr) + + @property + def constructor(self) -> Any: + attr = '_' + sys._getframe().f_code.co_name + if not hasattr(self, attr): + if self.Constructor is None: + if 'full' in self.typ: + raise YAMLError( + "\nyou can only use yaml=YAML(typ='full') for dumping\n", # NOQA + ) + cnst = self.Constructor(preserve_quotes=self.preserve_quotes, loader=self) # type: ignore # NOQA + cnst.allow_duplicate_keys = self.allow_duplicate_keys + setattr(self, attr, cnst) + return getattr(self, attr) + + @property + def resolver(self) -> Any: + try: + rslvr = self._resolver # type: ignore + except AttributeError: + rslvr = None + if rslvr is None or rslvr._loader_version != self.version: + rslvr = self._resolver = self.Resolver(version=self.version, loader=self) + return rslvr + + @property + def emitter(self) -> Any: + attr = '_' + sys._getframe().f_code.co_name + if not hasattr(self, attr): + if self.Emitter is not CEmitter: + _emitter = self.Emitter( + None, + canonical=self.canonical, + indent=self.old_indent, + width=self.width, + allow_unicode=self.allow_unicode, + line_break=self.line_break, + prefix_colon=self.prefix_colon, + brace_single_entry_mapping_in_flow_sequence=self.brace_single_entry_mapping_in_flow_sequence, # NOQA + dumper=self, + ) + setattr(self, attr, _emitter) + if self.map_indent is not None: + _emitter.best_map_indent = self.map_indent + if self.sequence_indent is not None: + _emitter.best_sequence_indent = self.sequence_indent + if self.sequence_dash_offset is not None: + _emitter.sequence_dash_offset = self.sequence_dash_offset + # _emitter.block_seq_indent = self.sequence_dash_offset + if self.compact_seq_seq is not None: + _emitter.compact_seq_seq = self.compact_seq_seq + if self.compact_seq_map is not None: + _emitter.compact_seq_map = self.compact_seq_map + else: + if getattr(self, '_stream', None) is None: + # wait for the stream + return None + return None + return getattr(self, attr) + + @property + def serializer(self) -> Any: + attr = '_' + sys._getframe().f_code.co_name + if not hasattr(self, attr): + setattr( + self, + attr, + self.Serializer( + encoding=self.encoding, + explicit_start=self.explicit_start, + explicit_end=self.explicit_end, + version=self.version, + tags=self.tags, + dumper=self, + ), + ) + return getattr(self, attr) + + @property + def representer(self) -> Any: + attr = '_' + sys._getframe().f_code.co_name + if not hasattr(self, attr): + repres = self.Representer( + default_style=self.default_style, + default_flow_style=self.default_flow_style, + dumper=self, + ) + if self.sort_base_mapping_type_on_output is not None: + repres.sort_base_mapping_type_on_output = self.sort_base_mapping_type_on_output + setattr(self, attr, repres) + return getattr(self, attr) + + def scan(self, stream: StreamTextType) -> Any: + """ + Scan a YAML stream and produce scanning tokens. + """ + if not hasattr(stream, 'read') and hasattr(stream, 'open'): + # pathlib.Path() instance + with stream.open('rb') as fp: + return self.scan(fp) + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + self.tags = {} + _, parser = self.get_constructor_parser(stream) + try: + while self.scanner.check_token(): + yield self.scanner.get_token() + finally: + parser.dispose() + for comp in ('reader', 'scanner'): + try: + getattr(getattr(self, '_' + comp), f'reset_{comp}')() + except AttributeError: + pass + + def parse(self, stream: StreamTextType) -> Any: + """ + Parse a YAML stream and produce parsing events. + """ + if not hasattr(stream, 'read') and hasattr(stream, 'open'): + # pathlib.Path() instance + with stream.open('rb') as fp: + return self.parse(fp) + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + self.tags = {} + _, parser = self.get_constructor_parser(stream) + try: + while parser.check_event(): + yield parser.get_event() + finally: + parser.dispose() + for comp in ('reader', 'scanner'): + try: + getattr(getattr(self, '_' + comp), f'reset_{comp}')() + except AttributeError: + pass + + def compose(self, stream: Union[Path, StreamTextType]) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + if not hasattr(stream, 'read') and hasattr(stream, 'open'): + # pathlib.Path() instance + with stream.open('rb') as fp: + return self.compose(fp) + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + self.tags = {} + constructor, parser = self.get_constructor_parser(stream) + try: + return constructor.composer.get_single_node() + finally: + parser.dispose() + for comp in ('reader', 'scanner'): + try: + getattr(getattr(self, '_' + comp), f'reset_{comp}')() + except AttributeError: + pass + + def compose_all(self, stream: Union[Path, StreamTextType]) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + self.tags = {} + constructor, parser = self.get_constructor_parser(stream) + try: + while constructor.composer.check_node(): + yield constructor.composer.get_node() + finally: + parser.dispose() + for comp in ('reader', 'scanner'): + try: + getattr(getattr(self, '_' + comp), f'reset_{comp}')() + except AttributeError: + pass + + # separate output resolver? + + # def load(self, stream=None): + # if self._context_manager: + # if not self._input: + # raise TypeError("Missing input stream while dumping from context manager") + # for data in self._context_manager.load(): + # yield data + # return + # if stream is None: + # raise TypeError("Need a stream argument when not loading from context manager") + # return self.load_one(stream) + + def load(self, stream: Union[Path, StreamTextType]) -> Any: + """ + at this point you either have the non-pure Parser (which has its own reader and + scanner) or you have the pure Parser. + If the pure Parser is set, then set the Reader and Scanner, if not already set. + If either the Scanner or Reader are set, you cannot use the non-pure Parser, + so reset it to the pure parser and set the Reader resp. Scanner if necessary + """ + if not hasattr(stream, 'read') and hasattr(stream, 'open'): + # pathlib.Path() instance + with stream.open('rb') as fp: + return self.load(fp) + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + self.tags = {} + constructor, parser = self.get_constructor_parser(stream) + try: + return constructor.get_single_data() + finally: + parser.dispose() + for comp in ('reader', 'scanner'): + try: + getattr(getattr(self, '_' + comp), f'reset_{comp}')() + except AttributeError: + pass + + def load_all(self, stream: Union[Path, StreamTextType]) -> Any: # *, skip=None): + if not hasattr(stream, 'read') and hasattr(stream, 'open'): + # pathlib.Path() instance + with stream.open('r') as fp: + for d in self.load_all(fp): + yield d + return + # if skip is None: + # skip = [] + # elif isinstance(skip, int): + # skip = [skip] + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + self.tags = {} + constructor, parser = self.get_constructor_parser(stream) + try: + while constructor.check_data(): + yield constructor.get_data() + self.doc_infos.append(DocInfo(requested_version=version(self.version))) + finally: + parser.dispose() + for comp in ('reader', 'scanner'): + try: + getattr(getattr(self, '_' + comp), f'reset_{comp}')() + except AttributeError: + pass + + def get_constructor_parser(self, stream: StreamTextType) -> Any: + """ + the old cyaml needs special setup, and therefore the stream + """ + if self.Constructor is None: + if 'full' in self.typ: + raise YAMLError( + "\nyou can only use yaml=YAML(typ='full') for dumping\n", # NOQA + ) + if self.Parser is not CParser: + if self.Reader is None: + self.Reader = ruamel.yaml.reader.Reader + if self.Scanner is None: + self.Scanner = ruamel.yaml.scanner.Scanner + self.reader.stream = stream + else: + if self.Reader is not None: + if self.Scanner is None: + self.Scanner = ruamel.yaml.scanner.Scanner + self.Parser = ruamel.yaml.parser.Parser + self.reader.stream = stream + elif self.Scanner is not None: + if self.Reader is None: + self.Reader = ruamel.yaml.reader.Reader + self.Parser = ruamel.yaml.parser.Parser + self.reader.stream = stream + else: + # combined C level reader>scanner>parser + # does some calls to the resolver, e.g. BaseResolver.descend_resolver + # if you just initialise the CParser, too much of resolver.py + # is actually used + rslvr = self.Resolver + # if rslvr is ruamel.yaml.resolver.VersionedResolver: + # rslvr = ruamel.yaml.resolver.Resolver + + class XLoader(self.Parser, self.Constructor, rslvr): # type: ignore + def __init__( + selfx, + stream: StreamTextType, + version: Optional[VersionType] = self.version, + preserve_quotes: Optional[bool] = None, + ) -> None: + # NOQA + CParser.__init__(selfx, stream) + selfx._parser = selfx._composer = selfx + self.Constructor.__init__(selfx, loader=selfx) + selfx.allow_duplicate_keys = self.allow_duplicate_keys + rslvr.__init__(selfx, version=version, loadumper=selfx) + + self._stream = stream + loader = XLoader(stream) + self._scanner = loader + return loader, loader + return self.constructor, self.parser + + def emit(self, events: Any, stream: Any) -> None: + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + _, _, emitter = self.get_serializer_representer_emitter(stream, None) + try: + for event in events: + emitter.emit(event) + finally: + try: + emitter.dispose() + except AttributeError: + raise + + def serialize(self, node: Any, stream: Optional[StreamType]) -> Any: + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + self.serialize_all([node], stream) + + def serialize_all(self, nodes: Any, stream: Optional[StreamType]) -> Any: + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + serializer, _, emitter = self.get_serializer_representer_emitter(stream, None) + try: + serializer.open() + for node in nodes: + serializer.serialize(node) + serializer.close() + finally: + try: + emitter.dispose() + except AttributeError: + raise + + def dump( + self: Any, data: Union[Path, StreamType], stream: Any = None, *, transform: Any = None, + ) -> Any: + if self._context_manager: + if not self._output: + raise TypeError('Missing output stream while dumping from context manager') + if transform is not None: + x = self.__class__.__name__ + raise TypeError( + f'{x}.dump() in the context manager cannot have transform keyword', + ) + self._context_manager.dump(data) + else: # old style + if stream is None: + raise TypeError('Need a stream argument when not dumping from context manager') + return self.dump_all([data], stream, transform=transform) + + def dump_all( + self, documents: Any, stream: Union[Path, StreamType], *, transform: Any = None, + ) -> Any: + if self._context_manager: + raise NotImplementedError + self._output = stream + self._context_manager = YAMLContextManager(self, transform=transform) + for data in documents: + self._context_manager.dump(data) + self._context_manager.teardown_output() + self._output = None + self._context_manager = None + + def Xdump_all(self, documents: Any, stream: Any, *, transform: Any = None) -> Any: + """ + Serialize a sequence of Python objects into a YAML stream. + """ + if not hasattr(stream, 'write') and hasattr(stream, 'open'): + # pathlib.Path() instance + with stream.open('w') as fp: + return self.dump_all(documents, fp, transform=transform) + # The stream should have the methods `write` and possibly `flush`. + if self.top_level_colon_align is True: + tlca: Any = max([len(str(x)) for x in documents[0]]) + else: + tlca = self.top_level_colon_align + if transform is not None: + fstream = stream + if self.encoding is None: + stream = StringIO() + else: + stream = BytesIO() + serializer, representer, emitter = self.get_serializer_representer_emitter( + stream, tlca, + ) + try: + self.serializer.open() + for data in documents: + try: + self.representer.represent(data) + except AttributeError: + # nprint(dir(dumper._representer)) + raise + self.serializer.close() + finally: + try: + self.emitter.dispose() + except AttributeError: + raise + # self.dumper.dispose() # cyaml + delattr(self, '_serializer') # NOQA + delattr(self, '_emitter') # NOQA + if transform: + val = stream.getvalue() + if self.encoding: + val = val.decode(self.encoding) + if fstream is None: + transform(val) + else: + fstream.write(transform(val)) + return None + + def get_serializer_representer_emitter(self, stream: StreamType, tlca: Any) -> Any: + # we have only .Serializer to deal with (vs .Reader & .Scanner), much simpler + if self.Emitter is not CEmitter: + if self.Serializer is None: + self.Serializer = ruamel.yaml.serializer.Serializer + self.emitter.stream = stream + self.emitter.top_level_colon_align = tlca + if self.scalar_after_indicator is not None: + self.emitter.scalar_after_indicator = self.scalar_after_indicator + return self.serializer, self.representer, self.emitter + if self.Serializer is not None: + # cannot set serializer with CEmitter + self.Emitter = ruamel.yaml.emitter.Emitter + self.emitter.stream = stream + self.emitter.top_level_colon_align = tlca + if self.scalar_after_indicator is not None: + self.emitter.scalar_after_indicator = self.scalar_after_indicator + return self.serializer, self.representer, self.emitter + # C routines + + rslvr = ( + ruamel.yaml.resolver.BaseResolver + if 'base' in self.typ + else ruamel.yaml.resolver.Resolver + ) + + class XDumper(CEmitter, self.Representer, rslvr): # type: ignore + def __init__( + selfx: StreamType, + stream: Any, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, + ) -> None: + # NOQA + CEmitter.__init__( + selfx, + stream, + canonical=canonical, + indent=indent, + width=width, + encoding=encoding, + allow_unicode=allow_unicode, + line_break=line_break, + explicit_start=explicit_start, + explicit_end=explicit_end, + version=version, + tags=tags, + ) + selfx._emitter = selfx._serializer = selfx._representer = selfx + self.Representer.__init__( + selfx, default_style=default_style, default_flow_style=default_flow_style, + ) + rslvr.__init__(selfx) + + self._stream = stream + dumper = XDumper( + stream, + default_style=self.default_style, + default_flow_style=self.default_flow_style, + canonical=self.canonical, + indent=self.old_indent, + width=self.width, + allow_unicode=self.allow_unicode, + line_break=self.line_break, + encoding=self.encoding, + explicit_start=self.explicit_start, + explicit_end=self.explicit_end, + version=self.version, + tags=self.tags, + ) + self._emitter = self._serializer = dumper + return dumper, dumper, dumper + + # basic types + def map(self, **kw: Any) -> Any: + if 'rt' in self.typ: + return CommentedMap(**kw) + else: + return dict(**kw) + + def seq(self, *args: Any) -> Any: + if 'rt' in self.typ: + return CommentedSeq(*args) + else: + return list(*args) + + # helpers + def official_plug_ins(self) -> Any: + """search for list of subdirs that are plug-ins, if __file__ is not available, e.g. + single file installers that are not properly emulating a file-system (issue 324) + no plug-ins will be found. If any are packaged, you know which file that are + and you can explicitly provide it during instantiation: + yaml = ruamel.yaml.YAML(plug_ins=['ruamel/yaml/jinja2/__plug_in__']) + """ + try: + bd = os.path.dirname(__file__) + except NameError: + return [] + gpbd = os.path.dirname(os.path.dirname(bd)) + res = [x.replace(gpbd, "")[1:-3] for x in glob.glob(bd + '/*/__plug_in__.py')] + return res + + def register_class(self, cls: Any) -> Any: + """ + register a class for dumping/loading + - if it has attribute yaml_tag use that to register, else use class name + - if it has methods to_yaml/from_yaml use those to dump/load else dump attributes + as mapping + """ + tag = getattr(cls, 'yaml_tag', '!' + cls.__name__) + try: + self.representer.add_representer(cls, cls.to_yaml) + except AttributeError: + + def t_y(representer: Any, data: Any) -> Any: + return representer.represent_yaml_object( + tag, data, cls, flow_style=representer.default_flow_style, + ) + + self.representer.add_representer(cls, t_y) + try: + self.constructor.add_constructor(tag, cls.from_yaml) + except AttributeError: + + def f_y(constructor: Any, node: Any) -> Any: + return constructor.construct_yaml_object(node, cls) + + self.constructor.add_constructor(tag, f_y) + return cls + + # ### context manager + + def __enter__(self) -> Any: + self._context_manager = YAMLContextManager(self) + return self + + def __exit__( + self, + typ: Optional[Type[BaseException]], + value: Optional[BaseException], + traceback: Optional[TracebackType], + ) -> None: + if typ: + nprint('typ', typ) + self._context_manager.teardown_output() + # self._context_manager.teardown_input() + self._context_manager = None + + # ### backwards compatibility + def _indent(self, mapping: Any = None, sequence: Any = None, offset: Any = None) -> None: + if mapping is not None: + self.map_indent = mapping + if sequence is not None: + self.sequence_indent = sequence + if offset is not None: + self.sequence_dash_offset = offset + + @property + def version(self) -> Optional[Tuple[int, int]]: + return self._version + + @version.setter + def version(self, val: VersionType) -> None: + if val is None: + self._version = val + return + elif isinstance(val, str): + sval = tuple(int(x) for x in val.split('.')) + elif isinstance(val, (list, tuple)): + sval = tuple(int(x) for x in val) + elif isinstance(val, Version): + sval = (val.major, val.minor) + else: + raise TypeError(f'unknown version type {type(val)}') + assert len(sval) == 2, f'version can only have major.minor, got {val}' + assert sval[0] == 1, f'version major part can only be 1, got {val}' + assert sval[1] in [1, 2], f'version minor part can only be 2 or 1, got {val}' + self._version = sval + + @property + def tags(self) -> Any: + return self._tags + + @tags.setter + def tags(self, val: Any) -> None: + self._tags = val + + @property + def indent(self) -> Any: + return self._indent + + @indent.setter + def indent(self, val: Any) -> None: + self.old_indent = val + + @property + def block_seq_indent(self) -> Any: + return self.sequence_dash_offset + + @block_seq_indent.setter + def block_seq_indent(self, val: Any) -> None: + self.sequence_dash_offset = val + + def compact(self, seq_seq: Any = None, seq_map: Any = None) -> None: + self.compact_seq_seq = seq_seq + self.compact_seq_map = seq_map + + +class YAMLContextManager: + def __init__(self, yaml: Any, transform: Any = None) -> None: + # used to be: (Any, Optional[Callable]) -> None + self._yaml = yaml + self._output_inited = False + self._output_path = None + self._output = self._yaml._output + self._transform = transform + + # self._input_inited = False + # self._input = input + # self._input_path = None + # self._transform = yaml.transform + # self._fstream = None + + if not hasattr(self._output, 'write') and hasattr(self._output, 'open'): + # pathlib.Path() instance, open with the same mode + self._output_path = self._output + self._output = self._output_path.open('w') + + # if not hasattr(self._stream, 'write') and hasattr(stream, 'open'): + # if not hasattr(self._input, 'read') and hasattr(self._input, 'open'): + # # pathlib.Path() instance, open with the same mode + # self._input_path = self._input + # self._input = self._input_path.open('r') + + if self._transform is not None: + self._fstream = self._output + if self._yaml.encoding is None: + self._output = StringIO() + else: + self._output = BytesIO() + + def teardown_output(self) -> None: + if self._output_inited: + self._yaml.serializer.close() + else: + return + try: + self._yaml.emitter.dispose() + except AttributeError: + raise + # self.dumper.dispose() # cyaml + try: + delattr(self._yaml, '_serializer') # NOQA + delattr(self._yaml, '_emitter') # NOQA + except AttributeError: + raise + if self._transform: + val = self._output.getvalue() + if self._yaml.encoding: + val = val.decode(self._yaml.encoding) + if self._fstream is None: + self._transform(val) + else: + self._fstream.write(self._transform(val)) + self._fstream.flush() + self._output = self._fstream # maybe not necessary + if self._output_path is not None: + self._output.close() + + def init_output(self, first_data: Any) -> None: + if self._yaml.top_level_colon_align is True: + tlca: Any = max([len(str(x)) for x in first_data]) + else: + tlca = self._yaml.top_level_colon_align + self._yaml.get_serializer_representer_emitter(self._output, tlca) + self._yaml.serializer.open() + self._output_inited = True + + def dump(self, data: Any) -> None: + if not self._output_inited: + self.init_output(data) + try: + self._yaml.representer.represent(data) + except AttributeError: + # nprint(dir(dumper._representer)) + raise + + # def teardown_input(self): + # pass + # + # def init_input(self): + # # set the constructor and parser on YAML() instance + # self._yaml.get_constructor_parser(stream) + # + # def load(self): + # if not self._input_inited: + # self.init_input() + # try: + # while self._yaml.constructor.check_data(): + # yield self._yaml.constructor.get_data() + # finally: + # parser.dispose() + # try: + # self._reader.reset_reader() # type: ignore + # except AttributeError: + # pass + # try: + # self._scanner.reset_scanner() # type: ignore + # except AttributeError: + # pass + + +def yaml_object(yml: Any) -> Any: + """ decorator for classes that needs to dump/load objects + The tag for such objects is taken from the class attribute yaml_tag (or the + class name in lowercase in case unavailable) + If methods to_yaml and/or from_yaml are available, these are called for dumping resp. + loading, default routines (dumping a mapping of the attributes) used otherwise. + """ + + def yo_deco(cls: Any) -> Any: + tag = getattr(cls, 'yaml_tag', '!' + cls.__name__) + try: + yml.representer.add_representer(cls, cls.to_yaml) + except AttributeError: + + def t_y(representer: Any, data: Any) -> Any: + return representer.represent_yaml_object( + tag, data, cls, flow_style=representer.default_flow_style, + ) + + yml.representer.add_representer(cls, t_y) + try: + yml.constructor.add_constructor(tag, cls.from_yaml) + except AttributeError: + + def f_y(constructor: Any, node: Any) -> Any: + return constructor.construct_yaml_object(node, cls) + + yml.constructor.add_constructor(tag, f_y) + return cls + + return yo_deco + + +######################################################################################## +def warn_deprecation(fun: Any, method: Any, arg: str = '') -> None: + warnings.warn( + f'\n{fun} will be removed, use\n\n yaml=YAML({arg})\n yaml.{method}(...)\n\ninstead', # NOQA + PendingDeprecationWarning, # this will show when testing with pytest/tox + stacklevel=3, + ) + + +def error_deprecation(fun: Any, method: Any, arg: str = '', comment: str = 'instead of') -> None: # NOQA + import inspect + + s = f'\n"{fun}()" has been removed, use\n\n yaml = YAML({arg})\n yaml.{method}(...)\n\n{comment}' # NOQA + try: + info = inspect.getframeinfo(inspect.stack()[2][0]) + context = '' if info.code_context is None else "".join(info.code_context) + s += f' file "{info.filename}", line {info.lineno}\n\n{context}' + except Exception as e: + _ = e + s += '\n' + if sys.version_info < (3, 10): + raise AttributeError(s) + else: + raise AttributeError(s, name=None) + + +_error_dep_arg = "typ='rt'" +_error_dep_comment = "and register any classes that you use, or check the tag attribute on the loaded data,\ninstead of" # NOQA + +######################################################################################## + + +def scan(stream: StreamTextType, Loader: Any = Loader) -> Any: + """ + Scan a YAML stream and produce scanning tokens. + """ + error_deprecation('scan', 'scan', arg=_error_dep_arg, comment=_error_dep_comment) + + +def parse(stream: StreamTextType, Loader: Any = Loader) -> Any: + """ + Parse a YAML stream and produce parsing events. + """ + error_deprecation('parse', 'parse', arg=_error_dep_arg, comment=_error_dep_comment) + + +def compose(stream: StreamTextType, Loader: Any = Loader) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + error_deprecation('compose', 'compose', arg=_error_dep_arg, comment=_error_dep_comment) + + +def compose_all(stream: StreamTextType, Loader: Any = Loader) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + error_deprecation('compose', 'compose', arg=_error_dep_arg, comment=_error_dep_comment) + + +def load( + stream: Any, Loader: Any = None, version: Any = None, preserve_quotes: Any = None, +) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + """ + error_deprecation('load', 'load', arg=_error_dep_arg, comment=_error_dep_comment) + + +def load_all( + stream: Any, Loader: Any = None, version: Any = None, preserve_quotes: Any = None, +) -> Any: + # NOQA + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + """ + error_deprecation('load_all', 'load_all', arg=_error_dep_arg, comment=_error_dep_comment) + + +def safe_load(stream: StreamTextType, version: Optional[VersionType] = None) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + Resolve only basic YAML tags. + """ + error_deprecation('safe_load', 'load', arg="typ='safe', pure=True") + + +def safe_load_all(stream: StreamTextType, version: Optional[VersionType] = None) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + Resolve only basic YAML tags. + """ + error_deprecation('safe_load_all', 'load_all', arg="typ='safe', pure=True") + + +def round_trip_load( + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, +) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + Resolve only basic YAML tags. + """ + error_deprecation('round_trip_load_all', 'load') + + +def round_trip_load_all( + stream: StreamTextType, + version: Optional[VersionType] = None, + preserve_quotes: Optional[bool] = None, +) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + Resolve only basic YAML tags. + """ + error_deprecation('round_trip_load_all', 'load_all') + + +def emit( + events: Any, + stream: Optional[StreamType] = None, + Dumper: Any = Dumper, + canonical: Optional[bool] = None, + indent: Union[int, None] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, +) -> Any: + # NOQA + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + error_deprecation('emit', 'emit', arg="typ='safe', pure=True") + + +enc = None + + +def serialize_all( + nodes: Any, + stream: Optional[StreamType] = None, + Dumper: Any = Dumper, + canonical: Any = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = enc, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Optional[VersionType] = None, + tags: Any = None, +) -> Any: + # NOQA + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + error_deprecation('serialize_all', 'serialize_all', arg="typ='safe', pure=True") + + +def serialize( + node: Any, stream: Optional[StreamType] = None, Dumper: Any = Dumper, **kwds: Any, +) -> Any: + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + error_deprecation('serialize', 'serialize', arg="typ='safe', pure=True") + + +def dump_all( + documents: Any, + stream: Optional[StreamType] = None, + Dumper: Any = Dumper, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = enc, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Any = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, +) -> Any: + # NOQA + """ + Serialize a sequence of Python objects into a YAML stream. + If stream is None, return the produced string instead. + """ + error_deprecation('dump_all', 'dump_all', arg="typ='unsafe', pure=True") + + +def dump( + data: Any, + stream: Optional[StreamType] = None, + Dumper: Any = Dumper, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = enc, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Optional[VersionType] = None, + tags: Any = None, + block_seq_indent: Any = None, +) -> Any: + # NOQA + """ + Serialize a Python object into a YAML stream. + If stream is None, return the produced string instead. + + default_style ∈ None, '', '"', "'", '|', '>' + + """ + error_deprecation('dump', 'dump', arg="typ='unsafe', pure=True") + + +def safe_dump(data: Any, stream: Optional[StreamType] = None, **kwds: Any) -> Any: + """ + Serialize a Python object into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + error_deprecation('safe_dump', 'dump', arg="typ='safe', pure=True") + + +def round_trip_dump( + data: Any, + stream: Optional[StreamType] = None, + Dumper: Any = RoundTripDumper, + default_style: Any = None, + default_flow_style: Any = None, + canonical: Optional[bool] = None, + indent: Optional[int] = None, + width: Optional[int] = None, + allow_unicode: Optional[bool] = None, + line_break: Any = None, + encoding: Any = enc, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Optional[VersionType] = None, + tags: Any = None, + block_seq_indent: Any = None, + top_level_colon_align: Any = None, + prefix_colon: Any = None, +) -> Any: + allow_unicode = True if allow_unicode is None else allow_unicode + error_deprecation('round_trip_dump', 'dump') + + +# Loader/Dumper are no longer composites, to get to the associated +# Resolver()/Representer(), etc., you need to instantiate the class + + +def add_implicit_resolver( + tag: Any, + regexp: Any, + first: Any = None, + Loader: Any = None, + Dumper: Any = None, + resolver: Any = Resolver, +) -> None: + """ + Add an implicit scalar detector. + If an implicit scalar value matches the given regexp, + the corresponding tag is assigned to the scalar. + first is a sequence of possible initial characters or None. + """ + if Loader is None and Dumper is None: + resolver.add_implicit_resolver(tag, regexp, first) + return + if Loader: + if hasattr(Loader, 'add_implicit_resolver'): + Loader.add_implicit_resolver(tag, regexp, first) + elif issubclass( + Loader, (BaseLoader, SafeLoader, ruamel.yaml.loader.Loader, RoundTripLoader), + ): + Resolver.add_implicit_resolver(tag, regexp, first) + else: + raise NotImplementedError + if Dumper: + if hasattr(Dumper, 'add_implicit_resolver'): + Dumper.add_implicit_resolver(tag, regexp, first) + elif issubclass( + Dumper, (BaseDumper, SafeDumper, ruamel.yaml.dumper.Dumper, RoundTripDumper), + ): + Resolver.add_implicit_resolver(tag, regexp, first) + else: + raise NotImplementedError + + +# this code currently not tested +def add_path_resolver( + tag: Any, + path: Any, + kind: Any = None, + Loader: Any = None, + Dumper: Any = None, + resolver: Any = Resolver, +) -> None: + """ + Add a path based resolver for the given tag. + A path is a list of keys that forms a path + to a node in the representation tree. + Keys can be string values, integers, or None. + """ + if Loader is None and Dumper is None: + resolver.add_path_resolver(tag, path, kind) + return + if Loader: + if hasattr(Loader, 'add_path_resolver'): + Loader.add_path_resolver(tag, path, kind) + elif issubclass( + Loader, (BaseLoader, SafeLoader, ruamel.yaml.loader.Loader, RoundTripLoader), + ): + Resolver.add_path_resolver(tag, path, kind) + else: + raise NotImplementedError + if Dumper: + if hasattr(Dumper, 'add_path_resolver'): + Dumper.add_path_resolver(tag, path, kind) + elif issubclass( + Dumper, (BaseDumper, SafeDumper, ruamel.yaml.dumper.Dumper, RoundTripDumper), + ): + Resolver.add_path_resolver(tag, path, kind) + else: + raise NotImplementedError + + +def add_constructor( + tag: Any, object_constructor: Any, Loader: Any = None, constructor: Any = Constructor, +) -> None: + """ + Add an object constructor for the given tag. + object_onstructor is a function that accepts a Loader instance + and a node object and produces the corresponding Python object. + """ + if Loader is None: + constructor.add_constructor(tag, object_constructor) + else: + if hasattr(Loader, 'add_constructor'): + Loader.add_constructor(tag, object_constructor) + return + if issubclass(Loader, BaseLoader): + BaseConstructor.add_constructor(tag, object_constructor) + elif issubclass(Loader, SafeLoader): + SafeConstructor.add_constructor(tag, object_constructor) + elif issubclass(Loader, Loader): + Constructor.add_constructor(tag, object_constructor) + elif issubclass(Loader, RoundTripLoader): + RoundTripConstructor.add_constructor(tag, object_constructor) + else: + raise NotImplementedError + + +def add_multi_constructor( + tag_prefix: Any, multi_constructor: Any, Loader: Any = None, constructor: Any = Constructor, # NOQA +) -> None: + """ + Add a multi-constructor for the given tag prefix. + Multi-constructor is called for a node if its tag starts with tag_prefix. + Multi-constructor accepts a Loader instance, a tag suffix, + and a node object and produces the corresponding Python object. + """ + if Loader is None: + constructor.add_multi_constructor(tag_prefix, multi_constructor) + else: + if False and hasattr(Loader, 'add_multi_constructor'): + Loader.add_multi_constructor(tag_prefix, constructor) + return + if issubclass(Loader, BaseLoader): + BaseConstructor.add_multi_constructor(tag_prefix, multi_constructor) + elif issubclass(Loader, SafeLoader): + SafeConstructor.add_multi_constructor(tag_prefix, multi_constructor) + elif issubclass(Loader, ruamel.yaml.loader.Loader): + Constructor.add_multi_constructor(tag_prefix, multi_constructor) + elif issubclass(Loader, RoundTripLoader): + RoundTripConstructor.add_multi_constructor(tag_prefix, multi_constructor) + else: + raise NotImplementedError + + +def add_representer( + data_type: Any, object_representer: Any, Dumper: Any = None, representer: Any = Representer, # NOQA +) -> None: + """ + Add a representer for the given type. + object_representer is a function accepting a Dumper instance + and an instance of the given data type + and producing the corresponding representation node. + """ + if Dumper is None: + representer.add_representer(data_type, object_representer) + else: + if hasattr(Dumper, 'add_representer'): + Dumper.add_representer(data_type, object_representer) + return + if issubclass(Dumper, BaseDumper): + BaseRepresenter.add_representer(data_type, object_representer) + elif issubclass(Dumper, SafeDumper): + SafeRepresenter.add_representer(data_type, object_representer) + elif issubclass(Dumper, Dumper): + Representer.add_representer(data_type, object_representer) + elif issubclass(Dumper, RoundTripDumper): + RoundTripRepresenter.add_representer(data_type, object_representer) + else: + raise NotImplementedError + + +# this code currently not tested +def add_multi_representer( + data_type: Any, multi_representer: Any, Dumper: Any = None, representer: Any = Representer, +) -> None: + """ + Add a representer for the given type. + multi_representer is a function accepting a Dumper instance + and an instance of the given data type or subtype + and producing the corresponding representation node. + """ + if Dumper is None: + representer.add_multi_representer(data_type, multi_representer) + else: + if hasattr(Dumper, 'add_multi_representer'): + Dumper.add_multi_representer(data_type, multi_representer) + return + if issubclass(Dumper, BaseDumper): + BaseRepresenter.add_multi_representer(data_type, multi_representer) + elif issubclass(Dumper, SafeDumper): + SafeRepresenter.add_multi_representer(data_type, multi_representer) + elif issubclass(Dumper, Dumper): + Representer.add_multi_representer(data_type, multi_representer) + elif issubclass(Dumper, RoundTripDumper): + RoundTripRepresenter.add_multi_representer(data_type, multi_representer) + else: + raise NotImplementedError + + +class YAMLObjectMetaclass(type): + """ + The metaclass for YAMLObject. + """ + + def __init__(cls, name: Any, bases: Any, kwds: Any) -> None: + super().__init__(name, bases, kwds) + if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: + cls.yaml_constructor.add_constructor(cls.yaml_tag, cls.from_yaml) # type: ignore + cls.yaml_representer.add_representer(cls, cls.to_yaml) # type: ignore + + +class YAMLObject(with_metaclass(YAMLObjectMetaclass)): # type: ignore + """ + An object that can dump itself to a YAML stream + and load itself from a YAML stream. + """ + + __slots__ = () # no direct instantiation, so allow immutable subclasses + + yaml_constructor = Constructor + yaml_representer = Representer + + yaml_tag: Any = None + yaml_flow_style: Any = None + + @classmethod + def from_yaml(cls, constructor: Any, node: Any) -> Any: + """ + Convert a representation node to a Python object. + """ + return constructor.construct_yaml_object(node, cls) + + @classmethod + def to_yaml(cls, representer: Any, data: Any) -> Any: + """ + Convert a Python object to a representation node. + """ + return representer.represent_yaml_object( + cls.yaml_tag, data, cls, flow_style=cls.yaml_flow_style, + ) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/mergevalue.py b/python/user_packages/Python313/site-packages/ruamel/yaml/mergevalue.py new file mode 100644 index 0000000000000000000000000000000000000000..742d9dab23a8b027ef220248b05130d1b7eab3b7 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/mergevalue.py @@ -0,0 +1,39 @@ + +from __future__ import annotations + +if False: # MYPY + from typing import Any, Dict, List, Union, Optional, Iterator # NOQA + + +merge_attrib = '_yaml_merge' + + +class MergeValue: + attrib = merge_attrib + + def __init__(self) -> None: + self.value: List[Any] = [] + self.sequence = None + self.merge_pos: Optional[int] = None # position of merge in the mapping + + def __getitem__(self, index: Any) -> Any: + return self.value[index] + + def __setitem__(self, index: Any, val: Any) -> None: + self.value[index] = val + + def __repr__(self) -> Any: + return f'MergeValue({self.value!r})' + + def __len__(self) -> Any: + return len(self.value) + + def append(self, elem: Any) -> Any: + self.value.append(elem) + + def extend(self, elements: Any) -> None: + self.value.extend(elements) + + def set_sequence(self, seq: Any) -> None: + # print('mergevalue.set_sequence node', node.anchor) + self.sequence = seq diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/nodes.py b/python/user_packages/Python313/site-packages/ruamel/yaml/nodes.py new file mode 100644 index 0000000000000000000000000000000000000000..37f2bb7da87585181e6f0610f434b3093069fac8 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/nodes.py @@ -0,0 +1,149 @@ + +from __future__ import annotations + +import sys + +if False: # MYPY + from typing import Dict, Any, Text, Optional # NOQA +from ruamel.yaml.tag import Tag + + +class Node: + __slots__ = 'ctag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor' + + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any, + end_mark: Any, + comment: Any = None, + anchor: Any = None, + ) -> None: + # you can still get a string from the serializer + self.ctag = tag if isinstance(tag, Tag) else Tag(suffix=tag) + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.comment = comment + self.anchor = anchor + + @property + def tag(self) -> Optional[str]: + return None if self.ctag is None else str(self.ctag) + + @tag.setter + def tag(self, val: Any) -> None: + if isinstance(val, str): + val = Tag(suffix=val) + self.ctag = val + + def __repr__(self) -> Any: + value = self.value + # if isinstance(value, list): + # if len(value) == 0: + # value = '' + # elif len(value) == 1: + # value = '<1 item>' + # else: + # value = f'<{len(value)} items>' + # else: + # if len(value) > 75: + # value = repr(value[:70]+' ... ') + # else: + # value = repr(value) + value = repr(value) + if self.anchor is not None: + return f'{self.__class__.__name__!s}(tag={self.tag!r}, anchor={self.anchor!r}, value={value!s})' # NOQA + return f'{self.__class__.__name__!s}(tag={self.tag!r}, value={value!s})' + + def dump(self, indent: int = 0) -> None: + xx = self.__class__.__name__ + xi = ' ' * indent + if isinstance(self.value, str): + sys.stdout.write(f'{xi}{xx}(tag={self.tag!r}, value={self.value!r})\n') + if self.comment: + sys.stdout.write(f' {xi}comment: {self.comment})\n') + return + sys.stdout.write(f'{xi}{xx}(tag={self.tag!r})\n') + if self.comment: + sys.stdout.write(f' {xi}comment: {self.comment})\n') + for v in self.value: + if isinstance(v, tuple): + for v1 in v: + v1.dump(indent + 1) + elif isinstance(v, Node): + v.dump(indent + 1) + else: + sys.stdout.write(f'Node value type? {type(v)}\n') + + +class ScalarNode(Node): + """ + styles: + ? -> set() ? key, no value + - -> suppressable null value in set + " -> double quoted + ' -> single quoted + | -> literal style + > -> folding style + """ + + __slots__ = ('style',) + id = 'scalar' + + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any = None, + end_mark: Any = None, + style: Any = None, + comment: Any = None, + anchor: Any = None, + ) -> None: + Node.__init__(self, tag, value, start_mark, end_mark, comment=comment, anchor=anchor) + self.style = style + + +class CollectionNode(Node): + __slots__ = ('flow_style',) + + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any = None, + end_mark: Any = None, + flow_style: Any = None, + comment: Any = None, + anchor: Any = None, + ) -> None: + Node.__init__(self, tag, value, start_mark, end_mark, comment=comment) + self.flow_style = flow_style + self.anchor = anchor + + +class SequenceNode(CollectionNode): + __slots__ = () + id = 'sequence' + + +class MappingNode(CollectionNode): + __slots__ = ('merge',) + id = 'mapping' + + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any = None, + end_mark: Any = None, + flow_style: Any = None, + comment: Any = None, + anchor: Any = None, + ) -> None: + CollectionNode.__init__( + self, tag, value, start_mark, end_mark, flow_style, comment, anchor, + ) + self.merge = None diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/parser.py b/python/user_packages/Python313/site-packages/ruamel/yaml/parser.py new file mode 100644 index 0000000000000000000000000000000000000000..02c03e0669ef456d3fff27756795dd0043267f44 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/parser.py @@ -0,0 +1,862 @@ + +from __future__ import annotations + +# The following YAML grammar is LL(1) and is parsed by a recursive descent +# parser. +# +# stream ::= STREAM-START implicit_document? explicit_document* +# STREAM-END +# implicit_document ::= block_node DOCUMENT-END* +# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +# block_node_or_indentless_sequence ::= +# ALIAS +# | properties (block_content | +# indentless_block_sequence)? +# | block_content +# | indentless_block_sequence +# block_node ::= ALIAS +# | properties block_content? +# | block_content +# flow_node ::= ALIAS +# | properties flow_content? +# | flow_content +# properties ::= TAG ANCHOR? | ANCHOR TAG? +# block_content ::= block_collection | flow_collection | SCALAR +# flow_content ::= flow_collection | SCALAR +# block_collection ::= block_sequence | block_mapping +# flow_collection ::= flow_sequence | flow_mapping +# block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* +# BLOCK-END +# indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +# block_mapping ::= BLOCK-MAPPING_START +# ((KEY block_node_or_indentless_sequence?)? +# (VALUE block_node_or_indentless_sequence?)?)* +# BLOCK-END +# flow_sequence ::= FLOW-SEQUENCE-START +# (flow_sequence_entry FLOW-ENTRY)* +# flow_sequence_entry? +# FLOW-SEQUENCE-END +# flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# flow_mapping ::= FLOW-MAPPING-START +# (flow_mapping_entry FLOW-ENTRY)* +# flow_mapping_entry? +# FLOW-MAPPING-END +# flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# +# FIRST sets: +# +# stream: { STREAM-START <} +# explicit_document: { DIRECTIVE DOCUMENT-START } +# implicit_document: FIRST(block_node) +# block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START +# BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START +# FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_sequence: { BLOCK-SEQUENCE-START } +# block_mapping: { BLOCK-MAPPING-START } +# block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR +# BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START +# FLOW-MAPPING-START BLOCK-ENTRY } +# indentless_sequence: { ENTRY } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_sequence: { FLOW-SEQUENCE-START } +# flow_mapping: { FLOW-MAPPING-START } +# flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START +# FLOW-MAPPING-START KEY } +# flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START +# FLOW-MAPPING-START KEY } + +# need to have full path with import, as pkg_resources tries to load parser.py in __init__.py +# only to not do anything with the package afterwards +# and for Jython too + + +from ruamel.yaml.error import MarkedYAMLError +from ruamel.yaml.tokens import * # NOQA +from ruamel.yaml.events import * # NOQA +from ruamel.yaml.scanner import Scanner, RoundTripScanner, ScannerError # NOQA +from ruamel.yaml.scanner import BlankLineComment +from ruamel.yaml.comments import C_PRE, C_POST, C_SPLIT_ON_FIRST_BLANK +from ruamel.yaml.compat import nprint, nprintf # NOQA +from ruamel.yaml.tag import Tag + +if False: # MYPY + from typing import Any, Dict, Optional, List, Optional # NOQA + +__all__ = ['Parser', 'RoundTripParser', 'ParserError'] + + +def xprintf(*args: Any, **kw: Any) -> Any: + return nprintf(*args, **kw) + pass + + +class ParserError(MarkedYAMLError): + pass + + +class Parser: + # Since writing a recursive-descendant parser is a straightforward task, we + # do not give many comments here. + + DEFAULT_TAGS = {'!': '!', '!!': 'tag:yaml.org,2002:'} + + def __init__(self, loader: Any) -> None: + self.loader = loader + if self.loader is not None and getattr(self.loader, '_parser', None) is None: + self.loader._parser = self + self.reset_parser() + + def reset_parser(self) -> None: + # Reset the state attributes (to clear self-references) + self.current_event = self.last_event = None + self.tag_handles: Dict[Any, Any] = {} + self.states: List[Any] = [] + self.marks: List[Any] = [] + self.state: Any = self.parse_stream_start + + def dispose(self) -> None: + self.reset_parser() + + @property + def scanner(self) -> Any: + if hasattr(self.loader, 'typ'): + return self.loader.scanner + return self.loader._scanner + + @property + def resolver(self) -> Any: + if hasattr(self.loader, 'typ'): + return self.loader.resolver + return self.loader._resolver + + def check_event(self, *choices: Any) -> bool: + # Check the type of the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + if self.current_event is not None: + if not choices: + return True + for choice in choices: + if isinstance(self.current_event, choice): + return True + return False + + def peek_event(self) -> Any: + # Get the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + return self.current_event + + def get_event(self) -> Any: + # Get the next event and proceed further. + if self.current_event is None: + if self.state: + self.current_event = self.state() + # assert self.current_event is not None + # if self.current_event.end_mark.line != self.peek_event().start_mark.line: + # xprintf('get_event', repr(self.current_event), self.peek_event().start_mark.line) + self.last_event = value = self.current_event + self.current_event = None + return value + + # stream ::= STREAM-START implicit_document? explicit_document* + # STREAM-END + # implicit_document ::= block_node DOCUMENT-END* + # explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + + def parse_stream_start(self) -> Any: + # Parse the stream start. + token = self.scanner.get_token() + self.move_token_comment(token) + event = StreamStartEvent(token.start_mark, token.end_mark, encoding=token.encoding) + + # Prepare the next state. + self.state = self.parse_implicit_document_start + + return event + + def parse_implicit_document_start(self) -> Any: + # Parse an implicit document. + if not self.scanner.check_token(DirectiveToken, DocumentStartToken, StreamEndToken): + # don't need copy, as an implicit tag doesn't add tag_handles + self.tag_handles = self.DEFAULT_TAGS + token = self.scanner.peek_token() + start_mark = end_mark = token.start_mark + event = DocumentStartEvent(start_mark, end_mark, explicit=False) + + # Prepare the next state. + self.states.append(self.parse_document_end) + self.state = self.parse_block_node + + return event + + else: + return self.parse_document_start() + + def parse_document_start(self) -> Any: + # Parse any extra document end indicators. + while self.scanner.check_token(DocumentEndToken): + self.scanner.get_token() + # Parse an explicit document. + if not self.scanner.check_token(StreamEndToken): + version, tags = self.process_directives() + if not self.scanner.check_token(DocumentStartToken): + raise ParserError( + None, + None, + "expected '', " + f'but found {self.scanner.peek_token().id,!r}', + self.scanner.peek_token().start_mark, + ) + token = self.scanner.get_token() + start_mark = token.start_mark + end_mark = token.end_mark + # if self.loader is not None and \ + # end_mark.line != self.scanner.peek_token().start_mark.line: + # self.loader.scalar_after_indicator = False + event: Any = DocumentStartEvent( + start_mark, + end_mark, + explicit=True, + version=version, + tags=tags, + comment=token.comment, + ) + self.states.append(self.parse_document_end) + self.state = self.parse_document_content + else: + # Parse the end of the stream. + token = self.scanner.get_token() + event = StreamEndEvent(token.start_mark, token.end_mark, comment=token.comment) + assert not self.states + assert not self.marks + self.state = None + return event + + def parse_document_end(self) -> Any: + # Parse the document end. + token = self.scanner.peek_token() + start_mark = end_mark = token.start_mark + explicit = False + if self.scanner.check_token(DocumentEndToken): + token = self.scanner.get_token() + # if token.end_mark.line != self.peek_event().start_mark.line: + pt = self.scanner.peek_token() + if not isinstance(pt, StreamEndToken) and ( + token.end_mark.line == pt.start_mark.line + ): + raise ParserError( + None, + None, + 'found non-comment content after document end marker, ' + f'{self.scanner.peek_token().id,!r}', + self.scanner.peek_token().start_mark, + ) + end_mark = token.end_mark + explicit = True + event = DocumentEndEvent(start_mark, end_mark, explicit=explicit) + + # Prepare the next state. + if self.resolver.processing_version == (1, 1): + self.state = self.parse_document_start + else: + if explicit: + # found a document end marker, can be followed by implicit document + self.state = self.parse_implicit_document_start + else: + self.state = self.parse_document_start + + return event + + def parse_document_content(self) -> Any: + if self.scanner.check_token( + DirectiveToken, DocumentStartToken, DocumentEndToken, StreamEndToken, + ): + event = self.process_empty_scalar(self.scanner.peek_token().start_mark) + self.state = self.states.pop() + return event + else: + return self.parse_block_node() + + def process_directives(self) -> Any: + yaml_version = None + self.tag_handles = {} + while self.scanner.check_token(DirectiveToken): + token = self.scanner.get_token() + if token.name == 'YAML': + if yaml_version is not None: + raise ParserError( + None, None, 'found duplicate YAML directive', token.start_mark, + ) + major, minor = token.value + if major != 1: + raise ParserError( + None, + None, + 'found incompatible YAML document (version 1.* is required)', + token.start_mark, + ) + yaml_version = token.value + elif token.name == 'TAG': + handle, prefix = token.value + if handle in self.tag_handles: + raise ParserError( + None, None, f'duplicate tag handle {handle!r}', token.start_mark, + ) + self.tag_handles[handle] = prefix + if bool(self.tag_handles): + value: Any = (yaml_version, self.tag_handles.copy()) + else: + value = yaml_version, None + if self.loader is not None and hasattr(self.loader, 'tags'): + # ToDo: this is used to keep a single loaded file from losing its version + # info, but it affects following versions that have no explicit directive + self.loader.version = yaml_version + if self.loader.tags is None: + self.loader.tags = {} + for k in self.tag_handles: + self.loader.tags[k] = self.tag_handles[k] + self.loader.doc_infos[-1].tags.append((k, self.tag_handles[k])) + for key in self.DEFAULT_TAGS: + if key not in self.tag_handles: + self.tag_handles[key] = self.DEFAULT_TAGS[key] + return value + + # block_node_or_indentless_sequence ::= ALIAS + # | properties (block_content | indentless_block_sequence)? + # | block_content + # | indentless_block_sequence + # block_node ::= ALIAS + # | properties block_content? + # | block_content + # flow_node ::= ALIAS + # | properties flow_content? + # | flow_content + # properties ::= TAG ANCHOR? | ANCHOR TAG? + # block_content ::= block_collection | flow_collection | SCALAR + # flow_content ::= flow_collection | SCALAR + # block_collection ::= block_sequence | block_mapping + # flow_collection ::= flow_sequence | flow_mapping + + def parse_block_node(self) -> Any: + return self.parse_node(block=True) + + def parse_flow_node(self) -> Any: + return self.parse_node() + + def parse_block_node_or_indentless_sequence(self) -> Any: + return self.parse_node(block=True, indentless_sequence=True) + + # def transform_tag(self, handle: Any, suffix: Any) -> Any: + # return self.tag_handles[handle] + suffix + + def select_tag_transform(self, tag: Tag) -> None: + if tag is None: + return + tag.select_transform(False) + + def parse_node(self, block: bool = False, indentless_sequence: bool = False) -> Any: + if self.scanner.check_token(AliasToken): + token = self.scanner.get_token() + event: Any = AliasEvent(token.value, token.start_mark, token.end_mark) + self.state = self.states.pop() + return event + + anchor = None + tag = None + start_mark = end_mark = tag_mark = None + if self.scanner.check_token(AnchorToken): + token = self.scanner.get_token() + self.move_token_comment(token) + start_mark = token.start_mark + end_mark = token.end_mark + anchor = token.value + if self.scanner.check_token(TagToken): + token = self.scanner.get_token() + tag_mark = token.start_mark + end_mark = token.end_mark + # tag = token.value + tag = Tag( + handle=token.value[0], suffix=token.value[1], handles=self.tag_handles, + ) + elif self.scanner.check_token(TagToken): + token = self.scanner.get_token() + try: + self.move_token_comment(token) + except NotImplementedError: + pass + start_mark = tag_mark = token.start_mark + end_mark = token.end_mark + # tag = token.value + tag = Tag(handle=token.value[0], suffix=token.value[1], handles=self.tag_handles) + if self.scanner.check_token(AnchorToken): + token = self.scanner.get_token() + start_mark = tag_mark = token.start_mark + end_mark = token.end_mark + anchor = token.value + if tag is not None: + self.select_tag_transform(tag) + if tag.check_handle(): + raise ParserError( + 'while parsing a node', + start_mark, + f'found undefined tag handle {tag.handle!r}', + tag_mark, + ) + if start_mark is None: + start_mark = end_mark = self.scanner.peek_token().start_mark + event = None + implicit = tag is None or str(tag) == '!' + if indentless_sequence and self.scanner.check_token(BlockEntryToken): + comment = None + pt = self.scanner.peek_token() + if self.loader and self.loader.comment_handling is None: + if pt.comment and pt.comment[0]: + comment = [pt.comment[0], []] + pt.comment[0] = None + elif pt.comment and pt.comment[0] is None and pt.comment[1]: + comment = [None, pt.comment[1]] + pt.comment[1] = None + elif self.loader: + if pt.comment: + comment = pt.comment + end_mark = self.scanner.peek_token().end_mark + event = SequenceStartEvent( + anchor, tag, implicit, start_mark, end_mark, flow_style=False, comment=comment, + ) + self.state = self.parse_indentless_sequence_entry + return event + + if self.scanner.check_token(ScalarToken): + token = self.scanner.get_token() + # self.scanner.peek_token_same_line_comment(token) + end_mark = token.end_mark + if (token.plain and tag is None) or str(tag) == '!': + dimplicit = (True, False) + elif tag is None: + dimplicit = (False, True) + else: + dimplicit = (False, False) + event = ScalarEvent( + anchor, + tag, + dimplicit, + token.value, + start_mark, + end_mark, + style=token.style, + comment=token.comment, + ) + self.state = self.states.pop() + elif self.scanner.check_token(FlowSequenceStartToken): + pt = self.scanner.peek_token() + end_mark = pt.end_mark + event = SequenceStartEvent( + anchor, + tag, + implicit, + start_mark, + end_mark, + flow_style=True, + comment=pt.comment, + ) + self.state = self.parse_flow_sequence_first_entry + elif self.scanner.check_token(FlowMappingStartToken): + pt = self.scanner.peek_token() + end_mark = pt.end_mark + event = MappingStartEvent( + anchor, + tag, + implicit, + start_mark, + end_mark, + flow_style=True, + comment=pt.comment, + ) + self.state = self.parse_flow_mapping_first_key + elif block and self.scanner.check_token(BlockSequenceStartToken): + end_mark = self.scanner.peek_token().start_mark + # should inserting the comment be dependent on the + # indentation? + pt = self.scanner.peek_token() + comment = pt.comment + # nprint('pt0', type(pt)) + if comment is None or comment[1] is None: + comment = pt.split_old_comment() + # nprint('pt1', comment) + event = SequenceStartEvent( + anchor, tag, implicit, start_mark, end_mark, flow_style=False, comment=comment, + ) + self.state = self.parse_block_sequence_first_entry + elif block and self.scanner.check_token(BlockMappingStartToken): + end_mark = self.scanner.peek_token().start_mark + comment = self.scanner.peek_token().comment + event = MappingStartEvent( + anchor, tag, implicit, start_mark, end_mark, flow_style=False, comment=comment, + ) + self.state = self.parse_block_mapping_first_key + elif anchor is not None or tag is not None: + # Empty scalars are allowed even if a tag or an anchor is + # specified. + event = ScalarEvent(anchor, tag, (implicit, False), "", start_mark, end_mark) + self.state = self.states.pop() + else: + if block: + node = 'block' + else: + node = 'flow' + token = self.scanner.peek_token() + raise ParserError( + f'while parsing a {node!s} node', + start_mark, + f'expected the node content, but found {token.id!r}', + token.start_mark, + ) + return event + + # block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* + # BLOCK-END + + def parse_block_sequence_first_entry(self) -> Any: + token = self.scanner.get_token() + # move any comment from start token + # self.move_token_comment(token) + self.marks.append(token.start_mark) + return self.parse_block_sequence_entry() + + def parse_block_sequence_entry(self) -> Any: + if self.scanner.check_token(BlockEntryToken): + token = self.scanner.get_token() + self.move_token_comment(token) + if not self.scanner.check_token(BlockEntryToken, BlockEndToken): + self.states.append(self.parse_block_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_block_sequence_entry + return self.process_empty_scalar(token.end_mark) + if not self.scanner.check_token(BlockEndToken): + token = self.scanner.peek_token() + raise ParserError( + 'while parsing a block collection', + self.marks[-1], + f'expected , but found {token.id!r}', + token.start_mark, + ) + token = self.scanner.get_token() # BlockEndToken + event = SequenceEndEvent(token.start_mark, token.end_mark, comment=token.comment) + self.state = self.states.pop() + self.marks.pop() + return event + + # indentless_sequence ::= (BLOCK-ENTRY block_node?)+ + + # indentless_sequence? + # sequence: + # - entry + # - nested + + def parse_indentless_sequence_entry(self) -> Any: + if self.scanner.check_token(BlockEntryToken): + token = self.scanner.get_token() + self.move_token_comment(token) + if not self.scanner.check_token( + BlockEntryToken, KeyToken, ValueToken, BlockEndToken, + ): + self.states.append(self.parse_indentless_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_indentless_sequence_entry + return self.process_empty_scalar(token.end_mark) + token = self.scanner.peek_token() + c = None + if self.loader and self.loader.comment_handling is None: + c = token.comment + start_mark = token.start_mark + else: + start_mark = self.last_event.end_mark # type: ignore + c = self.distribute_comment(token.comment, start_mark.line) # type: ignore + event = SequenceEndEvent(start_mark, start_mark, comment=c) + self.state = self.states.pop() + return event + + # block_mapping ::= BLOCK-MAPPING_START + # ((KEY block_node_or_indentless_sequence?)? + # (VALUE block_node_or_indentless_sequence?)?)* + # BLOCK-END + + def parse_block_mapping_first_key(self) -> Any: + token = self.scanner.get_token() + self.marks.append(token.start_mark) + return self.parse_block_mapping_key() + + def parse_block_mapping_key(self) -> Any: + if self.scanner.check_token(KeyToken): + token = self.scanner.get_token() + self.move_token_comment(token) + if not self.scanner.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_value) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_value + return self.process_empty_scalar(token.end_mark) + if self.resolver.processing_version > (1, 1) and self.scanner.check_token(ValueToken): + self.state = self.parse_block_mapping_value + return self.process_empty_scalar(self.scanner.peek_token().start_mark) + if not self.scanner.check_token(BlockEndToken): + token = self.scanner.peek_token() + raise ParserError( + 'while parsing a block mapping', + self.marks[-1], + f'expected , but found {token.id!r}', + token.start_mark, + ) + token = self.scanner.get_token() + self.move_token_comment(token) + event = MappingEndEvent(token.start_mark, token.end_mark, comment=token.comment) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_block_mapping_value(self) -> Any: + if self.scanner.check_token(ValueToken): + token = self.scanner.get_token() + # value token might have post comment move it to e.g. block + if self.scanner.check_token(ValueToken): + self.move_token_comment(token) + else: + if not self.scanner.check_token(KeyToken): + self.move_token_comment(token, empty=True) + # else: empty value for this key cannot move token.comment + if not self.scanner.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_key) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_key + comment = token.comment + if comment is None: + token = self.scanner.peek_token() + comment = token.comment + if comment: + token._comment = [None, comment[1]] + comment = [comment[0], None] + return self.process_empty_scalar(token.end_mark, comment=comment) + else: + self.state = self.parse_block_mapping_key + token = self.scanner.peek_token() + return self.process_empty_scalar(token.start_mark) + + # flow_sequence ::= FLOW-SEQUENCE-START + # (flow_sequence_entry FLOW-ENTRY)* + # flow_sequence_entry? + # FLOW-SEQUENCE-END + # flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + # + # Note that while production rules for both flow_sequence_entry and + # flow_mapping_entry are equal, their interpretations are different. + # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_node?)?` + # generate an inline mapping (set syntax). + + def parse_flow_sequence_first_entry(self) -> Any: + token = self.scanner.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_sequence_entry(first=True) + + def parse_flow_sequence_entry(self, first: bool = False) -> Any: + if not self.scanner.check_token(FlowSequenceEndToken): + if not first: + if self.scanner.check_token(FlowEntryToken): + self.scanner.get_token() + else: + token = self.scanner.peek_token() + raise ParserError( + 'while parsing a flow sequence', + self.marks[-1], + f"expected ',' or ']', but got {token.id!r}", + token.start_mark, + ) + + if self.scanner.check_token(KeyToken): + token = self.scanner.peek_token() + event: Any = MappingStartEvent( + None, None, True, token.start_mark, token.end_mark, flow_style=True, + ) + self.state = self.parse_flow_sequence_entry_mapping_key + return event + elif not self.scanner.check_token(FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry) + return self.parse_flow_node() + token = self.scanner.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark, comment=token.comment) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_sequence_entry_mapping_key(self) -> Any: + token = self.scanner.get_token() + if not self.scanner.check_token(ValueToken, FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_value + return self.process_empty_scalar(token.end_mark) + + def parse_flow_sequence_entry_mapping_value(self) -> Any: + if self.scanner.check_token(ValueToken): + token = self.scanner.get_token() + if not self.scanner.check_token(FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_end) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_end + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_sequence_entry_mapping_end + token = self.scanner.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_sequence_entry_mapping_end(self) -> Any: + self.state = self.parse_flow_sequence_entry + token = self.scanner.peek_token() + return MappingEndEvent(token.start_mark, token.start_mark) + + # flow_mapping ::= FLOW-MAPPING-START + # (flow_mapping_entry FLOW-ENTRY)* + # flow_mapping_entry? + # FLOW-MAPPING-END + # flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + + def parse_flow_mapping_first_key(self) -> Any: + token = self.scanner.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_mapping_key(first=True) + + def parse_flow_mapping_key(self, first: Any = False) -> Any: + if not self.scanner.check_token(FlowMappingEndToken): + if not first: + if self.scanner.check_token(FlowEntryToken): + self.scanner.get_token() + else: + token = self.scanner.peek_token() + raise ParserError( + 'while parsing a flow mapping', + self.marks[-1], + f"expected ',' or '}}', but got {token.id!r}", + token.start_mark, + ) + if self.scanner.check_token(KeyToken): + token = self.scanner.get_token() + if not self.scanner.check_token( + ValueToken, FlowEntryToken, FlowMappingEndToken, + ): + self.states.append(self.parse_flow_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_value + return self.process_empty_scalar(token.end_mark) + elif self.resolver.processing_version > (1, 1) and self.scanner.check_token( + ValueToken, + ): + self.state = self.parse_flow_mapping_value + return self.process_empty_scalar(self.scanner.peek_token().end_mark) + elif not self.scanner.check_token(FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_empty_value) + return self.parse_flow_node() + token = self.scanner.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark, comment=token.comment) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_mapping_value(self) -> Any: + if self.scanner.check_token(ValueToken): + token = self.scanner.get_token() + if not self.scanner.check_token(FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_key) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_mapping_key + token = self.scanner.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_mapping_empty_value(self) -> Any: + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(self.scanner.peek_token().start_mark) + + def process_empty_scalar(self, mark: Any, comment: Any = None) -> Any: + return ScalarEvent(None, None, (True, False), "", mark, mark, comment=comment) + + def move_token_comment( + self, token: Any, nt: Optional[Any] = None, empty: Optional[bool] = False, + ) -> Any: + pass + + +class RoundTripParser(Parser): + """roundtrip is a safe loader, that wants to see the unmangled tag""" + + def select_tag_transform(self, tag: Tag) -> None: + if tag is None: + return + tag.select_transform(True) + + def move_token_comment( + self, token: Any, nt: Optional[Any] = None, empty: Optional[bool] = False, + ) -> Any: + token.move_old_comment(self.scanner.peek_token() if nt is None else nt, empty=empty) + + +class RoundTripParserSC(RoundTripParser): + """roundtrip is a safe loader, that wants to see the unmangled tag""" + + # some of the differences are based on the superclass testing + # if self.loader.comment_handling is not None + + def move_token_comment( + self: Any, token: Any, nt: Any = None, empty: Optional[bool] = False, + ) -> None: + token.move_new_comment(self.scanner.peek_token() if nt is None else nt, empty=empty) + + def distribute_comment(self, comment: Any, line: Any) -> Any: + # ToDo, look at indentation of the comment to determine attachment + if comment is None: + return None + if not comment[0]: + return None + # if comment[0][0] != line + 1: + # nprintf('>>>dcxxx', comment, line) + assert comment[0][0] == line + 1 + # if comment[0] - line > 1: + # return + typ = self.loader.comment_handling & 0b11 + # nprintf('>>>dca', comment, line, typ) + if typ == C_POST: + return None + if typ == C_PRE: + c = [None, None, comment[0]] + comment[0] = None + return c + # nprintf('>>>dcb', comment[0]) + for _idx, cmntidx in enumerate(comment[0]): + # nprintf('>>>dcb', cmntidx) + if isinstance(self.scanner.comments[cmntidx], BlankLineComment): + break + else: + return None # no space found + if _idx == 0: + return None # first line was blank + # nprintf('>>>dcc', idx) + if typ == C_SPLIT_ON_FIRST_BLANK: + c = [None, None, comment[0][:_idx]] + comment[0] = comment[0][_idx:] + return c + raise NotImplementedError # reserved diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/py.typed b/python/user_packages/Python313/site-packages/ruamel/yaml/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/reader.py b/python/user_packages/Python313/site-packages/ruamel/yaml/reader.py new file mode 100644 index 0000000000000000000000000000000000000000..87f0163175016c3eb0a4321704692bb1f189aaa0 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/reader.py @@ -0,0 +1,277 @@ + +from __future__ import annotations + +# This module contains abstractions for the input stream. You don't have to +# looks further, there are no pretty code. +# +# We define two classes here. +# +# Mark(source, line, column) +# It's just a record and its only use is producing nice error messages. +# Parser does not use it for any other purposes. +# +# Reader(source, data) +# Reader determines the encoding of `data` and converts it to unicode. +# Reader provides the following methods and attributes: +# reader.peek(length=1) - return the next `length` characters +# reader.forward(length=1) - move the current position to `length` +# characters. +# reader.index - the number of the current character. +# reader.line, stream.column - the line and the column of the current +# character. + +import codecs + +from ruamel.yaml.error import YAMLError, FileMark, StringMark, YAMLStreamError +from ruamel.yaml.util import RegExp + +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, Text, Tuple, Optional # NOQA +# from ruamel.yaml.compat import StreamTextType # NOQA + +__all__ = ['Reader', 'ReaderError'] + + +class ReaderError(YAMLError): + def __init__( # NOQA + self, name: Any, position: Any, character: Any, encoding: Any, reason: Any, + ) -> None: + self.name = name + self.character = character + self.position = position + self.encoding = encoding + self.reason = reason + + def __str__(self) -> Any: + if isinstance(self.character, bytes): + return ( + f"'{self.encoding!s}' codec can't decode byte #x{ord(self.character):02x}: " + f'{self.reason!s}\n' + f' in "{self.name!s}", position {self.position:d}' + ) + else: + return ( + f'unacceptable character #x{self.character:04x}: {self.reason!s}\n' + f' in "{self.name!s}", position {self.position:d}' + ) + + +class Reader: + # Reader: + # - determines the data encoding and converts it to a unicode string, + # - checks if characters are in allowed range, + # - adds '\0' to the end. + + # Reader accepts + # - a `bytes` object, + # - a `str` object, + # - a file-like object with its `read` method returning `str`, + # - a file-like object with its `read` method returning `unicode`. + + # Yeah, it's ugly and slow. + + def __init__(self, stream: Any, loader: Any = None) -> None: + self.loader = loader + if self.loader is not None and getattr(self.loader, '_reader', None) is None: + self.loader._reader = self + self.reset_reader() + self.stream: Any = stream # as .read is called + + def reset_reader(self) -> None: + self.name: Any = None + self.stream_pointer = 0 + self.eof = True + self.buffer = "" + self.pointer = 0 + self.raw_buffer: Any = None + self.raw_decode = None + self.encoding: Optional[Text] = None + self.index = 0 + self.line = 0 + self.column = 0 + + @property + def stream(self) -> Any: + try: + return self._stream + except AttributeError: + raise YAMLStreamError('input stream needs to be specified') + + @stream.setter + def stream(self, val: Any) -> None: + if val is None: + return + self._stream = None + if isinstance(val, str): + self.name = '' + self.check_printable(val) + self.buffer = val + '\0' + elif isinstance(val, bytes): + self.name = '' + self.raw_buffer = val + self.determine_encoding() + else: + if not hasattr(val, 'read'): + raise YAMLStreamError('stream argument needs to have a read() method') + self._stream = val + self.name = getattr(self.stream, 'name', '') + self.eof = False + self.raw_buffer = None + self.determine_encoding() + + def peek(self, index: int = 0) -> Text: + try: + return self.buffer[self.pointer + index] + except IndexError: + self.update(index + 1) + return self.buffer[self.pointer + index] + + def prefix(self, length: int = 1) -> Any: + if self.pointer + length >= len(self.buffer): + self.update(length) + return self.buffer[self.pointer : self.pointer + length] + + def forward_1_1(self, length: int = 1) -> None: + if self.pointer + length + 1 >= len(self.buffer): + self.update(length + 1) + while length != 0: + ch = self.buffer[self.pointer] + self.pointer += 1 + self.index += 1 + if ch in '\n\x85\u2028\u2029' or ( + ch == '\r' and self.buffer[self.pointer] != '\n' + ): + self.line += 1 + self.column = 0 + elif ch != '\uFEFF': + self.column += 1 + length -= 1 + + def forward(self, length: int = 1) -> None: + if self.pointer + length + 1 >= len(self.buffer): + self.update(length + 1) + while length != 0: + ch = self.buffer[self.pointer] + self.pointer += 1 + self.index += 1 + if ch == '\n' or (ch == '\r' and self.buffer[self.pointer] != '\n'): + self.line += 1 + self.column = 0 + elif ch != '\uFEFF': + self.column += 1 + length -= 1 + + def get_mark(self) -> Any: + if self.stream is None: + return StringMark( + self.name, self.index, self.line, self.column, self.buffer, self.pointer, + ) + else: + return FileMark(self.name, self.index, self.line, self.column) + + def determine_encoding(self) -> None: + while not self.eof and (self.raw_buffer is None or len(self.raw_buffer) < 2): + self.update_raw() + if isinstance(self.raw_buffer, bytes): + if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): + self.raw_decode = codecs.utf_16_le_decode # type: ignore + self.encoding = 'utf-16-le' + elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): + self.raw_decode = codecs.utf_16_be_decode # type: ignore + self.encoding = 'utf-16-be' + else: + self.raw_decode = codecs.utf_8_decode # type: ignore + self.encoding = 'utf-8' + self.update(1) + + NON_PRINTABLE = RegExp( + '[^\x09\x0A\x0D\x20-\x7E\x85' '\xA0-\uD7FF' '\uE000-\uFFFD' '\U00010000-\U0010FFFF' ']' # NOQA + ) + + _printable_ascii = ('\x09\x0A\x0D' + "".join(map(chr, range(0x20, 0x7F)))).encode('ascii') + + @classmethod + def _get_non_printable_ascii(cls: Text, data: bytes) -> Optional[Tuple[int, Text]]: # type: ignore # NOQA + ascii_bytes = data.encode('ascii') # type: ignore + non_printables = ascii_bytes.translate(None, cls._printable_ascii) # type: ignore + if not non_printables: + return None + non_printable = non_printables[:1] + return ascii_bytes.index(non_printable), non_printable.decode('ascii') + + @classmethod + def _get_non_printable_regex(cls, data: Text) -> Optional[Tuple[int, Text]]: + match = cls.NON_PRINTABLE.search(data) + if not bool(match): + return None + return match.start(), match.group() + + @classmethod + def _get_non_printable(cls, data: Text) -> Optional[Tuple[int, Text]]: + try: + return cls._get_non_printable_ascii(data) # type: ignore + except UnicodeEncodeError: + return cls._get_non_printable_regex(data) + + def check_printable(self, data: Any) -> None: + non_printable_match = self._get_non_printable(data) + if non_printable_match is not None: + start, character = non_printable_match + position = self.index + (len(self.buffer) - self.pointer) + start + raise ReaderError( + self.name, + position, + ord(character), + 'unicode', + 'special characters are not allowed', + ) + + def update(self, length: int) -> None: + if self.raw_buffer is None: + return + self.buffer = self.buffer[self.pointer :] + self.pointer = 0 + while len(self.buffer) < length: + if not self.eof: + self.update_raw() + if self.raw_decode is not None: + try: + data, converted = self.raw_decode(self.raw_buffer, 'strict', self.eof) + except UnicodeDecodeError as exc: + character = self.raw_buffer[exc.start] + if self.stream is not None: + position = self.stream_pointer - len(self.raw_buffer) + exc.start + elif self.stream is not None: + position = self.stream_pointer - len(self.raw_buffer) + exc.start + else: + position = exc.start + raise ReaderError(self.name, position, character, exc.encoding, exc.reason) + else: + data = self.raw_buffer + converted = len(data) + self.check_printable(data) + self.buffer += data + self.raw_buffer = self.raw_buffer[converted:] + if self.eof: + self.buffer += '\0' + self.raw_buffer = None + break + + def update_raw(self, size: Optional[int] = None) -> None: + if size is None: + size = 4096 + data = self.stream.read(size) + if self.raw_buffer is None: + self.raw_buffer = data + else: + self.raw_buffer += data + self.stream_pointer += len(data) + if not data: + self.eof = True + + +# try: +# import psyco +# psyco.bind(Reader) +# except ImportError: +# pass diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/representer.py b/python/user_packages/Python313/site-packages/ruamel/yaml/representer.py new file mode 100644 index 0000000000000000000000000000000000000000..6350fba76dc7970f550b0f959671daf03d11bc4e --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/representer.py @@ -0,0 +1,1139 @@ + +from __future__ import annotations + +from ruamel.yaml.error import * # NOQA +from ruamel.yaml.nodes import * # NOQA +from ruamel.yaml.compat import ordereddict +from ruamel.yaml.compat import nprint, nprintf # NOQA +from ruamel.yaml.scalarstring import ( + LiteralScalarString, + FoldedScalarString, + SingleQuotedScalarString, + DoubleQuotedScalarString, + PlainScalarString, +) +from ruamel.yaml.comments import ( + CommentedMap, + CommentedOrderedMap, + CommentedSeq, + CommentedKeySeq, + CommentedKeyMap, + CommentedSet, + comment_attrib, + merge_attrib, + TaggedScalar, +) +from ruamel.yaml.scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt +from ruamel.yaml.scalarfloat import ScalarFloat +from ruamel.yaml.scalarbool import ScalarBoolean +from ruamel.yaml.timestamp import TimeStamp +from ruamel.yaml.anchor import Anchor + +import collections +import datetime +import types + +import copyreg +import base64 + +if False: # MYPY + from typing import Dict, List, Any, Union, Text, Optional # NOQA + +# fmt: off +__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', + 'RepresenterError', 'RoundTripRepresenter'] +# fmt: on + + +class RepresenterError(YAMLError): + pass + + +class BaseRepresenter: + + yaml_representers: Dict[Any, Any] = {} + yaml_multi_representers: Dict[Any, Any] = {} + + def __init__( + self: Any, + default_style: Any = None, + default_flow_style: Any = None, + dumper: Any = None, + ) -> None: + self.dumper = dumper + if self.dumper is not None: + self.dumper._representer = self + self.default_style = default_style + self.default_flow_style = default_flow_style + self.represented_objects: Dict[Any, Any] = {} + self.object_keeper: List[Any] = [] + self.alias_key: Optional[int] = None + self.sort_base_mapping_type_on_output = True + + @property + def serializer(self) -> Any: + try: + if hasattr(self.dumper, 'typ'): + return self.dumper.serializer + return self.dumper._serializer + except AttributeError: + return self # cyaml + + def represent(self, data: Any) -> None: + node = self.represent_data(data) + self.serializer.serialize(node) + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent_data(self, data: Any) -> Any: + if self.ignore_aliases(data): + self.alias_key = None + else: + self.alias_key = id(data) + if self.alias_key is not None: + if self.alias_key in self.represented_objects: + node = self.represented_objects[self.alias_key] + # if node is None: + # raise RepresenterError( + # f"recursive objects are not allowed: {data!r}") + return node + # self.represented_objects[alias_key] = None + self.object_keeper.append(data) + data_types = type(data).__mro__ + if data_types[0] in self.yaml_representers: + node = self.yaml_representers[data_types[0]](self, data) + else: + for data_type in data_types: + if data_type in self.yaml_multi_representers: + node = self.yaml_multi_representers[data_type](self, data) + break + else: + if None in self.yaml_multi_representers: + node = self.yaml_multi_representers[None](self, data) + elif None in self.yaml_representers: + node = self.yaml_representers[None](self, data) + else: + node = ScalarNode(None, str(data)) + # if alias_key is not None: + # self.represented_objects[alias_key] = node + return node + + def represent_key(self, data: Any) -> Any: + """ + David Fraser: Extract a method to represent keys in mappings, so that + a subclass can choose not to quote them (for example) + used in represent_mapping + https://bitbucket.org/davidfraser/pyyaml/commits/d81df6eb95f20cac4a79eed95ae553b5c6f77b8c + """ + return self.represent_data(data) + + @classmethod + def add_representer(cls, data_type: Any, representer: Any) -> None: + if 'yaml_representers' not in cls.__dict__: + cls.yaml_representers = cls.yaml_representers.copy() + cls.yaml_representers[data_type] = representer + + @classmethod + def add_multi_representer(cls, data_type: Any, representer: Any) -> None: + if 'yaml_multi_representers' not in cls.__dict__: + cls.yaml_multi_representers = cls.yaml_multi_representers.copy() + cls.yaml_multi_representers[data_type] = representer + + def represent_scalar( + self, tag: Any, value: Any, style: Any = None, anchor: Any = None, + ) -> ScalarNode: + if style is None: + style = self.default_style + comment = None + if style and style[0] in '|>': + comment = getattr(value, 'comment', None) + if comment: + comment = [None, [comment]] + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = ScalarNode(tag, value, style=style, comment=comment, anchor=anchor) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + return node + + def represent_sequence( + self, tag: Any, sequence: Any, flow_style: Any = None, + ) -> SequenceNode: + value: List[Any] = [] + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = SequenceNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + for item in sequence: + node_item = self.represent_data(item) + if not (isinstance(node_item, ScalarNode) and not node_item.style): + best_style = False + value.append(node_item) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def represent_omap(self, tag: Any, omap: Any, flow_style: Any = None) -> SequenceNode: + value: List[Any] = [] + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = SequenceNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + for item_key in omap: + item_val = omap[item_key] + node_item = self.represent_data({item_key: item_val}) + # if not (isinstance(node_item, ScalarNode) \ + # and not node_item.style): + # best_style = False + value.append(node_item) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def represent_mapping(self, tag: Any, mapping: Any, flow_style: Any = None) -> MappingNode: + value: List[Any] = [] + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = MappingNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + if hasattr(mapping, 'items'): + mapping = list(mapping.items()) + if self.sort_base_mapping_type_on_output: + try: + mapping = sorted(mapping) + except TypeError: + pass + for item_key, item_value in mapping: + node_key = self.represent_key(item_key) + node_value = self.represent_data(item_value) + if not (isinstance(node_key, ScalarNode) and not node_key.style): + best_style = False + if not (isinstance(node_value, ScalarNode) and not node_value.style): + best_style = False + value.append((node_key, node_value)) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def ignore_aliases(self, data: Any) -> bool: + return False + + +class SafeRepresenter(BaseRepresenter): + def ignore_aliases(self, data: Any) -> bool: + # https://docs.python.org/3/reference/expressions.html#parenthesized-forms : + # "i.e. two occurrences of the empty tuple may or may not yield the same object" + # so "data is ()" should not be used + if data is None or (isinstance(data, tuple) and data == ()): + return True + if isinstance(data, (bytes, str, bool, int, float)): + return True + return False + + def represent_none(self, data: Any) -> ScalarNode: + return self.represent_scalar('tag:yaml.org,2002:null', 'null') + + def represent_str(self, data: Any) -> Any: + return self.represent_scalar('tag:yaml.org,2002:str', data) + + def represent_binary(self, data: Any) -> ScalarNode: + if hasattr(base64, 'encodebytes'): + data = base64.encodebytes(data).decode('ascii') + else: + # check py2 only? + data = base64.encodestring(data).decode('ascii') # type: ignore + return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|') + + def represent_bool(self, data: Any, anchor: Optional[Any] = None) -> ScalarNode: + try: + value = self.dumper.boolean_representation[bool(data)] + except AttributeError: + if data: + value = 'true' + else: + value = 'false' + return self.represent_scalar('tag:yaml.org,2002:bool', value, anchor=anchor) + + def represent_int(self, data: Any) -> ScalarNode: + return self.represent_scalar('tag:yaml.org,2002:int', str(data)) + + inf_value = 1e300 + while repr(inf_value) != repr(inf_value * inf_value): + inf_value *= inf_value + + def represent_float(self, data: Any) -> ScalarNode: + if data != data or (data == 0.0 and data == 1.0): + value = '.nan' + elif data == self.inf_value: + value = '.inf' + elif data == -self.inf_value: + value = '-.inf' + else: + value = repr(data).lower() + if getattr(self.serializer, 'use_version', None) == (1, 1): + if '.' not in value and 'e' in value: + # Note that in some cases `repr(data)` represents a float number + # without the decimal parts. For instance: + # >>> repr(1e17) + # '1e17' + # Unfortunately, this is not a valid float representation according + # to the definition of the `!!float` tag in YAML 1.1. We fix + # this by adding '.0' before the 'e' symbol. + value = value.replace('e', '.0e', 1) + return self.represent_scalar('tag:yaml.org,2002:float', value) + + def represent_list(self, data: Any) -> SequenceNode: + # pairs = (len(data) > 0 and isinstance(data, list)) + # if pairs: + # for item in data: + # if not isinstance(item, tuple) or len(item) != 2: + # pairs = False + # break + # if not pairs: + return self.represent_sequence('tag:yaml.org,2002:seq', data) + + # value = [] + # for item_key, item_value in data: + # value.append(self.represent_mapping('tag:yaml.org,2002:map', + # [(item_key, item_value)])) + # return SequenceNode('tag:yaml.org,2002:pairs', value) + + def represent_dict(self, data: Any) -> MappingNode: + return self.represent_mapping('tag:yaml.org,2002:map', data) + + def represent_ordereddict(self, data: Any) -> SequenceNode: + return self.represent_omap('tag:yaml.org,2002:omap', data) + + def represent_set(self, data: Any) -> MappingNode: + value: Dict[Any, None] = {} + for key in data: + value[key] = None + return self.represent_mapping('tag:yaml.org,2002:set', value) + + def represent_date(self, data: Any) -> ScalarNode: + value = data.isoformat() + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_datetime(self, data: Any) -> ScalarNode: + value = data.isoformat(' ') + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_yaml_object( + self, tag: Any, data: Any, cls: Any, flow_style: Any = None, + ) -> MappingNode: + if hasattr(data, '__getstate__'): + state = data.__getstate__() + else: + state = data.__dict__.copy() + return self.represent_mapping(tag, state, flow_style=flow_style) + + def represent_undefined(self, data: Any) -> None: + raise RepresenterError(f'cannot represent an object: {data!r}') + + +SafeRepresenter.add_representer(type(None), SafeRepresenter.represent_none) + +SafeRepresenter.add_representer(str, SafeRepresenter.represent_str) + +SafeRepresenter.add_representer(bytes, SafeRepresenter.represent_binary) + +SafeRepresenter.add_representer(bool, SafeRepresenter.represent_bool) + +SafeRepresenter.add_representer(int, SafeRepresenter.represent_int) + +SafeRepresenter.add_representer(float, SafeRepresenter.represent_float) + +SafeRepresenter.add_representer(list, SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(tuple, SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(dict, SafeRepresenter.represent_dict) + +SafeRepresenter.add_representer(set, SafeRepresenter.represent_set) + +SafeRepresenter.add_representer(ordereddict, SafeRepresenter.represent_ordereddict) + +SafeRepresenter.add_representer( + collections.OrderedDict, SafeRepresenter.represent_ordereddict, +) + +SafeRepresenter.add_representer(datetime.date, SafeRepresenter.represent_date) + +SafeRepresenter.add_representer(datetime.datetime, SafeRepresenter.represent_datetime) + +SafeRepresenter.add_representer(None, SafeRepresenter.represent_undefined) + + +class Representer(SafeRepresenter): + def represent_complex(self, data: Any) -> Any: + if data.imag == 0.0: + data = repr(data.real) + elif data.real == 0.0: + data = f'{data.imag!r}j' + elif data.imag > 0: + data = f'{data.real!r}+{data.imag!r}j' + else: + data = f'{data.real!r}{data.imag!r}j' + return self.represent_scalar('tag:yaml.org,2002:python/complex', data) + + def represent_tuple(self, data: Any) -> SequenceNode: + return self.represent_sequence('tag:yaml.org,2002:python/tuple', data) + + def represent_name(self, data: Any) -> ScalarNode: + try: + name = f'{data.__module__!s}.{data.__qualname__!s}' + except AttributeError: + # ToDo: check if this can be reached in Py3 + name = f'{data.__module__!s}.{data.__name__!s}' + return self.represent_scalar('tag:yaml.org,2002:python/name:' + name, "") + + def represent_module(self, data: Any) -> ScalarNode: + return self.represent_scalar('tag:yaml.org,2002:python/module:' + data.__name__, "") + + def represent_object(self, data: Any) -> Union[SequenceNode, MappingNode]: + # We use __reduce__ API to save the data. data.__reduce__ returns + # a tuple of length 2-5: + # (function, args, state, listitems, dictitems) + + # For reconstructing, we calls function(*args), then set its state, + # listitems, and dictitems if they are not None. + + # A special case is when function.__name__ == '__newobj__'. In this + # case we create the object with args[0].__new__(*args). + + # Another special case is when __reduce__ returns a string - we don't + # support it. + + # We produce a !!python/object, !!python/object/new or + # !!python/object/apply node. + + cls = type(data) + if cls in copyreg.dispatch_table: + reduce: Any = copyreg.dispatch_table[cls](data) + elif hasattr(data, '__reduce_ex__'): + reduce = data.__reduce_ex__(2) + elif hasattr(data, '__reduce__'): + reduce = data.__reduce__() + else: + raise RepresenterError(f'cannot represent object: {data!r}') + reduce = (list(reduce) + [None] * 5)[:5] + function, args, state, listitems, dictitems = reduce + args = list(args) + if state is None: + state = {} + if listitems is not None: + listitems = list(listitems) + if dictitems is not None: + dictitems = dict(dictitems) + if function.__name__ == '__newobj__': + function = args[0] + args = args[1:] + tag = 'tag:yaml.org,2002:python/object/new:' + newobj = True + else: + tag = 'tag:yaml.org,2002:python/object/apply:' + newobj = False + try: + function_name = f'{function.__module__!s}.{function.__qualname__!s}' + except AttributeError: + # ToDo: check if this can be reached in Py3 + function_name = f'{function.__module__!s}.{function.__name__!s}' + if not args and not listitems and not dictitems and isinstance(state, dict) and newobj: + return self.represent_mapping( + 'tag:yaml.org,2002:python/object:' + function_name, state, + ) + if not listitems and not dictitems and isinstance(state, dict) and not state: + return self.represent_sequence(tag + function_name, args) + value = {} + if args: + value['args'] = args + if state or not isinstance(state, dict): + value['state'] = state + if listitems: + value['listitems'] = listitems + if dictitems: + value['dictitems'] = dictitems + return self.represent_mapping(tag + function_name, value) + + +Representer.add_representer(complex, Representer.represent_complex) + +Representer.add_representer(tuple, Representer.represent_tuple) + +Representer.add_representer(type, Representer.represent_name) + +Representer.add_representer(types.FunctionType, Representer.represent_name) + +Representer.add_representer(types.BuiltinFunctionType, Representer.represent_name) + +Representer.add_representer(types.ModuleType, Representer.represent_module) + +Representer.add_multi_representer(object, Representer.represent_object) + +Representer.add_multi_representer(type, Representer.represent_name) + + +class RoundTripRepresenter(SafeRepresenter): + # need to add type here and write out the .comment + # in serializer and emitter + + def __init__( + self, default_style: Any = None, default_flow_style: Any = None, dumper: Any = None, + ) -> None: + if not hasattr(dumper, 'typ') and default_flow_style is None: + default_flow_style = False + SafeRepresenter.__init__( + self, + default_style=default_style, + default_flow_style=default_flow_style, + dumper=dumper, + ) + + def ignore_aliases(self, data: Any) -> bool: + try: + if data.anchor is not None and data.anchor.value is not None: + return False + except AttributeError: + pass + return SafeRepresenter.ignore_aliases(self, data) + + def represent_none(self, data: Any) -> ScalarNode: + if len(self.represented_objects) == 0 and not self.serializer.use_explicit_start: + # this will be open ended (although it is not yet) + return self.represent_scalar('tag:yaml.org,2002:null', 'null') + return self.represent_scalar('tag:yaml.org,2002:null', "") + + def represent_literal_scalarstring(self, data: Any) -> ScalarNode: + tag = None + style = '|' + anchor = data.yaml_anchor(any=True) + tag = 'tag:yaml.org,2002:str' + return self.represent_scalar(tag, data, style=style, anchor=anchor) + + represent_preserved_scalarstring = represent_literal_scalarstring + + def represent_folded_scalarstring(self, data: Any) -> ScalarNode: + tag = None + style = '>' + anchor = data.yaml_anchor(any=True) + for fold_pos in reversed(getattr(data, 'fold_pos', [])): + if ( + data[fold_pos] == ' ' + and (fold_pos > 0 and not data[fold_pos - 1].isspace()) + and (fold_pos < len(data) and not data[fold_pos + 1].isspace()) + ): + data = data[:fold_pos] + '\a' + data[fold_pos:] + tag = 'tag:yaml.org,2002:str' + return self.represent_scalar(tag, data, style=style, anchor=anchor) + + def represent_single_quoted_scalarstring(self, data: Any) -> ScalarNode: + tag = None + style = "'" + anchor = data.yaml_anchor(any=True) + tag = 'tag:yaml.org,2002:str' + return self.represent_scalar(tag, data, style=style, anchor=anchor) + + def represent_double_quoted_scalarstring(self, data: Any) -> ScalarNode: + tag = None + style = '"' + anchor = data.yaml_anchor(any=True) + tag = 'tag:yaml.org,2002:str' + return self.represent_scalar(tag, data, style=style, anchor=anchor) + + def represent_plain_scalarstring(self, data: Any) -> ScalarNode: + tag = None + style = '' + anchor = data.yaml_anchor(any=True) + tag = 'tag:yaml.org,2002:str' + return self.represent_scalar(tag, data, style=style, anchor=anchor) + + def insert_underscore( + self, prefix: Any, s: Any, underscore: Any, anchor: Any = None, + ) -> ScalarNode: + if underscore is None: + return self.represent_scalar('tag:yaml.org,2002:int', prefix + s, anchor=anchor) + if underscore[0]: + sl = list(s) + pos = len(s) - underscore[0] + while pos > 0: + sl.insert(pos, '_') + pos -= underscore[0] + s = "".join(sl) + if underscore[1]: + s = '_' + s + if underscore[2]: + s += '_' + return self.represent_scalar('tag:yaml.org,2002:int', prefix + s, anchor=anchor) + + def represent_scalar_int(self, data: Any) -> ScalarNode: + if data._width is not None: + s = f'{data:0{data._width}d}' + else: + s = format(data, 'd') + anchor = data.yaml_anchor(any=True) + return self.insert_underscore("", s, data._underscore, anchor=anchor) + + def represent_binary_int(self, data: Any) -> ScalarNode: + if data._width is not None: + # cannot use '{:#0{}b}', that strips the zeros + s = f'{data:0{data._width}b}' + else: + s = format(data, 'b') + anchor = data.yaml_anchor(any=True) + return self.insert_underscore('0b', s, data._underscore, anchor=anchor) + + def represent_octal_int(self, data: Any) -> ScalarNode: + if data._width is not None: + # cannot use '{:#0{}o}', that strips the zeros + s = f'{data:0{data._width}o}' + else: + s = format(data, 'o') + anchor = data.yaml_anchor(any=True) + prefix = '0o' + if getattr(self.serializer, 'use_version', None) == (1, 1): + prefix = '0' + return self.insert_underscore(prefix, s, data._underscore, anchor=anchor) + + def represent_hex_int(self, data: Any) -> ScalarNode: + if data._width is not None: + # cannot use '{:#0{}x}', that strips the zeros + s = f'{data:0{data._width}x}' + else: + s = format(data, 'x') + anchor = data.yaml_anchor(any=True) + return self.insert_underscore('0x', s, data._underscore, anchor=anchor) + + def represent_hex_caps_int(self, data: Any) -> ScalarNode: + if data._width is not None: + # cannot use '{:#0{}X}', that strips the zeros + s = f'{data:0{data._width}X}' + else: + s = format(data, 'X') + anchor = data.yaml_anchor(any=True) + return self.insert_underscore('0x', s, data._underscore, anchor=anchor) + + def represent_scalar_float(self, data: Any) -> ScalarNode: + """ this is way more complicated """ + value = None + anchor = data.yaml_anchor(any=True) + if data != data or (data == 0.0 and data == 1.0): + value = '.nan' + elif data == self.inf_value: + value = '.inf' + elif data == -self.inf_value: + value = '-.inf' + if value: + return self.represent_scalar('tag:yaml.org,2002:float', value, anchor=anchor) + if data._exp is None and data._prec > 0 and data._prec == data._width - 1: + # no exponent, but trailing dot + value = f'{data._m_sign if data._m_sign else ""}{abs(int(data)):d}.' + elif data._exp is None: + # no exponent, "normal" dot + prec = data._prec + ms = data._m_sign if data._m_sign else "" + if prec < 0: + value = f'{ms}{abs(int(data)):0{data._width - len(ms)}d}' + else: + # -1 for the dot + value = f'{ms}{abs(data):0{data._width - len(ms)}.{data._width - prec - 1}f}' + if prec == 0 or (prec == 1 and ms != ""): + value = value.replace('0.', '.') + while len(value) < data._width: + value += '0' + else: + # exponent + ( + m, + es, + ) = f'{data:{data._width}.{data._width + (1 if data._m_sign else 0)}e}'.split('e') + w = data._width if data._prec > 0 else (data._width + 1) + if data < 0: + w += 1 + m = m[:w] + e = int(es) + m1, m2 = m.split('.') # always second? + while len(m1) + len(m2) < data._width - (1 if data._prec >= 0 else 0): + m2 += '0' + if data._m_sign and data > 0: + m1 = '+' + m1 + esgn = '+' if data._e_sign else "" + if data._prec < 0: # mantissa without dot + if m2 != '0': + e -= len(m2) + else: + m2 = "" + while (len(m1) + len(m2) - (1 if data._m_sign else 0)) < data._width: + m2 += '0' + e -= 1 + value = m1 + m2 + data._exp + f'{e:{esgn}0{data._e_width}d}' + elif data._prec == 0: # mantissa with trailing dot + e -= len(m2) + value = m1 + m2 + '.' + data._exp + f'{e:{esgn}0{data._e_width}d}' + else: + if data._m_lead0 > 0: + m2 = '0' * (data._m_lead0 - 1) + m1 + m2 + m1 = '0' + m2 = m2[: -data._m_lead0] # these should be zeros + e += data._m_lead0 + while len(m1) < data._prec: + m1 += m2[0] + m2 = m2[1:] + e -= 1 + value = m1 + '.' + m2 + data._exp + f'{e:{esgn}0{data._e_width}d}' + + if value is None: + value = repr(data).lower() + return self.represent_scalar('tag:yaml.org,2002:float', value, anchor=anchor) + + def represent_sequence( + self, tag: Any, sequence: Any, flow_style: Any = None, + ) -> SequenceNode: + value: List[Any] = [] + # if the flow_style is None, the flow style tacked on to the object + # explicitly will be taken. If that is None as well the default flow + # style rules + try: + flow_style = sequence.fa.flow_style(flow_style) + except AttributeError: + flow_style = flow_style + try: + anchor = sequence.yaml_anchor() + except AttributeError: + anchor = None + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = SequenceNode(tag, value, flow_style=flow_style, anchor=anchor) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + try: + comment = getattr(sequence, comment_attrib) + node.comment = comment.comment + # reset any comment already printed information + if node.comment and node.comment[1]: + for ct in node.comment[1]: + ct.reset() + item_comments = comment.items + for v in item_comments.values(): + if v and v[1]: + for ct in v[1]: + ct.reset() + item_comments = comment.items + if node.comment is None: + node.comment = comment.comment + else: + # as we are potentially going to extend this, make a new list + node.comment = comment.comment[:] + try: + node.comment.append(comment.end) + except AttributeError: + pass + except AttributeError: + item_comments = {} + for idx, item in enumerate(sequence): + node_item = self.represent_data(item) + self.merge_comments(node_item, item_comments.get(idx)) + if not (isinstance(node_item, ScalarNode) and not node_item.style): + best_style = False + value.append(node_item) + if flow_style is None: + if len(sequence) != 0 and self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def merge_comments(self, node: Any, comments: Any) -> Any: + if comments is None: + assert hasattr(node, 'comment') + return node + if getattr(node, 'comment', None) is not None: + for idx, val in enumerate(comments): + if idx >= len(node.comment): + continue + nc = node.comment[idx] + if nc is not None: + assert val is None or val == nc + comments[idx] = nc + node.comment = comments + return node + + def represent_key(self, data: Any) -> Any: + if isinstance(data, CommentedKeySeq): + self.alias_key = None + return self.represent_sequence('tag:yaml.org,2002:seq', data, flow_style=True) + if isinstance(data, CommentedKeyMap): + self.alias_key = None + return self.represent_mapping('tag:yaml.org,2002:map', data, flow_style=True) + return SafeRepresenter.represent_key(self, data) + + def represent_mapping(self, tag: Any, mapping: Any, flow_style: Any = None) -> MappingNode: + value: List[Any] = [] + try: + flow_style = mapping.fa.flow_style(flow_style) + except AttributeError: + flow_style = flow_style + try: + anchor = mapping.yaml_anchor() + except AttributeError: + anchor = None + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = MappingNode(tag, value, flow_style=flow_style, anchor=anchor) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + # no sorting! !! + try: + comment = getattr(mapping, comment_attrib) + if node.comment is None: + node.comment = comment.comment + else: + # as we are potentially going to extend this, make a new list + node.comment = comment.comment[:] + if node.comment and node.comment[1]: + for ct in node.comment[1]: + ct.reset() + item_comments = comment.items + if self.dumper.comment_handling is None: + for v in item_comments.values(): + if v and v[1]: + for ct in v[1]: + ct.reset() + try: + node.comment.append(comment.end) + except AttributeError: + pass + else: + # NEWCMNT + pass + except AttributeError: + item_comments = {} + merge_value = getattr(mapping, merge_attrib, []) + # merge_list = [m[1] for m in merge_value] + # merge_list = [m for m in merge_value] + try: + # merge_pos = getattr(mapping, merge_attrib, [[0]])[0][0] + # print('merge_pos', merge_pos, merge_value.merge_pos) + merge_pos = merge_value.merge_pos # type: ignore + except (AttributeError, IndexError): + merge_pos = 0 + item_count = 0 + # if bool(merge_list): + if len(merge_value) > 0: + items = mapping.non_merged_items() + else: + items = mapping.items() + for item_key, item_value in items: + item_count += 1 + node_key = self.represent_key(item_key) + node_value = self.represent_data(item_value) + item_comment = item_comments.get(item_key) + if item_comment: + # assert getattr(node_key, 'comment', None) is None + # issue 351 did throw this because the comment from the list item was + # moved to the dict + node_key.comment = item_comment[:2] + nvc = getattr(node_value, 'comment', None) + if nvc is not None: # end comment already there + nvc[0] = item_comment[2] + nvc[1] = item_comment[3] + else: + node_value.comment = item_comment[2:] + if not (isinstance(node_key, ScalarNode) and not node_key.style): + best_style = False + if not (isinstance(node_value, ScalarNode) and not node_value.style): + best_style = False + value.append((node_key, node_value)) + if flow_style is None: + if ((item_count != 0) or (len(merge_value) > 0)) and self.default_flow_style is not None: # NOQA + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + if len(merge_value) > 0: + # because of the call to represent_data here, the anchors + # are marked as being used and thereby created + # if len(merge_list) == 1: + if merge_value.sequence is None: # type: ignore + arg = self.represent_data(merge_value[0]) + else: + # arg = self.represent_data(merge_list) + # arg.flow_style = True + arg = self.represent_data(merge_value.sequence) # type: ignore + value.insert( + merge_pos, (ScalarNode(Tag(suffix='tag:yaml.org,2002:merge'), '<<'), arg), + ) + return node + + def represent_omap(self, tag: Any, omap: Any, flow_style: Any = None) -> SequenceNode: + value: List[Any] = [] + try: + flow_style = omap.fa.flow_style(flow_style) + except AttributeError: + flow_style = flow_style + try: + anchor = omap.yaml_anchor() + except AttributeError: + anchor = None + if isinstance(tag, str): + tag = Tag(suffix=tag) + node = SequenceNode(tag, value, flow_style=flow_style, anchor=anchor) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + try: + comment = getattr(omap, comment_attrib) + if node.comment is None: + node.comment = comment.comment + else: + # as we are potentially going to extend this, make a new list + node.comment = comment.comment[:] + if node.comment and node.comment[1]: + for ct in node.comment[1]: + ct.reset() + item_comments = comment.items + for v in item_comments.values(): + if v and v[1]: + for ct in v[1]: + ct.reset() + try: + node.comment.append(comment.end) + except AttributeError: + pass + except AttributeError: + item_comments = {} + for item_key in omap: + item_val = omap[item_key] + node_item = self.represent_data({item_key: item_val}) + # node_item.flow_style = False + # node item has two scalars in value: node_key and node_value + item_comment = item_comments.get(item_key) + if item_comment: + if item_comment[1]: + node_item.comment = [None, item_comment[1]] + assert getattr(node_item.value[0][0], 'comment', None) is None + node_item.value[0][0].comment = [item_comment[0], None] + nvc = getattr(node_item.value[0][1], 'comment', None) + if nvc is not None: # end comment already there + nvc[0] = item_comment[2] + nvc[1] = item_comment[3] + else: + node_item.value[0][1].comment = item_comment[2:] + # if not (isinstance(node_item, ScalarNode) \ + # and not node_item.style): + # best_style = False + value.append(node_item) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def represent_set(self, setting: Any) -> MappingNode: + flow_style = False + tag = Tag(suffix='tag:yaml.org,2002:set') + # return self.represent_mapping(tag, value) + value: List[Any] = [] + flow_style = setting.fa.flow_style(flow_style) + try: + anchor = setting.yaml_anchor() + except AttributeError: + anchor = None + node = MappingNode(tag, value, flow_style=flow_style, anchor=anchor) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + # no sorting! !! + try: + comment = getattr(setting, comment_attrib) + if node.comment is None: + node.comment = comment.comment + else: + # as we are potentially going to extend this, make a new list + node.comment = comment.comment[:] + if node.comment and node.comment[1]: + for ct in node.comment[1]: + ct.reset() + item_comments = comment.items + for v in item_comments.values(): + if v and v[1]: + for ct in v[1]: + ct.reset() + try: + node.comment.append(comment.end) + except AttributeError: + pass + except AttributeError: + item_comments = {} + for item_key in setting.odict: + node_key = self.represent_key(item_key) + node_value = self.represent_data(None) + item_comment = item_comments.get(item_key) + if item_comment: + assert getattr(node_key, 'comment', None) is None + node_key.comment = item_comment[:2] + node_key.style = '?' + node_value.style = '-' if flow_style else '?' + if not (isinstance(node_key, ScalarNode) and not node_key.style): + best_style = False + if not (isinstance(node_value, ScalarNode) and not node_value.style): + best_style = False + value.append((node_key, node_value)) + best_style = best_style + return node + + def represent_dict(self, data: Any) -> MappingNode: + """write out tag if saved on loading""" + try: + _ = data.tag + except AttributeError: + tag = Tag(suffix='tag:yaml.org,2002:map') + else: + if data.tag.trval: + if data.tag.startswith('!!'): + tag = Tag(suffix='tag:yaml.org,2002:' + data.tag.trval[2:]) + else: + tag = data.tag + else: + tag = Tag(suffix='tag:yaml.org,2002:map') + return self.represent_mapping(tag, data) + + def represent_list(self, data: Any) -> SequenceNode: + try: + _ = data.tag + except AttributeError: + tag = Tag(suffix='tag:yaml.org,2002:seq') + else: + if data.tag.trval: + if data.tag.startswith('!!'): + tag = Tag(suffix='tag:yaml.org,2002:' + data.tag.trval[2:]) + else: + tag = data.tag + else: + tag = Tag(suffix='tag:yaml.org,2002:seq') + return self.represent_sequence(tag, data) + + def represent_datetime(self, data: Any) -> ScalarNode: + inter = 'T' if data._yaml['t'] else ' ' + _yaml = data._yaml + if False and _yaml['delta']: + data += _yaml['delta'] + value = data.isoformat(inter) + else: + value = data.isoformat(inter).strip() + if False and _yaml['tz']: + value += _yaml['tz'] + if data.tzinfo and str(data.tzinfo): + if value[-6] in '+-': + value = value[:-6] + str(data.tzinfo) + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_tagged_scalar(self, data: Any) -> ScalarNode: + try: + if data.tag.handle == '!!': + tag = f'{data.tag.handle} {data.tag.suffix}' + else: + tag = data.tag + except AttributeError: + tag = None + try: + anchor = data.yaml_anchor() + except AttributeError: + anchor = None + return self.represent_scalar(tag, data.value, style=data.style, anchor=anchor) + + def represent_scalar_bool(self, data: Any) -> ScalarNode: + try: + anchor = data.yaml_anchor() + except AttributeError: + anchor = None + return SafeRepresenter.represent_bool(self, data, anchor=anchor) + + def represent_yaml_object( + self, tag: Any, data: Any, cls: Any, flow_style: Optional[Any] = None, + ) -> MappingNode: + if hasattr(data, '__getstate__'): + state = data.__getstate__() + else: + state = data.__dict__.copy() + anchor = state.pop(Anchor.attrib, None) + res = self.represent_mapping(tag, state, flow_style=flow_style) + if anchor is not None: + res.anchor = anchor + return res + + +RoundTripRepresenter.add_representer(type(None), RoundTripRepresenter.represent_none) + +RoundTripRepresenter.add_representer( + LiteralScalarString, RoundTripRepresenter.represent_literal_scalarstring, +) + +RoundTripRepresenter.add_representer( + FoldedScalarString, RoundTripRepresenter.represent_folded_scalarstring, +) + +RoundTripRepresenter.add_representer( + SingleQuotedScalarString, RoundTripRepresenter.represent_single_quoted_scalarstring, +) + +RoundTripRepresenter.add_representer( + DoubleQuotedScalarString, RoundTripRepresenter.represent_double_quoted_scalarstring, +) + +RoundTripRepresenter.add_representer( + PlainScalarString, RoundTripRepresenter.represent_plain_scalarstring, +) + +# RoundTripRepresenter.add_representer(tuple, Representer.represent_tuple) + +RoundTripRepresenter.add_representer(ScalarInt, RoundTripRepresenter.represent_scalar_int) + +RoundTripRepresenter.add_representer(BinaryInt, RoundTripRepresenter.represent_binary_int) + +RoundTripRepresenter.add_representer(OctalInt, RoundTripRepresenter.represent_octal_int) + +RoundTripRepresenter.add_representer(HexInt, RoundTripRepresenter.represent_hex_int) + +RoundTripRepresenter.add_representer(HexCapsInt, RoundTripRepresenter.represent_hex_caps_int) + +RoundTripRepresenter.add_representer(ScalarFloat, RoundTripRepresenter.represent_scalar_float) + +RoundTripRepresenter.add_representer(ScalarBoolean, RoundTripRepresenter.represent_scalar_bool) + +RoundTripRepresenter.add_representer(CommentedSeq, RoundTripRepresenter.represent_list) + +RoundTripRepresenter.add_representer(CommentedMap, RoundTripRepresenter.represent_dict) + +RoundTripRepresenter.add_representer( + CommentedOrderedMap, RoundTripRepresenter.represent_ordereddict, +) + +RoundTripRepresenter.add_representer( + collections.OrderedDict, RoundTripRepresenter.represent_ordereddict, +) + +RoundTripRepresenter.add_representer(CommentedSet, RoundTripRepresenter.represent_set) + +RoundTripRepresenter.add_representer( + TaggedScalar, RoundTripRepresenter.represent_tagged_scalar, +) + +RoundTripRepresenter.add_representer(TimeStamp, RoundTripRepresenter.represent_datetime) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/resolver.py b/python/user_packages/Python313/site-packages/ruamel/yaml/resolver.py new file mode 100644 index 0000000000000000000000000000000000000000..d693b8e7903b3c2cde6f5f48d95fe0d1397e2707 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/resolver.py @@ -0,0 +1,392 @@ + +from __future__ import annotations + +import re + +if False: # MYPY + from typing import Any, Dict, List, Union, Text, Optional # NOQA + from ruamel.yaml.compat import VersionType # NOQA + +from ruamel.yaml.tag import Tag +from ruamel.yaml.compat import _DEFAULT_YAML_VERSION # NOQA +from ruamel.yaml.error import * # NOQA +from ruamel.yaml.nodes import MappingNode, ScalarNode, SequenceNode # NOQA +from ruamel.yaml.util import RegExp # NOQA + +__all__ = ['BaseResolver', 'Resolver', 'VersionedResolver'] + + +# fmt: off +# resolvers consist of +# - a list of applicable version +# - a tag +# - a regexp +# - a list of first characters to match +implicit_resolvers = [ + ([(1, 2)], + 'tag:yaml.org,2002:bool', + RegExp('''^(?:true|True|TRUE|false|False|FALSE)$''', re.X), + list('tTfF')), + ([(1, 1)], + 'tag:yaml.org,2002:bool', + RegExp('''^(?:y|Y|yes|Yes|YES|n|N|no|No|NO + |true|True|TRUE|false|False|FALSE + |on|On|ON|off|Off|OFF)$''', re.X), + list('yYnNtTfFoO')), + ([(1, 2)], + 'tag:yaml.org,2002:float', + RegExp('''^(?: + [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? + |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) + |[-+]?\\.[0-9_]+(?:[eE][-+][0-9]+)? + |[-+]?\\.(?:inf|Inf|INF) + |\\.(?:nan|NaN|NAN))$''', re.X), + list('-+0123456789.')), + ([(1, 1)], + 'tag:yaml.org,2002:float', + RegExp('''^(?: + [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? + |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) + |\\.[0-9_]+(?:[eE][-+][0-9]+)? + |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]* # sexagesimal float + |[-+]?\\.(?:inf|Inf|INF) + |\\.(?:nan|NaN|NAN))$''', re.X), + list('-+0123456789.')), + ([(1, 2)], + 'tag:yaml.org,2002:int', + RegExp('''^(?:[-+]?0b[0-1_]+ + |[-+]?0o?[0-7_]+ + |[-+]?[0-9_]+ + |[-+]?0x[0-9a-fA-F_]+)$''', re.X), + list('-+0123456789')), + ([(1, 1)], + 'tag:yaml.org,2002:int', + RegExp('''^(?:[-+]?0b[0-1_]+ + |[-+]?0?[0-7_]+ + |[-+]?(?:0|[1-9][0-9_]*) + |[-+]?0x[0-9a-fA-F_]+ + |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), # sexagesimal int + list('-+0123456789')), + ([(1, 2), (1, 1)], + 'tag:yaml.org,2002:merge', + RegExp('^(?:<<)$'), + ['<']), + ([(1, 2), (1, 1)], + 'tag:yaml.org,2002:null', + RegExp('''^(?: ~ + |null|Null|NULL + | )$''', re.X), + ['~', 'n', 'N', '']), + ([(1, 2), (1, 1)], + 'tag:yaml.org,2002:timestamp', + RegExp('''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] + |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? + (?:[Tt]|[ \\t]+)[0-9][0-9]? + :[0-9][0-9] :[0-9][0-9] (?:\\.[0-9]*)? + (?:[ \\t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), + list('0123456789')), + ([(1, 2), (1, 1)], + 'tag:yaml.org,2002:value', + RegExp('^(?:=)$'), + ['=']), + # The following resolver is only for documentation purposes. It cannot work + # because plain scalars cannot start with '!', '&', or '*'. + ([(1, 2), (1, 1)], + 'tag:yaml.org,2002:yaml', + RegExp('^(?:!|&|\\*)$'), + list('!&*')), +] +# fmt: on + + +class ResolverError(YAMLError): + pass + + +class BaseResolver: + + DEFAULT_SCALAR_TAG = Tag(suffix='tag:yaml.org,2002:str') + DEFAULT_SEQUENCE_TAG = Tag(suffix='tag:yaml.org,2002:seq') + DEFAULT_MAPPING_TAG = Tag(suffix='tag:yaml.org,2002:map') + + yaml_implicit_resolvers: Dict[Any, Any] = {} + yaml_path_resolvers: Dict[Any, Any] = {} + + def __init__(self: Any, loadumper: Any = None) -> None: + self.loadumper = loadumper + if self.loadumper is not None and getattr(self.loadumper, '_resolver', None) is None: + self.loadumper._resolver = self.loadumper + self._loader_version: Any = None + self.resolver_exact_paths: List[Any] = [] + self.resolver_prefix_paths: List[Any] = [] + + @property + def parser(self) -> Any: + if self.loadumper is not None: + if hasattr(self.loadumper, 'typ'): + return self.loadumper.parser + return self.loadumper._parser + return None + + @classmethod + def add_implicit_resolver_base(cls, tag: Any, regexp: Any, first: Any) -> None: + if 'yaml_implicit_resolvers' not in cls.__dict__: + # deepcopy doesn't work here + cls.yaml_implicit_resolvers = { + k: cls.yaml_implicit_resolvers[k][:] for k in cls.yaml_implicit_resolvers + } + if first is None: + first = [None] + for ch in first: + cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp)) + + @classmethod + def add_implicit_resolver(cls, tag: Any, regexp: Any, first: Any) -> None: + if 'yaml_implicit_resolvers' not in cls.__dict__: + # deepcopy doesn't work here + cls.yaml_implicit_resolvers = { + k: cls.yaml_implicit_resolvers[k][:] for k in cls.yaml_implicit_resolvers + } + if first is None: + first = [None] + for ch in first: + cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp)) + implicit_resolvers.append(([(1, 2), (1, 1)], tag, regexp, first)) + + # @classmethod + # def add_implicit_resolver(cls, tag, regexp, first): + + @classmethod + def add_path_resolver(cls, tag: Any, path: Any, kind: Any = None) -> None: + # Note: `add_path_resolver` is experimental. The API could be changed. + # `new_path` is a pattern that is matched against the path from the + # root to the node that is being considered. `node_path` elements are + # tuples `(node_check, index_check)`. `node_check` is a node class: + # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` + # matches any kind of a node. `index_check` could be `None`, a boolean + # value, a string value, or a number. `None` and `False` match against + # any _value_ of sequence and mapping nodes. `True` matches against + # any _key_ of a mapping node. A string `index_check` matches against + # a mapping value that corresponds to a scalar key which content is + # equal to the `index_check` value. An integer `index_check` matches + # against a sequence value with the index equal to `index_check`. + if 'yaml_path_resolvers' not in cls.__dict__: + cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() + new_path: List[Any] = [] + for element in path: + if isinstance(element, (list, tuple)): + if len(element) == 2: + node_check, index_check = element + elif len(element) == 1: + node_check = element[0] + index_check = True + else: + raise ResolverError(f'Invalid path element: {element!s}') + else: + node_check = None + index_check = element + if node_check is str: + node_check = ScalarNode + elif node_check is list: + node_check = SequenceNode + elif node_check is dict: + node_check = MappingNode + elif ( + node_check not in [ScalarNode, SequenceNode, MappingNode] + and not isinstance(node_check, str) + and node_check is not None + ): + raise ResolverError(f'Invalid node checker: {node_check!s}') + if not isinstance(index_check, (str, int)) and index_check is not None: + raise ResolverError(f'Invalid index checker: {index_check!s}') + new_path.append((node_check, index_check)) + if kind is str: + kind = ScalarNode + elif kind is list: + kind = SequenceNode + elif kind is dict: + kind = MappingNode + elif kind not in [ScalarNode, SequenceNode, MappingNode] and kind is not None: + raise ResolverError(f'Invalid node kind: {kind!s}') + cls.yaml_path_resolvers[tuple(new_path), kind] = tag + + def descend_resolver(self, current_node: Any, current_index: Any) -> None: + if not self.yaml_path_resolvers: + return + exact_paths = {} + prefix_paths = [] + if current_node: + depth = len(self.resolver_prefix_paths) + for path, kind in self.resolver_prefix_paths[-1]: + if self.check_resolver_prefix(depth, path, kind, current_node, current_index): + if len(path) > depth: + prefix_paths.append((path, kind)) + else: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + for path, kind in self.yaml_path_resolvers: + if not path: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + prefix_paths.append((path, kind)) + self.resolver_exact_paths.append(exact_paths) + self.resolver_prefix_paths.append(prefix_paths) + + def ascend_resolver(self) -> None: + if not self.yaml_path_resolvers: + return + self.resolver_exact_paths.pop() + self.resolver_prefix_paths.pop() + + def check_resolver_prefix( + self, depth: int, path: Any, kind: Any, current_node: Any, current_index: Any, + ) -> bool: + node_check, index_check = path[depth - 1] + if isinstance(node_check, str): + if current_node.tag != node_check: + return False + elif node_check is not None: + if not isinstance(current_node, node_check): + return False + if index_check is True and current_index is not None: + return False + if (index_check is False or index_check is None) and current_index is None: + return False + if isinstance(index_check, str): + if not ( + isinstance(current_index, ScalarNode) and index_check == current_index.value + ): + return False + elif isinstance(index_check, int) and not isinstance(index_check, bool): + if index_check != current_index: + return False + return True + + def resolve(self, kind: Any, value: Any, implicit: Any) -> Any: + if kind is ScalarNode and implicit[0]: + if value == "": + resolvers = self.yaml_implicit_resolvers.get("", []) + else: + resolvers = self.yaml_implicit_resolvers.get(value[0], []) + resolvers += self.yaml_implicit_resolvers.get(None, []) + for tag, regexp in resolvers: + if regexp.match(value): + return Tag(suffix=tag) + implicit = implicit[1] + if bool(self.yaml_path_resolvers): + exact_paths = self.resolver_exact_paths[-1] + if kind in exact_paths: + return Tag(suffix=exact_paths[kind]) + if None in exact_paths: + return Tag(suffix=exact_paths[None]) + if kind is ScalarNode: + return self.DEFAULT_SCALAR_TAG + elif kind is SequenceNode: + return self.DEFAULT_SEQUENCE_TAG + elif kind is MappingNode: + return self.DEFAULT_MAPPING_TAG + + @property + def processing_version(self) -> Any: + return None + + +class Resolver(BaseResolver): + pass + + +for ir in implicit_resolvers: + if (1, 2) in ir[0]: + Resolver.add_implicit_resolver_base(*ir[1:]) + + +class VersionedResolver(BaseResolver): + """ + contrary to the "normal" resolver, the smart resolver delays loading + the pattern matching rules. That way it can decide to load 1.1 rules + or the (default) 1.2 rules, that no longer support octal without 0o, sexagesimals + and Yes/No/On/Off booleans. + """ + + def __init__( + self, version: Optional[VersionType] = None, loader: Any = None, loadumper: Any = None, + ) -> None: + if loader is None and loadumper is not None: + loader = loadumper + BaseResolver.__init__(self, loader) + self._loader_version = self.get_loader_version(version) + self._version_implicit_resolver: Dict[Any, Any] = {} + + def add_version_implicit_resolver( + self, version: VersionType, tag: Any, regexp: Any, first: Any, + ) -> None: + if first is None: + first = [None] + impl_resolver = self._version_implicit_resolver.setdefault(version, {}) + for ch in first: + impl_resolver.setdefault(ch, []).append((tag, regexp)) + + def get_loader_version(self, version: Optional[VersionType]) -> Any: + if version is None or isinstance(version, tuple): + return version + if isinstance(version, list): + return tuple(version) + # assume string + assert isinstance(version, str) + return tuple(map(int, version.split('.'))) + + @property + def versioned_resolver(self) -> Any: + """ + select the resolver based on the version we are parsing + """ + version = self.processing_version + if isinstance(version, str): + version = tuple(map(int, version.split('.'))) + if version not in self._version_implicit_resolver: + for x in implicit_resolvers: + if version in x[0]: + self.add_version_implicit_resolver(version, x[1], x[2], x[3]) + return self._version_implicit_resolver[version] + + def resolve(self, kind: Any, value: Any, implicit: Any) -> Any: + if kind is ScalarNode and implicit[0]: + if value == "": + resolvers = self.versioned_resolver.get("", []) + else: + resolvers = self.versioned_resolver.get(value[0], []) + resolvers += self.versioned_resolver.get(None, []) + for tag, regexp in resolvers: + if regexp.match(value): + return Tag(suffix=tag) + implicit = implicit[1] + if bool(self.yaml_path_resolvers): + exact_paths = self.resolver_exact_paths[-1] + if kind in exact_paths: + return Tag(suffix=exact_paths[kind]) + if None in exact_paths: + return Tag(suffix=exact_paths[None]) + if kind is ScalarNode: + return self.DEFAULT_SCALAR_TAG + elif kind is SequenceNode: + return self.DEFAULT_SEQUENCE_TAG + elif kind is MappingNode: + return self.DEFAULT_MAPPING_TAG + + @property + def processing_version(self) -> Any: + try: + version = self.loadumper._scanner.yaml_version + except AttributeError: + try: + if hasattr(self.loadumper, 'typ'): + version = self.loadumper.version + else: + version = self.loadumper._serializer.use_version # dumping + except AttributeError: + version = None + if version is None: + version = self._loader_version + if version is None: + version = _DEFAULT_YAML_VERSION + return version diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/scalarbool.py b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarbool.py new file mode 100644 index 0000000000000000000000000000000000000000..9921944e936223591e393e7b719bbfd0c4dc254c --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarbool.py @@ -0,0 +1,43 @@ +""" +You cannot subclass bool, and this is necessary for round-tripping anchored +bool values (and also if you want to preserve the original way of writing) + +bool.__bases__ is type 'int', so that is what is used as the basis for ScalarBoolean as well. + +You can use these in an if statement, but not when testing equivalence +""" + +from __future__ import annotations + +from ruamel.yaml.anchor import Anchor + +if False: # MYPY + from typing import Text, Any, Dict, List # NOQA + +__all__ = ['ScalarBoolean'] + + +class ScalarBoolean(int): + def __new__(cls: Any, *args: Any, **kw: Any) -> Any: + anchor = kw.pop('anchor', None) + b = int.__new__(cls, *args, **kw) + if anchor is not None: + b.yaml_set_anchor(anchor, always_dump=True) + return b + + @property + def anchor(self) -> Any: + if not hasattr(self, Anchor.attrib): + setattr(self, Anchor.attrib, Anchor()) + return getattr(self, Anchor.attrib) + + def yaml_anchor(self, any: bool = False) -> Any: + if not hasattr(self, Anchor.attrib): + return None + if any or self.anchor.always_dump: + return self.anchor + return None + + def yaml_set_anchor(self, value: Any, always_dump: bool = False) -> None: + self.anchor.value = value + self.anchor.always_dump = always_dump diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/scalarfloat.py b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarfloat.py new file mode 100644 index 0000000000000000000000000000000000000000..997cabce7e25662aab05d7ce6c8185edf91b9ef5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarfloat.py @@ -0,0 +1,105 @@ + +from __future__ import annotations + +import sys +from ruamel.yaml.anchor import Anchor + +if False: # MYPY + from typing import Text, Any, Dict, List # NOQA + +__all__ = ['ScalarFloat', 'ExponentialFloat', 'ExponentialCapsFloat'] + + +class ScalarFloat(float): + def __new__(cls: Any, *args: Any, **kw: Any) -> Any: + width = kw.pop('width', None) + prec = kw.pop('prec', None) + m_sign = kw.pop('m_sign', None) + m_lead0 = kw.pop('m_lead0', 0) + exp = kw.pop('exp', None) + e_width = kw.pop('e_width', None) + e_sign = kw.pop('e_sign', None) + underscore = kw.pop('underscore', None) + anchor = kw.pop('anchor', None) + v = float.__new__(cls, *args, **kw) + v._width = width + v._prec = prec + v._m_sign = m_sign + v._m_lead0 = m_lead0 + v._exp = exp + v._e_width = e_width + v._e_sign = e_sign + v._underscore = underscore + if anchor is not None: + v.yaml_set_anchor(anchor, always_dump=True) + return v + + def __iadd__(self, a: Any) -> Any: # type: ignore + return float(self) + a + x = type(self)(self + a) + x._width = self._width + x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA + return x + + def __ifloordiv__(self, a: Any) -> Any: # type: ignore + return float(self) // a + x = type(self)(self // a) + x._width = self._width + x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA + return x + + def __imul__(self, a: Any) -> Any: # type: ignore + return float(self) * a + x = type(self)(self * a) + x._width = self._width + x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA + x._prec = self._prec # check for others + return x + + def __ipow__(self, a: Any) -> Any: # type: ignore + return float(self) ** a + x = type(self)(self ** a) + x._width = self._width + x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA + return x + + def __isub__(self, a: Any) -> Any: # type: ignore + return float(self) - a + x = type(self)(self - a) + x._width = self._width + x._underscore = self._underscore[:] if self._underscore is not None else None # NOQA + return x + + @property + def anchor(self) -> Any: + if not hasattr(self, Anchor.attrib): + setattr(self, Anchor.attrib, Anchor()) + return getattr(self, Anchor.attrib) + + def yaml_anchor(self, any: bool = False) -> Any: + if not hasattr(self, Anchor.attrib): + return None + if any or self.anchor.always_dump: + return self.anchor + return None + + def yaml_set_anchor(self, value: Any, always_dump: bool = False) -> None: + self.anchor.value = value + self.anchor.always_dump = always_dump + + def dump(self, out: Any = sys.stdout) -> None: + out.write( + f'ScalarFloat({self}| w:{self._width}, p:{self._prec}, ' # type: ignore + f's:{self._m_sign}, lz:{self._m_lead0}, _:{self._underscore}|{self._exp}' + f', w:{self._e_width}, s:{self._e_sign})\n', + ) + + +class ExponentialFloat(ScalarFloat): + def __new__(cls, value: Any, width: Any = None, underscore: Any = None) -> Any: + return ScalarFloat.__new__(cls, value, width=width, underscore=underscore) + + +class ExponentialCapsFloat(ScalarFloat): + def __new__(cls, value: Any, width: Any = None, underscore: Any = None) -> Any: + return ScalarFloat.__new__(cls, value, width=width, underscore=underscore) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/scalarint.py b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarint.py new file mode 100644 index 0000000000000000000000000000000000000000..c9343d7a54cea54b749c62a41b323a4285a8a14a --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarint.py @@ -0,0 +1,124 @@ + +from __future__ import annotations + +from ruamel.yaml.anchor import Anchor + +if False: # MYPY + from typing import Text, Any, Dict, List # NOQA + +__all__ = ['ScalarInt', 'BinaryInt', 'OctalInt', 'HexInt', 'HexCapsInt', 'DecimalInt'] + + +class ScalarInt(int): + def __new__(cls: Any, *args: Any, **kw: Any) -> Any: + width = kw.pop('width', None) + underscore = kw.pop('underscore', None) + anchor = kw.pop('anchor', None) + v = int.__new__(cls, *args, **kw) + v._width = width + v._underscore = underscore + if anchor is not None: + v.yaml_set_anchor(anchor, always_dump=True) + return v + + def __iadd__(self, a: Any) -> Any: # type: ignore + x = type(self)(self + a) + x._width = self._width # type: ignore + x._underscore = ( # type: ignore + self._underscore[:] if self._underscore is not None else None # type: ignore + ) # NOQA + return x + + def __ifloordiv__(self, a: Any) -> Any: # type: ignore + x = type(self)(self // a) + x._width = self._width # type: ignore + x._underscore = ( # type: ignore + self._underscore[:] if self._underscore is not None else None # type: ignore + ) # NOQA + return x + + def __imul__(self, a: Any) -> Any: # type: ignore + x = type(self)(self * a) + x._width = self._width # type: ignore + x._underscore = ( # type: ignore + self._underscore[:] if self._underscore is not None else None # type: ignore + ) # NOQA + return x + + def __ipow__(self, a: Any) -> Any: # type: ignore + x = type(self)(self ** a) + x._width = self._width # type: ignore + x._underscore = ( # type: ignore + self._underscore[:] if self._underscore is not None else None # type: ignore + ) # NOQA + return x + + def __isub__(self, a: Any) -> Any: # type: ignore + x = type(self)(self - a) + x._width = self._width # type: ignore + x._underscore = ( # type: ignore + self._underscore[:] if self._underscore is not None else None # type: ignore + ) # NOQA + return x + + @property + def anchor(self) -> Any: + if not hasattr(self, Anchor.attrib): + setattr(self, Anchor.attrib, Anchor()) + return getattr(self, Anchor.attrib) + + def yaml_anchor(self, any: bool = False) -> Any: + if not hasattr(self, Anchor.attrib): + return None + if any or self.anchor.always_dump: + return self.anchor + return None + + def yaml_set_anchor(self, value: Any, always_dump: bool = False) -> None: + self.anchor.value = value + self.anchor.always_dump = always_dump + + +class BinaryInt(ScalarInt): + def __new__( + cls, value: Any, width: Any = None, underscore: Any = None, anchor: Any = None, + ) -> Any: + return ScalarInt.__new__(cls, value, width=width, underscore=underscore, anchor=anchor) + + +class OctalInt(ScalarInt): + def __new__( + cls, value: Any, width: Any = None, underscore: Any = None, anchor: Any = None, + ) -> Any: + return ScalarInt.__new__(cls, value, width=width, underscore=underscore, anchor=anchor) + + +# mixed casing of A-F is not supported, when loading the first non digit +# determines the case + + +class HexInt(ScalarInt): + """uses lower case (a-f)""" + + def __new__( + cls, value: Any, width: Any = None, underscore: Any = None, anchor: Any = None, + ) -> Any: + return ScalarInt.__new__(cls, value, width=width, underscore=underscore, anchor=anchor) + + +class HexCapsInt(ScalarInt): + """uses upper case (A-F)""" + + def __new__( + cls, value: Any, width: Any = None, underscore: Any = None, anchor: Any = None, + ) -> Any: + return ScalarInt.__new__(cls, value, width=width, underscore=underscore, anchor=anchor) + + +class DecimalInt(ScalarInt): + """needed if anchor""" + + def __new__( + cls, value: Any, width: Any = None, underscore: Any = None, anchor: Any = None, + ) -> Any: + return ScalarInt.__new__(cls, value, width=width, underscore=underscore, anchor=anchor) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/scalarstring.py b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarstring.py new file mode 100644 index 0000000000000000000000000000000000000000..32d9f1cba57ffb7580a2c87d8240f9bbe69da2dd --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/scalarstring.py @@ -0,0 +1,142 @@ + +from __future__ import annotations + +from ruamel.yaml.anchor import Anchor + +if False: # MYPY + from typing import Text, Any, Dict, List # NOQA + from ruamel.yaml.compat import SupportsIndex + +__all__ = [ + 'ScalarString', + 'LiteralScalarString', + 'FoldedScalarString', + 'SingleQuotedScalarString', + 'DoubleQuotedScalarString', + 'PlainScalarString', + # PreservedScalarString is the old name, as it was the first to be preserved on rt, + # use LiteralScalarString instead + 'PreservedScalarString', +] + + +class ScalarString(str): + __slots__ = Anchor.attrib + + def __new__(cls, *args: Any, **kw: Any) -> Any: + anchor = kw.pop('anchor', None) + ret_val = str.__new__(cls, *args, **kw) + if anchor is not None: + ret_val.yaml_set_anchor(anchor, always_dump=True) + return ret_val + + def replace(self, old: Any, new: Any, maxreplace: SupportsIndex = -1) -> Any: + return type(self)((str.replace(self, old, new, maxreplace))) + + @property + def anchor(self) -> Any: + if not hasattr(self, Anchor.attrib): + setattr(self, Anchor.attrib, Anchor()) + return getattr(self, Anchor.attrib) + + def yaml_anchor(self, any: bool = False) -> Any: + if not hasattr(self, Anchor.attrib): + return None + if any or self.anchor.always_dump: + return self.anchor + return None + + def yaml_set_anchor(self, value: Any, always_dump: bool = False) -> None: + self.anchor.value = value + self.anchor.always_dump = always_dump + + +class LiteralScalarString(ScalarString): + __slots__ = 'comment' # the comment after the | on the first line + + style = '|' + + def __new__(cls, value: Text, anchor: Any = None) -> Any: + return ScalarString.__new__(cls, value, anchor=anchor) + + +PreservedScalarString = LiteralScalarString + + +class FoldedScalarString(ScalarString): + __slots__ = ('fold_pos', 'comment') # the comment after the > on the first line + + style = '>' + + def __new__(cls, value: Text, anchor: Any = None) -> Any: + return ScalarString.__new__(cls, value, anchor=anchor) + + +class SingleQuotedScalarString(ScalarString): + __slots__ = () + + style = "'" + + def __new__(cls, value: Text, anchor: Any = None) -> Any: + return ScalarString.__new__(cls, value, anchor=anchor) + + +class DoubleQuotedScalarString(ScalarString): + __slots__ = () + + style = '"' + + def __new__(cls, value: Text, anchor: Any = None) -> Any: + return ScalarString.__new__(cls, value, anchor=anchor) + + +class PlainScalarString(ScalarString): + __slots__ = () + + style = '' + + def __new__(cls, value: Text, anchor: Any = None) -> Any: + return ScalarString.__new__(cls, value, anchor=anchor) + + +def preserve_literal(s: Text) -> Text: + return LiteralScalarString(s.replace('\r\n', '\n').replace('\r', '\n')) + + +def walk_tree(base: Any, map: Any = None) -> None: + """ + the routine here walks over a simple yaml tree (recursing in + dict values and list items) and converts strings that + have multiple lines to literal scalars + + You can also provide an explicit (ordered) mapping for multiple transforms + (first of which is executed): + map = ruamel.yaml.compat.ordereddict + map['\n'] = preserve_literal + map[':'] = SingleQuotedScalarString + walk_tree(data, map=map) + """ + from collections.abc import MutableMapping, MutableSequence + + if map is None: + map = {'\n': preserve_literal} + + if isinstance(base, MutableMapping): + for k in base: + v: Text = base[k] + if isinstance(v, str): + for ch in map: + if ch in v: + base[k] = map[ch](v) + break + else: + walk_tree(v, map=map) + elif isinstance(base, MutableSequence): + for idx, elem in enumerate(base): + if isinstance(elem, str): + for ch in map: + if ch in elem: + base[idx] = map[ch](elem) + break + else: + walk_tree(elem, map=map) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/scanner.py b/python/user_packages/Python313/site-packages/ruamel/yaml/scanner.py new file mode 100644 index 0000000000000000000000000000000000000000..58a224e37ba3220e88d24d5cf69b6c0c1f5a9ed4 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/scanner.py @@ -0,0 +1,2390 @@ + +from __future__ import annotations + +# Scanner produces tokens of the following types: +# STREAM-START +# STREAM-END +# DIRECTIVE(name, value) +# DOCUMENT-START +# DOCUMENT-END +# BLOCK-SEQUENCE-START +# BLOCK-MAPPING-START +# BLOCK-END +# FLOW-SEQUENCE-START +# FLOW-MAPPING-START +# FLOW-SEQUENCE-END +# FLOW-MAPPING-END +# BLOCK-ENTRY +# FLOW-ENTRY +# KEY +# VALUE +# ALIAS(value) +# ANCHOR(value) +# TAG(value) +# SCALAR(value, plain, style) +# +# RoundTripScanner +# COMMENT(value) +# +# Read comments in the Scanner code for more details. +# + +from ruamel.yaml.error import MarkedYAMLError +import ruamel.yaml.tokens as tokens +from ruamel.yaml.docinfo import Version # NOQA +from ruamel.yaml.compat import check_anchorname_char, _debug, nprint, nprintf # NOQA + +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, Text, Tuple # NOQA + +__all__ = ['Scanner', 'RoundTripScanner', 'ScannerError'] + + +_THE_END = '\n\0\r\x85\u2028\u2029' +_THE_END_SPACE_TAB = ' \n\0\t\r\x85\u2028\u2029' +_SPACE_TAB = ' \t' + + +if _debug != 0: + def xprintf(*args: Any, **kw: Any) -> Any: + return nprintf(*args, **kw) + + +class ScannerError(MarkedYAMLError): + pass + + +class SimpleKey: + # See below simple keys treatment. + + def __init__( + self, token_number: Any, required: Any, index: int, line: int, column: int, mark: Any, + ) -> None: + self.token_number = token_number + self.required = required + self.index = index + self.line = line + self.column = column + self.mark = mark + + +class Scanner: + def __init__(self, loader: Any = None) -> None: + """Initialize the scanner.""" + # It is assumed that Scanner and Reader will have a common descendant. + # Reader do the dirty work of checking for BOM and converting the + # input data to Unicode. It also adds NUL to the end. + # + # Reader supports the following methods + # self.peek(i=0) # peek the next i-th character + # self.prefix(l=1) # peek the next l characters + # self.forward(l=1) # read the next l characters and move the pointer + + self.loader = loader + if self.loader is not None and getattr(self.loader, '_scanner', None) is None: + self.loader._scanner = self + self.reset_scanner() + self.first_time = False + + @property + def flow_level(self) -> int: + return len(self.flow_context) + + def reset_scanner(self) -> None: + # Had we reached the end of the stream? + self.done = False + + # flow_context is an expanding/shrinking list consisting of '{' and '[' + # for each unclosed flow context. If empty list that means block context + self.flow_context: List[Text] = [] + + # List of processed tokens that are not yet emitted. + self.tokens: List[Any] = [] + + # Add the STREAM-START token. + self.fetch_stream_start() + + # Number of tokens that were emitted through the `get_token` method. + self.tokens_taken = 0 + + # The current indentation level. + self.indent = -1 + + # Past indentation levels. + self.indents: List[int] = [] + + # Variables related to simple keys treatment. + + # A simple key is a key that is not denoted by the '?' indicator. + # Example of simple keys: + # --- + # block simple key: value + # ? not a simple key: + # : { flow simple key: value } + # We emit the KEY token before all keys, so when we find a potential + # simple key, we try to locate the corresponding ':' indicator. + # Simple keys should be limited to a single line and 1024 characters. + + # Can a simple key start at the current position? A simple key may + # start: + # - at the beginning of the line, not counting indentation spaces + # (in block context), + # - after '{', '[', ',' (in the flow context), + # - after '?', ':', '-' (in the block context). + # In the block context, this flag also signifies if a block collection + # may start at the current position. + self.allow_simple_key = True + + # Keep track of possible simple keys. This is a dictionary. The key + # is `flow_level`; there can be no more that one possible simple key + # for each level. The value is a SimpleKey record: + # (token_number, required, index, line, column, mark) + # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow), + # '[', or '{' tokens. + self.possible_simple_keys: Dict[Any, Any] = {} + self.yaml_version: Any = None + self.tag_directives: List[Tuple[Any, Any]] = [] + + @property + def reader(self) -> Any: + try: + return self._scanner_reader # type: ignore + except AttributeError: + if hasattr(self.loader, 'typ'): + self._scanner_reader = self.loader.reader + else: + self._scanner_reader = self.loader._reader + return self._scanner_reader + + @property + def scanner_processing_version(self) -> Any: # prefix until un-composited + if hasattr(self.loader, 'typ'): + return self.loader.resolver.processing_version + return self.loader.processing_version + + # Public methods. + + def check_token(self, *choices: Any) -> bool: + # Check if the next token is one of the given types. + while self.need_more_tokens(): + self.fetch_more_tokens() + if len(self.tokens) > 0: + if not choices: + return True + for choice in choices: + if isinstance(self.tokens[0], choice): + return True + return False + + def peek_token(self) -> Any: + # Return the next token, but do not delete if from the queue. + while self.need_more_tokens(): + self.fetch_more_tokens() + if len(self.tokens) > 0: + return self.tokens[0] + + def get_token(self) -> Any: + # Return the next token. + while self.need_more_tokens(): + self.fetch_more_tokens() + if len(self.tokens) > 0: + self.tokens_taken += 1 + return self.tokens.pop(0) + + # Private methods. + + def need_more_tokens(self) -> bool: + if self.done: + return False + if len(self.tokens) == 0: + return True + # The current token may be a potential simple key, so we + # need to look further. + self.stale_possible_simple_keys() + if self.next_possible_simple_key() == self.tokens_taken: + return True + return False + + def fetch_comment(self, comment: Any) -> None: + raise NotImplementedError + + def fetch_more_tokens(self) -> Any: + # Eat whitespaces and comments until we reach the next token. + comment = self.scan_to_next_token() + if comment is not None: # never happens for base scanner + return self.fetch_comment(comment) + # Remove obsolete possible simple keys. + self.stale_possible_simple_keys() + + # Compare the current indentation and column. It may add some tokens + # and decrease the current indentation level. + self.unwind_indent(self.reader.column) + + # Peek the next character. + ch = self.reader.peek() + + # Is it the end of stream? + if ch == '\0': + return self.fetch_stream_end() + + # Is it a directive? + if ch == '%' and self.check_directive(): + return self.fetch_directive() + + # Is it the document start? + if ch == '-' and self.check_document_start(): + return self.fetch_document_start() + + # Is it the document end? + if ch == '.' and self.check_document_end(): + return self.fetch_document_end() + + # TODO: support for BOM within a stream. + # if ch == '\uFEFF': + # return self.fetch_bom() <-- issue BOMToken + + # Note: the order of the following checks is NOT significant. + + # Is it the flow sequence start indicator? + if ch == '[': + return self.fetch_flow_sequence_start() + + # Is it the flow mapping start indicator? + if ch == '{': + return self.fetch_flow_mapping_start() + + # Is it the flow sequence end indicator? + if ch == ']': + return self.fetch_flow_sequence_end() + + # Is it the flow mapping end indicator? + if ch == '}': + return self.fetch_flow_mapping_end() + + # Is it the flow entry indicator? + if ch == ',': + return self.fetch_flow_entry() + + # Is it the block entry indicator? + if ch == '-' and self.check_block_entry(): + return self.fetch_block_entry() + + # Is it the key indicator? + if ch == '?' and self.check_key(): + return self.fetch_key() + + # Is it the value indicator? + if ch == ':' and self.check_value(): + return self.fetch_value() + + # Is it an alias? + if ch == '*': + return self.fetch_alias() + + # Is it an anchor? + if ch == '&': + return self.fetch_anchor() + + # Is it a tag? + if ch == '!': + return self.fetch_tag() + + # Is it a literal scalar? + if ch == '|' and not self.flow_level: + return self.fetch_literal() + + # Is it a folded scalar? + if ch == '>' and not self.flow_level: + return self.fetch_folded() + + # Is it a single quoted scalar? + if ch == "'": + return self.fetch_single() + + # Is it a double quoted scalar? + if ch == '"': + return self.fetch_double() + + # It must be a plain scalar then. + if self.check_plain(): + return self.fetch_plain() + + # No? It's an error. Let's produce a nice error message. + raise ScannerError( + 'while scanning for the next token', + None, + f'found character {ch!r} that cannot start any token', + self.reader.get_mark(), + ) + + # Simple keys treatment. + + def next_possible_simple_key(self) -> Any: + # Return the number of the nearest possible simple key. Actually we + # don't need to loop through the whole dictionary. We may replace it + # with the following code: + # if not self.possible_simple_keys: + # return None + # return self.possible_simple_keys[ + # min(self.possible_simple_keys.keys())].token_number + min_token_number = None + for level in self.possible_simple_keys: + key = self.possible_simple_keys[level] + if min_token_number is None or key.token_number < min_token_number: + min_token_number = key.token_number + return min_token_number + + def stale_possible_simple_keys(self) -> None: + # Remove entries that are no longer possible simple keys. According to + # the YAML specification, simple keys + # - should be limited to a single line, + # - should be no longer than 1024 characters. + # Disabling this procedure will allow simple keys of any length and + # height (may cause problems if indentation is broken though). + for level in list(self.possible_simple_keys): + key = self.possible_simple_keys[level] + if key.line != self.reader.line or self.reader.index - key.index > 1024: + if key.required: + raise ScannerError( + 'while scanning a simple key', + key.mark, + "could not find expected ':'", + self.reader.get_mark(), + ) + del self.possible_simple_keys[level] + + def save_possible_simple_key(self) -> None: + # The next token may start a simple key. We check if it's possible + # and save its position. This function is called for + # ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'. + + # Check if a simple key is required at the current position. + required = not self.flow_level and self.indent == self.reader.column + + # The next token might be a simple key. Let's save it's number and + # position. + if self.allow_simple_key: + self.remove_possible_simple_key() + token_number = self.tokens_taken + len(self.tokens) + key = SimpleKey( + token_number, + required, + self.reader.index, + self.reader.line, + self.reader.column, + self.reader.get_mark(), + ) + self.possible_simple_keys[self.flow_level] = key + + def remove_possible_simple_key(self) -> None: + # Remove the saved possible key position at the current flow level. + if self.flow_level in self.possible_simple_keys: + key = self.possible_simple_keys[self.flow_level] + + if key.required: + raise ScannerError( + 'while scanning a simple key', + key.mark, + "could not find expected ':'", + self.reader.get_mark(), + ) + + del self.possible_simple_keys[self.flow_level] + + # Indentation functions. + + def unwind_indent(self, column: Any) -> None: + # In flow context, tokens should respect indentation. + # Actually the condition should be `self.indent >= column` according to + # the spec. But this condition will prohibit intuitively correct + # constructions such as + # key : { + # } + # #### + # if self.flow_level and self.indent > column: + # raise ScannerError(None, None, + # "invalid intendation or unclosed '[' or '{'", + # self.reader.get_mark()) + + # In the flow context, indentation is ignored. We make the scanner less + # restrictive then specification requires. + if bool(self.flow_level): + return + + # In block context, we may need to issue the BLOCK-END tokens. + while self.indent > column: + mark = self.reader.get_mark() + self.indent = self.indents.pop() + self.tokens.append(tokens.BlockEndToken(mark, mark)) + + def add_indent(self, column: int) -> bool: + # Check if we need to increase indentation. + if self.indent < column: + self.indents.append(self.indent) + self.indent = column + return True + return False + + # Fetchers. + + def fetch_stream_start(self) -> None: + # We always add STREAM-START as the first token and STREAM-END as the + # last token. + # Read the token. + mark = self.reader.get_mark() + # Add STREAM-START. + self.tokens.append(tokens.StreamStartToken(mark, mark, encoding=self.reader.encoding)) + + def fetch_stream_end(self) -> None: + # Set the current intendation to -1. + self.unwind_indent(-1) + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + self.possible_simple_keys = {} + # Read the token. + mark = self.reader.get_mark() + # Add STREAM-END. + self.tokens.append(tokens.StreamEndToken(mark, mark)) + # The steam is finished. + self.done = True + + def fetch_directive(self) -> None: + # Set the current intendation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Scan and add DIRECTIVE. + self.tokens.append(self.scan_directive()) + + def fetch_document_start(self) -> None: + self.fetch_document_indicator(tokens.DocumentStartToken) + + def fetch_document_end(self) -> None: + self.fetch_document_indicator(tokens.DocumentEndToken) + + def fetch_document_indicator(self, TokenClass: Any) -> None: + # Set the current intendation to -1. + self.unwind_indent(-1) + + # Reset simple keys. Note that there could not be a block collection + # after '---'. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Add DOCUMENT-START or DOCUMENT-END. + start_mark = self.reader.get_mark() + self.reader.forward(3) + end_mark = self.reader.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_start(self) -> None: + self.fetch_flow_collection_start(tokens.FlowSequenceStartToken, to_push='[') + + def fetch_flow_mapping_start(self) -> None: + self.fetch_flow_collection_start(tokens.FlowMappingStartToken, to_push='{') + + def fetch_flow_collection_start(self, TokenClass: Any, to_push: Text) -> None: + # '[' and '{' may start a simple key. + self.save_possible_simple_key() + # Increase the flow level. + self.flow_context.append(to_push) + # Simple keys are allowed after '[' and '{'. + self.allow_simple_key = True + # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START. + start_mark = self.reader.get_mark() + self.reader.forward() + end_mark = self.reader.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_end(self) -> None: + self.fetch_flow_collection_end(tokens.FlowSequenceEndToken) + + def fetch_flow_mapping_end(self) -> None: + self.fetch_flow_collection_end(tokens.FlowMappingEndToken) + + def fetch_flow_collection_end(self, TokenClass: Any) -> None: + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + # Decrease the flow level. + try: + popped = self.flow_context.pop() # NOQA + except IndexError: + # We must not be in a list or object. + # Defer error handling to the parser. + pass + # No simple keys after ']' or '}'. + self.allow_simple_key = False + # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END. + start_mark = self.reader.get_mark() + self.reader.forward() + end_mark = self.reader.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_entry(self) -> None: + # Simple keys are allowed after ','. + self.allow_simple_key = True + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + # Add FLOW-ENTRY. + start_mark = self.reader.get_mark() + self.reader.forward() + end_mark = self.reader.get_mark() + self.tokens.append(tokens.FlowEntryToken(start_mark, end_mark)) + + def fetch_block_entry(self) -> None: + # Block context needs additional checks. + if not self.flow_level: + # Are we allowed to start a new entry? + if not self.allow_simple_key: + raise ScannerError( + None, + None, + 'sequence entries are not allowed here', + self.reader.get_mark(), + ) + # We may need to add BLOCK-SEQUENCE-START. + if self.add_indent(self.reader.column): + mark = self.reader.get_mark() + self.tokens.append(tokens.BlockSequenceStartToken(mark, mark)) + # It's an error for the block entry to occur in the flow context, + # but we let the parser detect this. + else: + pass + # Simple keys are allowed after '-'. + self.allow_simple_key = True + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add BLOCK-ENTRY. + start_mark = self.reader.get_mark() + self.reader.forward() + end_mark = self.reader.get_mark() + self.tokens.append(tokens.BlockEntryToken(start_mark, end_mark)) + + def fetch_key(self) -> None: + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a key (not nessesary a simple)? + if not self.allow_simple_key: + raise ScannerError( + None, None, 'mapping keys are not allowed here', self.reader.get_mark(), + ) + + # We may need to add BLOCK-MAPPING-START. + if self.add_indent(self.reader.column): + mark = self.reader.get_mark() + self.tokens.append(tokens.BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after '?' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add KEY. + start_mark = self.reader.get_mark() + self.reader.forward() + end_mark = self.reader.get_mark() + self.tokens.append(tokens.KeyToken(start_mark, end_mark)) + + def fetch_value(self) -> None: + # Do we determine a simple key? + if self.flow_level in self.possible_simple_keys: + # Add KEY. + key = self.possible_simple_keys[self.flow_level] + del self.possible_simple_keys[self.flow_level] + self.tokens.insert( + key.token_number - self.tokens_taken, tokens.KeyToken(key.mark, key.mark), + ) + + # If this key starts a new block mapping, we need to add + # BLOCK-MAPPING-START. + if not self.flow_level: + if self.add_indent(key.column): + self.tokens.insert( + key.token_number - self.tokens_taken, + tokens.BlockMappingStartToken(key.mark, key.mark), + ) + + # There cannot be two simple keys one after another. + self.allow_simple_key = False + + # It must be a part of a complex key. + else: + + # Block context needs additional checks. + # (Do we really need them? They will be caught by the parser + # anyway.) + if not self.flow_level: + + # We are allowed to start a complex value if and only if + # we can start a simple key. + if not self.allow_simple_key: + raise ScannerError( + None, + None, + 'mapping values are not allowed here', + self.reader.get_mark(), + ) + + # If this value starts a new block mapping, we need to add + # BLOCK-MAPPING-START. It will be detected as an error later by + # the parser. + if not self.flow_level: + if self.add_indent(self.reader.column): + mark = self.reader.get_mark() + self.tokens.append(tokens.BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after ':' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add VALUE. + start_mark = self.reader.get_mark() + self.reader.forward() + end_mark = self.reader.get_mark() + self.tokens.append(tokens.ValueToken(start_mark, end_mark)) + + def fetch_alias(self) -> None: + # ALIAS could be a simple key. + self.save_possible_simple_key() + # No simple keys after ALIAS. + self.allow_simple_key = False + # Scan and add ALIAS. + self.tokens.append(self.scan_anchor(tokens.AliasToken)) + + def fetch_anchor(self) -> None: + # ANCHOR could start a simple key. + self.save_possible_simple_key() + # No simple keys after ANCHOR. + self.allow_simple_key = False + # Scan and add ANCHOR. + self.tokens.append(self.scan_anchor(tokens.AnchorToken)) + + def fetch_tag(self) -> None: + # TAG could start a simple key. + self.save_possible_simple_key() + # No simple keys after TAG. + self.allow_simple_key = False + # Scan and add TAG. + self.tokens.append(self.scan_tag()) + + def fetch_literal(self) -> None: + self.fetch_block_scalar(style='|') + + def fetch_folded(self) -> None: + self.fetch_block_scalar(style='>') + + def fetch_block_scalar(self, style: Any) -> None: + # A simple key may follow a block scalar. + self.allow_simple_key = True + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + # Scan and add SCALAR. + self.tokens.append(self.scan_block_scalar(style)) + + def fetch_single(self) -> None: + self.fetch_flow_scalar(style="'") + + def fetch_double(self) -> None: + self.fetch_flow_scalar(style='"') + + def fetch_flow_scalar(self, style: Any) -> None: + # A flow scalar could be a simple key. + self.save_possible_simple_key() + # No simple keys after flow scalars. + self.allow_simple_key = False + # Scan and add SCALAR. + self.tokens.append(self.scan_flow_scalar(style)) + + def fetch_plain(self) -> None: + # A plain scalar could be a simple key. + self.save_possible_simple_key() + # No simple keys after plain scalars. But note that `scan_plain` will + # change this flag if the scan is finished at the beginning of the + # line. + self.allow_simple_key = False + # Scan and add SCALAR. May change `allow_simple_key`. + self.tokens.append(self.scan_plain()) + + # Checkers. + + def check_directive(self) -> Any: + # DIRECTIVE: ^ '%' ... + # The '%' indicator is already checked. + if self.reader.column == 0: + return True + return None + + def check_document_start(self) -> Any: + # DOCUMENT-START: ^ '---' (' '|'\n') + if self.reader.column == 0: + if self.reader.prefix(3) == '---' and self.reader.peek(3) in _THE_END_SPACE_TAB: + return True + return None + + def check_document_end(self) -> Any: + # DOCUMENT-END: ^ '...' (' '|'\n') + if self.reader.column == 0: + if self.reader.prefix(3) == '...' and self.reader.peek(3) in _THE_END_SPACE_TAB: + return True + return None + + def check_block_entry(self) -> Any: + # BLOCK-ENTRY: '-' (' '|'\n') + return self.reader.peek(1) in _THE_END_SPACE_TAB + + def check_key(self) -> Any: + # KEY(flow context): '?' + if bool(self.flow_level): + return True + # KEY(block context): '?' (' '|'\n') + return self.reader.peek(1) in _THE_END_SPACE_TAB + + def check_value(self) -> Any: + # VALUE(flow context): ':' + if self.scanner_processing_version == (1, 1): + if bool(self.flow_level): + return True + else: + if bool(self.flow_level): + if self.flow_context[-1] == '[': + if self.reader.peek(1) not in _THE_END_SPACE_TAB: + return False + elif self.tokens and isinstance(self.tokens[-1], tokens.ValueToken): + # mapping flow context scanning a value token + if self.reader.peek(1) not in _THE_END_SPACE_TAB: + return False + return True + # VALUE(block context): ':' (' '|'\n') + return self.reader.peek(1) in _THE_END_SPACE_TAB + + def check_plain(self) -> Any: + # A plain scalar may start with any non-space character except: + # '-', '?', ':', ',', '[', ']', '{', '}', + # '#', '&', '*', '!', '|', '>', '\'', '\"', + # '%', '@', '`'. + # + # It may also start with + # '-', '?', ':' + # if it is followed by a non-space character. + # + # Note that we limit the last rule to the block context (except the + # '-' character) because we want the flow context to be space + # independent. + srp = self.reader.peek + ch = srp() + if self.scanner_processing_version == (1, 1): + return ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'"%@`' or ( + srp(1) not in _THE_END_SPACE_TAB + and (ch == '-' or (not self.flow_level and ch in '?:')) + ) + # YAML 1.2 + if ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'"%@`': + # ################### ^ ??? + return True + ch1 = srp(1) + if ch == '-' and ch1 not in _THE_END_SPACE_TAB: + return True + if ch == ':' and bool(self.flow_level) and ch1 not in _SPACE_TAB: + return True + + return srp(1) not in _THE_END_SPACE_TAB and ( + ch == '-' or (not self.flow_level and ch in '?:') + ) + + # Scanners. + + def scan_to_next_token(self) -> Any: + # We ignore spaces, line breaks and comments. + # If we find a line break in the block context, we set the flag + # `allow_simple_key` on. + # The byte order mark is stripped if it's the first character in the + # stream. We do not yet support BOM inside the stream as the + # specification requires. Any such mark will be considered as a part + # of the document. + # + # TODO: We need to make tab handling rules more sane. A good rule is + # Tabs cannot precede tokens + # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, + # KEY(block), VALUE(block), BLOCK-ENTRY + # So the checking code is + # if : + # self.allow_simple_keys = False + # We also need to add the check for `allow_simple_keys == True` to + # `unwind_indent` before issuing BLOCK-END. + # Scanners for block, flow, and plain scalars need to be modified. + srp = self.reader.peek + srf = self.reader.forward + if self.reader.index == 0 and srp() == '\uFEFF': + srf() + found = False + _the_end = _THE_END + white_space = ' \t' if self.flow_level > 0 else ' ' + while not found: + while srp() in white_space: + srf() + if srp() == '#': + while srp() not in _the_end: + srf() + if self.scan_line_break(): + if not self.flow_level: + self.allow_simple_key = True + else: + found = True + return None + + def scan_directive(self) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + start_mark = self.reader.get_mark() + srf() + name = self.scan_directive_name(start_mark) + value = None + if name == 'YAML': + value = self.scan_yaml_directive_value(start_mark) + end_mark = self.reader.get_mark() + elif name == 'TAG': + value = self.scan_tag_directive_value(start_mark) + end_mark = self.reader.get_mark() + else: + end_mark = self.reader.get_mark() + while srp() not in _THE_END: + srf() + self.scan_directive_ignored_line(start_mark) + return tokens.DirectiveToken(name, value, start_mark, end_mark) + + def scan_directive_name(self, start_mark: Any) -> Any: + # See the specification for details. + length = 0 + srp = self.reader.peek + ch = srp(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' or ch in '-_:.': + length += 1 + ch = srp(length) + if not length: + raise ScannerError( + 'while scanning a directive', + start_mark, + f'expected alphabetic or numeric character, but found {ch!r}', + self.reader.get_mark(), + ) + value = self.reader.prefix(length) + self.reader.forward(length) + ch = srp() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError( + 'while scanning a directive', + start_mark, + f'expected alphabetic or numeric character, but found {ch!r}', + self.reader.get_mark(), + ) + return value + + def scan_yaml_directive_value(self, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + while srp() == ' ': + srf() + major = self.scan_yaml_directive_number(start_mark) + if srp() != '.': + raise ScannerError( + 'while scanning a directive', + start_mark, + f"expected a digit or '.', but found {srp()!r}", + self.reader.get_mark(), + ) + srf() + minor = self.scan_yaml_directive_number(start_mark) + if srp() not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError( + 'while scanning a directive', + start_mark, + f"expected a digit or '.', but found {srp()!r}", + self.reader.get_mark(), + ) + self.yaml_version = (major, minor) + self.loader.doc_infos[-1].doc_version = Version(major, minor) + return self.yaml_version + + def scan_yaml_directive_number(self, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + ch = srp() + if not ('0' <= ch <= '9'): + raise ScannerError( + 'while scanning a directive', + start_mark, + f'expected a digit, but found {ch!r}', + self.reader.get_mark(), + ) + length = 0 + while '0' <= srp(length) <= '9': + length += 1 + value = int(self.reader.prefix(length)) + srf(length) + return value + + def scan_tag_directive_value(self, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + while srp() == ' ': + srf() + handle = self.scan_tag_directive_handle(start_mark) + while srp() == ' ': + srf() + prefix = self.scan_tag_directive_prefix(start_mark) + ret_val = (handle, prefix) + self.tag_directives.append(ret_val) + return ret_val + + def scan_tag_directive_handle(self, start_mark: Any) -> Any: + # See the specification for details. + value = self.scan_tag_handle('directive', start_mark) + ch = self.reader.peek() + if ch != ' ': + raise ScannerError( + 'while scanning a directive', + start_mark, + f"expected ' ', but found {ch!r}", + self.reader.get_mark(), + ) + return value + + def scan_tag_directive_prefix(self, start_mark: Any) -> Any: + # See the specification for details. + value = self.scan_tag_uri('directive', start_mark) + ch = self.reader.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError( + 'while scanning a directive', + start_mark, + f"expected ' ', but found {ch!r}", + self.reader.get_mark(), + ) + return value + + def scan_directive_ignored_line(self, start_mark: Any) -> None: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + while srp() == ' ': + srf() + if srp() == '#': + while srp() not in _THE_END: + srf() + ch = srp() + if ch not in _THE_END: + raise ScannerError( + 'while scanning a directive', + start_mark, + f'expected a comment or a line break, but found {ch!r}', + self.reader.get_mark(), + ) + self.scan_line_break() + + def scan_anchor(self, TokenClass: Any) -> Any: + # The specification does not restrict characters for anchors and + # aliases. This may lead to problems, for instance, the document: + # [ *alias, value ] + # can be interpteted in two ways, as + # [ "value" ] + # and + # [ *alias , "value" ] + # Therefore we restrict aliases to numbers and ASCII letters. + srp = self.reader.peek + start_mark = self.reader.get_mark() + indicator = srp() + if indicator == '*': + name = 'alias' + else: + name = 'anchor' + self.reader.forward() + length = 0 + ch = srp(length) + # while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + # or ch in '-_': + while check_anchorname_char(ch): + length += 1 + ch = srp(length) + if not length: + raise ScannerError( + f'while scanning an {name!s}', + start_mark, + f'expected alphabetic or numeric character, but found {ch!r}', + self.reader.get_mark(), + ) + value = self.reader.prefix(length) + self.reader.forward(length) + # ch1 = ch + # ch = srp() # no need to peek, ch is already set + # assert ch1 == ch + if ch not in '\0 \t\r\n\x85\u2028\u2029?:,[]{}%@`': + raise ScannerError( + f'while scanning an {name!s}', + start_mark, + f'expected alphabetic or numeric character, but found {ch!r}', + self.reader.get_mark(), + ) + end_mark = self.reader.get_mark() + return TokenClass(value, start_mark, end_mark) + + def scan_tag(self) -> Any: + # See the specification for details. + srp = self.reader.peek + start_mark = self.reader.get_mark() + ch = srp(1) + short_handle = '!' + if ch == '!': + short_handle = '!!' + self.reader.forward() + srp = self.reader.peek + ch = srp(1) + + if ch == '<': + handle = None + self.reader.forward(2) + suffix = self.scan_tag_uri('tag', start_mark) + if srp() != '>': + raise ScannerError( + 'while parsing a tag', + start_mark, + f"expected '>' but found {srp()!r}", + self.reader.get_mark(), + ) + self.reader.forward() + elif ch in _THE_END_SPACE_TAB: + handle = None + suffix = short_handle + self.reader.forward() + else: + length = 1 + use_handle = False + while ch not in '\0 \r\n\x85\u2028\u2029': + if ch == '!': + use_handle = True + break + length += 1 + ch = srp(length) + handle = short_handle + if use_handle: + handle = self.scan_tag_handle('tag', start_mark) + else: + handle = short_handle + self.reader.forward() + suffix = self.scan_tag_uri('tag', start_mark) + ch = srp() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError( + 'while scanning a tag', + start_mark, + f"expected ' ', but found {ch!r}", + self.reader.get_mark(), + ) + value = (handle, suffix) + end_mark = self.reader.get_mark() + return tokens.TagToken(value, start_mark, end_mark) + + def scan_block_scalar(self, style: Any, rt: Optional[bool] = False) -> Any: + # See the specification for details. + srp = self.reader.peek + if style == '>': + folded = True + else: + folded = False + + chunks: List[Any] = [] + start_mark = self.reader.get_mark() + + # Scan the header. + self.reader.forward() + chomping, increment = self.scan_block_scalar_indicators(start_mark) + # block scalar comment e.g. : |+ # comment text + block_scalar_comment = self.scan_block_scalar_ignored_line(start_mark) + + # Determine the indentation level and go to the first non-empty line. + min_indent = self.indent + 1 + if increment is None: + # no increment and top level, min_indent could be 0 + if min_indent < 1 and ( + style not in '|>' + or (self.scanner_processing_version == (1, 1)) + and getattr( + self.loader, 'top_level_block_style_scalar_no_indent_error_1_1', False, + ) + ): + min_indent = 1 + breaks, max_indent, end_mark = self.scan_block_scalar_indentation() + indent = max(min_indent, max_indent) + else: + if min_indent < 1: + min_indent = 1 + indent = min_indent + increment - 1 + breaks, end_mark = self.scan_block_scalar_breaks(indent) + line_break = "" + + # Scan the inner part of the block scalar. + while self.reader.column == indent and srp() != '\0': + chunks.extend(breaks) + leading_non_space = srp() not in ' \t' + length = 0 + while srp(length) not in _THE_END: + length += 1 + chunks.append(self.reader.prefix(length)) + self.reader.forward(length) + line_break = self.scan_line_break() + breaks, end_mark = self.scan_block_scalar_breaks(indent) + if style in '|>' and min_indent == 0: + # at the beginning of a line, if in block style see if + # end of document/start_new_document + if self.check_document_start() or self.check_document_end(): + break + if self.reader.column == indent and srp() != '\0': + + # Unfortunately, folding rules are ambiguous. + # + # This is the folding according to the specification: + + if rt and folded and line_break == '\n': + chunks.append('\a') + if folded and line_break == '\n' and leading_non_space and srp() not in ' \t': + if not breaks: + chunks.append(' ') + else: + chunks.append(line_break) + + # This is Clark Evans's interpretation (also in the spec + # examples): + # + # if folded and line_break == '\n': + # if not breaks: + # if srp() not in ' \t': + # chunks.append(' ') + # else: + # chunks.append(line_break) + # else: + # chunks.append(line_break) + else: + break + + # Process trailing line breaks. The 'chomping' setting determines + # whether they are included in the value. + trailing: List[Any] = [] + if chomping in [None, True]: + chunks.append(line_break) + if chomping is True: + chunks.extend(breaks) + elif chomping in [None, False]: + trailing.extend(breaks) + + # We are done. + token = tokens.ScalarToken("".join(chunks), False, start_mark, end_mark, style) + if self.loader is not None: + comment_handler = getattr(self.loader, 'comment_handling', False) + if comment_handler is None: + if block_scalar_comment is not None: + token.add_pre_comments([block_scalar_comment]) + if len(trailing) > 0: + # Eat whitespaces and comments until we reach the next token. + if self.loader is not None: + comment_handler = getattr(self.loader, 'comment_handling', None) + if comment_handler is not None: + line = end_mark.line - len(trailing) + for x in trailing: + assert x[-1] == '\n' + self.comments.add_blank_line(x, 0, line) # type: ignore + line += 1 + comment = self.scan_to_next_token() + while comment: + trailing.append(' ' * comment[1].column + comment[0]) + comment = self.scan_to_next_token() + if self.loader is not None: + comment_handler = getattr(self.loader, 'comment_handling', False) + if comment_handler is None: + # Keep track of the trailing whitespace and following comments + # as a comment token, if isn't all included in the actual value. + comment_end_mark = self.reader.get_mark() + comment = tokens.CommentToken("".join(trailing), + end_mark, + comment_end_mark) + token.add_post_comment(comment) + return token + + def scan_block_scalar_indicators(self, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + chomping = None + increment = None + ch = srp() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.reader.forward() + ch = srp() + if ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError( + 'while scanning a block scalar', + start_mark, + 'expected indentation indicator in the range 1-9, ' 'but found 0', + self.reader.get_mark(), + ) + self.reader.forward() + elif ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError( + 'while scanning a block scalar', + start_mark, + 'expected indentation indicator in the range 1-9, ' 'but found 0', + self.reader.get_mark(), + ) + self.reader.forward() + ch = srp() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.reader.forward() + ch = srp() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError( + 'while scanning a block scalar', + start_mark, + f'expected chomping or indentation indicators, but found {ch!r}', + self.reader.get_mark(), + ) + return chomping, increment + + def scan_block_scalar_ignored_line(self, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + prefix = '' + comment = None + while srp() == ' ': + prefix += srp() + srf() + if srp() == '#': + comment = prefix + while srp() not in _THE_END: + comment += srp() + srf() + ch = srp() + if ch not in _THE_END: + raise ScannerError( + 'while scanning a block scalar', + start_mark, + f'expected a comment or a line break, but found {ch!r}', + self.reader.get_mark(), + ) + self.scan_line_break() + return comment + + def scan_block_scalar_indentation(self) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + chunks = [] + first_indent = -1 + max_indent = 0 + end_mark = self.reader.get_mark() + while srp() in ' \r\n\x85\u2028\u2029': + if srp() != ' ': + if first_indent < 0: + first_indent = self.reader.column + chunks.append(self.scan_line_break()) + end_mark = self.reader.get_mark() + else: + srf() + if self.reader.column > max_indent: + max_indent = self.reader.column + if first_indent > 0 and max_indent > first_indent: + start_mark = self.reader.get_mark() + raise ScannerError( + 'more indented follow up line than first in a block scalar', start_mark, + ) + return chunks, max_indent, end_mark + + def scan_block_scalar_breaks(self, indent: int) -> Any: + # See the specification for details. + chunks = [] + srp = self.reader.peek + srf = self.reader.forward + end_mark = self.reader.get_mark() + while self.reader.column < indent and srp() == ' ': + srf() + while srp() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + end_mark = self.reader.get_mark() + while self.reader.column < indent and srp() == ' ': + srf() + return chunks, end_mark + + def scan_flow_scalar(self, style: Any) -> Any: + # See the specification for details. + # Note that we loose indentation rules for quoted scalars. Quoted + # scalars don't need to adhere indentation because " and ' clearly + # mark the beginning and the end of them. Therefore we are less + # restrictive then the specification requires. We only need to check + # that document separators are not included in scalars. + if style == '"': + double = True + else: + double = False + srp = self.reader.peek + chunks: List[Any] = [] + start_mark = self.reader.get_mark() + quote = srp() + self.reader.forward() + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + while srp() != quote: + chunks.extend(self.scan_flow_scalar_spaces(double, start_mark)) + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + self.reader.forward() + end_mark = self.reader.get_mark() + return tokens.ScalarToken("".join(chunks), False, start_mark, end_mark, style) + + ESCAPE_REPLACEMENTS = { + '0': '\0', + 'a': '\x07', + 'b': '\x08', + 't': '\x09', + '\t': '\x09', + 'n': '\x0A', + 'v': '\x0B', + 'f': '\x0C', + 'r': '\x0D', + 'e': '\x1B', + ' ': '\x20', + '"': '"', + '/': '/', # as per http://www.json.org/ + '\\': '\\', + 'N': '\x85', + '_': '\xA0', + 'L': '\u2028', + 'P': '\u2029', + } + + ESCAPE_CODES = {'x': 2, 'u': 4, 'U': 8} + + def scan_flow_scalar_non_spaces(self, double: Any, start_mark: Any) -> Any: + # See the specification for details. + chunks: List[Any] = [] + srp = self.reader.peek + srf = self.reader.forward + while True: + length = 0 + while srp(length) not in ' \n\'"\\\0\t\r\x85\u2028\u2029': + length += 1 + if length != 0: + chunks.append(self.reader.prefix(length)) + srf(length) + ch = srp() + if not double and ch == "'" and srp(1) == "'": + chunks.append("'") + srf(2) + elif (double and ch == "'") or (not double and ch in '"\\'): + chunks.append(ch) + srf() + elif double and ch == '\\': + srf() + ch = srp() + if ch in self.ESCAPE_REPLACEMENTS: + chunks.append(self.ESCAPE_REPLACEMENTS[ch]) + srf() + elif ch in self.ESCAPE_CODES: + length = self.ESCAPE_CODES[ch] + srf() + for k in range(length): + if srp(k) not in '0123456789ABCDEFabcdef': + raise ScannerError( + 'while scanning a double-quoted scalar', + start_mark, + f'expected escape sequence of {length:d} ' + f'hexdecimal numbers, but found {srp(k)!r}', + self.reader.get_mark(), + ) + code = int(self.reader.prefix(length), 16) + chunks.append(chr(code)) + srf(length) + elif ch in '\n\r\x85\u2028\u2029': + self.scan_line_break() + chunks.extend(self.scan_flow_scalar_breaks(double, start_mark)) + else: + raise ScannerError( + 'while scanning a double-quoted scalar', + start_mark, + f'found unknown escape character {ch!r}', + self.reader.get_mark(), + ) + else: + return chunks + + def scan_flow_scalar_spaces(self, double: Any, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + chunks = [] + length = 0 + while srp(length) in ' \t': + length += 1 + whitespaces = self.reader.prefix(length) + self.reader.forward(length) + ch = srp() + if ch == '\0': + raise ScannerError( + 'while scanning a quoted scalar', + start_mark, + 'found unexpected end of stream', + self.reader.get_mark(), + ) + elif ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + breaks = self.scan_flow_scalar_breaks(double, start_mark) + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + else: + chunks.append(whitespaces) + return chunks + + def scan_flow_scalar_breaks(self, double: Any, start_mark: Any) -> Any: + # See the specification for details. + chunks: List[Any] = [] + srp = self.reader.peek + srf = self.reader.forward + while True: + # Instead of checking indentation, we check for document + # separators. + prefix = self.reader.prefix(3) + if (prefix == '---' or prefix == '...') and srp(3) in _THE_END_SPACE_TAB: + raise ScannerError( + 'while scanning a quoted scalar', + start_mark, + 'found unexpected document separator', + self.reader.get_mark(), + ) + while srp() in ' \t': + srf() + if srp() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + else: + return chunks + + def scan_plain(self) -> Any: + # See the specification for details. + # We add an additional restriction for the flow context: + # plain scalars in the flow context cannot contain ',', ': ' and '?'. + # We also keep track of the `allow_simple_key` flag here. + # Indentation rules are loosed for the flow context. + srp = self.reader.peek + srf = self.reader.forward + chunks: List[Any] = [] + start_mark = self.reader.get_mark() + end_mark = start_mark + indent = self.indent + 1 + # We allow zero indentation for scalars, but then we need to check for + # document separators at the beginning of the line. + # if indent == 0: + # indent = 1 + spaces: List[Any] = [] + while True: + length = 0 + if srp() == '#': + break + while True: + ch = srp(length) + if False and ch == ':' and srp(length + 1) == ',': + break + elif ch == ':' and srp(length + 1) not in _THE_END_SPACE_TAB: + pass + elif ch == '?' and self.scanner_processing_version != (1, 1): + pass + elif ( + ch in _THE_END_SPACE_TAB + or ( + not self.flow_level + and ch == ':' + and srp(length + 1) in _THE_END_SPACE_TAB + ) + or (self.flow_level and ch in ',:?[]{}') + ): + break + length += 1 + # It's not clear what we should do with ':' in the flow context. + if ( + self.flow_level + and ch == ':' + and srp(length + 1) not in '\0 \t\r\n\x85\u2028\u2029,[]{}' + ): + srf(length) + raise ScannerError( + 'while scanning a plain scalar', + start_mark, + "found unexpected ':'", + self.reader.get_mark(), + 'Please check ' + 'http://pyyaml.org/wiki/YAMLColonInFlowContext ' + 'for details.', + ) + if length == 0: + break + self.allow_simple_key = False + chunks.extend(spaces) + chunks.append(self.reader.prefix(length)) + srf(length) + end_mark = self.reader.get_mark() + spaces = self.scan_plain_spaces(indent, start_mark) + if ( + not spaces + or srp() == '#' + or (not self.flow_level and self.reader.column < indent) + ): + break + + token = tokens.ScalarToken("".join(chunks), True, start_mark, end_mark) + # getattr provides True so C type loader, which cannot handle comment, + # will not make CommentToken + if self.loader is not None: + comment_handler = getattr(self.loader, 'comment_handling', False) + if comment_handler is None: + if spaces and spaces[0] == '\n': + # Create a comment token to preserve the trailing line breaks. + comment = tokens.CommentToken("".join(spaces) + '\n', start_mark, end_mark) + token.add_post_comment(comment) + elif comment_handler is not False: + line = start_mark.line + 1 + for ch in spaces: + if ch == '\n': + self.comments.add_blank_line('\n', 0, line) # type: ignore + line += 1 + + return token + + def scan_plain_spaces(self, indent: Any, start_mark: Any) -> Any: + # See the specification for details. + # The specification is really confusing about tabs in plain scalars. + # We just forbid them completely. Do not use tabs in YAML! + srp = self.reader.peek + srf = self.reader.forward + chunks = [] + length = 0 + while srp(length) in ' ': + length += 1 + whitespaces = self.reader.prefix(length) + self.reader.forward(length) + ch = srp() + if ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + self.allow_simple_key = True + prefix = self.reader.prefix(3) + if (prefix == '---' or prefix == '...') and srp(3) in _THE_END_SPACE_TAB: + return + breaks = [] + while srp() in ' \r\n\x85\u2028\u2029': + if srp() == ' ': + srf() + else: + breaks.append(self.scan_line_break()) + prefix = self.reader.prefix(3) + if (prefix == '---' or prefix == '...') and srp(3) in _THE_END_SPACE_TAB: + return + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + elif whitespaces: + chunks.append(whitespaces) + return chunks + + def scan_tag_handle(self, name: Any, start_mark: Any) -> Any: + # See the specification for details. + # For some strange reasons, the specification does not allow '_' in + # tag handles. I have allowed it anyway. + srp = self.reader.peek + ch = srp() + if ch != '!': + raise ScannerError( + f'while scanning an {name!s}', + start_mark, + f"expected '!', but found {ch!r}", + self.reader.get_mark(), + ) + length = 1 + ch = srp(length) + if ch != ' ': + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' or ch in '-_': + length += 1 + ch = srp(length) + if ch != '!': + self.reader.forward(length) + raise ScannerError( + f'while scanning an {name!s}', + start_mark, + f"expected '!' but found {ch!r}", + self.reader.get_mark(), + ) + length += 1 + value = self.reader.prefix(length) + self.reader.forward(length) + return value + + def scan_tag_uri(self, name: Any, start_mark: Any) -> Any: + # See the specification for details. + # Note: we do not check if URI is well-formed. + srp = self.reader.peek + chunks = [] + length = 0 + ch = srp(length) + while ( + '0' <= ch <= '9' + or 'A' <= ch <= 'Z' + or 'a' <= ch <= 'z' + or ch in "-;/?:@&=+$,_.!~*'()[]%" + or ((self.scanner_processing_version > (1, 1)) and ch == '#') + ): + if ch == '%': + chunks.append(self.reader.prefix(length)) + self.reader.forward(length) + length = 0 + chunks.append(self.scan_uri_escapes(name, start_mark)) + else: + length += 1 + ch = srp(length) + if length != 0: + chunks.append(self.reader.prefix(length)) + self.reader.forward(length) + length = 0 + if not chunks: + raise ScannerError( + f'while parsing an {name!s}', + start_mark, + f'expected URI, but found {ch!r}', + self.reader.get_mark(), + ) + return "".join(chunks) + + def scan_uri_escapes(self, name: Any, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + code_bytes: List[Any] = [] + mark = self.reader.get_mark() + while srp() == '%': + srf() + for k in range(2): + if srp(k) not in '0123456789ABCDEFabcdef': + raise ScannerError( + f'while scanning an {name!s}', + start_mark, + f'expected URI escape sequence of 2 hexdecimal numbers, ' + f'but found {srp(k)!r}', + self.reader.get_mark(), + ) + code_bytes.append(int(self.reader.prefix(2), 16)) + srf(2) + try: + value = bytes(code_bytes).decode('utf-8') + except UnicodeDecodeError as exc: + raise ScannerError(f'while scanning an {name!s}', start_mark, str(exc), mark) + return value + + def scan_line_break(self) -> Any: + # Transforms: + # '\r\n' : '\n' + # '\r' : '\n' + # '\n' : '\n' + # '\x85' : '\n' + # '\u2028' : '\u2028' + # '\u2029 : '\u2029' + # default : '' + ch = self.reader.peek() + if ch in '\r\n\x85': + if self.reader.prefix(2) == '\r\n': + self.reader.forward(2) + else: + self.reader.forward() + return '\n' + elif ch in '\u2028\u2029': + self.reader.forward() + return ch + return "" + + +class RoundTripScanner(Scanner): + def check_token(self, *choices: Any) -> bool: + # Check if the next token is one of the given types. + while self.need_more_tokens(): + self.fetch_more_tokens() + self._gather_comments() + if len(self.tokens) > 0: + if not choices: + return True + for choice in choices: + if isinstance(self.tokens[0], choice): + return True + return False + + def peek_token(self) -> Any: + # Return the next token, but do not delete if from the queue. + while self.need_more_tokens(): + self.fetch_more_tokens() + self._gather_comments() + if len(self.tokens) > 0: + return self.tokens[0] + return None + + def _gather_comments(self) -> Any: + """combine multiple comment lines and assign to next non-comment-token""" + comments: List[Any] = [] + if not self.tokens: + return comments + if isinstance(self.tokens[0], tokens.CommentToken): + comment = self.tokens.pop(0) + self.tokens_taken += 1 + comments.append(comment) + while self.need_more_tokens(): + self.fetch_more_tokens() + if not self.tokens: + return comments + if isinstance(self.tokens[0], tokens.CommentToken): + self.tokens_taken += 1 + comment = self.tokens.pop(0) + # nprint('dropping2', comment) + comments.append(comment) + if len(comments) >= 1: + self.tokens[0].add_pre_comments(comments) + # pull in post comment on e.g. ':' + if not self.done and len(self.tokens) < 2: + self.fetch_more_tokens() + + def get_token(self) -> Any: + # Return the next token. + while self.need_more_tokens(): + self.fetch_more_tokens() + self._gather_comments() + if len(self.tokens) > 0: + # nprint('tk', self.tokens) + # only add post comment to single line tokens: + # scalar, value token. FlowXEndToken, otherwise + # hidden streamtokens could get them (leave them and they will be + # pre comments for the next map/seq + if ( + len(self.tokens) > 1 + and isinstance( + self.tokens[0], + (tokens.ScalarToken, tokens.ValueToken, tokens.FlowSequenceEndToken, + tokens.FlowMappingEndToken), + ) + and isinstance(self.tokens[1], tokens.CommentToken) + and self.tokens[0].end_mark.line == self.tokens[1].start_mark.line + ): + self.tokens_taken += 1 + c = self.tokens.pop(1) + self.fetch_more_tokens() + while len(self.tokens) > 1 and isinstance(self.tokens[1], tokens.CommentToken): + self.tokens_taken += 1 + c1 = self.tokens.pop(1) + c.value = c.value + (' ' * c1.start_mark.column) + c1.value + self.fetch_more_tokens() + self.tokens[0].add_post_comment(c) + elif ( + len(self.tokens) > 1 + and isinstance(self.tokens[0], tokens.ScalarToken) + and isinstance(self.tokens[1], tokens.CommentToken) + and self.tokens[0].end_mark.line != self.tokens[1].start_mark.line + ): + self.tokens_taken += 1 + c = self.tokens.pop(1) + c.value = ( + '\n' * (c.start_mark.line - self.tokens[0].end_mark.line) + + (' ' * c.start_mark.column) + + c.value + ) + self.tokens[0].add_post_comment(c) + self.fetch_more_tokens() + while len(self.tokens) > 1 and isinstance(self.tokens[1], tokens.CommentToken): + self.tokens_taken += 1 + c1 = self.tokens.pop(1) + c.value = c.value + (' ' * c1.start_mark.column) + c1.value + self.fetch_more_tokens() + self.tokens_taken += 1 + return self.tokens.pop(0) + return None + + def fetch_comment(self, comment: Any) -> None: + value, start_mark, end_mark = comment + while value and value[-1] == ' ': + # empty line within indented key context + # no need to update end-mark, that is not used + value = value[:-1] + self.tokens.append(tokens.CommentToken(value, start_mark, end_mark)) + + # scanner + + def scan_to_next_token(self) -> Any: + # We ignore spaces, line breaks and comments. + # If we find a line break in the block context, we set the flag + # `allow_simple_key` on. + # The byte order mark is stripped if it's the first character in the + # stream. We do not yet support BOM inside the stream as the + # specification requires. Any such mark will be considered as a part + # of the document. + # + # TODO: We need to make tab handling rules more sane. A good rule is + # Tabs cannot precede tokens + # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, + # KEY(block), VALUE(block), BLOCK-ENTRY + # So the checking code is + # if : + # self.allow_simple_keys = False + # We also need to add the check for `allow_simple_keys == True` to + # `unwind_indent` before issuing BLOCK-END. + # Scanners for block, flow, and plain scalars need to be modified. + srp = self.reader.peek + srf = self.reader.forward + if self.reader.index == 0 and srp() == '\uFEFF': + srf() + found = False + white_space = ' \t' if self.flow_level > 0 else ' ' + while not found: + while srp() in white_space: + srf() + ch = srp() + if ch == '#': + start_mark = self.reader.get_mark() + comment = ch + srf() + while ch not in _THE_END: + ch = srp() + if ch == '\0': # don't gobble the end-of-stream character + # but add an explicit newline as "YAML processors should terminate + # the stream with an explicit line break + # https://yaml.org/spec/1.2/spec.html#id2780069 + comment += '\n' + break + comment += ch + srf() + # gather any blank lines following the comment + ch = self.scan_line_break() + while len(ch) > 0: + comment += ch + ch = self.scan_line_break() + end_mark = self.reader.get_mark() + if not self.flow_level: + self.allow_simple_key = True + return comment, start_mark, end_mark + if self.scan_line_break() != '': + start_mark = self.reader.get_mark() + if not self.flow_level: + self.allow_simple_key = True + ch = srp() + if ch == '\n': # empty toplevel lines + start_mark = self.reader.get_mark() + comment = "" + while ch: + ch = self.scan_line_break(empty_line=True) + comment += ch + if srp() == '#': + # empty line followed by indented real comment + comment = comment.rsplit('\n', 1)[0] + '\n' + end_mark = self.reader.get_mark() + return comment, start_mark, end_mark + else: + found = True + return None + + def scan_line_break(self, empty_line: bool = False) -> Text: + # Transforms: + # '\r\n' : '\n' + # '\r' : '\n' + # '\n' : '\n' + # '\x85' : '\n' + # '\u2028' : '\u2028' + # '\u2029 : '\u2029' + # default : '' + ch: Text = self.reader.peek() + if ch in '\r\n\x85': + if self.reader.prefix(2) == '\r\n': + self.reader.forward(2) + else: + self.reader.forward() + return '\n' + elif ch in '\u2028\u2029': + self.reader.forward() + return ch + elif empty_line and ch in '\t ': + self.reader.forward() + return ch + return "" + + def scan_block_scalar(self, style: Any, rt: Optional[bool] = True) -> Any: + return Scanner.scan_block_scalar(self, style, rt=rt) + + def scan_uri_escapes(self, name: Any, start_mark: Any) -> Any: + """ + The roundtripscanner doesn't do URI escaping + """ + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + code_bytes: List[Any] = [] + chunk = '' + mark = self.reader.get_mark() + while srp() == '%': + chunk += '%' + srf() + for k in range(2): + if srp(k) not in '0123456789ABCDEFabcdef': + raise ScannerError( + f'while scanning an {name!s}', + start_mark, + f'expected URI escape sequence of 2 hexdecimal numbers, ' + f'but found {srp(k)!r}', + self.reader.get_mark(), + ) + code_bytes.append(int(self.reader.prefix(2), 16)) + chunk += self.reader.prefix(2) + srf(2) + try: + _ = bytes(code_bytes).decode('utf-8') + except UnicodeDecodeError as exc: + raise ScannerError(f'while scanning an {name!s}', start_mark, str(exc), mark) + return chunk + + +# commenthandling 2021, differentiatiation not needed + +VALUECMNT = 0 +KEYCMNT = 0 # 1 +# TAGCMNT = 2 +# ANCHORCMNT = 3 + + +class CommentBase: + __slots__ = ('value', 'line', 'column', 'used', 'function', 'fline', 'ufun', 'uline') + + def __init__(self, value: Any, line: Any, column: Any) -> None: + self.value = value + self.line = line + self.column = column + self.used = ' ' + if _debug != 0: + import inspect + + info = inspect.getframeinfo(inspect.stack()[3][0]) + self.function = info.function + self.fline = info.lineno + self.ufun = None + self.uline = None + + def set_used(self, v: Any = '+') -> None: + self.used = v + if _debug != 0: + import inspect + + info = inspect.getframeinfo(inspect.stack()[1][0]) + self.ufun = info.function # type: ignore + self.uline = info.lineno # type: ignore + + def set_assigned(self) -> None: + self.used = '|' + + def __str__(self) -> str: + return f'{self.value}' + + def __repr__(self) -> str: + return f'{self.value!r}' + + def info(self) -> str: + xv = self.value + '"' + name = self.name # type: ignore + return ( + f'{name}{self.used} {self.line:2}:{self.column:<2} "{xv:40s} ' + f'{self.function}:{self.fline} {self.ufun}:{self.uline}' + ) + + +class EOLComment(CommentBase): + name = 'EOLC' + + def __init__(self, value: Any, line: Any, column: Any) -> None: + super().__init__(value, line, column) + + +class FullLineComment(CommentBase): + name = 'FULL' + + def __init__(self, value: Any, line: Any, column: Any) -> None: + super().__init__(value, line, column) + + +class BlankLineComment(CommentBase): + name = 'BLNK' + + def __init__(self, value: Any, line: Any, column: Any) -> None: + super().__init__(value, line, column) + + +class ScannedComments: + def __init__(self: Any) -> None: + self.comments = {} # type: ignore + self.unused = [] # type: ignore + + def add_eol_comment(self, comment: Any, column: Any, line: Any) -> Any: + # info = inspect.getframeinfo(inspect.stack()[1][0]) + if comment.count('\n') == 1: + assert comment[-1] == '\n' + else: + assert '\n' not in comment + self.comments[line] = retval = EOLComment(comment[:-1], line, column) + self.unused.append(line) + return retval + + def add_blank_line(self, comment: Any, column: Any, line: Any) -> Any: + # info = inspect.getframeinfo(inspect.stack()[1][0]) + assert comment.count('\n') == 1 and comment[-1] == '\n' + assert line not in self.comments + self.comments[line] = retval = BlankLineComment(comment[:-1], line, column) + self.unused.append(line) + return retval + + def add_full_line_comment(self, comment: Any, column: Any, line: Any) -> Any: + # info = inspect.getframeinfo(inspect.stack()[1][0]) + assert comment.count('\n') == 1 and comment[-1] == '\n' + # if comment.startswith('# C12'): + # raise + # this raises in line 2127 fro 330 + self.comments[line] = retval = FullLineComment(comment[:-1], line, column) + self.unused.append(line) + return retval + + def __getitem__(self, idx: Any) -> Any: + return self.comments[idx] + + def __str__(self) -> Any: + return ( + 'ParsedComments:\n ' + + '\n '.join((f'{lineno:2} {x.info()}' for lineno, x in self.comments.items())) + + '\n' + ) + + def last(self) -> str: + lineno, x = list(self.comments.items())[-1] + return f'{lineno:2} {x.info()}\n' + + def any_unprocessed(self) -> bool: + # ToDo: might want to differentiate based on lineno + return len(self.unused) > 0 + # for lno, comment in reversed(self.comments.items()): + # if comment.used == ' ': + # return True + # return False + + def unprocessed(self, use: Any = False) -> Any: + while len(self.unused) > 0: + if _debug != 0: + import inspect + + first = self.unused.pop(0) if use else self.unused[0] + info = inspect.getframeinfo(inspect.stack()[1][0]) + xprintf('using', first, self.comments[first].value, info.function, info.lineno) + yield first, self.comments[first] + if use: + self.comments[first].set_used() + + def assign_pre(self, token: Any) -> Any: + token_line = token.start_mark.line + if _debug != 0: + import inspect + + info = inspect.getframeinfo(inspect.stack()[1][0]) + xprintf('assign_pre', token_line, self.unused, info.function, info.lineno) + gobbled = False + while self.unused and self.unused[0] < token_line: + gobbled = True + first = self.unused.pop(0) + if _debug != 0: + xprintf('assign_pre < ', first) + self.comments[first].set_used() + token.add_comment_pre(first) + return gobbled + + def assign_eol(self, tokens: Any) -> Any: + try: + comment_line = self.unused[0] + except IndexError: + return + if not isinstance(self.comments[comment_line], EOLComment): + return + idx = 1 + while tokens[-idx].start_mark.line > comment_line or isinstance( + tokens[-idx], tokens.ValueToken, + ): + idx += 1 + if _debug != 0: + xprintf('idx1', idx) + if ( + len(tokens) > idx + and isinstance(tokens[-idx], tokens.ScalarToken) + and isinstance(tokens[-(idx + 1)], tokens.ScalarToken) + ): + return + try: + if isinstance(tokens[-idx], tokens.ScalarToken) and isinstance( + tokens[-(idx + 1)], tokens.KeyToken, + ): + try: + eol_idx = self.unused.pop(0) + self.comments[eol_idx].set_used() + if _debug != 0: + xprintf('>>>>>a', idx, eol_idx, KEYCMNT) + tokens[-idx].add_comment_eol(eol_idx, KEYCMNT) + except IndexError: + raise NotImplementedError + return + except IndexError: + if _debug != 0: + xprintf('IndexError1') + pass + try: + if isinstance(tokens[-idx], tokens.ScalarToken) and isinstance( + tokens[-(idx + 1)], (tokens.ValueToken, tokens.BlockEntryToken), + ): + try: + eol_idx = self.unused.pop(0) + self.comments[eol_idx].set_used() + tokens[-idx].add_comment_eol(eol_idx, VALUECMNT) + except IndexError: + raise NotImplementedError + return + except IndexError: + if _debug != 0: + xprintf('IndexError2') + pass + for t in tokens: + xprintf('tt-', t) + if _debug != 0: + xprintf('not implemented EOL', type(tokens[-idx])) + import sys + + sys.exit(0) + + def assign_post(self, token: Any) -> Any: + token_line = token.start_mark.line + if _debug != 0: + import inspect + + info = inspect.getframeinfo(inspect.stack()[1][0]) + xprintf('assign_post', token_line, self.unused, info.function, info.lineno) + gobbled = False + while self.unused and self.unused[0] < token_line: + gobbled = True + first = self.unused.pop(0) + if _debug != 0: + xprintf('assign_post < ', first) + self.comments[first].set_used() + token.add_comment_post(first) + return gobbled + + def str_unprocessed(self) -> Any: + return ''.join( + (f' {ind:2} {x.info()}\n' for ind, x in self.comments.items() if x.used == ' '), + ) + + +class RoundTripScannerSC(Scanner): # RoundTripScanner Split Comments + def __init__(self, *arg: Any, **kw: Any) -> None: + super().__init__(*arg, **kw) + assert self.loader is not None + # comments isinitialised on .need_more_tokens and persist on + # self.loader.parsed_comments + self.comments = None + + def get_token(self) -> Any: + # Return the next token. + while self.need_more_tokens(): + self.fetch_more_tokens() + if len(self.tokens) > 0: + if isinstance(self.tokens[0], tokens.BlockEndToken): + self.comments.assign_post(self.tokens[0]) # type: ignore + else: + self.comments.assign_pre(self.tokens[0]) # type: ignore + self.tokens_taken += 1 + return self.tokens.pop(0) + + def need_more_tokens(self) -> bool: + if self.comments is None: + self.loader.parsed_comments = self.comments = ScannedComments() # type: ignore + if self.done: + return False + if len(self.tokens) == 0: + return True + # The current token may be a potential simple key, so we + # need to look further. + self.stale_possible_simple_keys() + if self.next_possible_simple_key() == self.tokens_taken: + return True + if len(self.tokens) < 2: + return True + if self.tokens[0].start_mark.line == self.tokens[-1].start_mark.line: + return True + if True: + if _debug != 0: + xprintf('-x--', len(self.tokens)) + for t in self.tokens: + xprintf(t) + # xprintf(self.comments.last()) + xprintf(self.comments.str_unprocessed()) # type: ignore + self.comments.assign_pre(self.tokens[0]) # type: ignore + self.comments.assign_eol(self.tokens) # type: ignore + return False + + def scan_to_next_token(self) -> None: + srp = self.reader.peek + srf = self.reader.forward + if self.reader.index == 0 and srp() == '\uFEFF': + srf() + start_mark = self.reader.get_mark() + # xprintf('current_mark', start_mark.line, start_mark.column) + found = False + while not found: + while srp() == ' ': + srf() + ch = srp() + if ch == '#': + comment_start_mark = self.reader.get_mark() + comment = ch + srf() # skipt the '#' + while ch not in _THE_END: + ch = srp() + if ch == '\0': # don't gobble the end-of-stream character + # but add an explicit newline as "YAML processors should terminate + # the stream with an explicit line break + # https://yaml.org/spec/1.2/spec.html#id2780069 + comment += '\n' + break + comment += ch + srf() + # we have a comment + if start_mark.column == 0: + self.comments.add_full_line_comment( # type: ignore + comment, comment_start_mark.column, comment_start_mark.line, + ) + else: + self.comments.add_eol_comment( # type: ignore + comment, comment_start_mark.column, comment_start_mark.line, + ) + comment = "" + # gather any blank lines or full line comments following the comment as well + self.scan_empty_or_full_line_comments() + if not self.flow_level: + self.allow_simple_key = True + return + if bool(self.scan_line_break()): + # start_mark = self.reader.get_mark() + if not self.flow_level: + self.allow_simple_key = True + self.scan_empty_or_full_line_comments() + return None + ch = srp() + if ch == '\n': # empty toplevel lines + start_mark = self.reader.get_mark() + comment = "" + while ch: + ch = self.scan_line_break(empty_line=True) + comment += ch + if srp() == '#': + # empty line followed by indented real comment + comment = comment.rsplit('\n', 1)[0] + '\n' + _ = self.reader.get_mark() # gobble end_mark + return None + else: + found = True + return None + + def scan_empty_or_full_line_comments(self) -> None: + blmark = self.reader.get_mark() + assert blmark.column == 0 + blanks = "" + comment = None + mark = None + ch = self.reader.peek() + while True: + # nprint('ch', repr(ch), self.reader.get_mark().column) + if ch in '\r\n\x85\u2028\u2029': + if self.reader.prefix(2) == '\r\n': + self.reader.forward(2) + else: + self.reader.forward() + if comment is not None: + comment += '\n' + self.comments.add_full_line_comment(comment, mark.column, mark.line) + comment = None + else: + blanks += '\n' + self.comments.add_blank_line(blanks, blmark.column, blmark.line) # type: ignore # NOQA + blanks = "" + blmark = self.reader.get_mark() + ch = self.reader.peek() + continue + if comment is None: + if ch in ' \t': + blanks += ch + elif ch == '#': + mark = self.reader.get_mark() + comment = '#' + else: + # xprintf('breaking on', repr(ch)) + break + else: + comment += ch + self.reader.forward() + ch = self.reader.peek() + + def scan_block_scalar_ignored_line(self, start_mark: Any) -> Any: + # See the specification for details. + srp = self.reader.peek + srf = self.reader.forward + prefix = '' + comment = None + while srp() == ' ': + prefix += srp() + srf() + if srp() == '#': + comment = '' + mark = self.reader.get_mark() + while srp() not in _THE_END: + comment += srp() + srf() + comment += '\n' # type: ignore + ch = srp() + if ch not in _THE_END: + raise ScannerError( + 'while scanning a block scalar', + start_mark, + f'expected a comment or a line break, but found {ch!r}', + self.reader.get_mark(), + ) + if comment is not None: + self.comments.add_eol_comment(comment, mark.column, mark.line) # type: ignore + self.scan_line_break() + return None diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/serializer.py b/python/user_packages/Python313/site-packages/ruamel/yaml/serializer.py new file mode 100644 index 0000000000000000000000000000000000000000..90f7c11317f7b6eed144535108205dc6d24182b7 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/serializer.py @@ -0,0 +1,233 @@ + +from __future__ import annotations + +from ruamel.yaml.error import YAMLError +from ruamel.yaml.compat import nprint, DBG_NODE, dbg, nprintf # NOQA +from ruamel.yaml.util import RegExp + +from ruamel.yaml.events import ( + StreamStartEvent, + StreamEndEvent, + MappingStartEvent, + MappingEndEvent, + SequenceStartEvent, + SequenceEndEvent, + AliasEvent, + ScalarEvent, + DocumentStartEvent, + DocumentEndEvent, +) +from ruamel.yaml.nodes import MappingNode, ScalarNode, SequenceNode + +if False: # MYPY + from typing import Any, Dict, Union, Text, Optional # NOQA + from ruamel.yaml.compat import VersionType # NOQA + +__all__ = ['Serializer', 'SerializerError'] + + +class SerializerError(YAMLError): + pass + + +class Serializer: + + # 'id' and 3+ numbers, but not 000 + ANCHOR_TEMPLATE = 'id{:03d}' + ANCHOR_RE = RegExp('id(?!000$)\\d{3,}') + + def __init__( + self, + encoding: Any = None, + explicit_start: Optional[bool] = None, + explicit_end: Optional[bool] = None, + version: Optional[VersionType] = None, + tags: Any = None, + dumper: Any = None, + ) -> None: + # NOQA + self.dumper = dumper + if self.dumper is not None: + self.dumper._serializer = self + self.use_encoding = encoding + self.use_explicit_start = explicit_start + self.use_explicit_end = explicit_end + if isinstance(version, str): + self.use_version = tuple(map(int, version.split('.'))) + else: + self.use_version = version # type: ignore + self.use_tags = tags + self.serialized_nodes: Dict[Any, Any] = {} + self.anchors: Dict[Any, Any] = {} + self.last_anchor_id = 0 + self.closed: Optional[bool] = None + self._templated_id = None + + @property + def emitter(self) -> Any: + if hasattr(self.dumper, 'typ'): + return self.dumper.emitter + return self.dumper._emitter + + @property + def resolver(self) -> Any: + if hasattr(self.dumper, 'typ'): + self.dumper.resolver + return self.dumper._resolver + + def open(self) -> None: + if self.closed is None: + self.emitter.emit(StreamStartEvent(encoding=self.use_encoding)) + self.closed = False + elif self.closed: + raise SerializerError('serializer is closed') + else: + raise SerializerError('serializer is already opened') + + def close(self) -> None: + if self.closed is None: + raise SerializerError('serializer is not opened') + elif not self.closed: + self.emitter.emit(StreamEndEvent()) + self.closed = True + + # def __del__(self): + # self.close() + + def serialize(self, node: Any) -> None: + if dbg(DBG_NODE): + nprint('Serializing nodes') + node.dump() + if self.closed is None: + raise SerializerError('serializer is not opened') + elif self.closed: + raise SerializerError('serializer is closed') + self.emitter.emit( + DocumentStartEvent( + explicit=self.use_explicit_start, version=self.use_version, tags=self.use_tags, + ), + ) + self.anchor_node(node) + self.serialize_node(node, None, None) + self.emitter.emit(DocumentEndEvent(explicit=self.use_explicit_end)) + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + + def anchor_node(self, node: Any) -> None: + if node in self.anchors: + if self.anchors[node] is None: + self.anchors[node] = self.generate_anchor(node) + else: + anchor = None + try: + if node.anchor.always_dump: + anchor = node.anchor.value + except: # NOQA + pass + self.anchors[node] = anchor + if isinstance(node, SequenceNode): + for item in node.value: + self.anchor_node(item) + elif isinstance(node, MappingNode): + for key, value in node.value: + self.anchor_node(key) + self.anchor_node(value) + + def generate_anchor(self, node: Any) -> Any: + try: + anchor = node.anchor.value + except: # NOQA + anchor = None + if anchor is None: + self.last_anchor_id += 1 + return self.ANCHOR_TEMPLATE.format(self.last_anchor_id) + return anchor + + def serialize_node(self, node: Any, parent: Any, index: Any) -> None: + alias = self.anchors[node] + if node in self.serialized_nodes: + node_style = getattr(node, 'style', None) + if node_style != '?': + node_style = None + self.emitter.emit(AliasEvent(alias, style=node_style)) + else: + self.serialized_nodes[node] = True + self.resolver.descend_resolver(parent, index) + if isinstance(node, ScalarNode): + # here check if the node.tag equals the one that would result from parsing + # if not equal quoting is necessary for strings + detected_tag = self.resolver.resolve(ScalarNode, node.value, (True, False)) + default_tag = self.resolver.resolve(ScalarNode, node.value, (False, True)) + implicit = ( + (node.ctag == detected_tag), + (node.ctag == default_tag), + node.tag.startswith('tag:yaml.org,2002:'), # type: ignore + ) + self.emitter.emit( + ScalarEvent( + alias, + node.ctag, + implicit, + node.value, + style=node.style, + comment=node.comment, + ), + ) + elif isinstance(node, SequenceNode): + implicit = node.ctag == self.resolver.resolve(SequenceNode, node.value, True) + comment = node.comment + end_comment = None + seq_comment = None + if node.flow_style is True: + if comment: # eol comment on flow style sequence + seq_comment = comment[0] + # comment[0] = None + if comment and len(comment) > 2: + end_comment = comment[2] + else: + end_comment = None + self.emitter.emit( + SequenceStartEvent( + alias, + node.ctag, + implicit, + flow_style=node.flow_style, + comment=node.comment, + ), + ) + index = 0 + for item in node.value: + self.serialize_node(item, node, index) + index += 1 + self.emitter.emit(SequenceEndEvent(comment=[seq_comment, end_comment])) + elif isinstance(node, MappingNode): + implicit = node.ctag == self.resolver.resolve(MappingNode, node.value, True) + comment = node.comment + end_comment = None + map_comment = None + if node.flow_style is True: + if comment: # eol comment on flow style sequence + map_comment = comment[0] + # comment[0] = None + if comment and len(comment) > 2: + end_comment = comment[2] + self.emitter.emit( + MappingStartEvent( + alias, + node.ctag, + implicit, + flow_style=node.flow_style, + comment=node.comment, + nr_items=len(node.value), + ), + ) + for key, value in node.value: + self.serialize_node(key, node, None) + self.serialize_node(value, node, key) + self.emitter.emit(MappingEndEvent(comment=[map_comment, end_comment])) + self.resolver.ascend_resolver() + + +def templated_id(s: Text) -> Any: + return Serializer.ANCHOR_RE.match(s) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/tag.py b/python/user_packages/Python313/site-packages/ruamel/yaml/tag.py new file mode 100644 index 0000000000000000000000000000000000000000..f85dd0311855201d9a077c0c29a51049271b9699 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/tag.py @@ -0,0 +1,126 @@ + +from __future__ import annotations + +""" +In round-trip mode the original tag needs to be preserved, but the tag +transformed based on the directives needs to be available as well. + +A Tag that is created during loading has a handle and a suffix. +Not all objects loaded currently have a Tag, that .tag attribute can be None +A Tag that is created for dumping only (on an object loaded without a tag) has a suffix +only. +""" + +if False: # MYPY + from typing import Any, Dict, Optional, List, Union, Iterator # NOQA + +tag_attrib = '_yaml_tag' + + +class Tag: + """store original tag information for roundtripping""" + + attrib = tag_attrib + + def __init__(self, handle: Any = None, suffix: Any = None, handles: Any = None) -> None: + self.handle = handle + self.suffix = suffix + self.handles = handles + self._transform_type: Optional[bool] = None + + def __repr__(self) -> str: + return f'{self.__class__.__name__}({self.trval!r})' + + def __str__(self) -> str: + return f'{self.trval}' + + def __hash__(self) -> int: + try: + return self._hash_id # type: ignore + except AttributeError: + self._hash_id = res = hash((self.handle, self.suffix)) + return res + + def __eq__(self, other: Any) -> bool: + # other should not be a string, but the serializer sometimes provides these + if isinstance(other, str): + return self.trval == other + return bool(self.trval == other.trval) + + def startswith(self, x: str) -> bool: + if self.trval is not None: + return self.trval.startswith(x) + return False + + @property + def trval(self) -> Optional[str]: + try: + return self._trval + except AttributeError: + pass + if self.handle is None: + self._trval: Optional[str] = self.uri_decoded_suffix + return self._trval + assert self._transform_type is not None + if not self._transform_type: + # the non-round-trip case + self._trval = self.handles[self.handle] + self.uri_decoded_suffix + return self._trval + # round-trip case + if self.handle == '!!' and self.suffix in ( + 'null', + 'bool', + 'int', + 'float', + 'binary', + 'timestamp', + 'omap', + 'pairs', + 'set', + 'str', + 'seq', + 'map', + ): + self._trval = self.handles[self.handle] + self.uri_decoded_suffix + else: + # self._trval = self.handle + self.suffix + self._trval = self.handles[self.handle] + self.uri_decoded_suffix + return self._trval + + value = trval + + @property + def uri_decoded_suffix(self) -> Optional[str]: + try: + return self._uri_decoded_suffix + except AttributeError: + pass + if self.suffix is None: + self._uri_decoded_suffix: Optional[str] = None + return None + res = '' + # don't have to check for scanner errors here + idx = 0 + while idx < len(self.suffix): + ch = self.suffix[idx] + idx += 1 + if ch != '%': + res += ch + else: + res += chr(int(self.suffix[idx : idx + 2], 16)) + idx += 2 + self._uri_decoded_suffix = res + return res + + def select_transform(self, val: bool) -> None: + """ + val: False -> non-round-trip + True -> round-trip + """ + assert self._transform_type is None + self._transform_type = val + + def check_handle(self) -> bool: + if self.handle is None: + return False + return self.handle not in self.handles diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/timestamp.py b/python/user_packages/Python313/site-packages/ruamel/yaml/timestamp.py new file mode 100644 index 0000000000000000000000000000000000000000..55efa0a45f1b90e4f41302827693a384ab10f5f4 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/timestamp.py @@ -0,0 +1,63 @@ + +from __future__ import annotations + +import copy +import datetime + +# ToDo: at least on PY3 you could probably attach the tzinfo correctly to the object +# a more complete datetime might be used by safe loading as well +# +# add type information (iso8601, spaced) + +if False: # MYPY + from typing import Any, Dict, Optional, List # NOQA + + +class TimeStamp(datetime.datetime): + def __init__(self, *args: Any, **kw: Any) -> None: + self._yaml: Dict[str, Any] = dict(t=False, tz=None, delta=0) + + def __new__(cls, *args: Any, **kw: Any) -> Any: # datetime is immutable + return datetime.datetime.__new__(cls, *args, **kw) + + def __deepcopy__(self, memo: Any) -> Any: + ts = TimeStamp(self.year, self.month, self.day, self.hour, self.minute, self.second) + ts._yaml = copy.deepcopy(self._yaml) + return ts + + def replace( + self, + year: Any = None, + month: Any = None, + day: Any = None, + hour: Any = None, + minute: Any = None, + second: Any = None, + microsecond: Any = None, + tzinfo: Any = True, + fold: Any = None, + ) -> Any: + if year is None: + year = self.year + if month is None: + month = self.month + if day is None: + day = self.day + if hour is None: + hour = self.hour + if minute is None: + minute = self.minute + if second is None: + second = self.second + if microsecond is None: + microsecond = self.microsecond + if tzinfo is True: + tzinfo = self.tzinfo + if fold is None: + fold = self.fold + ts = type(self)(year, month, day, hour, minute, second, microsecond, tzinfo, fold=fold) + ts._yaml = copy.deepcopy(self._yaml) + return ts + + def __str__(self) -> str: + return self.isoformat('T' if self._yaml['t'] else ' ') diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/tokens.py b/python/user_packages/Python313/site-packages/ruamel/yaml/tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..988ae91405d8bbbd8c62340b051d55b08ccdf0cb --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/tokens.py @@ -0,0 +1,384 @@ + +from __future__ import annotations + +from ruamel.yaml.compat import nprintf # NOQA + +if False: # MYPY + from typing import Text, Any, Dict, Optional, List # NOQA +from .error import StreamMark # NOQA + +SHOW_LINES = True + + +class Token: + __slots__ = 'start_mark', 'end_mark', '_comment' + + def __init__(self, start_mark: StreamMark, end_mark: StreamMark) -> None: + self.start_mark = start_mark + self.end_mark = end_mark + + def __repr__(self) -> Any: + # attributes = [key for key in self.__slots__ if not key.endswith('_mark') and + # hasattr('self', key)] + attributes = [key for key in self.__slots__ if not key.endswith('_mark')] + attributes.sort() + # arguments = ', '.join( + # [f'{key!s}={getattr(self, key)!r})' for key in attributes] + # ) + arguments = [f'{key!s}={getattr(self, key)!r}' for key in attributes] + if SHOW_LINES: + try: + arguments.append('line: ' + str(self.start_mark.line)) + except: # NOQA + pass + try: + arguments.append('comment: ' + str(self._comment)) + except: # NOQA + pass + return f'{self.__class__.__name__}({", ".join(arguments)})' + + @property + def column(self) -> int: + return self.start_mark.column + + @column.setter + def column(self, pos: Any) -> None: + self.start_mark.column = pos + + # old style ( <= 0.17) is a TWO element list with first being the EOL + # comment concatenated with following FLC/BLNK; and second being a list of FLC/BLNK + # preceding the token + # new style ( >= 0.17 ) is a THREE element list with the first being a list of + # preceding FLC/BLNK, the second EOL and the third following FLC/BLNK + # note that new style has differing order, and does not consist of CommentToken(s) + # but of CommentInfo instances + # any non-assigned values in new style are None, but first and last can be empty list + # new style routines add one comment at a time + + # going to be deprecated in favour of add_comment_eol/post + def add_post_comment(self, comment: Any) -> None: + if not hasattr(self, '_comment'): + self._comment = [None, None] + else: + assert len(self._comment) in [2, 5] # make sure it is version 0 + # if isinstance(comment, CommentToken): + # if comment.value.startswith('# C09'): + # raise + self._comment[0] = comment + + # going to be deprecated in favour of add_comment_pre + def add_pre_comments(self, comments: Any) -> None: + if not hasattr(self, '_comment'): + self._comment = [None, None] + else: + assert len(self._comment) == 2 # make sure it is version 0 + assert self._comment[1] is None + self._comment[1] = comments + return + + # new style + def add_comment_pre(self, comment: Any) -> None: + if not hasattr(self, '_comment'): + self._comment = [[], None, None] # type: ignore + else: + assert len(self._comment) == 3 + if self._comment[0] is None: + self._comment[0] = [] # type: ignore + self._comment[0].append(comment) # type: ignore + + def add_comment_eol(self, comment: Any, comment_type: Any) -> None: + if not hasattr(self, '_comment'): + self._comment = [None, None, None] + else: + assert len(self._comment) == 3 + assert self._comment[1] is None + if self.comment[1] is None: + self._comment[1] = [] # type: ignore + self._comment[1].extend([None] * (comment_type + 1 - len(self.comment[1]))) # type: ignore # NOQA + # nprintf('commy', self.comment, comment_type) + self._comment[1][comment_type] = comment # type: ignore + + def add_comment_post(self, comment: Any) -> None: + if not hasattr(self, '_comment'): + self._comment = [None, None, []] # type: ignore + else: + assert len(self._comment) == 3 + if self._comment[2] is None: + self._comment[2] = [] # type: ignore + self._comment[2].append(comment) # type: ignore + + # def get_comment(self) -> Any: + # return getattr(self, '_comment', None) + + @property + def comment(self) -> Any: + return getattr(self, '_comment', None) + + def move_old_comment(self, target: Any, empty: bool = False) -> Any: + """move a comment from this token to target (normally next token) + used to combine e.g. comments before a BlockEntryToken to the + ScalarToken that follows it + empty is a special for empty values -> comment after key + """ + c = self.comment + if c is None: + return + # don't push beyond last element + if isinstance(target, (StreamEndToken, DocumentStartToken)): + return + delattr(self, '_comment') # NOQA + tc = target.comment + if not tc: # target comment, just insert + # special for empty value in key: value issue 25 + if empty: + c = [c[0], c[1], None, None, c[0]] + target._comment = c + # nprint('mco2:', self, target, target.comment, empty) + return self + if c[0] and tc[0] or c[1] and tc[1]: + if isinstance(c[1], list) and isinstance(tc[1], list): + c[1].extend(tc[1]) + else: + raise NotImplementedError(f'overlap in comment {c!r} {tc!r}') + if c[0]: + tc[0] = c[0] + if c[1]: + tc[1] = c[1] + return self + + def split_old_comment(self) -> Any: + """ split the post part of a comment, and return it + as comment to be added. Delete second part if [None, None] + abc: # this goes to sequence + # this goes to first element + - first element + """ + comment = self.comment + if comment is None or comment[0] is None: + return None # nothing to do + ret_val = [comment[0], None] + if comment[1] is None: + delattr(self, '_comment') # NOQA + return ret_val + + def move_new_comment(self, target: Any, empty: bool = False) -> Any: + """move a comment from this token to target (normally next token) + used to combine e.g. comments before a BlockEntryToken to the + ScalarToken that follows it + empty is a special for empty values -> comment after key + """ + c = self.comment + if c is None: + return + # don't push beyond last element + if isinstance(target, (StreamEndToken, DocumentStartToken)): + return + delattr(self, '_comment') # NOQA + tc = target.comment + if not tc: # target comment, just insert + # special for empty value in key: value issue 25 + if empty: + c = [c[0], c[1], c[2]] + target._comment = c + # nprint('mco2:', self, target, target.comment, empty) + return self + # if self and target have both pre, eol or post comments, something seems wrong + for idx in range(3): + if c[idx] is not None and tc[idx] is not None: + raise NotImplementedError(f'overlap in comment {c!r} {tc!r}') + # move the comment parts + for idx in range(3): + if c[idx]: + tc[idx] = c[idx] + return self + + +# class BOMToken(Token): +# id = '' + + +class DirectiveToken(Token): + __slots__ = 'name', 'value' + id = '' + + def __init__(self, name: Any, value: Any, start_mark: Any, end_mark: Any) -> None: + Token.__init__(self, start_mark, end_mark) + self.name = name + self.value = value + + +class DocumentStartToken(Token): + __slots__ = () + id = '' + + +class DocumentEndToken(Token): + __slots__ = () + id = '' + + +class StreamStartToken(Token): + __slots__ = ('encoding',) + id = '' + + def __init__( + self, start_mark: Any = None, end_mark: Any = None, encoding: Any = None, + ) -> None: + Token.__init__(self, start_mark, end_mark) + self.encoding = encoding + + +class StreamEndToken(Token): + __slots__ = () + id = '' + + +class BlockSequenceStartToken(Token): + __slots__ = () + id = '' + + +class BlockMappingStartToken(Token): + __slots__ = () + id = '' + + +class BlockEndToken(Token): + __slots__ = () + id = '' + + +class FlowSequenceStartToken(Token): + __slots__ = () + id = '[' + + +class FlowMappingStartToken(Token): + __slots__ = () + id = '{' + + +class FlowSequenceEndToken(Token): + __slots__ = () + id = ']' + + +class FlowMappingEndToken(Token): + __slots__ = () + id = '}' + + +class KeyToken(Token): + __slots__ = () + id = '?' + +# def x__repr__(self): +# return f'KeyToken({self.start_mark.buffer[self.start_mark.index:].split(None, 1)[0]})' + + +class ValueToken(Token): + __slots__ = () + id = ':' + + +class BlockEntryToken(Token): + __slots__ = () + id = '-' + + +class FlowEntryToken(Token): + __slots__ = () + id = ',' + + +class AliasToken(Token): + __slots__ = ('value',) + id = '' + + def __init__(self, value: Any, start_mark: Any, end_mark: Any) -> None: + Token.__init__(self, start_mark, end_mark) + self.value = value + + +class AnchorToken(Token): + __slots__ = ('value',) + id = '' + + def __init__(self, value: Any, start_mark: Any, end_mark: Any) -> None: + Token.__init__(self, start_mark, end_mark) + self.value = value + + +class TagToken(Token): + __slots__ = ('value',) + id = '' + + def __init__(self, value: Any, start_mark: Any, end_mark: Any) -> None: + Token.__init__(self, start_mark, end_mark) + self.value = value + + +class ScalarToken(Token): + __slots__ = 'value', 'plain', 'style' + id = '' + + def __init__( + self, value: Any, plain: Any, start_mark: Any, end_mark: Any, style: Any = None, + ) -> None: + Token.__init__(self, start_mark, end_mark) + self.value = value + self.plain = plain + self.style = style + + +class CommentToken(Token): + __slots__ = '_value', '_column', 'pre_done' + id = '' + + def __init__( + self, value: Any, start_mark: Any = None, end_mark: Any = None, column: Any = None, + ) -> None: + if start_mark is None: + assert column is not None + self._column = column + Token.__init__(self, start_mark, end_mark) + self._value = value + + @property + def value(self) -> str: + if isinstance(self._value, str): + return self._value + return "".join(self._value) + + @value.setter + def value(self, val: Any) -> None: + self._value = val + + def reset(self) -> None: + if hasattr(self, 'pre_done'): + delattr(self, 'pre_done') # NOQA + + def __repr__(self) -> Any: + v = f'{self.value!r}' + if SHOW_LINES: + try: + v += ', line: ' + str(self.start_mark.line) + except: # NOQA + pass + try: + v += ', col: ' + str(self.start_mark.column) + except: # NOQA + pass + return f'CommentToken({v})' + + def __eq__(self, other: Any) -> bool: + if self.start_mark != other.start_mark: + return False + if self.end_mark != other.end_mark: + return False + if self.value != other.value: + return False + return True + + def __ne__(self, other: Any) -> bool: + return not self.__eq__(other) diff --git a/python/user_packages/Python313/site-packages/ruamel/yaml/util.py b/python/user_packages/Python313/site-packages/ruamel/yaml/util.py new file mode 100644 index 0000000000000000000000000000000000000000..398e0e9cf757338cad3704b792725d8bb284a67f --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel/yaml/util.py @@ -0,0 +1,264 @@ + + +""" +some helper functions that might be generally useful +""" + +from __future__ import annotations + +import datetime +from functools import partial +import re + + +if False: # MYPY + from typing import Any, Dict, Optional, List, Text, Callable, Union # NOQA + from .compat import StreamTextType # NOQA + + +class LazyEval: + """ + Lightweight wrapper around lazily evaluated func(*args, **kwargs). + + func is only evaluated when any attribute of its return value is accessed. + Every attribute access is passed through to the wrapped value. + (This only excludes special cases like method-wrappers, e.g., __hash__.) + The sole additional attribute is the lazy_self function which holds the + return value (or, prior to evaluation, func and arguments), in its closure. + """ + + def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: + def lazy_self() -> Any: + return_value = func(*args, **kwargs) + object.__setattr__(self, 'lazy_self', lambda: return_value) + return return_value + + object.__setattr__(self, 'lazy_self', lazy_self) + + def __getattribute__(self, name: str) -> Any: + lazy_self = object.__getattribute__(self, 'lazy_self') + if name == 'lazy_self': + return lazy_self + return getattr(lazy_self(), name) + + def __setattr__(self, name: str, value: Any) -> None: + setattr(self.lazy_self(), name, value) + + +RegExp = partial(LazyEval, re.compile) + +timestamp_regexp = RegExp( + """^(?P[0-9][0-9][0-9][0-9]) + -(?P[0-9][0-9]?) + -(?P[0-9][0-9]?) + (?:((?P[Tt])|[ \\t]+) # explictly not retaining extra spaces + (?P[0-9][0-9]?) + :(?P[0-9][0-9]) + :(?P[0-9][0-9]) + (?:\\.(?P[0-9]*))? + (?:[ \\t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) + (?::(?P[0-9][0-9]))?))?)?$""", + re.X, +) + + +def create_timestamp( + year: Any, + month: Any, + day: Any, + t: Any, + hour: Any, + minute: Any, + second: Any, + fraction: Any, + tz: Any, + tz_sign: Any, + tz_hour: Any, + tz_minute: Any, +) -> Union[datetime.datetime, datetime.date]: + # create a timestamp from matching against timestamp_regexp + MAX_FRAC = 999999 + year = int(year) + month = int(month) + day = int(day) + if hour is None: + return datetime.date(year, month, day) + hour = int(hour) + minute = int(minute) + second = int(second) + frac = 0 + if fraction: + frac_s = fraction[:6] + while len(frac_s) < 6: + frac_s += '0' + frac = int(frac_s) + if len(fraction) > 6 and int(fraction[6]) > 4: + frac += 1 + if frac > MAX_FRAC: + fraction = 0 + else: + fraction = frac + else: + fraction = 0 + tzinfo = None + delta = None + if tz_sign: + tz_hour = int(tz_hour) + tz_minute = int(tz_minute) if tz_minute else 0 + td = datetime.timedelta( + hours=tz_hour, minutes=tz_minute, + ) + if tz_sign == '-': + td = -td + tzinfo = datetime.timezone(td, name=tz) + elif tz == 'Z': + tzinfo = datetime.timezone(datetime.timedelta(hours=0), name=tz) + if frac > MAX_FRAC: + delta = -datetime.timedelta(seconds=1) + # should do something else instead (or hook this up to the preceding if statement + # in reverse + # if delta is None: + # return datetime.datetime(year, month, day, hour, minute, second, fraction) + # return datetime.datetime(year, month, day, hour, minute, second, fraction, + # datetime.timezone.utc) + # the above is not good enough though, should provide tzinfo. In Python3 that is easily + # doable drop that kind of support for Python2 as it has not native tzinfo + data = datetime.datetime(year, month, day, hour, minute, second, fraction, tzinfo) + if delta: + data -= delta + return data + + +# originally as comment +# https://github.com/pre-commit/pre-commit/pull/211#issuecomment-186466605 +# if you use this in your code, I suggest adding a test in your test suite +# that check this routines output against a known piece of your YAML +# before upgrades to this code break your round-tripped YAML +def load_yaml_guess_indent(stream: StreamTextType, **kw: Any) -> Any: + """guess the indent and block sequence indent of yaml stream/string + + returns round_trip_loaded stream, indent level, block sequence indent + - block sequence indent is the number of spaces before a dash relative to previous indent + - if there are no block sequences, indent is taken from nested mappings, block sequence + indent is unset (None) in that case + """ + from .main import YAML + + # load a YAML document, guess the indentation, if you use TABs you are on your own + def leading_spaces(line: Any) -> int: + idx = 0 + while idx < len(line) and line[idx] == ' ': + idx += 1 + return idx + + if isinstance(stream, str): + yaml_str: Any = stream + elif isinstance(stream, bytes): + # most likely, but the Reader checks BOM for this + yaml_str = stream.decode('utf-8') + else: + yaml_str = stream.read() + map_indent = None + indent = None # default if not found for some reason + block_seq_indent = None + prev_line_key_only = None + key_indent = 0 + for line in yaml_str.splitlines(): + rline = line.rstrip() + lline = rline.lstrip() + if lline.startswith('- '): + l_s = leading_spaces(line) + block_seq_indent = l_s - key_indent + idx = l_s + 1 + while line[idx] == ' ': # this will end as we rstripped + idx += 1 + if line[idx] == '#': # comment after - + continue + indent = idx - key_indent + break + if map_indent is None and prev_line_key_only is not None and rline: + idx = 0 + while line[idx] in ' -': + idx += 1 + if idx > prev_line_key_only: + map_indent = idx - prev_line_key_only + if rline.endswith(':'): + key_indent = leading_spaces(line) + idx = 0 + while line[idx] == ' ': # this will end on ':' + idx += 1 + prev_line_key_only = idx + continue + prev_line_key_only = None + if indent is None and map_indent is not None: + indent = map_indent + yaml = YAML() if 'yaml' not in kw else kw.pop('yaml') + return yaml.load(yaml_str, **kw), indent, block_seq_indent + + +def configobj_walker(cfg: Any) -> Any: + """ + walks over a ConfigObj (INI file with comments) generating + corresponding YAML output (including comments + """ + from configobj import ConfigObj # type: ignore + + assert isinstance(cfg, ConfigObj) + for c in cfg.initial_comment: + if c.strip(): + yield c + for s in _walk_section(cfg): + if s.strip(): + yield s + for c in cfg.final_comment: + if c.strip(): + yield c + + +def _walk_section(s: Any, level: int = 0) -> Any: + from configobj import Section + + assert isinstance(s, Section) + indent = ' ' * level + for name in s.scalars: + for c in s.comments[name]: + yield indent + c.strip() + x = s[name] + if '\n' in x: + i = indent + ' ' + x = '|\n' + i + x.strip().replace('\n', '\n' + i) + elif ':' in x: + x = "'" + x.replace("'", "''") + "'" + line = f'{indent}{name}: {x}' + c = s.inline_comments[name] + if c: + line += ' ' + c + yield line + for name in s.sections: + for c in s.comments[name]: + yield indent + c.strip() + line = f'{indent}{name}:' + c = s.inline_comments[name] + if c: + line += ' ' + c + yield line + for val in _walk_section(s[name], level=level + 1): + yield val + + +# def config_obj_2_rt_yaml(cfg): +# from .comments import CommentedMap, CommentedSeq +# from configobj import ConfigObj +# assert isinstance(cfg, ConfigObj) +# #for c in cfg.initial_comment: +# # if c.strip(): +# # pass +# cm = CommentedMap() +# for name in s.sections: +# cm[name] = d = CommentedMap() +# +# +# #for c in cfg.final_comment: +# # if c.strip(): +# # yield c +# return cm diff --git a/python/user_packages/Python313/site-packages/ruamel_yaml-0.19.1.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/ruamel_yaml-0.19.1.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c781ecbf698a18bdff8b2687661e6437aaeb2c47 --- /dev/null +++ b/python/user_packages/Python313/site-packages/ruamel_yaml-0.19.1.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ + The MIT License (MIT) + + Copyright (c) 2014-2026 Anthon van der Neut, Ruamel bvba + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/README.md b/python/user_packages/Python313/site-packages/schemas/embedding_functions/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5947f0da4723b42a55c8ce5650df8ddb0a176e58 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/README.md @@ -0,0 +1,56 @@ +# Embedding Function Schemas + +This directory contains JSON schemas for all embedding functions in Chroma. The purpose of having these schemas is to support cross-language compatibility and to validate that changes in one client library do not accidentally diverge from others. + +## Schema Structure + +Each schema follows the JSON Schema Draft-07 specification and includes: + +- `version`: The version of the schema +- `title`: The title of the schema +- `description`: A description of the schema +- `properties`: The properties that can be configured for the embedding function +- `required`: The properties that are required for the embedding function +- `additionalProperties`: Whether additional properties are allowed (always set to `false` to ensure strict validation) + +## Usage + +These schemas are used by both the Python and JavaScript clients to validate embedding function configurations. + +### Python + +```python +from chromadb.utils.embedding_functions.schemas import validate_config + +# Validate a configuration +config = { + "api_key_env_var": "CHROMA_OPENAI_API_KEY", + "model_name": "text-embedding-ada-002" +} +validate_config(config, "openai") +``` + +### JavaScript + +```typescript +import { validateConfig } from '@chromadb/core'; + +// Validate a configuration +const config = { + api_key_env_var: "CHROMA_OPENAI_API_KEY", + model_name: "text-embedding-ada-002" +}; +validateConfig(config, "openai"); +``` + +## Adding New Schemas + +To add a new schema: + +1. Create a new JSON file in this directory with the name of the embedding function (e.g., `new_function.json`) +2. Define the schema following the JSON Schema Draft-07 specification +3. Update the embedding function implementations in both Python and JavaScript to use the schema for validation + +## Schema Versioning + +Each schema includes a version number to support future changes to embedding function configurations. When making changes to a schema, increment the version number to ensure backward compatibility. diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/amazon_bedrock.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/amazon_bedrock.json new file mode 100644 index 0000000000000000000000000000000000000000..5b90d8df31727f7649855c4c6b45a8997e23dfa2 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/amazon_bedrock.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Amazon Bedrock Embedding Function Schema", + "description": "Schema for the Amazon Bedrock embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "session_args": { + "type": "object", + "description": "The arguments to pass to the boto3 session" + }, + "model_name": { + "type": "string", + "description": "The name of the model to use for embeddings" + }, + "kwargs": { + "type": "object", + "description": "Additional arguments to pass to the Amazon Bedrock client" + } + }, + "required": [ + "session_args", + "model_name", + "kwargs" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/base_schema.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/base_schema.json new file mode 100644 index 0000000000000000000000000000000000000000..267bd6cd99f89d5ccc79aa22a3d14d96d1aeafc9 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/base_schema.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Embedding Function Base Schema", + "description": "Base schema for all embedding functions in Chroma", + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "Schema version for the embedding function" + }, + "name": { + "type": "string", + "description": "Name of the embedding function" + }, + "config": { + "type": "object", + "description": "Configuration parameters for the embedding function" + } + }, + "required": [ + "version", + "name", + "config" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/baseten.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/baseten.json new file mode 100644 index 0000000000000000000000000000000000000000..27657361699761cb96a6d54988ecf9671952b651 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/baseten.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Baseten Embedding Function Schema", + "description": "Schema for the Baseten embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "api_base": { + "type": "string", + "description": "The Baseten URL of the deployment" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Baseten API" + } + }, + "required": [ + "api_base", + "api_key_env_var" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/bm25.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/bm25.json new file mode 100644 index 0000000000000000000000000000000000000000..7f464be045f67ff596ff81195640984bfab2aad7 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/bm25.json @@ -0,0 +1,103 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BM25 Embedding Function Schema", + "description": "Schema for the BM25 sparse embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "task": { + "type": "string", + "enum": [ + "document", + "query" + ], + "description": "Task to perform, can be 'document' or 'query'" + }, + "query_config": { + "type": "object", + "description": "Configuration for the query", + "properties": { + "task": { + "type": "string", + "enum": [ + "document", + "query" + ], + "description": "Task to perform for query embedding" + } + }, + "additionalProperties": false + }, + "cache_dir": { + "type": [ + "string", + "null" + ], + "description": "The path to the cache directory" + }, + "k": { + "type": [ + "number", + "null" + ], + "description": "The k parameter in the BM25 formula. Defines the saturation of the term frequency" + }, + "b": { + "type": [ + "number", + "null" + ], + "description": "The b parameter in the BM25 formula. Defines the importance of the document length" + }, + "avg_len": { + "type": [ + "number", + "null" + ], + "description": "The average length of the documents in the corpus" + }, + "language": { + "type": [ + "string", + "null" + ], + "description": "Specifies the language for the stemmer" + }, + "token_max_length": { + "type": [ + "integer", + "null" + ], + "description": "The maximum length of the tokens" + }, + "disable_stemmer": { + "type": [ + "boolean", + "null" + ], + "description": "Disable the stemmer" + }, + "specific_model_path": { + "type": [ + "string", + "null" + ], + "description": "The path to the specific model" + }, + "kwargs": { + "type": "object", + "description": "Additional arguments to pass to the BM25 model", + "additionalProperties": { + "type": [ + "string", + "integer", + "number", + "boolean", + "array", + "object" + ] + } + } + }, + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma-cloud-qwen.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma-cloud-qwen.json new file mode 100644 index 0000000000000000000000000000000000000000..17ec2c569fe008c30450037839d4297fa0ea1402 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma-cloud-qwen.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Chroma Cloud Qwen Embedding Function Schema", + "description": "Schema for the Chroma Cloud Qwen embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model": { + "type": "string", + "enum": [ + "Qwen/Qwen3-Embedding-0.6B" + ], + "description": "The specific Qwen model to use for embeddings" + }, + "task": { + "type": [ + "string", + "null" + ], + "description": "The task for which embeddings are being generated. If null or empty, empty instructions will be used." + }, + "instructions": { + "type": "object", + "description": "A mapping of tasks to instructions for targets (documents/queries)", + "properties": { + "nl_to_code": { + "type": "object", + "properties": { + "documents": { + "type": "string", + "description": "Instructions for embedding documents" + }, + "query": { + "type": "string", + "description": "Instructions for embedding queries" + } + }, + "required": [ + "documents", + "query" + ], + "additionalProperties": false + } + }, + "required": [ + "nl_to_code" + ], + "additionalProperties": false + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Chroma Embedding API", + "default": "CHROMA_API_KEY" + } + }, + "required": [ + "model", + "task" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma-cloud-splade.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma-cloud-splade.json new file mode 100644 index 0000000000000000000000000000000000000000..2f6c1b719cf109f56c7bfc41e152ebf08a6a4e8e --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma-cloud-splade.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Chroma Cloud Splade Embedding Function Schema", + "description": "Schema for the Chroma Cloud Splade sparse embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model": { + "type": "string", + "enum": [ + "prithivida/Splade_PP_en_v1" + ], + "description": "The specific Splade model to use for sparse embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Chroma Embedding API", + "default": "CHROMA_API_KEY" + }, + "include_tokens": { + "type": "boolean", + "description": "Whether to store token labels in the sparse vector output", + "default": false + } + }, + "required": [ + "api_key_env_var", + "model" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma_bm25.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma_bm25.json new file mode 100644 index 0000000000000000000000000000000000000000..b3c9e05eebee6091509bf1c91729c54b22ed93da --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma_bm25.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Chroma BM25 Embedding Function Schema", + "description": "Schema for the Chroma BM25 sparse embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "k": { + "type": "number", + "description": "BM25 saturation parameter controlling term frequency scaling" + }, + "b": { + "type": "number", + "description": "BM25 length normalization parameter" + }, + "avg_doc_length": { + "type": "number", + "description": "Average document length in tokens used for normalization" + }, + "token_max_length": { + "type": "number", + "description": "Maximum token length allowed before filtering" + }, + "stopwords": { + "type": "array", + "description": "Optional custom stopword list (in lowercase) to override the defaults", + "items": { + "type": "string" + } + }, + "include_tokens": { + "type": "boolean", + "description": "Whether to store token strings in the sparse vectors (default: true)" + } + }, + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma_langchain.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma_langchain.json new file mode 100644 index 0000000000000000000000000000000000000000..6677c388c834ab235ac5e716d5d600d4eaa93d49 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/chroma_langchain.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Langchain Embedding Function Schema", + "description": "Schema for the langchain embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "embedding_function": { + "type": "string", + "description": "Parameter embedding_function for the langchain embedding function" + } + }, + "required": [ + "embedding_function" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/cloudflare_workers_ai.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/cloudflare_workers_ai.json new file mode 100644 index 0000000000000000000000000000000000000000..ba512e689fa8d375e137b3e23082550a729f85a5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/cloudflare_workers_ai.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Cloudflare Workers AI Embedding Function Schema", + "description": "Schema for the Cloudflare Workers AI embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "account_id": { + "type": "string", + "description": "The account ID for the Cloudflare Workers AI API" + }, + "api_key_env_var": { + "type": "string", + "description": "The environment variable name that contains your API key for the Cloudflare Workers AI API" + }, + "gateway_id": { + "type": [ + "string", + "null" + ], + "description": "The ID of the Cloudflare AI Gateway to use for a more customized solution" + } + }, + "required": [ + "api_key_env_var", + "model_name", + "account_id" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/cohere.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/cohere.json new file mode 100644 index 0000000000000000000000000000000000000000..b46af3d3bce14b51e0f6323b559452d314a81d21 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/cohere.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Cohere Embedding Function Schema", + "description": "Schema for the Cohere embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Cohere API" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/default.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/default.json new file mode 100644 index 0000000000000000000000000000000000000000..9dfaa724ff23139b804367cdc50054212b42e23e --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/default.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Default Embedding Function Schema", + "description": "Schema for the default embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": {}, + "required": [], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/fastembed_sparse.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/fastembed_sparse.json new file mode 100644 index 0000000000000000000000000000000000000000..e989b9eee3dafdc370a379f8465f01b651d644f7 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/fastembed_sparse.json @@ -0,0 +1,92 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Fastembed Sparse Embedding Function Schema", + "description": "Schema for the Fastembed sparse embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Identifier of the Fastembed model. List of commonly used models: Qdrant/bm25, prithivida/Splade_PP_en_v1, Qdrant/minicoil-v1" + }, + "task": { + "type": "string", + "enum": [ + "document", + "query" + ], + "description": "Task to perform, can be 'document' or 'query'" + }, + "query_config": { + "type": "object", + "description": "Configuration for the query", + "properties": { + "task": { + "type": "string", + "enum": [ + "document", + "query" + ], + "description": "Task to perform for query embedding" + } + }, + "additionalProperties": false + }, + "cache_dir": { + "type": [ + "string", + "null" + ], + "description": "The path to the cache directory" + }, + "threads": { + "type": [ + "integer", + "null" + ], + "description": "The number of threads to use for the model" + }, + "cuda": { + "type": [ + "boolean", + "null" + ], + "description": "Whether to use CUDA" + }, + "device_ids": { + "type": [ + "array", + "null" + ], + "description": "The device IDs to use for the model", + "items": { + "type": "integer" + } + }, + "lazy_load": { + "type": [ + "boolean", + "null" + ], + "description": "Whether to lazy load the model" + }, + "kwargs": { + "type": "object", + "description": "Additional arguments to pass to the model", + "additionalProperties": { + "type": [ + "string", + "integer", + "number", + "boolean", + "array", + "object" + ] + } + } + }, + "required": [ + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_gemini.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_gemini.json new file mode 100644 index 0000000000000000000000000000000000000000..a54387fbafce741e69e61386f154c24496264e81 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_gemini.json @@ -0,0 +1,53 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Google Gemini Embedding Function Schema", + "description": "Schema for the Google Gemini embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "task_type": { + "type": "string", + "description": "The task type for the embeddings (e.g., RETRIEVAL_DOCUMENT, SEMANTIC_SIMILARITY)" + }, + "dimension": { + "type": "integer", + "description": "The output dimensionality for the embeddings. If not specified, the model's default dimensionality is used." + }, + "api_key_env_var": { + "type": [ + "string", + "null" + ], + "description": "Environment variable name that contains your API key for the Gemini API" + }, + "vertexai": { + "type": [ + "boolean", + "null" + ], + "description": "Whether to use Vertex AI" + }, + "project": { + "type": [ + "string", + "null" + ], + "description": "The Google Cloud project ID (required for Vertex AI)" + }, + "location": { + "type": [ + "string", + "null" + ], + "description": "The Google Cloud location/region (required for Vertex AI)" + } + }, + "required": [ + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_genai.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_genai.json new file mode 100644 index 0000000000000000000000000000000000000000..935e826748b4cf7c2c97744c782df299157fd8a0 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_genai.json @@ -0,0 +1,50 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Google GenAI Embedding Function Schema", + "description": "Schema for the Google GenAI embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "task_type": { + "type": "string", + "description": "The task type for the embeddings (e.g., RETRIEVAL_DOCUMENT, SEMANTIC_SIMILARITY)" + }, + "dimension": { + "type": "integer", + "description": "The output dimensionality for the embeddings. If not specified, the model's default dimensionality is used." + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Gemini API" + }, + "vertexai": { + "type": [ + "boolean", + "null" + ], + "description": "Whether to use Vertex AI" + }, + "project": { + "type": [ + "string", + "null" + ], + "description": "The Google Cloud project ID (required for Vertex AI)" + }, + "location": { + "type": [ + "string", + "null" + ], + "description": "The Google Cloud location/region (required for Vertex AI)" + } + }, + "required": [ + "model_name" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_generative_ai.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_generative_ai.json new file mode 100644 index 0000000000000000000000000000000000000000..0850f206930d5b17c5dbaef1f2d57e3657a29d1e --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_generative_ai.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Google Generative AI Embedding Function Schema", + "description": "Schema for the Google Generative AI embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "task_type": { + "type": "string", + "description": "The task type for the embeddings (e.g., RETRIEVAL_DOCUMENT)" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Google Generative AI API" + }, + "dimension": { + "type": "integer", + "description": "The output dimensionality for the embeddings. If not specified, the model's default dimensionality is used." + } + }, + "required": [ + "api_key_env_var", + "model_name", + "task_type" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_palm.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_palm.json new file mode 100644 index 0000000000000000000000000000000000000000..01534afb1cf285ace3410673b9a0905ce26ed9e6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_palm.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Google PaLM Embedding Function Schema", + "description": "Schema for the Google PaLM embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Google PaLM API" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_vertex.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_vertex.json new file mode 100644 index 0000000000000000000000000000000000000000..63198cc0d24bf5786679236ef8aaf12a070a4eb0 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/google_vertex.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Google Vertex Embedding Function Schema", + "description": "Schema for the Google Vertex embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "project_id": { + "type": "string", + "description": "The Google Cloud project ID" + }, + "region": { + "type": "string", + "description": "The Google Cloud region" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Google Vertex API" + } + }, + "required": [ + "api_key_env_var", + "model_name", + "project_id", + "region" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface.json new file mode 100644 index 0000000000000000000000000000000000000000..a398b18d64736d0382654a83bf70f5dc304041a3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HuggingFace Embedding Function Schema", + "description": "Schema for the HuggingFace embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the HuggingFace API" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface_server.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface_server.json new file mode 100644 index 0000000000000000000000000000000000000000..42af0659fb70332347454f967c78da76651eb691 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface_server.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HuggingFace Embedding Server Schema", + "description": "Schema for the HuggingFace embedding server configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL of the HuggingFace Embedding Server" + }, + "api_key_env_var": { + "type": [ + "string", + "null" + ], + "description": "The environment variable name that contains your API key for the HuggingFace API" + } + }, + "required": [ + "url" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface_sparse.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface_sparse.json new file mode 100644 index 0000000000000000000000000000000000000000..5fc84a7768bfe0e78eb36a568d9a3e040a4a4212 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/huggingface_sparse.json @@ -0,0 +1,59 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HuggingFace Sparse Embedding Function Schema", + "description": "Schema for the HuggingFace sparse embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Identifier of the Huggingface SparseEncoder model. Some common models: prithivida/Splade_PP_en_v1, naver/splade-cocondenser-ensembledistil, naver/splade-v3" + }, + "device": { + "type": "string", + "description": "Device used for computation" + }, + "task": { + "type": "string", + "enum": [ + "document", + "query" + ], + "description": "Task to perform, can be 'document' or 'query'" + }, + "query_config": { + "type": "object", + "description": "Configuration for the query", + "properties": { + "task": { + "type": "string", + "enum": [ + "document", + "query" + ], + "description": "Task to perform for query embedding" + } + }, + "additionalProperties": false + }, + "kwargs": { + "type": "object", + "description": "Additional arguments to pass to the Splade model", + "additionalProperties": { + "type": [ + "string", + "integer", + "number", + "boolean", + "array", + "object" + ] + } + } + }, + "required": [ + "model_name", + "device" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/instructor.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/instructor.json new file mode 100644 index 0000000000000000000000000000000000000000..f6dcc2f74745484d81b4ddc11f573a514de0c3b5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/instructor.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Instructor Embedding Function Schema", + "description": "Schema for the instructor embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Parameter model_name for the instructor embedding function" + }, + "device": { + "type": "string", + "description": "Parameter device for the instructor embedding function" + }, + "instruction": { + "type": [ + "string", + "null" + ], + "description": "Parameter instruction for the instructor embedding function" + } + }, + "required": [ + "model_name", + "device" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/jina.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/jina.json new file mode 100644 index 0000000000000000000000000000000000000000..91913b12c5c107a829d8693eca9e9e5dcb623982 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/jina.json @@ -0,0 +1,71 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Jina Embedding Function Schema", + "description": "Schema for the jina embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Parameter model_name for the jina embedding function" + }, + "api_key_env_var": { + "type": "string", + "description": "Parameter api_key_env_var for the jina embedding function" + }, + "task": { + "type": [ + "string", + "null" + ], + "description": "Parameter task for the jina embedding function" + }, + "late_chunking": { + "type": [ + "boolean", + "null" + ], + "description": "Parameter late_chunking for the jina embedding function" + }, + "truncate": { + "type": [ + "boolean", + "null" + ], + "description": "Parameter truncate for the jina embedding function" + }, + "dimensions": { + "type": [ + "integer", + "null" + ], + "description": "Parameter dimensions for the jina embedding function" + }, + "embedding_type": { + "type": [ + "string", + "null" + ], + "description": "Parameter embedding_type for the jina embedding function" + }, + "normalized": { + "type": [ + "boolean", + "null" + ], + "description": "Parameter normalized for the jina embedding function" + }, + "query_config": { + "type": [ + "object", + "null" + ], + "description": "Parameter query_config for the jina embedding function" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/mistral.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/mistral.json new file mode 100644 index 0000000000000000000000000000000000000000..2907bb45cde8ec1eb8396cb053801432a067fc65 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/mistral.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Mistral Embedding Function Schema", + "description": "Schema for the Mistral embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model": { + "type": "string", + "description": "Parameter model for the Mistral embedding function" + }, + "api_key_env_var": { + "type": "string", + "description": "Parameter api_key_env_var for the Mistral embedding function" + } + }, + "required": [ + "api_key_env_var", + "model" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/morph.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/morph.json new file mode 100644 index 0000000000000000000000000000000000000000..1d7edc49890d4d2c280c6ffb8c8aa62124ebfb37 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/morph.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Morph Embedding Function Schema", + "description": "Schema for the Morph embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the Morph API" + }, + "api_base": { + "type": [ + "string", + "null" + ], + "description": "The base URL for the Morph API" + }, + "encoding_format": { + "type": [ + "string", + "null" + ], + "description": "The format for embeddings (float or base64)" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/nomic.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/nomic.json new file mode 100644 index 0000000000000000000000000000000000000000..2f6db6f144045cdae3c19445b61103bb9dfe451d --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/nomic.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nomic Embedding Function Schema", + "description": "Schema for the Nomic embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model": { + "type": "string", + "description": "Parameter model for the Nomic embedding function" + }, + "api_key_env_var": { + "type": "string", + "description": "Parameter api_key_env_var for the Nomic embedding function" + }, + "task_type": { + "type": "string", + "description": "Parameter task_type for the Nomic embedding function" + } + } +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/ollama.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/ollama.json new file mode 100644 index 0000000000000000000000000000000000000000..ef94357621144766d6e4efd40d5fe45c3eec3f58 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/ollama.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Ollama Embedding Function Schema", + "description": "Schema for the Ollama embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL of the Ollama server" + }, + "model_name": { + "type": "string", + "description": "The name of the model to use for embeddings" + }, + "timeout": { + "type": "integer", + "description": "Timeout in seconds for the API request" + } + }, + "required": [ + "url", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/onnx_mini_lm_l6_v2.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/onnx_mini_lm_l6_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..6bce046b1967eb2c694a2b2927b1a992727808a3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/onnx_mini_lm_l6_v2.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Onnx_mini_lm_l6_v2 Embedding Function Schema", + "description": "Schema for the onnx_mini_lm_l6_v2 embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "preferred_providers": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + }, + "description": "Parameter preferred_providers for the onnx_mini_lm_l6_v2 embedding function" + } + }, + "required": [], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/open_clip.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/open_clip.json new file mode 100644 index 0000000000000000000000000000000000000000..f9882ffa34ecc55ae2a1443a88881a04d0b5b214 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/open_clip.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Open_clip Embedding Function Schema", + "description": "Schema for the open_clip embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Parameter model_name for the open_clip embedding function" + }, + "checkpoint": { + "type": "string", + "description": "Parameter checkpoint for the open_clip embedding function" + }, + "device": { + "type": [ + "string", + "null" + ], + "description": "Parameter device for the open_clip embedding function" + } + }, + "required": [ + "model_name", + "checkpoint", + "device" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/openai.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/openai.json new file mode 100644 index 0000000000000000000000000000000000000000..8d1b1d8cf129d244560622d14d3d33c0bb6042a0 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/openai.json @@ -0,0 +1,71 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OpenAI Embedding Function Schema", + "description": "Schema for the OpenAI embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "organization_id": { + "type": [ + "string", + "null" + ], + "description": "The OpenAI organization ID if applicable" + }, + "api_base": { + "type": [ + "string", + "null" + ], + "description": "The base path for the API" + }, + "api_type": { + "type": [ + "string", + "null" + ], + "description": "The type of the API deployment" + }, + "api_version": { + "type": [ + "string", + "null" + ], + "description": "The api version for the API" + }, + "deployment_id": { + "type": [ + "string", + "null" + ], + "description": "Deployment ID for Azure OpenAI" + }, + "default_headers": { + "type": [ + "object", + "null" + ], + "description": "A mapping of default headers to be sent with each API request" + }, + "dimensions": { + "type": [ + "integer", + "null" + ], + "description": "The number of dimensions for the embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "Environment variable name that contains your API key for the OpenAI API" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/perplexity.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/perplexity.json new file mode 100644 index 0000000000000000000000000000000000000000..6e8edd4db09a76a5123e123617b4454d9a389835 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/perplexity.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Perplexity Embedding Function Schema", + "description": "Schema for the perplexity embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Parameter model_name for the perplexity embedding function" + }, + "api_key_env_var": { + "type": "string", + "description": "Parameter api_key_env_var for the perplexity embedding function" + }, + "dimensions": { + "type": "number", + "description": "Matryoshka dimension (128-1024 for 0.6b, 128-2560 for 4b)" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/roboflow.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/roboflow.json new file mode 100644 index 0000000000000000000000000000000000000000..65ecd13d602db9f59dbede8bfe041a370eefce04 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/roboflow.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Roboflow Embedding Function Schema", + "description": "Schema for the roboflow embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "api_url": { + "type": "string", + "description": "Parameter api_url for the roboflow embedding function" + }, + "api_key_env_var": { + "type": "string", + "description": "Parameter api_key_env_var for the roboflow embedding function" + } + }, + "required": [ + "api_key_env_var", + "api_url" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/sentence_transformer.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/sentence_transformer.json new file mode 100644 index 0000000000000000000000000000000000000000..b9d5102b23aab25ad5c83127ed28c237f4815a8c --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/sentence_transformer.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SentenceTransformer Embedding Function Schema", + "description": "Schema for the SentenceTransformer embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Identifier of the SentenceTransformer model" + }, + "device": { + "type": "string", + "description": "Device used for computation" + }, + "normalize_embeddings": { + "type": "boolean", + "description": "Whether to normalize returned vectors" + }, + "kwargs": { + "type": "object", + "description": "Additional arguments to pass to the SentenceTransformer model", + "additionalProperties": { + "type": [ + "string", + "integer", + "number", + "boolean", + "array", + "object" + ] + } + } + }, + "required": [ + "model_name", + "device", + "normalize_embeddings" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/text2vec.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/text2vec.json new file mode 100644 index 0000000000000000000000000000000000000000..7338d010813ae84d1906e24ff64dea700e4928b3 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/text2vec.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Text2vec Embedding Function Schema", + "description": "Schema for the text2vec embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Parameter model_name for the text2vec embedding function" + } + }, + "required": [ + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/together_ai.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/together_ai.json new file mode 100644 index 0000000000000000000000000000000000000000..2f45cc492a88ea4eff433a50f37b2136f733597c --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/together_ai.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Together AI Embedding Function Schema", + "description": "Schema for the Together AI embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "The name of the model to use for text embeddings" + }, + "api_key_env_var": { + "type": "string", + "description": "The environment variable name that contains your API key for the Together AI API" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/transformers.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/transformers.json new file mode 100644 index 0000000000000000000000000000000000000000..fb2c080f7406c689165d23a83b0161963aaf3408 --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/transformers.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Transformers Embedding Function Schema", + "description": "Schema for the Transformers embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model": { + "type": "string", + "description": "Identifier of the SentenceTransformer model" + }, + "revision": { + "type": "string", + "description": "Specific model version to use (can be a branch, tag name, or commit id)" + }, + "quantized": { + "type": "boolean", + "description": "Whether to load the 8-bit quantized version of the model" + } + }, + "required": [ + "model", + "revision", + "quantized" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/schemas/embedding_functions/voyageai.json b/python/user_packages/Python313/site-packages/schemas/embedding_functions/voyageai.json new file mode 100644 index 0000000000000000000000000000000000000000..32f74639250170e2e641a80f3f71f108ff44d19f --- /dev/null +++ b/python/user_packages/Python313/site-packages/schemas/embedding_functions/voyageai.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Voyageai Embedding Function Schema", + "description": "Schema for the voyageai embedding function configuration", + "version": "1.0.0", + "type": "object", + "properties": { + "model_name": { + "type": "string", + "description": "Parameter model_name for the voyageai embedding function" + }, + "api_key_env_var": { + "type": "string", + "description": "Parameter api_key_env_var for the voyageai embedding function" + }, + "input_type": { + "type": [ + "string", + "null" + ], + "description": "Parameter input_type for the voyageai embedding function" + }, + "truncation": { + "type": "boolean", + "description": "Parameter truncation for the voyageai embedding function" + } + }, + "required": [ + "api_key_env_var", + "model_name" + ], + "additionalProperties": false +} diff --git a/python/user_packages/Python313/site-packages/service_identity-24.2.0.dist-info/licenses/LICENSE b/python/user_packages/Python313/site-packages/service_identity-24.2.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7ad898feb430e5c17122a6e1bea2bc50aa73b7fb --- /dev/null +++ b/python/user_packages/Python313/site-packages/service_identity-24.2.0.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Hynek Schlawack and the service-identity contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/python/user_packages/Python313/site-packages/service_identity/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/service_identity/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b8ccc36e1d6d9e983d210a8b38a9992ddd22ae6b Binary files /dev/null and b/python/user_packages/Python313/site-packages/service_identity/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/service_identity/__pycache__/cryptography.cpython-313.pyc b/python/user_packages/Python313/site-packages/service_identity/__pycache__/cryptography.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..311aa0fd8d055228f27662b5351fdde7f71ec817 Binary files /dev/null and b/python/user_packages/Python313/site-packages/service_identity/__pycache__/cryptography.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/service_identity/__pycache__/exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/service_identity/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..73117331c5a2ce9f5b81307ec677918f5716665b Binary files /dev/null and b/python/user_packages/Python313/site-packages/service_identity/__pycache__/exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/service_identity/__pycache__/hazmat.cpython-313.pyc b/python/user_packages/Python313/site-packages/service_identity/__pycache__/hazmat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0627a46dccfab9d25cb8e6d3bee414490a56b9ac Binary files /dev/null and b/python/user_packages/Python313/site-packages/service_identity/__pycache__/hazmat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/service_identity/__pycache__/pyopenssl.cpython-313.pyc b/python/user_packages/Python313/site-packages/service_identity/__pycache__/pyopenssl.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6b2c0a35a7376e322003b8c7c481cd510e9988d Binary files /dev/null and b/python/user_packages/Python313/site-packages/service_identity/__pycache__/pyopenssl.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d91dab998a65033cd37ae94de5dedb4f902babbe Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/_framework_compat.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/_framework_compat.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a058619bd4fa6c826d9016d4f34e43989f66fa9c Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/_framework_compat.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/check.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/check.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7eeca959615d5f9770897bb242f5a8f781da5374 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/check.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/clean.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/clean.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e347957266e829cdc6952ea49e6cb0c6eb74dfd Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/clean.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/config.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/config.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d2afd0939fd59450830b28cdd4c021ba8341081 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/config.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0014acd3896c3b6f9ff379bc797c0c258e56338f Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_data.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_data.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d75d3df73ff8374a82d526e78b09ef038adfae18 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_data.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_egg_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_egg_info.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79311fb24abf3cf48f48837f10921f6ecf0ad8b6 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_egg_info.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_headers.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_headers.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..857588e4172a7514292baac2356d3b3aff903c1c Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_headers.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_lib.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_lib.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e375427341fc6caaa260243019435926ae32de1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_lib.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_scripts.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_scripts.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cbb717344ac53bac79c88e5b153d19a2c8d9c5a5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/install_scripts.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/sdist.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/sdist.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d509daae403624c3510065dc5f8404c01bbf6d01 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/_distutils/command/__pycache__/sdist.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ddd5a67a9a5b1a866f37702c7fc5a802720eae9 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/_requirestxt.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/_requirestxt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f62806d0b53f045b9c13dbb050154b0ac8792d26 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/_requirestxt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/alias.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/alias.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0aebedd9050fd2d8a39d6b5e33187936e678774 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/alias.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f347e594aca866e6d908deec4b5f2cc6ac02ecd8 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f22f82c39e7baa6e7449c5dabdc16237f5eb7d2f Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_wheel.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_wheel.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..25328e019de602a87f0fa3193c2b95e791390aeb Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/bdist_wheel.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d82318078db33324c097e4b77bdb5bc754c493f4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_clib.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_clib.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f4e59be35c870244ec681ce79ab4836a96a883e Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_clib.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_ext.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_ext.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5c4d53b7b8dea00ba4e47716628411b2d991363 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_ext.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_py.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_py.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..63894f64a7d2bc6a36a9ecdf2eb4cfbf35139fd0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/build_py.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/develop.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/develop.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05575a23524f479f83ea5c3813307b1b25f04262 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/develop.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/dist_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/dist_info.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..769ff22d9b5ff231d51c3858d4efc3eb6c375bc7 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/dist_info.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/easy_install.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/easy_install.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8fd9983b891ac41f5024cbfe2560ce0febfa457a Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/easy_install.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/editable_wheel.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/editable_wheel.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..14ce96699003d03073a972fc22a0fad29a85c017 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/editable_wheel.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/egg_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/egg_info.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea4b34802c8f6e4e34e38c2569f8a14578964673 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/egg_info.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..96b21aa377f113ef56d3827a069ec880678c0375 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b48320c1e1510ec8795f7244021a49ac975cc93 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_lib.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_lib.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..058679e01e0bbee35673f10d88da63eaf9a62d40 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_lib.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_scripts.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_scripts.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ede3a41c49d0de792b44f35a8aebb08ccc8d5d8f Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/install_scripts.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/rotate.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/rotate.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12bfc256ffdd6b00a457f44706f04e641c47b753 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/rotate.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/saveopts.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/saveopts.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3490789d66b3eb596c9d02f6f2327a753a49cfc1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/saveopts.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/sdist.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/sdist.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90f1c7e7ca3926c3404aedebb6b1c967e936d662 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/sdist.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/setopt.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/setopt.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c83c5e92e7636c485d3867f4a93474380b5a3453 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/setopt.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/test.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/test.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..56657c98e609bf4c4569de2749a0ec4de09a3e5b Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/command/__pycache__/test.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d38e66ffeb8d2e2edba524543ebc726823b17542 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py310.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py310.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c33c18c174eadab83642fb8b5a4763bc616fe5e4 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py310.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py311.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py311.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88e4798269a5f66113bb2100f193c409d74df822 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py311.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py312.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py312.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e58d62cf2435270c0a7f746deae216b8a65369d1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py312.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py39.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py39.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..31ca67a787afa8e540519c7b4a1ba4ba6ed0b217 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/compat/__pycache__/py39.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..460c8d7a468ef3fcb752381b47f3dac71d133efc Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/_apply_pyprojecttoml.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/_apply_pyprojecttoml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..790533389ca923c348b5fa54d6ac3eead5e9dc04 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/_apply_pyprojecttoml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/expand.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/expand.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f8ce623463e55d26c715e75bab708374a1f2119 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/expand.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/pyprojecttoml.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/pyprojecttoml.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88aa54eadc35b86e3fac21dcfaacb367c59bb917 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/pyprojecttoml.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/setupcfg.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/setupcfg.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d18edf9647f2a60b1abb73eb3dff14478427d13d Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/__pycache__/setupcfg.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/NOTICE b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..74e8821fc84b4d62796e08b3941c1a6e2017e1e8 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/NOTICE @@ -0,0 +1,438 @@ +The code contained in this directory was automatically generated using the +following command: + + python -m validate_pyproject.pre_compile --output-dir=setuptools/config/_validate_pyproject --enable-plugins setuptools distutils --very-verbose -t distutils=setuptools/config/distutils.schema.json -t setuptools=setuptools/config/setuptools.schema.json + +Please avoid changing it manually. + + +You can report issues or suggest changes directly to `validate-pyproject` +(or to the relevant plugin repository) + +- https://github.com/abravalheri/validate-pyproject/issues + + +*** + +The following files include code from opensource projects +(either as direct copies or modified versions): + +- `fastjsonschema_exceptions.py`: + - project: `fastjsonschema` - licensed under BSD-3-Clause + (https://github.com/horejsek/python-fastjsonschema) +- `extra_validations.py` and `format.py`, `error_reporting.py`: + - project: `validate-pyproject` - licensed under MPL-2.0 + (https://github.com/abravalheri/validate-pyproject) + + +Additionally the following files are automatically generated by tools provided +by the same projects: + +- `__init__.py` +- `fastjsonschema_validations.py` + +The relevant copyright notes and licenses are included below. + + +*** + +`fastjsonschema` +================ + +Copyright (c) 2018, Michal Horejsek +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + + Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +*** + +`validate-pyproject` +==================== + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__init__.py b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4f612bd51c4ac1d272318ed6fb96e4aeb57e3e27 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__init__.py @@ -0,0 +1,34 @@ +from functools import reduce +from typing import Any, Callable, Dict + +from . import formats +from .error_reporting import detailed_errors, ValidationError +from .extra_validations import EXTRA_VALIDATIONS +from .fastjsonschema_exceptions import JsonSchemaException, JsonSchemaValueException +from .fastjsonschema_validations import validate as _validate + +__all__ = [ + "validate", + "FORMAT_FUNCTIONS", + "EXTRA_VALIDATIONS", + "ValidationError", + "JsonSchemaException", + "JsonSchemaValueException", +] + + +FORMAT_FUNCTIONS: Dict[str, Callable[[str], bool]] = { + fn.__name__.replace("_", "-"): fn + for fn in formats.__dict__.values() + if callable(fn) and not fn.__name__.startswith("_") +} + + +def validate(data: Any) -> bool: + """Validate the given ``data`` object using JSON Schema + This function raises ``ValidationError`` if ``data`` is invalid. + """ + with detailed_errors(): + _validate(data, custom_formats=FORMAT_FUNCTIONS) + reduce(lambda acc, fn: fn(acc), EXTRA_VALIDATIONS, data) + return True diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..277242f96b4fb8284a1cefba1f54b042a9160443 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/error_reporting.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/error_reporting.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d83ff7a0f3c31fff3ab0027d9c12ae796f2cce5 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/error_reporting.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/extra_validations.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/extra_validations.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..07dbba43a845ad37acb70e533223f9c10125b4cc Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/extra_validations.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_exceptions.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dcfa9c854b819069ca22ba0a1480b0bf1f8351b1 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/fastjsonschema_exceptions.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/formats.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/formats.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..134b7782a8648921f6fc3a43245d9361ffc75df0 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/__pycache__/formats.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/error_reporting.py b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/error_reporting.py new file mode 100644 index 0000000000000000000000000000000000000000..9ebe6a335c9308a79c147ed2ae2e4085e9964013 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/error_reporting.py @@ -0,0 +1,338 @@ +from __future__ import annotations + +import io +import json +import logging +import os +import re +import typing +from contextlib import contextmanager +from textwrap import indent, wrap +from typing import Any, Generator, Iterator, Sequence + +from .fastjsonschema_exceptions import JsonSchemaValueException + +if typing.TYPE_CHECKING: + import sys + + if sys.version_info < (3, 11): + from typing_extensions import Self + else: + from typing import Self + +_logger = logging.getLogger(__name__) + +_MESSAGE_REPLACEMENTS = { + "must be named by propertyName definition": "keys must be named by", + "one of contains definition": "at least one item that matches", + " same as const definition:": "", + "only specified items": "only items matching the definition", +} + +_SKIP_DETAILS = ( + "must not be empty", + "is always invalid", + "must not be there", +) + +_NEED_DETAILS = {"anyOf", "oneOf", "allOf", "contains", "propertyNames", "not", "items"} + +_CAMEL_CASE_SPLITTER = re.compile(r"\W+|([A-Z][^A-Z\W]*)") +_IDENTIFIER = re.compile(r"^[\w_]+$", re.IGNORECASE) + +_TOML_JARGON = { + "object": "table", + "property": "key", + "properties": "keys", + "property names": "keys", +} + +_FORMATS_HELP = """ +For more details about `format` see +https://validate-pyproject.readthedocs.io/en/latest/api/validate_pyproject.formats.html +""" + + +class ValidationError(JsonSchemaValueException): + """Report violations of a given JSON schema. + + This class extends :exc:`~fastjsonschema.JsonSchemaValueException` + by adding the following properties: + + - ``summary``: an improved version of the ``JsonSchemaValueException`` error message + with only the necessary information) + + - ``details``: more contextual information about the error like the failing schema + itself and the value that violates the schema. + + Depending on the level of the verbosity of the ``logging`` configuration + the exception message will be only ``summary`` (default) or a combination of + ``summary`` and ``details`` (when the logging level is set to :obj:`logging.DEBUG`). + """ + + summary = "" + details = "" + _original_message = "" + + @classmethod + def _from_jsonschema(cls, ex: JsonSchemaValueException) -> Self: + formatter = _ErrorFormatting(ex) + obj = cls(str(formatter), ex.value, formatter.name, ex.definition, ex.rule) + debug_code = os.getenv("JSONSCHEMA_DEBUG_CODE_GENERATION", "false").lower() + if debug_code != "false": # pragma: no cover + obj.__cause__, obj.__traceback__ = ex.__cause__, ex.__traceback__ + obj._original_message = ex.message + obj.summary = formatter.summary + obj.details = formatter.details + return obj + + +@contextmanager +def detailed_errors() -> Generator[None, None, None]: + try: + yield + except JsonSchemaValueException as ex: + raise ValidationError._from_jsonschema(ex) from None + + +class _ErrorFormatting: + def __init__(self, ex: JsonSchemaValueException): + self.ex = ex + self.name = f"`{self._simplify_name(ex.name)}`" + self._original_message: str = self.ex.message.replace(ex.name, self.name) + self._summary = "" + self._details = "" + + def __str__(self) -> str: + if _logger.getEffectiveLevel() <= logging.DEBUG and self.details: + return f"{self.summary}\n\n{self.details}" + + return self.summary + + @property + def summary(self) -> str: + if not self._summary: + self._summary = self._expand_summary() + + return self._summary + + @property + def details(self) -> str: + if not self._details: + self._details = self._expand_details() + + return self._details + + @staticmethod + def _simplify_name(name: str) -> str: + x = len("data.") + return name[x:] if name.startswith("data.") else name + + def _expand_summary(self) -> str: + msg = self._original_message + + for bad, repl in _MESSAGE_REPLACEMENTS.items(): + msg = msg.replace(bad, repl) + + if any(substring in msg for substring in _SKIP_DETAILS): + return msg + + schema = self.ex.rule_definition + if self.ex.rule in _NEED_DETAILS and schema: + summary = _SummaryWriter(_TOML_JARGON) + return f"{msg}:\n\n{indent(summary(schema), ' ')}" + + return msg + + def _expand_details(self) -> str: + optional = [] + definition = self.ex.definition or {} + desc_lines = definition.pop("$$description", []) + desc = definition.pop("description", None) or " ".join(desc_lines) + if desc: + description = "\n".join( + wrap( + desc, + width=80, + initial_indent=" ", + subsequent_indent=" ", + break_long_words=False, + ) + ) + optional.append(f"DESCRIPTION:\n{description}") + schema = json.dumps(definition, indent=4) + value = json.dumps(self.ex.value, indent=4) + defaults = [ + f"GIVEN VALUE:\n{indent(value, ' ')}", + f"OFFENDING RULE: {self.ex.rule!r}", + f"DEFINITION:\n{indent(schema, ' ')}", + ] + msg = "\n\n".join(optional + defaults) + epilog = f"\n{_FORMATS_HELP}" if "format" in msg.lower() else "" + return msg + epilog + + +class _SummaryWriter: + _IGNORE = frozenset(("description", "default", "title", "examples")) + + def __init__(self, jargon: dict[str, str] | None = None): + self.jargon: dict[str, str] = jargon or {} + # Clarify confusing terms + self._terms = { + "anyOf": "at least one of the following", + "oneOf": "exactly one of the following", + "allOf": "all of the following", + "not": "(*NOT* the following)", + "prefixItems": f"{self._jargon('items')} (in order)", + "items": "items", + "contains": "contains at least one of", + "propertyNames": ( + f"non-predefined acceptable {self._jargon('property names')}" + ), + "patternProperties": f"{self._jargon('properties')} named via pattern", + "const": "predefined value", + "enum": "one of", + } + # Attributes that indicate that the definition is easy and can be done + # inline (e.g. string and number) + self._guess_inline_defs = [ + "enum", + "const", + "maxLength", + "minLength", + "pattern", + "format", + "minimum", + "maximum", + "exclusiveMinimum", + "exclusiveMaximum", + "multipleOf", + ] + + def _jargon(self, term: str | list[str]) -> str | list[str]: + if isinstance(term, list): + return [self.jargon.get(t, t) for t in term] + return self.jargon.get(term, term) + + def __call__( + self, + schema: dict | list[dict], + prefix: str = "", + *, + _path: Sequence[str] = (), + ) -> str: + if isinstance(schema, list): + return self._handle_list(schema, prefix, _path) + + filtered = self._filter_unecessary(schema, _path) + simple = self._handle_simple_dict(filtered, _path) + if simple: + return f"{prefix}{simple}" + + child_prefix = self._child_prefix(prefix, " ") + item_prefix = self._child_prefix(prefix, "- ") + indent = len(prefix) * " " + with io.StringIO() as buffer: + for i, (key, value) in enumerate(filtered.items()): + child_path = [*_path, key] + line_prefix = prefix if i == 0 else indent + buffer.write(f"{line_prefix}{self._label(child_path)}:") + # ^ just the first item should receive the complete prefix + if isinstance(value, dict): + filtered = self._filter_unecessary(value, child_path) + simple = self._handle_simple_dict(filtered, child_path) + buffer.write( + f" {simple}" + if simple + else f"\n{self(value, child_prefix, _path=child_path)}" + ) + elif isinstance(value, list) and ( + key != "type" or self._is_property(child_path) + ): + children = self._handle_list(value, item_prefix, child_path) + sep = " " if children.startswith("[") else "\n" + buffer.write(f"{sep}{children}") + else: + buffer.write(f" {self._value(value, child_path)}\n") + return buffer.getvalue() + + def _is_unecessary(self, path: Sequence[str]) -> bool: + if self._is_property(path) or not path: # empty path => instruction @ root + return False + key = path[-1] + return any(key.startswith(k) for k in "$_") or key in self._IGNORE + + def _filter_unecessary( + self, schema: dict[str, Any], path: Sequence[str] + ) -> dict[str, Any]: + return { + key: value + for key, value in schema.items() + if not self._is_unecessary([*path, key]) + } + + def _handle_simple_dict(self, value: dict, path: Sequence[str]) -> str | None: + inline = any(p in value for p in self._guess_inline_defs) + simple = not any(isinstance(v, (list, dict)) for v in value.values()) + if inline or simple: + return f"{{{', '.join(self._inline_attrs(value, path))}}}\n" + return None + + def _handle_list( + self, schemas: list, prefix: str = "", path: Sequence[str] = () + ) -> str: + if self._is_unecessary(path): + return "" + + repr_ = repr(schemas) + if all(not isinstance(e, (dict, list)) for e in schemas) and len(repr_) < 60: + return f"{repr_}\n" + + item_prefix = self._child_prefix(prefix, "- ") + return "".join( + self(v, item_prefix, _path=[*path, f"[{i}]"]) for i, v in enumerate(schemas) + ) + + def _is_property(self, path: Sequence[str]) -> bool: + """Check if the given path can correspond to an arbitrarily named property""" + counter = 0 + for key in path[-2::-1]: + if key not in {"properties", "patternProperties"}: + break + counter += 1 + + # If the counter if even, the path correspond to a JSON Schema keyword + # otherwise it can be any arbitrary string naming a property + return counter % 2 == 1 + + def _label(self, path: Sequence[str]) -> str: + *parents, key = path + if not self._is_property(path): + norm_key = _separate_terms(key) + return self._terms.get(key) or " ".join(self._jargon(norm_key)) + + if parents[-1] == "patternProperties": + return f"(regex {key!r})" + return repr(key) # property name + + def _value(self, value: Any, path: Sequence[str]) -> str: + if path[-1] == "type" and not self._is_property(path): + type_ = self._jargon(value) + return f"[{', '.join(type_)}]" if isinstance(type_, list) else type_ + return repr(value) + + def _inline_attrs(self, schema: dict, path: Sequence[str]) -> Iterator[str]: + for key, value in schema.items(): + child_path = [*path, key] + yield f"{self._label(child_path)}: {self._value(value, child_path)}" + + def _child_prefix(self, parent_prefix: str, child_prefix: str) -> str: + return len(parent_prefix) * " " + child_prefix + + +def _separate_terms(word: str) -> list[str]: + """ + >>> _separate_terms("FooBar-foo") + ['foo', 'bar', 'foo'] + """ + return [w.lower() for w in _CAMEL_CASE_SPLITTER.split(word) if w] diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/extra_validations.py b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/extra_validations.py new file mode 100644 index 0000000000000000000000000000000000000000..72a7132f2b564748679242facbb5ab241feffae5 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/extra_validations.py @@ -0,0 +1,151 @@ +"""The purpose of this module is implement PEP 621 validations that are +difficult to express as a JSON Schema (or that are not supported by the current +JSON Schema library). +""" + +import collections +import itertools +from inspect import cleandoc +from typing import Generator, Iterable, Mapping, TypeVar + +from .error_reporting import ValidationError + +T = TypeVar("T", bound=Mapping) + + +class RedefiningStaticFieldAsDynamic(ValidationError): + _DESC = """According to PEP 621: + + Build back-ends MUST raise an error if the metadata specifies a field + statically as well as being listed in dynamic. + """ + __doc__ = _DESC + _URL = ( + "https://packaging.python.org/en/latest/specifications/pyproject-toml/#dynamic" + ) + + +class IncludedDependencyGroupMustExist(ValidationError): + _DESC = """An included dependency group must exist and must not be cyclic. + """ + __doc__ = _DESC + _URL = "https://peps.python.org/pep-0735/" + + +class ImportNameCollision(ValidationError): + _DESC = """According to PEP 794: + + All import-names and import-namespaces items must be unique. + """ + __doc__ = _DESC + _URL = "https://peps.python.org/pep-0794/" + + +class ImportNameMissing(ValidationError): + _DESC = """According to PEP 794: + + An import name must have all parents listed. + """ + __doc__ = _DESC + _URL = "https://peps.python.org/pep-0794/" + + +def validate_project_dynamic(pyproject: T) -> T: + project_table = pyproject.get("project", {}) + dynamic = project_table.get("dynamic", []) + + for field in dynamic: + if field in project_table: + raise RedefiningStaticFieldAsDynamic( + message=f"You cannot provide a value for `project.{field}` and " + "list it under `project.dynamic` at the same time", + value={ + field: project_table[field], + "...": " # ...", + "dynamic": dynamic, + }, + name=f"data.project.{field}", + definition={ + "description": cleandoc(RedefiningStaticFieldAsDynamic._DESC), + "see": RedefiningStaticFieldAsDynamic._URL, + }, + rule="PEP 621", + ) + + return pyproject + + +def validate_include_depenency(pyproject: T) -> T: + dependency_groups = pyproject.get("dependency-groups", {}) + for key, value in dependency_groups.items(): + for each in value: + if ( + isinstance(each, dict) + and (include_group := each.get("include-group")) + and include_group not in dependency_groups + ): + raise IncludedDependencyGroupMustExist( + message=f"The included dependency group {include_group} doesn't exist", + value=each, + name=f"data.dependency_groups.{key}", + definition={ + "description": cleandoc(IncludedDependencyGroupMustExist._DESC), + "see": IncludedDependencyGroupMustExist._URL, + }, + rule="PEP 735", + ) + # TODO: check for `include-group` cycles (can be conditional to graphlib) + return pyproject + + +def _remove_private(items: Iterable[str]) -> Generator[str, None, None]: + for item in items: + yield item.partition(";")[0].rstrip() + + +def validate_import_name_issues(pyproject: T) -> T: + project = pyproject.get("project", {}) + import_names = collections.Counter(_remove_private(project.get("import-names", []))) + import_namespaces = collections.Counter( + _remove_private(project.get("import-namespaces", [])) + ) + + duplicated = [k for k, v in (import_names + import_namespaces).items() if v > 1] + + if duplicated: + raise ImportNameCollision( + message="Duplicated names are not allowed in import-names/import-namespaces", + value=duplicated, + name="data.project.importnames(paces)", + definition={ + "description": cleandoc(ImportNameCollision._DESC), + "see": ImportNameCollision._URL, + }, + rule="PEP 794", + ) + + names = frozenset(import_names + import_namespaces) + for name in names: + for parent in itertools.accumulate( + name.split(".")[:-1], lambda a, b: f"{a}.{b}" + ): + if parent not in names: + raise ImportNameMissing( + message="All parents of an import name must also be listed in import-namespace/import-names", + value=name, + name="data.project.importnames(paces)", + definition={ + "description": cleandoc(ImportNameMissing._DESC), + "see": ImportNameMissing._URL, + }, + rule="PEP 794", + ) + + return pyproject + + +EXTRA_VALIDATIONS = ( + validate_project_dynamic, + validate_include_depenency, + validate_import_name_issues, +) diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..d2dddd6a106f021a4723c1e8f5953ccc09e55e1f --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py @@ -0,0 +1,51 @@ +import re + + +SPLIT_RE = re.compile(r'[\.\[\]]+') + + +class JsonSchemaException(ValueError): + """ + Base exception of ``fastjsonschema`` library. + """ + + +class JsonSchemaValueException(JsonSchemaException): + """ + Exception raised by validation function. Available properties: + + * ``message`` containing human-readable information what is wrong (e.g. ``data.property[index] must be smaller than or equal to 42``), + * invalid ``value`` (e.g. ``60``), + * ``name`` of a path in the data structure (e.g. ``data.property[index]``), + * ``path`` as an array in the data structure (e.g. ``['data', 'property', 'index']``), + * the whole ``definition`` which the ``value`` has to fulfil (e.g. ``{'type': 'number', 'maximum': 42}``), + * ``rule`` which the ``value`` is breaking (e.g. ``maximum``) + * and ``rule_definition`` (e.g. ``42``). + + .. versionchanged:: 2.14.0 + Added all extra properties. + """ + + def __init__(self, message, value=None, name=None, definition=None, rule=None): + super().__init__(message) + self.message = message + self.value = value + self.name = name + self.definition = definition + self.rule = rule + + @property + def path(self): + return [item for item in SPLIT_RE.split(self.name) if item != ''] + + @property + def rule_definition(self): + if not self.rule or not self.definition: + return None + return self.definition.get(self.rule) + + +class JsonSchemaDefinitionException(JsonSchemaException): + """ + Exception raised by generator of validation function. + """ diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_validations.py b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_validations.py new file mode 100644 index 0000000000000000000000000000000000000000..d8a03de9bfacf5e3401211ddb852354bb86c12f6 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/fastjsonschema_validations.py @@ -0,0 +1,1453 @@ +# noqa +# ruff: noqa +# flake8: noqa +# pylint: skip-file +# mypy: ignore-errors +# yapf: disable +# pylama:skip=1 + + +# *** PLEASE DO NOT MODIFY DIRECTLY: Automatically generated code *** + + +VERSION = "2.21.2" +from decimal import Decimal +import re +from .fastjsonschema_exceptions import JsonSchemaValueException + + +REGEX_PATTERNS = { + '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$': re.compile('^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])\\Z'), + '^.*$': re.compile('^.*$'), + '.+': re.compile('.+'), + '^.+$': re.compile('^.+$'), + 'idn-email_re_pattern': re.compile('^[^@]+@[^@]+\\.[^@]+\\Z') +} + +NoneType = type(None) + +def validate(data, custom_formats={}, name_prefix=None): + validate_https___packaging_python_org_en_latest_specifications_declaring_build_dependencies(data, custom_formats, (name_prefix or "data") + "") + return data + +def validate_https___packaging_python_org_en_latest_specifications_declaring_build_dependencies(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/declaring-build-dependencies/', 'title': 'Data structure for ``pyproject.toml`` files', '$$description': ['File format containing build-time configurations for the Python ecosystem. ', ':pep:`517` initially defined a build-system independent format for source trees', 'which was complemented by :pep:`518` to provide a way of specifying dependencies ', 'for building Python projects.', 'Please notice the ``project`` table (as initially defined in :pep:`621`) is not included', 'in this schema and should be considered separately.'], 'type': 'object', 'additionalProperties': False, 'properties': {'build-system': {'type': 'object', 'description': 'Table used to store build-related data', 'additionalProperties': False, 'properties': {'requires': {'type': 'array', '$$description': ['List of dependencies in the :pep:`508` format required to execute the build', 'system. Please notice that the resulting dependency graph', '**MUST NOT contain cycles**'], 'items': {'type': 'string'}}, 'build-backend': {'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, 'backend-path': {'type': 'array', '$$description': ['List of directories to be prepended to ``sys.path`` when loading the', 'back-end, and running its hooks'], 'items': {'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}}}, 'required': ['requires']}, 'project': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create command-line wrappers for the given', '`entry points `_.']}, 'gui-scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create GUI wrappers for the given', '`entry points `_.', 'The difference between ``scripts`` and ``gui-scripts`` is only relevant in', 'Windows.']}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$ref': '#/definitions/entry-point-group'}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$ref': '#/definitions/dependency'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$ref': '#/definitions/dependency'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}, 'tool': {'type': 'object', 'properties': {'distutils': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html', 'title': '``tool.distutils`` table', '$$description': ['**EXPERIMENTAL** (NOT OFFICIALLY SUPPORTED): Use ``tool.distutils``', 'subtables to configure arguments for ``distutils`` commands.', 'Originally, ``distutils`` allowed developers to configure arguments for', '``setup.py`` commands via `distutils configuration files', '`_.', 'See also `the old Python docs _`.'], 'type': 'object', 'properties': {'global': {'type': 'object', 'description': 'Global options applied to all ``distutils`` commands'}}, 'patternProperties': {'.+': {'type': 'object'}}, '$comment': 'TODO: Is there a practical way of making this schema more specific?'}, 'setuptools': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html', 'title': '``tool.setuptools`` table', '$$description': ['``setuptools``-specific configurations that can be set by users that require', 'customization.', 'These configurations are completely optional and probably can be skipped when', 'creating simple packages. They are equivalent to some of the `Keywords', '`_', 'used by the ``setup.py`` file, and can be set via the ``tool.setuptools`` table.', 'It considers only ``setuptools`` `parameters', '`_', 'that are not covered by :pep:`621`; and intentionally excludes ``dependency_links``', 'and ``setup_requires`` (incompatible with modern workflows/standards).'], 'type': 'object', 'additionalProperties': False, 'properties': {'platforms': {'type': 'array', 'items': {'type': 'string'}}, 'provides': {'$$description': ['Package and virtual package names contained within this package', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'obsoletes': {'$$description': ['Packages which this package renders obsolete', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'zip-safe': {'$$description': ['Whether the project can be safely installed and run from a zip file.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'boolean'}, 'script-files': {'$$description': ['Legacy way of defining scripts (entry-points are preferred).', 'Equivalent to the ``script`` keyword in ``setup.py``', '(it was renamed to avoid confusion with entry-point based ``project.scripts``', 'defined in :pep:`621`).', '**DISCOURAGED**: generic script wrappers are tricky and may not work properly.', 'Whenever possible, please use ``project.scripts`` instead.'], 'type': 'array', 'items': {'type': 'string'}, '$comment': 'TODO: is this field deprecated/should be removed?'}, 'eager-resources': {'$$description': ['Resources that should be extracted together, if any of them is needed,', 'or if any C extensions included in the project are imported.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'array', 'items': {'type': 'string'}}, 'packages': {'$$description': ['Packages that should be included in the distribution.', 'It can be given either as a list of package identifiers', 'or as a ``dict``-like structure with a single key ``find``', 'which corresponds to a dynamic call to', '``setuptools.config.expand.find_packages`` function.', 'The ``find`` key is associated with a nested ``dict``-like structure that can', 'contain ``where``, ``include``, ``exclude`` and ``namespaces`` keys,', 'mimicking the keyword arguments of the associated function.'], 'oneOf': [{'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$ref': '#/definitions/package-name'}}, {'$ref': '#/definitions/find-directive'}]}, 'package-dir': {'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$ref': '#/definitions/package-name'}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, 'package-data': {'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$ref': '#/definitions/package-name'}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'include-package-data': {'$$description': ['Automatically include any data files inside the package directories', 'that are specified by ``MANIFEST.in``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'boolean'}, 'exclude-package-data': {'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$ref': '#/definitions/package-name'}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'namespace-packages': {'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'https://setuptools.pypa.io/en/latest/userguide/package_discovery.html', 'description': '**DEPRECATED**: use implicit namespaces instead (:pep:`420`).'}, 'py-modules': {'description': 'Modules that setuptools will manipulate', 'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'TODO: clarify the relationship with ``packages``'}, 'ext-modules': {'description': 'Extension modules to be compiled by setuptools', 'type': 'array', 'items': {'$ref': '#/definitions/ext-module'}}, 'data-files': {'$$description': ['``dict``-like structure where each key represents a directory and', 'the value is a list of glob patterns that should be installed in them.', '**DISCOURAGED**: please notice this might not work as expected with wheels.', 'Whenever possible, consider using data files inside the package directories', '(or create a new namespace package that only contains data files).', 'See `data files support', '`_.'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'cmdclass': {'$$description': ['Mapping of distutils-style command names to ``setuptools.Command`` subclasses', 'which in turn should be represented by strings with a qualified class name', '(i.e., "dotted" form with module), e.g.::\n\n', ' cmdclass = {mycmd = "pkg.subpkg.module.CommandClass"}\n\n', 'The command class should be a directly defined at the top-level of the', 'containing module (no class nesting).'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'string', 'format': 'python-qualified-identifier'}}}, 'license-files': {'type': 'array', 'items': {'type': 'string'}, '$$description': ['**PROVISIONAL**: list of glob patterns for all license files being distributed.', '(likely to become standard with :pep:`639`).', "By default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``"], '$comment': 'TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?'}, 'dynamic': {'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'$ref': '#/definitions/attr-directive'}, {'$ref': '#/definitions/file-directive'}]}, 'classifiers': {'$ref': '#/definitions/file-directive'}, 'description': {'$ref': '#/definitions/file-directive'}, 'entry-points': {'$ref': '#/definitions/file-directive'}, 'dependencies': {'$ref': '#/definitions/file-directive-for-dependencies'}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'$ref': '#/definitions/file-directive-for-dependencies'}}}, 'readme': {'type': 'object', 'anyOf': [{'$ref': '#/definitions/file-directive'}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'$ref': '#/definitions/file-directive/properties/file'}}, 'additionalProperties': False}], 'required': ['file']}}}}, 'definitions': {'package-name': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, 'ext-module': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, 'file-directive': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'file-directive-for-dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'attr-directive': {'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, 'find-directive': {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}}}}}, 'dependency-groups': {'type': 'object', 'description': 'Dependency groups following PEP 735', 'additionalProperties': False, 'patternProperties': {'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$': {'type': 'array', 'items': {'oneOf': [{'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, {'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}]}}}}}, 'project': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create command-line wrappers for the given', '`entry points `_.']}, 'gui-scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create GUI wrappers for the given', '`entry points `_.', 'The difference between ``scripts`` and ``gui-scripts`` is only relevant in', 'Windows.']}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$ref': '#/definitions/entry-point-group'}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$ref': '#/definitions/dependency'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$ref': '#/definitions/dependency'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "build-system" in data_keys: + data_keys.remove("build-system") + data__buildsystem = data["build-system"] + if not isinstance(data__buildsystem, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system must be object", value=data__buildsystem, name="" + (name_prefix or "data") + ".build-system", definition={'type': 'object', 'description': 'Table used to store build-related data', 'additionalProperties': False, 'properties': {'requires': {'type': 'array', '$$description': ['List of dependencies in the :pep:`508` format required to execute the build', 'system. Please notice that the resulting dependency graph', '**MUST NOT contain cycles**'], 'items': {'type': 'string'}}, 'build-backend': {'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, 'backend-path': {'type': 'array', '$$description': ['List of directories to be prepended to ``sys.path`` when loading the', 'back-end, and running its hooks'], 'items': {'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}}}, 'required': ['requires']}, rule='type') + data__buildsystem_is_dict = isinstance(data__buildsystem, dict) + if data__buildsystem_is_dict: + data__buildsystem__missing_keys = set(['requires']) - data__buildsystem.keys() + if data__buildsystem__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system must contain " + (str(sorted(data__buildsystem__missing_keys)) + " properties"), value=data__buildsystem, name="" + (name_prefix or "data") + ".build-system", definition={'type': 'object', 'description': 'Table used to store build-related data', 'additionalProperties': False, 'properties': {'requires': {'type': 'array', '$$description': ['List of dependencies in the :pep:`508` format required to execute the build', 'system. Please notice that the resulting dependency graph', '**MUST NOT contain cycles**'], 'items': {'type': 'string'}}, 'build-backend': {'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, 'backend-path': {'type': 'array', '$$description': ['List of directories to be prepended to ``sys.path`` when loading the', 'back-end, and running its hooks'], 'items': {'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}}}, 'required': ['requires']}, rule='required') + data__buildsystem_keys = set(data__buildsystem.keys()) + if "requires" in data__buildsystem_keys: + data__buildsystem_keys.remove("requires") + data__buildsystem__requires = data__buildsystem["requires"] + if not isinstance(data__buildsystem__requires, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system.requires must be array", value=data__buildsystem__requires, name="" + (name_prefix or "data") + ".build-system.requires", definition={'type': 'array', '$$description': ['List of dependencies in the :pep:`508` format required to execute the build', 'system. Please notice that the resulting dependency graph', '**MUST NOT contain cycles**'], 'items': {'type': 'string'}}, rule='type') + data__buildsystem__requires_is_list = isinstance(data__buildsystem__requires, (list, tuple)) + if data__buildsystem__requires_is_list: + data__buildsystem__requires_len = len(data__buildsystem__requires) + for data__buildsystem__requires_x, data__buildsystem__requires_item in enumerate(data__buildsystem__requires): + if not isinstance(data__buildsystem__requires_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system.requires[{data__buildsystem__requires_x}]".format(**locals()) + " must be string", value=data__buildsystem__requires_item, name="" + (name_prefix or "data") + ".build-system.requires[{data__buildsystem__requires_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "build-backend" in data__buildsystem_keys: + data__buildsystem_keys.remove("build-backend") + data__buildsystem__buildbackend = data__buildsystem["build-backend"] + if not isinstance(data__buildsystem__buildbackend, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system.build-backend must be string", value=data__buildsystem__buildbackend, name="" + (name_prefix or "data") + ".build-system.build-backend", definition={'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, rule='type') + if isinstance(data__buildsystem__buildbackend, str): + if not custom_formats["pep517-backend-reference"](data__buildsystem__buildbackend): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system.build-backend must be pep517-backend-reference", value=data__buildsystem__buildbackend, name="" + (name_prefix or "data") + ".build-system.build-backend", definition={'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, rule='format') + if "backend-path" in data__buildsystem_keys: + data__buildsystem_keys.remove("backend-path") + data__buildsystem__backendpath = data__buildsystem["backend-path"] + if not isinstance(data__buildsystem__backendpath, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system.backend-path must be array", value=data__buildsystem__backendpath, name="" + (name_prefix or "data") + ".build-system.backend-path", definition={'type': 'array', '$$description': ['List of directories to be prepended to ``sys.path`` when loading the', 'back-end, and running its hooks'], 'items': {'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}}, rule='type') + data__buildsystem__backendpath_is_list = isinstance(data__buildsystem__backendpath, (list, tuple)) + if data__buildsystem__backendpath_is_list: + data__buildsystem__backendpath_len = len(data__buildsystem__backendpath) + for data__buildsystem__backendpath_x, data__buildsystem__backendpath_item in enumerate(data__buildsystem__backendpath): + if not isinstance(data__buildsystem__backendpath_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system.backend-path[{data__buildsystem__backendpath_x}]".format(**locals()) + " must be string", value=data__buildsystem__backendpath_item, name="" + (name_prefix or "data") + ".build-system.backend-path[{data__buildsystem__backendpath_x}]".format(**locals()) + "", definition={'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}, rule='type') + if data__buildsystem_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".build-system must not contain "+str(data__buildsystem_keys)+" properties", value=data__buildsystem, name="" + (name_prefix or "data") + ".build-system", definition={'type': 'object', 'description': 'Table used to store build-related data', 'additionalProperties': False, 'properties': {'requires': {'type': 'array', '$$description': ['List of dependencies in the :pep:`508` format required to execute the build', 'system. Please notice that the resulting dependency graph', '**MUST NOT contain cycles**'], 'items': {'type': 'string'}}, 'build-backend': {'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, 'backend-path': {'type': 'array', '$$description': ['List of directories to be prepended to ``sys.path`` when loading the', 'back-end, and running its hooks'], 'items': {'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}}}, 'required': ['requires']}, rule='additionalProperties') + if "project" in data_keys: + data_keys.remove("project") + data__project = data["project"] + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml(data__project, custom_formats, (name_prefix or "data") + ".project") + if "tool" in data_keys: + data_keys.remove("tool") + data__tool = data["tool"] + if not isinstance(data__tool, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".tool must be object", value=data__tool, name="" + (name_prefix or "data") + ".tool", definition={'type': 'object', 'properties': {'distutils': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html', 'title': '``tool.distutils`` table', '$$description': ['**EXPERIMENTAL** (NOT OFFICIALLY SUPPORTED): Use ``tool.distutils``', 'subtables to configure arguments for ``distutils`` commands.', 'Originally, ``distutils`` allowed developers to configure arguments for', '``setup.py`` commands via `distutils configuration files', '`_.', 'See also `the old Python docs _`.'], 'type': 'object', 'properties': {'global': {'type': 'object', 'description': 'Global options applied to all ``distutils`` commands'}}, 'patternProperties': {'.+': {'type': 'object'}}, '$comment': 'TODO: Is there a practical way of making this schema more specific?'}, 'setuptools': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html', 'title': '``tool.setuptools`` table', '$$description': ['``setuptools``-specific configurations that can be set by users that require', 'customization.', 'These configurations are completely optional and probably can be skipped when', 'creating simple packages. They are equivalent to some of the `Keywords', '`_', 'used by the ``setup.py`` file, and can be set via the ``tool.setuptools`` table.', 'It considers only ``setuptools`` `parameters', '`_', 'that are not covered by :pep:`621`; and intentionally excludes ``dependency_links``', 'and ``setup_requires`` (incompatible with modern workflows/standards).'], 'type': 'object', 'additionalProperties': False, 'properties': {'platforms': {'type': 'array', 'items': {'type': 'string'}}, 'provides': {'$$description': ['Package and virtual package names contained within this package', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'obsoletes': {'$$description': ['Packages which this package renders obsolete', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'zip-safe': {'$$description': ['Whether the project can be safely installed and run from a zip file.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'boolean'}, 'script-files': {'$$description': ['Legacy way of defining scripts (entry-points are preferred).', 'Equivalent to the ``script`` keyword in ``setup.py``', '(it was renamed to avoid confusion with entry-point based ``project.scripts``', 'defined in :pep:`621`).', '**DISCOURAGED**: generic script wrappers are tricky and may not work properly.', 'Whenever possible, please use ``project.scripts`` instead.'], 'type': 'array', 'items': {'type': 'string'}, '$comment': 'TODO: is this field deprecated/should be removed?'}, 'eager-resources': {'$$description': ['Resources that should be extracted together, if any of them is needed,', 'or if any C extensions included in the project are imported.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'array', 'items': {'type': 'string'}}, 'packages': {'$$description': ['Packages that should be included in the distribution.', 'It can be given either as a list of package identifiers', 'or as a ``dict``-like structure with a single key ``find``', 'which corresponds to a dynamic call to', '``setuptools.config.expand.find_packages`` function.', 'The ``find`` key is associated with a nested ``dict``-like structure that can', 'contain ``where``, ``include``, ``exclude`` and ``namespaces`` keys,', 'mimicking the keyword arguments of the associated function.'], 'oneOf': [{'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$ref': '#/definitions/package-name'}}, {'$ref': '#/definitions/find-directive'}]}, 'package-dir': {'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$ref': '#/definitions/package-name'}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, 'package-data': {'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$ref': '#/definitions/package-name'}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'include-package-data': {'$$description': ['Automatically include any data files inside the package directories', 'that are specified by ``MANIFEST.in``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'boolean'}, 'exclude-package-data': {'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$ref': '#/definitions/package-name'}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'namespace-packages': {'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'https://setuptools.pypa.io/en/latest/userguide/package_discovery.html', 'description': '**DEPRECATED**: use implicit namespaces instead (:pep:`420`).'}, 'py-modules': {'description': 'Modules that setuptools will manipulate', 'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'TODO: clarify the relationship with ``packages``'}, 'ext-modules': {'description': 'Extension modules to be compiled by setuptools', 'type': 'array', 'items': {'$ref': '#/definitions/ext-module'}}, 'data-files': {'$$description': ['``dict``-like structure where each key represents a directory and', 'the value is a list of glob patterns that should be installed in them.', '**DISCOURAGED**: please notice this might not work as expected with wheels.', 'Whenever possible, consider using data files inside the package directories', '(or create a new namespace package that only contains data files).', 'See `data files support', '`_.'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'cmdclass': {'$$description': ['Mapping of distutils-style command names to ``setuptools.Command`` subclasses', 'which in turn should be represented by strings with a qualified class name', '(i.e., "dotted" form with module), e.g.::\n\n', ' cmdclass = {mycmd = "pkg.subpkg.module.CommandClass"}\n\n', 'The command class should be a directly defined at the top-level of the', 'containing module (no class nesting).'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'string', 'format': 'python-qualified-identifier'}}}, 'license-files': {'type': 'array', 'items': {'type': 'string'}, '$$description': ['**PROVISIONAL**: list of glob patterns for all license files being distributed.', '(likely to become standard with :pep:`639`).', "By default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``"], '$comment': 'TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?'}, 'dynamic': {'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'$ref': '#/definitions/attr-directive'}, {'$ref': '#/definitions/file-directive'}]}, 'classifiers': {'$ref': '#/definitions/file-directive'}, 'description': {'$ref': '#/definitions/file-directive'}, 'entry-points': {'$ref': '#/definitions/file-directive'}, 'dependencies': {'$ref': '#/definitions/file-directive-for-dependencies'}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'$ref': '#/definitions/file-directive-for-dependencies'}}}, 'readme': {'type': 'object', 'anyOf': [{'$ref': '#/definitions/file-directive'}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'$ref': '#/definitions/file-directive/properties/file'}}, 'additionalProperties': False}], 'required': ['file']}}}}, 'definitions': {'package-name': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, 'ext-module': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, 'file-directive': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'file-directive-for-dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'attr-directive': {'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, 'find-directive': {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}}}}}, rule='type') + data__tool_is_dict = isinstance(data__tool, dict) + if data__tool_is_dict: + data__tool_keys = set(data__tool.keys()) + if "distutils" in data__tool_keys: + data__tool_keys.remove("distutils") + data__tool__distutils = data__tool["distutils"] + validate_https___setuptools_pypa_io_en_latest_deprecated_distutils_configfile_html(data__tool__distutils, custom_formats, (name_prefix or "data") + ".tool.distutils") + if "setuptools" in data__tool_keys: + data__tool_keys.remove("setuptools") + data__tool__setuptools = data__tool["setuptools"] + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html(data__tool__setuptools, custom_formats, (name_prefix or "data") + ".tool.setuptools") + if "dependency-groups" in data_keys: + data_keys.remove("dependency-groups") + data__dependencygroups = data["dependency-groups"] + if not isinstance(data__dependencygroups, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups must be object", value=data__dependencygroups, name="" + (name_prefix or "data") + ".dependency-groups", definition={'type': 'object', 'description': 'Dependency groups following PEP 735', 'additionalProperties': False, 'patternProperties': {'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$': {'type': 'array', 'items': {'oneOf': [{'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, {'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}]}}}}, rule='type') + data__dependencygroups_is_dict = isinstance(data__dependencygroups, dict) + if data__dependencygroups_is_dict: + data__dependencygroups_keys = set(data__dependencygroups.keys()) + for data__dependencygroups_key, data__dependencygroups_val in data__dependencygroups.items(): + if REGEX_PATTERNS['^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'].search(data__dependencygroups_key): + if data__dependencygroups_key in data__dependencygroups_keys: + data__dependencygroups_keys.remove(data__dependencygroups_key) + if not isinstance(data__dependencygroups_val, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}".format(**locals()) + " must be array", value=data__dependencygroups_val, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}".format(**locals()) + "", definition={'type': 'array', 'items': {'oneOf': [{'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, {'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}]}}, rule='type') + data__dependencygroups_val_is_list = isinstance(data__dependencygroups_val, (list, tuple)) + if data__dependencygroups_val_is_list: + data__dependencygroups_val_len = len(data__dependencygroups_val) + for data__dependencygroups_val_x, data__dependencygroups_val_item in enumerate(data__dependencygroups_val): + data__dependencygroups_val_item_one_of_count1 = 0 + if data__dependencygroups_val_item_one_of_count1 < 2: + try: + if not isinstance(data__dependencygroups_val_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + " must be string", value=data__dependencygroups_val_item, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + "", definition={'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, rule='type') + if isinstance(data__dependencygroups_val_item, str): + if not custom_formats["pep508"](data__dependencygroups_val_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + " must be pep508", value=data__dependencygroups_val_item, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + "", definition={'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, rule='format') + data__dependencygroups_val_item_one_of_count1 += 1 + except JsonSchemaValueException: pass + if data__dependencygroups_val_item_one_of_count1 < 2: + try: + if not isinstance(data__dependencygroups_val_item, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + " must be object", value=data__dependencygroups_val_item, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + "", definition={'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}, rule='type') + data__dependencygroups_val_item_is_dict = isinstance(data__dependencygroups_val_item, dict) + if data__dependencygroups_val_item_is_dict: + data__dependencygroups_val_item_keys = set(data__dependencygroups_val_item.keys()) + if "include-group" in data__dependencygroups_val_item_keys: + data__dependencygroups_val_item_keys.remove("include-group") + data__dependencygroups_val_item__includegroup = data__dependencygroups_val_item["include-group"] + if not isinstance(data__dependencygroups_val_item__includegroup, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}].include-group".format(**locals()) + " must be string", value=data__dependencygroups_val_item__includegroup, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}].include-group".format(**locals()) + "", definition={'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}, rule='type') + if isinstance(data__dependencygroups_val_item__includegroup, str): + if not REGEX_PATTERNS['^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'].search(data__dependencygroups_val_item__includegroup): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}].include-group".format(**locals()) + " must match pattern ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$", value=data__dependencygroups_val_item__includegroup, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}].include-group".format(**locals()) + "", definition={'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}, rule='pattern') + if data__dependencygroups_val_item_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + " must not contain "+str(data__dependencygroups_val_item_keys)+" properties", value=data__dependencygroups_val_item, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + "", definition={'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}, rule='additionalProperties') + data__dependencygroups_val_item_one_of_count1 += 1 + except JsonSchemaValueException: pass + if data__dependencygroups_val_item_one_of_count1 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + " must be valid exactly by one definition" + (" (" + str(data__dependencygroups_val_item_one_of_count1) + " matches found)"), value=data__dependencygroups_val_item, name="" + (name_prefix or "data") + ".dependency-groups.{data__dependencygroups_key}[{data__dependencygroups_val_x}]".format(**locals()) + "", definition={'oneOf': [{'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, {'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}]}, rule='oneOf') + if data__dependencygroups_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependency-groups must not contain "+str(data__dependencygroups_keys)+" properties", value=data__dependencygroups, name="" + (name_prefix or "data") + ".dependency-groups", definition={'type': 'object', 'description': 'Dependency groups following PEP 735', 'additionalProperties': False, 'patternProperties': {'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$': {'type': 'array', 'items': {'oneOf': [{'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, {'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}]}}}}, rule='additionalProperties') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/declaring-build-dependencies/', 'title': 'Data structure for ``pyproject.toml`` files', '$$description': ['File format containing build-time configurations for the Python ecosystem. ', ':pep:`517` initially defined a build-system independent format for source trees', 'which was complemented by :pep:`518` to provide a way of specifying dependencies ', 'for building Python projects.', 'Please notice the ``project`` table (as initially defined in :pep:`621`) is not included', 'in this schema and should be considered separately.'], 'type': 'object', 'additionalProperties': False, 'properties': {'build-system': {'type': 'object', 'description': 'Table used to store build-related data', 'additionalProperties': False, 'properties': {'requires': {'type': 'array', '$$description': ['List of dependencies in the :pep:`508` format required to execute the build', 'system. Please notice that the resulting dependency graph', '**MUST NOT contain cycles**'], 'items': {'type': 'string'}}, 'build-backend': {'type': 'string', 'description': 'Python object that will be used to perform the build according to :pep:`517`', 'format': 'pep517-backend-reference'}, 'backend-path': {'type': 'array', '$$description': ['List of directories to be prepended to ``sys.path`` when loading the', 'back-end, and running its hooks'], 'items': {'type': 'string', '$comment': 'Should be a path (TODO: enforce it with format?)'}}}, 'required': ['requires']}, 'project': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create command-line wrappers for the given', '`entry points `_.']}, 'gui-scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create GUI wrappers for the given', '`entry points `_.', 'The difference between ``scripts`` and ``gui-scripts`` is only relevant in', 'Windows.']}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$ref': '#/definitions/entry-point-group'}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$ref': '#/definitions/dependency'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$ref': '#/definitions/dependency'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}, 'tool': {'type': 'object', 'properties': {'distutils': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html', 'title': '``tool.distutils`` table', '$$description': ['**EXPERIMENTAL** (NOT OFFICIALLY SUPPORTED): Use ``tool.distutils``', 'subtables to configure arguments for ``distutils`` commands.', 'Originally, ``distutils`` allowed developers to configure arguments for', '``setup.py`` commands via `distutils configuration files', '`_.', 'See also `the old Python docs _`.'], 'type': 'object', 'properties': {'global': {'type': 'object', 'description': 'Global options applied to all ``distutils`` commands'}}, 'patternProperties': {'.+': {'type': 'object'}}, '$comment': 'TODO: Is there a practical way of making this schema more specific?'}, 'setuptools': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html', 'title': '``tool.setuptools`` table', '$$description': ['``setuptools``-specific configurations that can be set by users that require', 'customization.', 'These configurations are completely optional and probably can be skipped when', 'creating simple packages. They are equivalent to some of the `Keywords', '`_', 'used by the ``setup.py`` file, and can be set via the ``tool.setuptools`` table.', 'It considers only ``setuptools`` `parameters', '`_', 'that are not covered by :pep:`621`; and intentionally excludes ``dependency_links``', 'and ``setup_requires`` (incompatible with modern workflows/standards).'], 'type': 'object', 'additionalProperties': False, 'properties': {'platforms': {'type': 'array', 'items': {'type': 'string'}}, 'provides': {'$$description': ['Package and virtual package names contained within this package', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'obsoletes': {'$$description': ['Packages which this package renders obsolete', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'zip-safe': {'$$description': ['Whether the project can be safely installed and run from a zip file.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'boolean'}, 'script-files': {'$$description': ['Legacy way of defining scripts (entry-points are preferred).', 'Equivalent to the ``script`` keyword in ``setup.py``', '(it was renamed to avoid confusion with entry-point based ``project.scripts``', 'defined in :pep:`621`).', '**DISCOURAGED**: generic script wrappers are tricky and may not work properly.', 'Whenever possible, please use ``project.scripts`` instead.'], 'type': 'array', 'items': {'type': 'string'}, '$comment': 'TODO: is this field deprecated/should be removed?'}, 'eager-resources': {'$$description': ['Resources that should be extracted together, if any of them is needed,', 'or if any C extensions included in the project are imported.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'array', 'items': {'type': 'string'}}, 'packages': {'$$description': ['Packages that should be included in the distribution.', 'It can be given either as a list of package identifiers', 'or as a ``dict``-like structure with a single key ``find``', 'which corresponds to a dynamic call to', '``setuptools.config.expand.find_packages`` function.', 'The ``find`` key is associated with a nested ``dict``-like structure that can', 'contain ``where``, ``include``, ``exclude`` and ``namespaces`` keys,', 'mimicking the keyword arguments of the associated function.'], 'oneOf': [{'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$ref': '#/definitions/package-name'}}, {'$ref': '#/definitions/find-directive'}]}, 'package-dir': {'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$ref': '#/definitions/package-name'}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, 'package-data': {'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$ref': '#/definitions/package-name'}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'include-package-data': {'$$description': ['Automatically include any data files inside the package directories', 'that are specified by ``MANIFEST.in``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'boolean'}, 'exclude-package-data': {'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$ref': '#/definitions/package-name'}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'namespace-packages': {'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'https://setuptools.pypa.io/en/latest/userguide/package_discovery.html', 'description': '**DEPRECATED**: use implicit namespaces instead (:pep:`420`).'}, 'py-modules': {'description': 'Modules that setuptools will manipulate', 'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'TODO: clarify the relationship with ``packages``'}, 'ext-modules': {'description': 'Extension modules to be compiled by setuptools', 'type': 'array', 'items': {'$ref': '#/definitions/ext-module'}}, 'data-files': {'$$description': ['``dict``-like structure where each key represents a directory and', 'the value is a list of glob patterns that should be installed in them.', '**DISCOURAGED**: please notice this might not work as expected with wheels.', 'Whenever possible, consider using data files inside the package directories', '(or create a new namespace package that only contains data files).', 'See `data files support', '`_.'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'cmdclass': {'$$description': ['Mapping of distutils-style command names to ``setuptools.Command`` subclasses', 'which in turn should be represented by strings with a qualified class name', '(i.e., "dotted" form with module), e.g.::\n\n', ' cmdclass = {mycmd = "pkg.subpkg.module.CommandClass"}\n\n', 'The command class should be a directly defined at the top-level of the', 'containing module (no class nesting).'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'string', 'format': 'python-qualified-identifier'}}}, 'license-files': {'type': 'array', 'items': {'type': 'string'}, '$$description': ['**PROVISIONAL**: list of glob patterns for all license files being distributed.', '(likely to become standard with :pep:`639`).', "By default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``"], '$comment': 'TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?'}, 'dynamic': {'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'$ref': '#/definitions/attr-directive'}, {'$ref': '#/definitions/file-directive'}]}, 'classifiers': {'$ref': '#/definitions/file-directive'}, 'description': {'$ref': '#/definitions/file-directive'}, 'entry-points': {'$ref': '#/definitions/file-directive'}, 'dependencies': {'$ref': '#/definitions/file-directive-for-dependencies'}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'$ref': '#/definitions/file-directive-for-dependencies'}}}, 'readme': {'type': 'object', 'anyOf': [{'$ref': '#/definitions/file-directive'}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'$ref': '#/definitions/file-directive/properties/file'}}, 'additionalProperties': False}], 'required': ['file']}}}}, 'definitions': {'package-name': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, 'ext-module': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, 'file-directive': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'file-directive-for-dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'attr-directive': {'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, 'find-directive': {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}}}}}, 'dependency-groups': {'type': 'object', 'description': 'Dependency groups following PEP 735', 'additionalProperties': False, 'patternProperties': {'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$': {'type': 'array', 'items': {'oneOf': [{'type': 'string', 'description': 'Python package specifiers following PEP 508', 'format': 'pep508'}, {'type': 'object', 'additionalProperties': False, 'properties': {'include-group': {'description': 'Another dependency group to include in this one', 'type': 'string', 'pattern': '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$'}}}]}}}}}, 'project': {'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$ref': '#/definitions/author'}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create command-line wrappers for the given', '`entry points `_.']}, 'gui-scripts': {'$ref': '#/definitions/entry-point-group', '$$description': ['Instruct the installer to create GUI wrappers for the given', '`entry points `_.', 'The difference between ``scripts`` and ``gui-scripts`` is only relevant in', 'Windows.']}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$ref': '#/definitions/entry-point-group'}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$ref': '#/definitions/dependency'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$ref': '#/definitions/dependency'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, rule='additionalProperties') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html', 'title': '``tool.setuptools`` table', '$$description': ['``setuptools``-specific configurations that can be set by users that require', 'customization.', 'These configurations are completely optional and probably can be skipped when', 'creating simple packages. They are equivalent to some of the `Keywords', '`_', 'used by the ``setup.py`` file, and can be set via the ``tool.setuptools`` table.', 'It considers only ``setuptools`` `parameters', '`_', 'that are not covered by :pep:`621`; and intentionally excludes ``dependency_links``', 'and ``setup_requires`` (incompatible with modern workflows/standards).'], 'type': 'object', 'additionalProperties': False, 'properties': {'platforms': {'type': 'array', 'items': {'type': 'string'}}, 'provides': {'$$description': ['Package and virtual package names contained within this package', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'obsoletes': {'$$description': ['Packages which this package renders obsolete', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'zip-safe': {'$$description': ['Whether the project can be safely installed and run from a zip file.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'boolean'}, 'script-files': {'$$description': ['Legacy way of defining scripts (entry-points are preferred).', 'Equivalent to the ``script`` keyword in ``setup.py``', '(it was renamed to avoid confusion with entry-point based ``project.scripts``', 'defined in :pep:`621`).', '**DISCOURAGED**: generic script wrappers are tricky and may not work properly.', 'Whenever possible, please use ``project.scripts`` instead.'], 'type': 'array', 'items': {'type': 'string'}, '$comment': 'TODO: is this field deprecated/should be removed?'}, 'eager-resources': {'$$description': ['Resources that should be extracted together, if any of them is needed,', 'or if any C extensions included in the project are imported.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'array', 'items': {'type': 'string'}}, 'packages': {'$$description': ['Packages that should be included in the distribution.', 'It can be given either as a list of package identifiers', 'or as a ``dict``-like structure with a single key ``find``', 'which corresponds to a dynamic call to', '``setuptools.config.expand.find_packages`` function.', 'The ``find`` key is associated with a nested ``dict``-like structure that can', 'contain ``where``, ``include``, ``exclude`` and ``namespaces`` keys,', 'mimicking the keyword arguments of the associated function.'], 'oneOf': [{'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}}, {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}]}, 'package-dir': {'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, 'package-data': {'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'include-package-data': {'$$description': ['Automatically include any data files inside the package directories', 'that are specified by ``MANIFEST.in``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'boolean'}, 'exclude-package-data': {'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'namespace-packages': {'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'https://setuptools.pypa.io/en/latest/userguide/package_discovery.html', 'description': '**DEPRECATED**: use implicit namespaces instead (:pep:`420`).'}, 'py-modules': {'description': 'Modules that setuptools will manipulate', 'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'TODO: clarify the relationship with ``packages``'}, 'ext-modules': {'description': 'Extension modules to be compiled by setuptools', 'type': 'array', 'items': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}}, 'data-files': {'$$description': ['``dict``-like structure where each key represents a directory and', 'the value is a list of glob patterns that should be installed in them.', '**DISCOURAGED**: please notice this might not work as expected with wheels.', 'Whenever possible, consider using data files inside the package directories', '(or create a new namespace package that only contains data files).', 'See `data files support', '`_.'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'cmdclass': {'$$description': ['Mapping of distutils-style command names to ``setuptools.Command`` subclasses', 'which in turn should be represented by strings with a qualified class name', '(i.e., "dotted" form with module), e.g.::\n\n', ' cmdclass = {mycmd = "pkg.subpkg.module.CommandClass"}\n\n', 'The command class should be a directly defined at the top-level of the', 'containing module (no class nesting).'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'string', 'format': 'python-qualified-identifier'}}}, 'license-files': {'type': 'array', 'items': {'type': 'string'}, '$$description': ['**PROVISIONAL**: list of glob patterns for all license files being distributed.', '(likely to become standard with :pep:`639`).', "By default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``"], '$comment': 'TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?'}, 'dynamic': {'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, 'classifiers': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'description': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'entry-points': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, 'readme': {'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}}}}, 'definitions': {'package-name': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, 'ext-module': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, 'file-directive': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'file-directive-for-dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, 'attr-directive': {'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, 'find-directive': {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "platforms" in data_keys: + data_keys.remove("platforms") + data__platforms = data["platforms"] + if not isinstance(data__platforms, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".platforms must be array", value=data__platforms, name="" + (name_prefix or "data") + ".platforms", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__platforms_is_list = isinstance(data__platforms, (list, tuple)) + if data__platforms_is_list: + data__platforms_len = len(data__platforms) + for data__platforms_x, data__platforms_item in enumerate(data__platforms): + if not isinstance(data__platforms_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".platforms[{data__platforms_x}]".format(**locals()) + " must be string", value=data__platforms_item, name="" + (name_prefix or "data") + ".platforms[{data__platforms_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "provides" in data_keys: + data_keys.remove("provides") + data__provides = data["provides"] + if not isinstance(data__provides, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".provides must be array", value=data__provides, name="" + (name_prefix or "data") + ".provides", definition={'$$description': ['Package and virtual package names contained within this package', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, rule='type') + data__provides_is_list = isinstance(data__provides, (list, tuple)) + if data__provides_is_list: + data__provides_len = len(data__provides) + for data__provides_x, data__provides_item in enumerate(data__provides): + if not isinstance(data__provides_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".provides[{data__provides_x}]".format(**locals()) + " must be string", value=data__provides_item, name="" + (name_prefix or "data") + ".provides[{data__provides_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'pep508-identifier'}, rule='type') + if isinstance(data__provides_item, str): + if not custom_formats["pep508-identifier"](data__provides_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".provides[{data__provides_x}]".format(**locals()) + " must be pep508-identifier", value=data__provides_item, name="" + (name_prefix or "data") + ".provides[{data__provides_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'pep508-identifier'}, rule='format') + if "obsoletes" in data_keys: + data_keys.remove("obsoletes") + data__obsoletes = data["obsoletes"] + if not isinstance(data__obsoletes, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".obsoletes must be array", value=data__obsoletes, name="" + (name_prefix or "data") + ".obsoletes", definition={'$$description': ['Packages which this package renders obsolete', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, rule='type') + data__obsoletes_is_list = isinstance(data__obsoletes, (list, tuple)) + if data__obsoletes_is_list: + data__obsoletes_len = len(data__obsoletes) + for data__obsoletes_x, data__obsoletes_item in enumerate(data__obsoletes): + if not isinstance(data__obsoletes_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".obsoletes[{data__obsoletes_x}]".format(**locals()) + " must be string", value=data__obsoletes_item, name="" + (name_prefix or "data") + ".obsoletes[{data__obsoletes_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'pep508-identifier'}, rule='type') + if isinstance(data__obsoletes_item, str): + if not custom_formats["pep508-identifier"](data__obsoletes_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".obsoletes[{data__obsoletes_x}]".format(**locals()) + " must be pep508-identifier", value=data__obsoletes_item, name="" + (name_prefix or "data") + ".obsoletes[{data__obsoletes_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'pep508-identifier'}, rule='format') + if "zip-safe" in data_keys: + data_keys.remove("zip-safe") + data__zipsafe = data["zip-safe"] + if not isinstance(data__zipsafe, (bool)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".zip-safe must be boolean", value=data__zipsafe, name="" + (name_prefix or "data") + ".zip-safe", definition={'$$description': ['Whether the project can be safely installed and run from a zip file.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'boolean'}, rule='type') + if "script-files" in data_keys: + data_keys.remove("script-files") + data__scriptfiles = data["script-files"] + if not isinstance(data__scriptfiles, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".script-files must be array", value=data__scriptfiles, name="" + (name_prefix or "data") + ".script-files", definition={'$$description': ['Legacy way of defining scripts (entry-points are preferred).', 'Equivalent to the ``script`` keyword in ``setup.py``', '(it was renamed to avoid confusion with entry-point based ``project.scripts``', 'defined in :pep:`621`).', '**DISCOURAGED**: generic script wrappers are tricky and may not work properly.', 'Whenever possible, please use ``project.scripts`` instead.'], 'type': 'array', 'items': {'type': 'string'}, '$comment': 'TODO: is this field deprecated/should be removed?'}, rule='type') + data__scriptfiles_is_list = isinstance(data__scriptfiles, (list, tuple)) + if data__scriptfiles_is_list: + data__scriptfiles_len = len(data__scriptfiles) + for data__scriptfiles_x, data__scriptfiles_item in enumerate(data__scriptfiles): + if not isinstance(data__scriptfiles_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".script-files[{data__scriptfiles_x}]".format(**locals()) + " must be string", value=data__scriptfiles_item, name="" + (name_prefix or "data") + ".script-files[{data__scriptfiles_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "eager-resources" in data_keys: + data_keys.remove("eager-resources") + data__eagerresources = data["eager-resources"] + if not isinstance(data__eagerresources, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".eager-resources must be array", value=data__eagerresources, name="" + (name_prefix or "data") + ".eager-resources", definition={'$$description': ['Resources that should be extracted together, if any of them is needed,', 'or if any C extensions included in the project are imported.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__eagerresources_is_list = isinstance(data__eagerresources, (list, tuple)) + if data__eagerresources_is_list: + data__eagerresources_len = len(data__eagerresources) + for data__eagerresources_x, data__eagerresources_item in enumerate(data__eagerresources): + if not isinstance(data__eagerresources_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".eager-resources[{data__eagerresources_x}]".format(**locals()) + " must be string", value=data__eagerresources_item, name="" + (name_prefix or "data") + ".eager-resources[{data__eagerresources_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "packages" in data_keys: + data_keys.remove("packages") + data__packages = data["packages"] + data__packages_one_of_count2 = 0 + if data__packages_one_of_count2 < 2: + try: + if not isinstance(data__packages, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".packages must be array", value=data__packages, name="" + (name_prefix or "data") + ".packages", definition={'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}}, rule='type') + data__packages_is_list = isinstance(data__packages, (list, tuple)) + if data__packages_is_list: + data__packages_len = len(data__packages) + for data__packages_x, data__packages_item in enumerate(data__packages): + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_package_name(data__packages_item, custom_formats, (name_prefix or "data") + ".packages[{data__packages_x}]".format(**locals())) + data__packages_one_of_count2 += 1 + except JsonSchemaValueException: pass + if data__packages_one_of_count2 < 2: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_find_directive(data__packages, custom_formats, (name_prefix or "data") + ".packages") + data__packages_one_of_count2 += 1 + except JsonSchemaValueException: pass + if data__packages_one_of_count2 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".packages must be valid exactly by one definition" + (" (" + str(data__packages_one_of_count2) + " matches found)"), value=data__packages, name="" + (name_prefix or "data") + ".packages", definition={'$$description': ['Packages that should be included in the distribution.', 'It can be given either as a list of package identifiers', 'or as a ``dict``-like structure with a single key ``find``', 'which corresponds to a dynamic call to', '``setuptools.config.expand.find_packages`` function.', 'The ``find`` key is associated with a nested ``dict``-like structure that can', 'contain ``where``, ``include``, ``exclude`` and ``namespaces`` keys,', 'mimicking the keyword arguments of the associated function.'], 'oneOf': [{'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}}, {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}]}, rule='oneOf') + if "package-dir" in data_keys: + data_keys.remove("package-dir") + data__packagedir = data["package-dir"] + if not isinstance(data__packagedir, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-dir must be object", value=data__packagedir, name="" + (name_prefix or "data") + ".package-dir", definition={'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, rule='type') + data__packagedir_is_dict = isinstance(data__packagedir, dict) + if data__packagedir_is_dict: + data__packagedir_keys = set(data__packagedir.keys()) + for data__packagedir_key, data__packagedir_val in data__packagedir.items(): + if REGEX_PATTERNS['^.*$'].search(data__packagedir_key): + if data__packagedir_key in data__packagedir_keys: + data__packagedir_keys.remove(data__packagedir_key) + if not isinstance(data__packagedir_val, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-dir.{data__packagedir_key}".format(**locals()) + " must be string", value=data__packagedir_val, name="" + (name_prefix or "data") + ".package-dir.{data__packagedir_key}".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if data__packagedir_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-dir must not contain "+str(data__packagedir_keys)+" properties", value=data__packagedir, name="" + (name_prefix or "data") + ".package-dir", definition={'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, rule='additionalProperties') + data__packagedir_len = len(data__packagedir) + if data__packagedir_len != 0: + data__packagedir_property_names = True + for data__packagedir_key in data__packagedir: + try: + data__packagedir_key_any_of_count3 = 0 + if not data__packagedir_key_any_of_count3: + try: + if data__packagedir_key != "": + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-dir must be same as const definition: ", value=data__packagedir_key, name="" + (name_prefix or "data") + ".package-dir", definition={'const': ''}, rule='const') + data__packagedir_key_any_of_count3 += 1 + except JsonSchemaValueException: pass + if not data__packagedir_key_any_of_count3: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_package_name(data__packagedir_key, custom_formats, (name_prefix or "data") + ".package-dir") + data__packagedir_key_any_of_count3 += 1 + except JsonSchemaValueException: pass + if not data__packagedir_key_any_of_count3: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-dir cannot be validated by any definition", value=data__packagedir_key, name="" + (name_prefix or "data") + ".package-dir", definition={'anyOf': [{'const': ''}, {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}]}, rule='anyOf') + except JsonSchemaValueException: + data__packagedir_property_names = False + if not data__packagedir_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-dir must be named by propertyName definition", value=data__packagedir, name="" + (name_prefix or "data") + ".package-dir", definition={'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, rule='propertyNames') + if "package-data" in data_keys: + data_keys.remove("package-data") + data__packagedata = data["package-data"] + if not isinstance(data__packagedata, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data must be object", value=data__packagedata, name="" + (name_prefix or "data") + ".package-data", definition={'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='type') + data__packagedata_is_dict = isinstance(data__packagedata, dict) + if data__packagedata_is_dict: + data__packagedata_keys = set(data__packagedata.keys()) + for data__packagedata_key, data__packagedata_val in data__packagedata.items(): + if REGEX_PATTERNS['^.*$'].search(data__packagedata_key): + if data__packagedata_key in data__packagedata_keys: + data__packagedata_keys.remove(data__packagedata_key) + if not isinstance(data__packagedata_val, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data.{data__packagedata_key}".format(**locals()) + " must be array", value=data__packagedata_val, name="" + (name_prefix or "data") + ".package-data.{data__packagedata_key}".format(**locals()) + "", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__packagedata_val_is_list = isinstance(data__packagedata_val, (list, tuple)) + if data__packagedata_val_is_list: + data__packagedata_val_len = len(data__packagedata_val) + for data__packagedata_val_x, data__packagedata_val_item in enumerate(data__packagedata_val): + if not isinstance(data__packagedata_val_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data.{data__packagedata_key}[{data__packagedata_val_x}]".format(**locals()) + " must be string", value=data__packagedata_val_item, name="" + (name_prefix or "data") + ".package-data.{data__packagedata_key}[{data__packagedata_val_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if data__packagedata_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data must not contain "+str(data__packagedata_keys)+" properties", value=data__packagedata, name="" + (name_prefix or "data") + ".package-data", definition={'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='additionalProperties') + data__packagedata_len = len(data__packagedata) + if data__packagedata_len != 0: + data__packagedata_property_names = True + for data__packagedata_key in data__packagedata: + try: + data__packagedata_key_any_of_count4 = 0 + if not data__packagedata_key_any_of_count4: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_package_name(data__packagedata_key, custom_formats, (name_prefix or "data") + ".package-data") + data__packagedata_key_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data__packagedata_key_any_of_count4: + try: + if data__packagedata_key != "*": + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data must be same as const definition: *", value=data__packagedata_key, name="" + (name_prefix or "data") + ".package-data", definition={'const': '*'}, rule='const') + data__packagedata_key_any_of_count4 += 1 + except JsonSchemaValueException: pass + if not data__packagedata_key_any_of_count4: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data cannot be validated by any definition", value=data__packagedata_key, name="" + (name_prefix or "data") + ".package-data", definition={'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, rule='anyOf') + except JsonSchemaValueException: + data__packagedata_property_names = False + if not data__packagedata_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".package-data must be named by propertyName definition", value=data__packagedata, name="" + (name_prefix or "data") + ".package-data", definition={'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='propertyNames') + if "include-package-data" in data_keys: + data_keys.remove("include-package-data") + data__includepackagedata = data["include-package-data"] + if not isinstance(data__includepackagedata, (bool)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".include-package-data must be boolean", value=data__includepackagedata, name="" + (name_prefix or "data") + ".include-package-data", definition={'$$description': ['Automatically include any data files inside the package directories', 'that are specified by ``MANIFEST.in``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'boolean'}, rule='type') + if "exclude-package-data" in data_keys: + data_keys.remove("exclude-package-data") + data__excludepackagedata = data["exclude-package-data"] + if not isinstance(data__excludepackagedata, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data must be object", value=data__excludepackagedata, name="" + (name_prefix or "data") + ".exclude-package-data", definition={'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='type') + data__excludepackagedata_is_dict = isinstance(data__excludepackagedata, dict) + if data__excludepackagedata_is_dict: + data__excludepackagedata_keys = set(data__excludepackagedata.keys()) + for data__excludepackagedata_key, data__excludepackagedata_val in data__excludepackagedata.items(): + if REGEX_PATTERNS['^.*$'].search(data__excludepackagedata_key): + if data__excludepackagedata_key in data__excludepackagedata_keys: + data__excludepackagedata_keys.remove(data__excludepackagedata_key) + if not isinstance(data__excludepackagedata_val, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data.{data__excludepackagedata_key}".format(**locals()) + " must be array", value=data__excludepackagedata_val, name="" + (name_prefix or "data") + ".exclude-package-data.{data__excludepackagedata_key}".format(**locals()) + "", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__excludepackagedata_val_is_list = isinstance(data__excludepackagedata_val, (list, tuple)) + if data__excludepackagedata_val_is_list: + data__excludepackagedata_val_len = len(data__excludepackagedata_val) + for data__excludepackagedata_val_x, data__excludepackagedata_val_item in enumerate(data__excludepackagedata_val): + if not isinstance(data__excludepackagedata_val_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data.{data__excludepackagedata_key}[{data__excludepackagedata_val_x}]".format(**locals()) + " must be string", value=data__excludepackagedata_val_item, name="" + (name_prefix or "data") + ".exclude-package-data.{data__excludepackagedata_key}[{data__excludepackagedata_val_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if data__excludepackagedata_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data must not contain "+str(data__excludepackagedata_keys)+" properties", value=data__excludepackagedata, name="" + (name_prefix or "data") + ".exclude-package-data", definition={'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='additionalProperties') + data__excludepackagedata_len = len(data__excludepackagedata) + if data__excludepackagedata_len != 0: + data__excludepackagedata_property_names = True + for data__excludepackagedata_key in data__excludepackagedata: + try: + data__excludepackagedata_key_any_of_count5 = 0 + if not data__excludepackagedata_key_any_of_count5: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_package_name(data__excludepackagedata_key, custom_formats, (name_prefix or "data") + ".exclude-package-data") + data__excludepackagedata_key_any_of_count5 += 1 + except JsonSchemaValueException: pass + if not data__excludepackagedata_key_any_of_count5: + try: + if data__excludepackagedata_key != "*": + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data must be same as const definition: *", value=data__excludepackagedata_key, name="" + (name_prefix or "data") + ".exclude-package-data", definition={'const': '*'}, rule='const') + data__excludepackagedata_key_any_of_count5 += 1 + except JsonSchemaValueException: pass + if not data__excludepackagedata_key_any_of_count5: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data cannot be validated by any definition", value=data__excludepackagedata_key, name="" + (name_prefix or "data") + ".exclude-package-data", definition={'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, rule='anyOf') + except JsonSchemaValueException: + data__excludepackagedata_property_names = False + if not data__excludepackagedata_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".exclude-package-data must be named by propertyName definition", value=data__excludepackagedata, name="" + (name_prefix or "data") + ".exclude-package-data", definition={'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='propertyNames') + if "namespace-packages" in data_keys: + data_keys.remove("namespace-packages") + data__namespacepackages = data["namespace-packages"] + if not isinstance(data__namespacepackages, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".namespace-packages must be array", value=data__namespacepackages, name="" + (name_prefix or "data") + ".namespace-packages", definition={'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'https://setuptools.pypa.io/en/latest/userguide/package_discovery.html', 'description': '**DEPRECATED**: use implicit namespaces instead (:pep:`420`).'}, rule='type') + data__namespacepackages_is_list = isinstance(data__namespacepackages, (list, tuple)) + if data__namespacepackages_is_list: + data__namespacepackages_len = len(data__namespacepackages) + for data__namespacepackages_x, data__namespacepackages_item in enumerate(data__namespacepackages): + if not isinstance(data__namespacepackages_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".namespace-packages[{data__namespacepackages_x}]".format(**locals()) + " must be string", value=data__namespacepackages_item, name="" + (name_prefix or "data") + ".namespace-packages[{data__namespacepackages_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='type') + if isinstance(data__namespacepackages_item, str): + if not custom_formats["python-module-name-relaxed"](data__namespacepackages_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".namespace-packages[{data__namespacepackages_x}]".format(**locals()) + " must be python-module-name-relaxed", value=data__namespacepackages_item, name="" + (name_prefix or "data") + ".namespace-packages[{data__namespacepackages_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='format') + if "py-modules" in data_keys: + data_keys.remove("py-modules") + data__pymodules = data["py-modules"] + if not isinstance(data__pymodules, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".py-modules must be array", value=data__pymodules, name="" + (name_prefix or "data") + ".py-modules", definition={'description': 'Modules that setuptools will manipulate', 'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'TODO: clarify the relationship with ``packages``'}, rule='type') + data__pymodules_is_list = isinstance(data__pymodules, (list, tuple)) + if data__pymodules_is_list: + data__pymodules_len = len(data__pymodules) + for data__pymodules_x, data__pymodules_item in enumerate(data__pymodules): + if not isinstance(data__pymodules_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".py-modules[{data__pymodules_x}]".format(**locals()) + " must be string", value=data__pymodules_item, name="" + (name_prefix or "data") + ".py-modules[{data__pymodules_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='type') + if isinstance(data__pymodules_item, str): + if not custom_formats["python-module-name-relaxed"](data__pymodules_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".py-modules[{data__pymodules_x}]".format(**locals()) + " must be python-module-name-relaxed", value=data__pymodules_item, name="" + (name_prefix or "data") + ".py-modules[{data__pymodules_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='format') + if "ext-modules" in data_keys: + data_keys.remove("ext-modules") + data__extmodules = data["ext-modules"] + if not isinstance(data__extmodules, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".ext-modules must be array", value=data__extmodules, name="" + (name_prefix or "data") + ".ext-modules", definition={'description': 'Extension modules to be compiled by setuptools', 'type': 'array', 'items': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}}, rule='type') + data__extmodules_is_list = isinstance(data__extmodules, (list, tuple)) + if data__extmodules_is_list: + data__extmodules_len = len(data__extmodules) + for data__extmodules_x, data__extmodules_item in enumerate(data__extmodules): + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_ext_module(data__extmodules_item, custom_formats, (name_prefix or "data") + ".ext-modules[{data__extmodules_x}]".format(**locals())) + if "data-files" in data_keys: + data_keys.remove("data-files") + data__datafiles = data["data-files"] + if not isinstance(data__datafiles, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".data-files must be object", value=data__datafiles, name="" + (name_prefix or "data") + ".data-files", definition={'$$description': ['``dict``-like structure where each key represents a directory and', 'the value is a list of glob patterns that should be installed in them.', '**DISCOURAGED**: please notice this might not work as expected with wheels.', 'Whenever possible, consider using data files inside the package directories', '(or create a new namespace package that only contains data files).', 'See `data files support', '`_.'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, rule='type') + data__datafiles_is_dict = isinstance(data__datafiles, dict) + if data__datafiles_is_dict: + data__datafiles_keys = set(data__datafiles.keys()) + for data__datafiles_key, data__datafiles_val in data__datafiles.items(): + if REGEX_PATTERNS['^.*$'].search(data__datafiles_key): + if data__datafiles_key in data__datafiles_keys: + data__datafiles_keys.remove(data__datafiles_key) + if not isinstance(data__datafiles_val, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".data-files.{data__datafiles_key}".format(**locals()) + " must be array", value=data__datafiles_val, name="" + (name_prefix or "data") + ".data-files.{data__datafiles_key}".format(**locals()) + "", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__datafiles_val_is_list = isinstance(data__datafiles_val, (list, tuple)) + if data__datafiles_val_is_list: + data__datafiles_val_len = len(data__datafiles_val) + for data__datafiles_val_x, data__datafiles_val_item in enumerate(data__datafiles_val): + if not isinstance(data__datafiles_val_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".data-files.{data__datafiles_key}[{data__datafiles_val_x}]".format(**locals()) + " must be string", value=data__datafiles_val_item, name="" + (name_prefix or "data") + ".data-files.{data__datafiles_key}[{data__datafiles_val_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "cmdclass" in data_keys: + data_keys.remove("cmdclass") + data__cmdclass = data["cmdclass"] + if not isinstance(data__cmdclass, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".cmdclass must be object", value=data__cmdclass, name="" + (name_prefix or "data") + ".cmdclass", definition={'$$description': ['Mapping of distutils-style command names to ``setuptools.Command`` subclasses', 'which in turn should be represented by strings with a qualified class name', '(i.e., "dotted" form with module), e.g.::\n\n', ' cmdclass = {mycmd = "pkg.subpkg.module.CommandClass"}\n\n', 'The command class should be a directly defined at the top-level of the', 'containing module (no class nesting).'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'string', 'format': 'python-qualified-identifier'}}}, rule='type') + data__cmdclass_is_dict = isinstance(data__cmdclass, dict) + if data__cmdclass_is_dict: + data__cmdclass_keys = set(data__cmdclass.keys()) + for data__cmdclass_key, data__cmdclass_val in data__cmdclass.items(): + if REGEX_PATTERNS['^.*$'].search(data__cmdclass_key): + if data__cmdclass_key in data__cmdclass_keys: + data__cmdclass_keys.remove(data__cmdclass_key) + if not isinstance(data__cmdclass_val, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".cmdclass.{data__cmdclass_key}".format(**locals()) + " must be string", value=data__cmdclass_val, name="" + (name_prefix or "data") + ".cmdclass.{data__cmdclass_key}".format(**locals()) + "", definition={'type': 'string', 'format': 'python-qualified-identifier'}, rule='type') + if isinstance(data__cmdclass_val, str): + if not custom_formats["python-qualified-identifier"](data__cmdclass_val): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".cmdclass.{data__cmdclass_key}".format(**locals()) + " must be python-qualified-identifier", value=data__cmdclass_val, name="" + (name_prefix or "data") + ".cmdclass.{data__cmdclass_key}".format(**locals()) + "", definition={'type': 'string', 'format': 'python-qualified-identifier'}, rule='format') + if "license-files" in data_keys: + data_keys.remove("license-files") + data__licensefiles = data["license-files"] + if not isinstance(data__licensefiles, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license-files must be array", value=data__licensefiles, name="" + (name_prefix or "data") + ".license-files", definition={'type': 'array', 'items': {'type': 'string'}, '$$description': ['**PROVISIONAL**: list of glob patterns for all license files being distributed.', '(likely to become standard with :pep:`639`).', "By default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``"], '$comment': 'TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?'}, rule='type') + data__licensefiles_is_list = isinstance(data__licensefiles, (list, tuple)) + if data__licensefiles_is_list: + data__licensefiles_len = len(data__licensefiles) + for data__licensefiles_x, data__licensefiles_item in enumerate(data__licensefiles): + if not isinstance(data__licensefiles_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license-files[{data__licensefiles_x}]".format(**locals()) + " must be string", value=data__licensefiles_item, name="" + (name_prefix or "data") + ".license-files[{data__licensefiles_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "dynamic" in data_keys: + data_keys.remove("dynamic") + data__dynamic = data["dynamic"] + if not isinstance(data__dynamic, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic must be object", value=data__dynamic, name="" + (name_prefix or "data") + ".dynamic", definition={'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, 'classifiers': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'description': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'entry-points': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, 'readme': {'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}}}, rule='type') + data__dynamic_is_dict = isinstance(data__dynamic, dict) + if data__dynamic_is_dict: + data__dynamic_keys = set(data__dynamic.keys()) + if "version" in data__dynamic_keys: + data__dynamic_keys.remove("version") + data__dynamic__version = data__dynamic["version"] + data__dynamic__version_one_of_count6 = 0 + if data__dynamic__version_one_of_count6 < 2: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_attr_directive(data__dynamic__version, custom_formats, (name_prefix or "data") + ".dynamic.version") + data__dynamic__version_one_of_count6 += 1 + except JsonSchemaValueException: pass + if data__dynamic__version_one_of_count6 < 2: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data__dynamic__version, custom_formats, (name_prefix or "data") + ".dynamic.version") + data__dynamic__version_one_of_count6 += 1 + except JsonSchemaValueException: pass + if data__dynamic__version_one_of_count6 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.version must be valid exactly by one definition" + (" (" + str(data__dynamic__version_one_of_count6) + " matches found)"), value=data__dynamic__version, name="" + (name_prefix or "data") + ".dynamic.version", definition={'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, rule='oneOf') + if "classifiers" in data__dynamic_keys: + data__dynamic_keys.remove("classifiers") + data__dynamic__classifiers = data__dynamic["classifiers"] + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data__dynamic__classifiers, custom_formats, (name_prefix or "data") + ".dynamic.classifiers") + if "description" in data__dynamic_keys: + data__dynamic_keys.remove("description") + data__dynamic__description = data__dynamic["description"] + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data__dynamic__description, custom_formats, (name_prefix or "data") + ".dynamic.description") + if "entry-points" in data__dynamic_keys: + data__dynamic_keys.remove("entry-points") + data__dynamic__entrypoints = data__dynamic["entry-points"] + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data__dynamic__entrypoints, custom_formats, (name_prefix or "data") + ".dynamic.entry-points") + if "dependencies" in data__dynamic_keys: + data__dynamic_keys.remove("dependencies") + data__dynamic__dependencies = data__dynamic["dependencies"] + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive_for_dependencies(data__dynamic__dependencies, custom_formats, (name_prefix or "data") + ".dynamic.dependencies") + if "optional-dependencies" in data__dynamic_keys: + data__dynamic_keys.remove("optional-dependencies") + data__dynamic__optionaldependencies = data__dynamic["optional-dependencies"] + if not isinstance(data__dynamic__optionaldependencies, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.optional-dependencies must be object", value=data__dynamic__optionaldependencies, name="" + (name_prefix or "data") + ".dynamic.optional-dependencies", definition={'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, rule='type') + data__dynamic__optionaldependencies_is_dict = isinstance(data__dynamic__optionaldependencies, dict) + if data__dynamic__optionaldependencies_is_dict: + data__dynamic__optionaldependencies_keys = set(data__dynamic__optionaldependencies.keys()) + for data__dynamic__optionaldependencies_key, data__dynamic__optionaldependencies_val in data__dynamic__optionaldependencies.items(): + if REGEX_PATTERNS['.+'].search(data__dynamic__optionaldependencies_key): + if data__dynamic__optionaldependencies_key in data__dynamic__optionaldependencies_keys: + data__dynamic__optionaldependencies_keys.remove(data__dynamic__optionaldependencies_key) + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive_for_dependencies(data__dynamic__optionaldependencies_val, custom_formats, (name_prefix or "data") + ".dynamic.optional-dependencies.{data__dynamic__optionaldependencies_key}".format(**locals())) + if data__dynamic__optionaldependencies_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.optional-dependencies must not contain "+str(data__dynamic__optionaldependencies_keys)+" properties", value=data__dynamic__optionaldependencies, name="" + (name_prefix or "data") + ".dynamic.optional-dependencies", definition={'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, rule='additionalProperties') + data__dynamic__optionaldependencies_len = len(data__dynamic__optionaldependencies) + if data__dynamic__optionaldependencies_len != 0: + data__dynamic__optionaldependencies_property_names = True + for data__dynamic__optionaldependencies_key in data__dynamic__optionaldependencies: + try: + if not isinstance(data__dynamic__optionaldependencies_key, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.optional-dependencies must be string", value=data__dynamic__optionaldependencies_key, name="" + (name_prefix or "data") + ".dynamic.optional-dependencies", definition={'type': 'string', 'format': 'pep508-identifier'}, rule='type') + if isinstance(data__dynamic__optionaldependencies_key, str): + if not custom_formats["pep508-identifier"](data__dynamic__optionaldependencies_key): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.optional-dependencies must be pep508-identifier", value=data__dynamic__optionaldependencies_key, name="" + (name_prefix or "data") + ".dynamic.optional-dependencies", definition={'type': 'string', 'format': 'pep508-identifier'}, rule='format') + except JsonSchemaValueException: + data__dynamic__optionaldependencies_property_names = False + if not data__dynamic__optionaldependencies_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.optional-dependencies must be named by propertyName definition", value=data__dynamic__optionaldependencies, name="" + (name_prefix or "data") + ".dynamic.optional-dependencies", definition={'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, rule='propertyNames') + if "readme" in data__dynamic_keys: + data__dynamic_keys.remove("readme") + data__dynamic__readme = data__dynamic["readme"] + if not isinstance(data__dynamic__readme, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.readme must be object", value=data__dynamic__readme, name="" + (name_prefix or "data") + ".dynamic.readme", definition={'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}, rule='type') + data__dynamic__readme_any_of_count7 = 0 + if not data__dynamic__readme_any_of_count7: + try: + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data__dynamic__readme, custom_formats, (name_prefix or "data") + ".dynamic.readme") + data__dynamic__readme_any_of_count7 += 1 + except JsonSchemaValueException: pass + if not data__dynamic__readme_any_of_count7: + try: + if not isinstance(data__dynamic__readme, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.readme must be object", value=data__dynamic__readme, name="" + (name_prefix or "data") + ".dynamic.readme", definition={'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}, rule='type') + data__dynamic__readme_is_dict = isinstance(data__dynamic__readme, dict) + if data__dynamic__readme_is_dict: + data__dynamic__readme_keys = set(data__dynamic__readme.keys()) + if "content-type" in data__dynamic__readme_keys: + data__dynamic__readme_keys.remove("content-type") + data__dynamic__readme__contenttype = data__dynamic__readme["content-type"] + if not isinstance(data__dynamic__readme__contenttype, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.readme.content-type must be string", value=data__dynamic__readme__contenttype, name="" + (name_prefix or "data") + ".dynamic.readme.content-type", definition={'type': 'string'}, rule='type') + if "file" in data__dynamic__readme_keys: + data__dynamic__readme_keys.remove("file") + data__dynamic__readme__file = data__dynamic__readme["file"] + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive_properties_file(data__dynamic__readme__file, custom_formats, (name_prefix or "data") + ".dynamic.readme.file") + if data__dynamic__readme_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.readme must not contain "+str(data__dynamic__readme_keys)+" properties", value=data__dynamic__readme, name="" + (name_prefix or "data") + ".dynamic.readme", definition={'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}, rule='additionalProperties') + data__dynamic__readme_any_of_count7 += 1 + except JsonSchemaValueException: pass + if not data__dynamic__readme_any_of_count7: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.readme cannot be validated by any definition", value=data__dynamic__readme, name="" + (name_prefix or "data") + ".dynamic.readme", definition={'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}, rule='anyOf') + data__dynamic__readme_is_dict = isinstance(data__dynamic__readme, dict) + if data__dynamic__readme_is_dict: + data__dynamic__readme__missing_keys = set(['file']) - data__dynamic__readme.keys() + if data__dynamic__readme__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.readme must contain " + (str(sorted(data__dynamic__readme__missing_keys)) + " properties"), value=data__dynamic__readme, name="" + (name_prefix or "data") + ".dynamic.readme", definition={'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}, rule='required') + if data__dynamic_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic must not contain "+str(data__dynamic_keys)+" properties", value=data__dynamic, name="" + (name_prefix or "data") + ".dynamic", definition={'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, 'classifiers': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'description': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'entry-points': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, 'readme': {'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}}}, rule='additionalProperties') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html', 'title': '``tool.setuptools`` table', '$$description': ['``setuptools``-specific configurations that can be set by users that require', 'customization.', 'These configurations are completely optional and probably can be skipped when', 'creating simple packages. They are equivalent to some of the `Keywords', '`_', 'used by the ``setup.py`` file, and can be set via the ``tool.setuptools`` table.', 'It considers only ``setuptools`` `parameters', '`_', 'that are not covered by :pep:`621`; and intentionally excludes ``dependency_links``', 'and ``setup_requires`` (incompatible with modern workflows/standards).'], 'type': 'object', 'additionalProperties': False, 'properties': {'platforms': {'type': 'array', 'items': {'type': 'string'}}, 'provides': {'$$description': ['Package and virtual package names contained within this package', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'obsoletes': {'$$description': ['Packages which this package renders obsolete', '**(not supported by pip)**'], 'type': 'array', 'items': {'type': 'string', 'format': 'pep508-identifier'}}, 'zip-safe': {'$$description': ['Whether the project can be safely installed and run from a zip file.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'boolean'}, 'script-files': {'$$description': ['Legacy way of defining scripts (entry-points are preferred).', 'Equivalent to the ``script`` keyword in ``setup.py``', '(it was renamed to avoid confusion with entry-point based ``project.scripts``', 'defined in :pep:`621`).', '**DISCOURAGED**: generic script wrappers are tricky and may not work properly.', 'Whenever possible, please use ``project.scripts`` instead.'], 'type': 'array', 'items': {'type': 'string'}, '$comment': 'TODO: is this field deprecated/should be removed?'}, 'eager-resources': {'$$description': ['Resources that should be extracted together, if any of them is needed,', 'or if any C extensions included in the project are imported.', '**OBSOLETE**: only relevant for ``pkg_resources``, ``easy_install`` and', '``setup.py install`` in the context of ``eggs`` (**DEPRECATED**).'], 'type': 'array', 'items': {'type': 'string'}}, 'packages': {'$$description': ['Packages that should be included in the distribution.', 'It can be given either as a list of package identifiers', 'or as a ``dict``-like structure with a single key ``find``', 'which corresponds to a dynamic call to', '``setuptools.config.expand.find_packages`` function.', 'The ``find`` key is associated with a nested ``dict``-like structure that can', 'contain ``where``, ``include``, ``exclude`` and ``namespaces`` keys,', 'mimicking the keyword arguments of the associated function.'], 'oneOf': [{'title': 'Array of Python package identifiers', 'type': 'array', 'items': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}}, {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}]}, 'package-dir': {'$$description': [':class:`dict`-like structure mapping from package names to directories where their', 'code can be found.', 'The empty string (as key) means that all packages are contained inside', 'the given directory will be included in the distribution.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'const': ''}, {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}]}, 'patternProperties': {'^.*$': {'type': 'string'}}}, 'package-data': {'$$description': ['Mapping from package names to lists of glob patterns.', 'Usually this option is not needed when using ``include-package-data = true``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'include-package-data': {'$$description': ['Automatically include any data files inside the package directories', 'that are specified by ``MANIFEST.in``', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'boolean'}, 'exclude-package-data': {'$$description': ['Mapping from package names to lists of glob patterns that should be excluded', 'For more information on how to include data files, check ``setuptools`` `docs', '`_.'], 'type': 'object', 'additionalProperties': False, 'propertyNames': {'anyOf': [{'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, {'const': '*'}]}, 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'namespace-packages': {'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'https://setuptools.pypa.io/en/latest/userguide/package_discovery.html', 'description': '**DEPRECATED**: use implicit namespaces instead (:pep:`420`).'}, 'py-modules': {'description': 'Modules that setuptools will manipulate', 'type': 'array', 'items': {'type': 'string', 'format': 'python-module-name-relaxed'}, '$comment': 'TODO: clarify the relationship with ``packages``'}, 'ext-modules': {'description': 'Extension modules to be compiled by setuptools', 'type': 'array', 'items': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}}, 'data-files': {'$$description': ['``dict``-like structure where each key represents a directory and', 'the value is a list of glob patterns that should be installed in them.', '**DISCOURAGED**: please notice this might not work as expected with wheels.', 'Whenever possible, consider using data files inside the package directories', '(or create a new namespace package that only contains data files).', 'See `data files support', '`_.'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'array', 'items': {'type': 'string'}}}}, 'cmdclass': {'$$description': ['Mapping of distutils-style command names to ``setuptools.Command`` subclasses', 'which in turn should be represented by strings with a qualified class name', '(i.e., "dotted" form with module), e.g.::\n\n', ' cmdclass = {mycmd = "pkg.subpkg.module.CommandClass"}\n\n', 'The command class should be a directly defined at the top-level of the', 'containing module (no class nesting).'], 'type': 'object', 'patternProperties': {'^.*$': {'type': 'string', 'format': 'python-qualified-identifier'}}}, 'license-files': {'type': 'array', 'items': {'type': 'string'}, '$$description': ['**PROVISIONAL**: list of glob patterns for all license files being distributed.', '(likely to become standard with :pep:`639`).', "By default: ``['LICEN[CS]E*', 'COPYING*', 'NOTICE*', 'AUTHORS*']``"], '$comment': 'TODO: revise if PEP 639 is accepted. Probably ``project.license-files``?'}, 'dynamic': {'type': 'object', 'description': 'Instructions for loading :pep:`621`-related metadata dynamically', 'additionalProperties': False, 'properties': {'version': {'$$description': ['A version dynamically loaded via either the ``attr:`` or ``file:``', 'directives. Please make sure the given file or attribute respects :pep:`440`.', 'Also ensure to set ``project.dynamic`` accordingly.'], 'oneOf': [{'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, 'classifiers': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'description': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'entry-points': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}, 'optional-dependencies': {'type': 'object', 'propertyNames': {'type': 'string', 'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$ref': '#/definitions/file-directive'}]}}}, 'readme': {'type': 'object', 'anyOf': [{'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, {'type': 'object', 'properties': {'content-type': {'type': 'string'}, 'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'additionalProperties': False}], 'required': ['file']}}}}, 'definitions': {'package-name': {'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, 'ext-module': {'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, 'file-directive': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, 'file-directive-for-dependencies': {'title': "'file:' directive for dependencies", 'allOf': [{'$$description': ['**BETA**: subset of the ``requirements.txt`` format', 'without ``pip`` flags and options', '(one :pep:`508`-compliant string per line,', 'lines that are blank or start with ``#`` are excluded).', 'See `dynamic metadata', '`_.']}, {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}]}, 'attr-directive': {'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, 'find-directive': {'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}}}, rule='additionalProperties') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive_properties_file(data, custom_formats={}, name_prefix=None): + data_one_of_count8 = 0 + if data_one_of_count8 < 2: + try: + if not isinstance(data, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string'}, rule='type') + data_one_of_count8 += 1 + except JsonSchemaValueException: pass + if data_one_of_count8 < 2: + try: + if not isinstance(data, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be array", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data_is_list = isinstance(data, (list, tuple)) + if data_is_list: + data_len = len(data) + for data_x, data_item in enumerate(data): + if not isinstance(data_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + "[{data_x}]".format(**locals()) + " must be string", value=data_item, name="" + (name_prefix or "data") + "[{data_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + data_one_of_count8 += 1 + except JsonSchemaValueException: pass + if data_one_of_count8 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be valid exactly by one definition" + (" (" + str(data_one_of_count8) + " matches found)"), value=data, name="" + (name_prefix or "data") + "", definition={'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}, rule='oneOf') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive_for_dependencies(data, custom_formats={}, name_prefix=None): + validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data, custom_formats, (name_prefix or "data") + "") + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_file_directive(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['file']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, rule='required') + data_keys = set(data.keys()) + if "file" in data_keys: + data_keys.remove("file") + data__file = data["file"] + data__file_one_of_count9 = 0 + if data__file_one_of_count9 < 2: + try: + if not isinstance(data__file, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".file must be string", value=data__file, name="" + (name_prefix or "data") + ".file", definition={'type': 'string'}, rule='type') + data__file_one_of_count9 += 1 + except JsonSchemaValueException: pass + if data__file_one_of_count9 < 2: + try: + if not isinstance(data__file, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".file must be array", value=data__file, name="" + (name_prefix or "data") + ".file", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__file_is_list = isinstance(data__file, (list, tuple)) + if data__file_is_list: + data__file_len = len(data__file) + for data__file_x, data__file_item in enumerate(data__file): + if not isinstance(data__file_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".file[{data__file_x}]".format(**locals()) + " must be string", value=data__file_item, name="" + (name_prefix or "data") + ".file[{data__file_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + data__file_one_of_count9 += 1 + except JsonSchemaValueException: pass + if data__file_one_of_count9 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".file must be valid exactly by one definition" + (" (" + str(data__file_one_of_count9) + " matches found)"), value=data__file, name="" + (name_prefix or "data") + ".file", definition={'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}, rule='oneOf') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}, rule='additionalProperties') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_attr_directive(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['attr']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, rule='required') + data_keys = set(data.keys()) + if "attr" in data_keys: + data_keys.remove("attr") + data__attr = data["attr"] + if not isinstance(data__attr, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".attr must be string", value=data__attr, name="" + (name_prefix or "data") + ".attr", definition={'type': 'string', 'format': 'python-qualified-identifier'}, rule='type') + if isinstance(data__attr, str): + if not custom_formats["python-qualified-identifier"](data__attr): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".attr must be python-qualified-identifier", value=data__attr, name="" + (name_prefix or "data") + ".attr", definition={'type': 'string', 'format': 'python-qualified-identifier'}, rule='format') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'title': "'attr:' directive", '$id': '#/definitions/attr-directive', '$$description': ['Value is read from a module attribute. Supports callables and iterables;', 'unsupported types are cast via ``str()``'], 'type': 'object', 'additionalProperties': False, 'properties': {'attr': {'type': 'string', 'format': 'python-qualified-identifier'}}, 'required': ['attr']}, rule='additionalProperties') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_ext_module(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['name', 'sources']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, rule='required') + data_keys = set(data.keys()) + if "name" in data_keys: + data_keys.remove("name") + data__name = data["name"] + if not isinstance(data__name, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be string", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='type') + if isinstance(data__name, str): + if not custom_formats["python-module-name-relaxed"](data__name): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be python-module-name-relaxed", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='format') + if "sources" in data_keys: + data_keys.remove("sources") + data__sources = data["sources"] + if not isinstance(data__sources, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".sources must be array", value=data__sources, name="" + (name_prefix or "data") + ".sources", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__sources_is_list = isinstance(data__sources, (list, tuple)) + if data__sources_is_list: + data__sources_len = len(data__sources) + for data__sources_x, data__sources_item in enumerate(data__sources): + if not isinstance(data__sources_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".sources[{data__sources_x}]".format(**locals()) + " must be string", value=data__sources_item, name="" + (name_prefix or "data") + ".sources[{data__sources_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "include-dirs" in data_keys: + data_keys.remove("include-dirs") + data__includedirs = data["include-dirs"] + if not isinstance(data__includedirs, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".include-dirs must be array", value=data__includedirs, name="" + (name_prefix or "data") + ".include-dirs", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__includedirs_is_list = isinstance(data__includedirs, (list, tuple)) + if data__includedirs_is_list: + data__includedirs_len = len(data__includedirs) + for data__includedirs_x, data__includedirs_item in enumerate(data__includedirs): + if not isinstance(data__includedirs_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".include-dirs[{data__includedirs_x}]".format(**locals()) + " must be string", value=data__includedirs_item, name="" + (name_prefix or "data") + ".include-dirs[{data__includedirs_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "define-macros" in data_keys: + data_keys.remove("define-macros") + data__definemacros = data["define-macros"] + if not isinstance(data__definemacros, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros must be array", value=data__definemacros, name="" + (name_prefix or "data") + ".define-macros", definition={'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, rule='type') + data__definemacros_is_list = isinstance(data__definemacros, (list, tuple)) + if data__definemacros_is_list: + data__definemacros_len = len(data__definemacros) + for data__definemacros_x, data__definemacros_item in enumerate(data__definemacros): + if not isinstance(data__definemacros_item, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}]".format(**locals()) + " must be array", value=data__definemacros_item, name="" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}]".format(**locals()) + "", definition={'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}, rule='type') + data__definemacros_item_is_list = isinstance(data__definemacros_item, (list, tuple)) + if data__definemacros_item_is_list: + data__definemacros_item_len = len(data__definemacros_item) + if data__definemacros_item_len > 0: + data__definemacros_item__0 = data__definemacros_item[0] + if not isinstance(data__definemacros_item__0, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][0]".format(**locals()) + " must be string", value=data__definemacros_item__0, name="" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][0]".format(**locals()) + "", definition={'description': 'macro name', 'type': 'string'}, rule='type') + if data__definemacros_item_len > 1: + data__definemacros_item__1 = data__definemacros_item[1] + data__definemacros_item__1_one_of_count10 = 0 + if data__definemacros_item__1_one_of_count10 < 2: + try: + if not isinstance(data__definemacros_item__1, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][1]".format(**locals()) + " must be string", value=data__definemacros_item__1, name="" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][1]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + data__definemacros_item__1_one_of_count10 += 1 + except JsonSchemaValueException: pass + if data__definemacros_item__1_one_of_count10 < 2: + try: + if not isinstance(data__definemacros_item__1, (NoneType)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][1]".format(**locals()) + " must be null", value=data__definemacros_item__1, name="" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][1]".format(**locals()) + "", definition={'type': 'null'}, rule='type') + data__definemacros_item__1_one_of_count10 += 1 + except JsonSchemaValueException: pass + if data__definemacros_item__1_one_of_count10 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][1]".format(**locals()) + " must be valid exactly by one definition" + (" (" + str(data__definemacros_item__1_one_of_count10) + " matches found)"), value=data__definemacros_item__1, name="" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}][1]".format(**locals()) + "", definition={'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}, rule='oneOf') + if data__definemacros_item_len > 2: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}]".format(**locals()) + " must contain only specified items", value=data__definemacros_item, name="" + (name_prefix or "data") + ".define-macros[{data__definemacros_x}]".format(**locals()) + "", definition={'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}, rule='items') + if "undef-macros" in data_keys: + data_keys.remove("undef-macros") + data__undefmacros = data["undef-macros"] + if not isinstance(data__undefmacros, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".undef-macros must be array", value=data__undefmacros, name="" + (name_prefix or "data") + ".undef-macros", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__undefmacros_is_list = isinstance(data__undefmacros, (list, tuple)) + if data__undefmacros_is_list: + data__undefmacros_len = len(data__undefmacros) + for data__undefmacros_x, data__undefmacros_item in enumerate(data__undefmacros): + if not isinstance(data__undefmacros_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".undef-macros[{data__undefmacros_x}]".format(**locals()) + " must be string", value=data__undefmacros_item, name="" + (name_prefix or "data") + ".undef-macros[{data__undefmacros_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "library-dirs" in data_keys: + data_keys.remove("library-dirs") + data__librarydirs = data["library-dirs"] + if not isinstance(data__librarydirs, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".library-dirs must be array", value=data__librarydirs, name="" + (name_prefix or "data") + ".library-dirs", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__librarydirs_is_list = isinstance(data__librarydirs, (list, tuple)) + if data__librarydirs_is_list: + data__librarydirs_len = len(data__librarydirs) + for data__librarydirs_x, data__librarydirs_item in enumerate(data__librarydirs): + if not isinstance(data__librarydirs_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".library-dirs[{data__librarydirs_x}]".format(**locals()) + " must be string", value=data__librarydirs_item, name="" + (name_prefix or "data") + ".library-dirs[{data__librarydirs_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "libraries" in data_keys: + data_keys.remove("libraries") + data__libraries = data["libraries"] + if not isinstance(data__libraries, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".libraries must be array", value=data__libraries, name="" + (name_prefix or "data") + ".libraries", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__libraries_is_list = isinstance(data__libraries, (list, tuple)) + if data__libraries_is_list: + data__libraries_len = len(data__libraries) + for data__libraries_x, data__libraries_item in enumerate(data__libraries): + if not isinstance(data__libraries_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".libraries[{data__libraries_x}]".format(**locals()) + " must be string", value=data__libraries_item, name="" + (name_prefix or "data") + ".libraries[{data__libraries_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "runtime-library-dirs" in data_keys: + data_keys.remove("runtime-library-dirs") + data__runtimelibrarydirs = data["runtime-library-dirs"] + if not isinstance(data__runtimelibrarydirs, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".runtime-library-dirs must be array", value=data__runtimelibrarydirs, name="" + (name_prefix or "data") + ".runtime-library-dirs", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__runtimelibrarydirs_is_list = isinstance(data__runtimelibrarydirs, (list, tuple)) + if data__runtimelibrarydirs_is_list: + data__runtimelibrarydirs_len = len(data__runtimelibrarydirs) + for data__runtimelibrarydirs_x, data__runtimelibrarydirs_item in enumerate(data__runtimelibrarydirs): + if not isinstance(data__runtimelibrarydirs_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".runtime-library-dirs[{data__runtimelibrarydirs_x}]".format(**locals()) + " must be string", value=data__runtimelibrarydirs_item, name="" + (name_prefix or "data") + ".runtime-library-dirs[{data__runtimelibrarydirs_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "extra-objects" in data_keys: + data_keys.remove("extra-objects") + data__extraobjects = data["extra-objects"] + if not isinstance(data__extraobjects, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extra-objects must be array", value=data__extraobjects, name="" + (name_prefix or "data") + ".extra-objects", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__extraobjects_is_list = isinstance(data__extraobjects, (list, tuple)) + if data__extraobjects_is_list: + data__extraobjects_len = len(data__extraobjects) + for data__extraobjects_x, data__extraobjects_item in enumerate(data__extraobjects): + if not isinstance(data__extraobjects_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extra-objects[{data__extraobjects_x}]".format(**locals()) + " must be string", value=data__extraobjects_item, name="" + (name_prefix or "data") + ".extra-objects[{data__extraobjects_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "extra-compile-args" in data_keys: + data_keys.remove("extra-compile-args") + data__extracompileargs = data["extra-compile-args"] + if not isinstance(data__extracompileargs, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extra-compile-args must be array", value=data__extracompileargs, name="" + (name_prefix or "data") + ".extra-compile-args", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__extracompileargs_is_list = isinstance(data__extracompileargs, (list, tuple)) + if data__extracompileargs_is_list: + data__extracompileargs_len = len(data__extracompileargs) + for data__extracompileargs_x, data__extracompileargs_item in enumerate(data__extracompileargs): + if not isinstance(data__extracompileargs_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extra-compile-args[{data__extracompileargs_x}]".format(**locals()) + " must be string", value=data__extracompileargs_item, name="" + (name_prefix or "data") + ".extra-compile-args[{data__extracompileargs_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "extra-link-args" in data_keys: + data_keys.remove("extra-link-args") + data__extralinkargs = data["extra-link-args"] + if not isinstance(data__extralinkargs, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extra-link-args must be array", value=data__extralinkargs, name="" + (name_prefix or "data") + ".extra-link-args", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__extralinkargs_is_list = isinstance(data__extralinkargs, (list, tuple)) + if data__extralinkargs_is_list: + data__extralinkargs_len = len(data__extralinkargs) + for data__extralinkargs_x, data__extralinkargs_item in enumerate(data__extralinkargs): + if not isinstance(data__extralinkargs_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".extra-link-args[{data__extralinkargs_x}]".format(**locals()) + " must be string", value=data__extralinkargs_item, name="" + (name_prefix or "data") + ".extra-link-args[{data__extralinkargs_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "export-symbols" in data_keys: + data_keys.remove("export-symbols") + data__exportsymbols = data["export-symbols"] + if not isinstance(data__exportsymbols, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".export-symbols must be array", value=data__exportsymbols, name="" + (name_prefix or "data") + ".export-symbols", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__exportsymbols_is_list = isinstance(data__exportsymbols, (list, tuple)) + if data__exportsymbols_is_list: + data__exportsymbols_len = len(data__exportsymbols) + for data__exportsymbols_x, data__exportsymbols_item in enumerate(data__exportsymbols): + if not isinstance(data__exportsymbols_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".export-symbols[{data__exportsymbols_x}]".format(**locals()) + " must be string", value=data__exportsymbols_item, name="" + (name_prefix or "data") + ".export-symbols[{data__exportsymbols_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "swig-opts" in data_keys: + data_keys.remove("swig-opts") + data__swigopts = data["swig-opts"] + if not isinstance(data__swigopts, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".swig-opts must be array", value=data__swigopts, name="" + (name_prefix or "data") + ".swig-opts", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__swigopts_is_list = isinstance(data__swigopts, (list, tuple)) + if data__swigopts_is_list: + data__swigopts_len = len(data__swigopts) + for data__swigopts_x, data__swigopts_item in enumerate(data__swigopts): + if not isinstance(data__swigopts_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".swig-opts[{data__swigopts_x}]".format(**locals()) + " must be string", value=data__swigopts_item, name="" + (name_prefix or "data") + ".swig-opts[{data__swigopts_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "depends" in data_keys: + data_keys.remove("depends") + data__depends = data["depends"] + if not isinstance(data__depends, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".depends must be array", value=data__depends, name="" + (name_prefix or "data") + ".depends", definition={'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__depends_is_list = isinstance(data__depends, (list, tuple)) + if data__depends_is_list: + data__depends_len = len(data__depends) + for data__depends_x, data__depends_item in enumerate(data__depends): + if not isinstance(data__depends_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".depends[{data__depends_x}]".format(**locals()) + " must be string", value=data__depends_item, name="" + (name_prefix or "data") + ".depends[{data__depends_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "language" in data_keys: + data_keys.remove("language") + data__language = data["language"] + if not isinstance(data__language, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".language must be string", value=data__language, name="" + (name_prefix or "data") + ".language", definition={'type': 'string'}, rule='type') + if "optional" in data_keys: + data_keys.remove("optional") + data__optional = data["optional"] + if not isinstance(data__optional, (bool)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional must be boolean", value=data__optional, name="" + (name_prefix or "data") + ".optional", definition={'type': 'boolean'}, rule='type') + if "py-limited-api" in data_keys: + data_keys.remove("py-limited-api") + data__pylimitedapi = data["py-limited-api"] + if not isinstance(data__pylimitedapi, (bool)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".py-limited-api must be boolean", value=data__pylimitedapi, name="" + (name_prefix or "data") + ".py-limited-api", definition={'type': 'boolean'}, rule='type') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/ext-module', 'title': 'Extension module', 'description': 'Parameters to construct a :class:`setuptools.Extension` object', 'type': 'object', 'required': ['name', 'sources'], 'additionalProperties': False, 'properties': {'name': {'type': 'string', 'format': 'python-module-name-relaxed'}, 'sources': {'type': 'array', 'items': {'type': 'string'}}, 'include-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'define-macros': {'type': 'array', 'items': {'type': 'array', 'items': [{'description': 'macro name', 'type': 'string'}, {'description': 'macro value', 'oneOf': [{'type': 'string'}, {'type': 'null'}]}], 'additionalItems': False}}, 'undef-macros': {'type': 'array', 'items': {'type': 'string'}}, 'library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'libraries': {'type': 'array', 'items': {'type': 'string'}}, 'runtime-library-dirs': {'type': 'array', 'items': {'type': 'string'}}, 'extra-objects': {'type': 'array', 'items': {'type': 'string'}}, 'extra-compile-args': {'type': 'array', 'items': {'type': 'string'}}, 'extra-link-args': {'type': 'array', 'items': {'type': 'string'}}, 'export-symbols': {'type': 'array', 'items': {'type': 'string'}}, 'swig-opts': {'type': 'array', 'items': {'type': 'string'}}, 'depends': {'type': 'array', 'items': {'type': 'string'}}, 'language': {'type': 'string'}, 'optional': {'type': 'boolean'}, 'py-limited-api': {'type': 'boolean'}}}, rule='additionalProperties') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_find_directive(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "find" in data_keys: + data_keys.remove("find") + data__find = data["find"] + if not isinstance(data__find, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find must be object", value=data__find, name="" + (name_prefix or "data") + ".find", definition={'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}, rule='type') + data__find_is_dict = isinstance(data__find, dict) + if data__find_is_dict: + data__find_keys = set(data__find.keys()) + if "where" in data__find_keys: + data__find_keys.remove("where") + data__find__where = data__find["where"] + if not isinstance(data__find__where, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.where must be array", value=data__find__where, name="" + (name_prefix or "data") + ".find.where", definition={'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__find__where_is_list = isinstance(data__find__where, (list, tuple)) + if data__find__where_is_list: + data__find__where_len = len(data__find__where) + for data__find__where_x, data__find__where_item in enumerate(data__find__where): + if not isinstance(data__find__where_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.where[{data__find__where_x}]".format(**locals()) + " must be string", value=data__find__where_item, name="" + (name_prefix or "data") + ".find.where[{data__find__where_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "exclude" in data__find_keys: + data__find_keys.remove("exclude") + data__find__exclude = data__find["exclude"] + if not isinstance(data__find__exclude, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.exclude must be array", value=data__find__exclude, name="" + (name_prefix or "data") + ".find.exclude", definition={'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, rule='type') + data__find__exclude_is_list = isinstance(data__find__exclude, (list, tuple)) + if data__find__exclude_is_list: + data__find__exclude_len = len(data__find__exclude) + for data__find__exclude_x, data__find__exclude_item in enumerate(data__find__exclude): + if not isinstance(data__find__exclude_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.exclude[{data__find__exclude_x}]".format(**locals()) + " must be string", value=data__find__exclude_item, name="" + (name_prefix or "data") + ".find.exclude[{data__find__exclude_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "include" in data__find_keys: + data__find_keys.remove("include") + data__find__include = data__find["include"] + if not isinstance(data__find__include, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.include must be array", value=data__find__include, name="" + (name_prefix or "data") + ".find.include", definition={'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, rule='type') + data__find__include_is_list = isinstance(data__find__include, (list, tuple)) + if data__find__include_is_list: + data__find__include_len = len(data__find__include) + for data__find__include_x, data__find__include_item in enumerate(data__find__include): + if not isinstance(data__find__include_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.include[{data__find__include_x}]".format(**locals()) + " must be string", value=data__find__include_item, name="" + (name_prefix or "data") + ".find.include[{data__find__include_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "namespaces" in data__find_keys: + data__find_keys.remove("namespaces") + data__find__namespaces = data__find["namespaces"] + if not isinstance(data__find__namespaces, (bool)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find.namespaces must be boolean", value=data__find__namespaces, name="" + (name_prefix or "data") + ".find.namespaces", definition={'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}, rule='type') + if data__find_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".find must not contain "+str(data__find_keys)+" properties", value=data__find, name="" + (name_prefix or "data") + ".find", definition={'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}, rule='additionalProperties') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/find-directive', 'title': "'find:' directive", 'type': 'object', 'additionalProperties': False, 'properties': {'find': {'type': 'object', '$$description': ['Dynamic `package discovery', '`_.'], 'additionalProperties': False, 'properties': {'where': {'description': 'Directories to be searched for packages (Unix-style relative path)', 'type': 'array', 'items': {'type': 'string'}}, 'exclude': {'type': 'array', '$$description': ['Exclude packages that match the values listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'include': {'type': 'array', '$$description': ['Restrict the found packages to just the ones listed in this field.', "Can container shell-style wildcards (e.g. ``'pkg.*'``)"], 'items': {'type': 'string'}}, 'namespaces': {'type': 'boolean', '$$description': ['When ``True``, directories without a ``__init__.py`` file will also', 'be scanned for :pep:`420`-style implicit namespaces']}}}}}, rule='additionalProperties') + return data + +def validate_https___setuptools_pypa_io_en_latest_userguide_pyproject_config_html__definitions_package_name(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, rule='type') + data_any_of_count11 = 0 + if not data_any_of_count11: + try: + if not isinstance(data, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='type') + if isinstance(data, str): + if not custom_formats["python-module-name-relaxed"](data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be python-module-name-relaxed", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'python-module-name-relaxed'}, rule='format') + data_any_of_count11 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count11: + try: + if not isinstance(data, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'pep561-stub-name'}, rule='type') + if isinstance(data, str): + if not custom_formats["pep561-stub-name"](data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be pep561-stub-name", value=data, name="" + (name_prefix or "data") + "", definition={'type': 'string', 'format': 'pep561-stub-name'}, rule='format') + data_any_of_count11 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count11: + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/package-name', 'title': 'Valid package name', 'description': 'Valid package name (importable or :pep:`561`).', 'type': 'string', 'anyOf': [{'type': 'string', 'format': 'python-module-name-relaxed'}, {'type': 'string', 'format': 'pep561-stub-name'}]}, rule='anyOf') + return data + +def validate_https___setuptools_pypa_io_en_latest_deprecated_distutils_configfile_html(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html', 'title': '``tool.distutils`` table', '$$description': ['**EXPERIMENTAL** (NOT OFFICIALLY SUPPORTED): Use ``tool.distutils``', 'subtables to configure arguments for ``distutils`` commands.', 'Originally, ``distutils`` allowed developers to configure arguments for', '``setup.py`` commands via `distutils configuration files', '`_.', 'See also `the old Python docs _`.'], 'type': 'object', 'properties': {'global': {'type': 'object', 'description': 'Global options applied to all ``distutils`` commands'}}, 'patternProperties': {'.+': {'type': 'object'}}, '$comment': 'TODO: Is there a practical way of making this schema more specific?'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "global" in data_keys: + data_keys.remove("global") + data__global = data["global"] + if not isinstance(data__global, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".global must be object", value=data__global, name="" + (name_prefix or "data") + ".global", definition={'type': 'object', 'description': 'Global options applied to all ``distutils`` commands'}, rule='type') + for data_key, data_val in data.items(): + if REGEX_PATTERNS['.+'].search(data_key): + if data_key in data_keys: + data_keys.remove(data_key) + if not isinstance(data_val, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".{data_key}".format(**locals()) + " must be object", value=data_val, name="" + (name_prefix or "data") + ".{data_key}".format(**locals()) + "", definition={'type': 'object'}, rule='type') + return data + +def validate_https___packaging_python_org_en_latest_specifications_pyproject_toml(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'gui-scripts': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}, rule='type') + try: + try: + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['dynamic']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, rule='required') + data_keys = set(data.keys()) + if "dynamic" in data_keys: + data_keys.remove("dynamic") + data__dynamic = data["dynamic"] + data__dynamic_is_list = isinstance(data__dynamic, (list, tuple)) + if data__dynamic_is_list: + data__dynamic_contains = False + for data__dynamic_key in data__dynamic: + try: + if data__dynamic_key != "version": + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic must be same as const definition: version", value=data__dynamic_key, name="" + (name_prefix or "data") + ".dynamic", definition={'const': 'version'}, rule='const') + data__dynamic_contains = True + break + except JsonSchemaValueException: pass + if not data__dynamic_contains: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic must contain one of contains definition", value=data__dynamic, name="" + (name_prefix or "data") + ".dynamic", definition={'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}, rule='contains') + except JsonSchemaValueException: pass + else: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must NOT match a disallowed definition", value=data, name="" + (name_prefix or "data") + "", definition={'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, rule='not') + except JsonSchemaValueException: + pass + else: + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['version']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}, rule='required') + try: + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['license-files']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'required': ['license-files']}, rule='required') + except JsonSchemaValueException: + pass + else: + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "license" in data_keys: + data_keys.remove("license") + data__license = data["license"] + if not isinstance(data__license, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must be string", value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'string'}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['name']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'gui-scripts': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}, rule='required') + data_keys = set(data.keys()) + if "name" in data_keys: + data_keys.remove("name") + data__name = data["name"] + if not isinstance(data__name, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be string", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, rule='type') + if isinstance(data__name, str): + if not custom_formats["pep508-identifier"](data__name): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be pep508-identifier", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, rule='format') + if "version" in data_keys: + data_keys.remove("version") + data__version = data["version"] + if not isinstance(data__version, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".version must be string", value=data__version, name="" + (name_prefix or "data") + ".version", definition={'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, rule='type') + if isinstance(data__version, str): + if not custom_formats["pep440"](data__version): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".version must be pep440", value=data__version, name="" + (name_prefix or "data") + ".version", definition={'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, rule='format') + if "description" in data_keys: + data_keys.remove("description") + data__description = data["description"] + if not isinstance(data__description, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".description must be string", value=data__description, name="" + (name_prefix or "data") + ".description", definition={'type': 'string', '$$description': ['The `summary description of the project', '`_']}, rule='type') + if "readme" in data_keys: + data_keys.remove("readme") + data__readme = data["readme"] + data__readme_one_of_count12 = 0 + if data__readme_one_of_count12 < 2: + try: + if not isinstance(data__readme, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme must be string", value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, rule='type') + data__readme_one_of_count12 += 1 + except JsonSchemaValueException: pass + if data__readme_one_of_count12 < 2: + try: + if not isinstance(data__readme, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme must be object", value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}, rule='type') + data__readme_any_of_count13 = 0 + if not data__readme_any_of_count13: + try: + data__readme_is_dict = isinstance(data__readme, dict) + if data__readme_is_dict: + data__readme__missing_keys = set(['file']) - data__readme.keys() + if data__readme__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme must contain " + (str(sorted(data__readme__missing_keys)) + " properties"), value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, rule='required') + data__readme_keys = set(data__readme.keys()) + if "file" in data__readme_keys: + data__readme_keys.remove("file") + data__readme__file = data__readme["file"] + if not isinstance(data__readme__file, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme.file must be string", value=data__readme__file, name="" + (name_prefix or "data") + ".readme.file", definition={'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}, rule='type') + data__readme_any_of_count13 += 1 + except JsonSchemaValueException: pass + if not data__readme_any_of_count13: + try: + data__readme_is_dict = isinstance(data__readme, dict) + if data__readme_is_dict: + data__readme__missing_keys = set(['text']) - data__readme.keys() + if data__readme__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme must contain " + (str(sorted(data__readme__missing_keys)) + " properties"), value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}, rule='required') + data__readme_keys = set(data__readme.keys()) + if "text" in data__readme_keys: + data__readme_keys.remove("text") + data__readme__text = data__readme["text"] + if not isinstance(data__readme__text, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme.text must be string", value=data__readme__text, name="" + (name_prefix or "data") + ".readme.text", definition={'type': 'string', 'description': 'Full text describing the project.'}, rule='type') + data__readme_any_of_count13 += 1 + except JsonSchemaValueException: pass + if not data__readme_any_of_count13: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme cannot be validated by any definition", value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, rule='anyOf') + data__readme_is_dict = isinstance(data__readme, dict) + if data__readme_is_dict: + data__readme__missing_keys = set(['content-type']) - data__readme.keys() + if data__readme__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme must contain " + (str(sorted(data__readme__missing_keys)) + " properties"), value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}, rule='required') + data__readme_keys = set(data__readme.keys()) + if "content-type" in data__readme_keys: + data__readme_keys.remove("content-type") + data__readme__contenttype = data__readme["content-type"] + if not isinstance(data__readme__contenttype, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme.content-type must be string", value=data__readme__contenttype, name="" + (name_prefix or "data") + ".readme.content-type", definition={'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}, rule='type') + data__readme_one_of_count12 += 1 + except JsonSchemaValueException: pass + if data__readme_one_of_count12 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".readme must be valid exactly by one definition" + (" (" + str(data__readme_one_of_count12) + " matches found)"), value=data__readme, name="" + (name_prefix or "data") + ".readme", definition={'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, rule='oneOf') + if "requires-python" in data_keys: + data_keys.remove("requires-python") + data__requirespython = data["requires-python"] + if not isinstance(data__requirespython, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".requires-python must be string", value=data__requirespython, name="" + (name_prefix or "data") + ".requires-python", definition={'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, rule='type') + if isinstance(data__requirespython, str): + if not custom_formats["pep508-versionspec"](data__requirespython): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".requires-python must be pep508-versionspec", value=data__requirespython, name="" + (name_prefix or "data") + ".requires-python", definition={'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, rule='format') + if "license" in data_keys: + data_keys.remove("license") + data__license = data["license"] + data__license_one_of_count14 = 0 + if data__license_one_of_count14 < 2: + try: + if not isinstance(data__license, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must be string", value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, rule='type') + if isinstance(data__license, str): + if not custom_formats["SPDX"](data__license): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must be SPDX", value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, rule='format') + data__license_one_of_count14 += 1 + except JsonSchemaValueException: pass + if data__license_one_of_count14 < 2: + try: + if not isinstance(data__license, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must be object", value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, rule='type') + data__license_is_dict = isinstance(data__license, dict) + if data__license_is_dict: + data__license__missing_keys = set(['file']) - data__license.keys() + if data__license__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must contain " + (str(sorted(data__license__missing_keys)) + " properties"), value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, rule='required') + data__license_keys = set(data__license.keys()) + if "file" in data__license_keys: + data__license_keys.remove("file") + data__license__file = data__license["file"] + if not isinstance(data__license__file, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license.file must be string", value=data__license__file, name="" + (name_prefix or "data") + ".license.file", definition={'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}, rule='type') + data__license_one_of_count14 += 1 + except JsonSchemaValueException: pass + if data__license_one_of_count14 < 2: + try: + if not isinstance(data__license, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must be object", value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}, rule='type') + data__license_is_dict = isinstance(data__license, dict) + if data__license_is_dict: + data__license__missing_keys = set(['text']) - data__license.keys() + if data__license__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must contain " + (str(sorted(data__license__missing_keys)) + " properties"), value=data__license, name="" + (name_prefix or "data") + ".license", definition={'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}, rule='required') + data__license_keys = set(data__license.keys()) + if "text" in data__license_keys: + data__license_keys.remove("text") + data__license__text = data__license["text"] + if not isinstance(data__license__text, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license.text must be string", value=data__license__text, name="" + (name_prefix or "data") + ".license.text", definition={'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}, rule='type') + data__license_one_of_count14 += 1 + except JsonSchemaValueException: pass + if data__license_one_of_count14 != 1: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license must be valid exactly by one definition" + (" (" + str(data__license_one_of_count14) + " matches found)"), value=data__license, name="" + (name_prefix or "data") + ".license", definition={'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, rule='oneOf') + if "license-files" in data_keys: + data_keys.remove("license-files") + data__licensefiles = data["license-files"] + if not isinstance(data__licensefiles, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license-files must be array", value=data__licensefiles, name="" + (name_prefix or "data") + ".license-files", definition={'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, rule='type') + data__licensefiles_is_list = isinstance(data__licensefiles, (list, tuple)) + if data__licensefiles_is_list: + data__licensefiles_len = len(data__licensefiles) + for data__licensefiles_x, data__licensefiles_item in enumerate(data__licensefiles): + if not isinstance(data__licensefiles_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".license-files[{data__licensefiles_x}]".format(**locals()) + " must be string", value=data__licensefiles_item, name="" + (name_prefix or "data") + ".license-files[{data__licensefiles_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "authors" in data_keys: + data_keys.remove("authors") + data__authors = data["authors"] + if not isinstance(data__authors, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".authors must be array", value=data__authors, name="" + (name_prefix or "data") + ".authors", definition={'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, rule='type') + data__authors_is_list = isinstance(data__authors, (list, tuple)) + if data__authors_is_list: + data__authors_len = len(data__authors) + for data__authors_x, data__authors_item in enumerate(data__authors): + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_author(data__authors_item, custom_formats, (name_prefix or "data") + ".authors[{data__authors_x}]".format(**locals())) + if "maintainers" in data_keys: + data_keys.remove("maintainers") + data__maintainers = data["maintainers"] + if not isinstance(data__maintainers, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".maintainers must be array", value=data__maintainers, name="" + (name_prefix or "data") + ".maintainers", definition={'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, rule='type') + data__maintainers_is_list = isinstance(data__maintainers, (list, tuple)) + if data__maintainers_is_list: + data__maintainers_len = len(data__maintainers) + for data__maintainers_x, data__maintainers_item in enumerate(data__maintainers): + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_author(data__maintainers_item, custom_formats, (name_prefix or "data") + ".maintainers[{data__maintainers_x}]".format(**locals())) + if "keywords" in data_keys: + data_keys.remove("keywords") + data__keywords = data["keywords"] + if not isinstance(data__keywords, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".keywords must be array", value=data__keywords, name="" + (name_prefix or "data") + ".keywords", definition={'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, rule='type') + data__keywords_is_list = isinstance(data__keywords, (list, tuple)) + if data__keywords_is_list: + data__keywords_len = len(data__keywords) + for data__keywords_x, data__keywords_item in enumerate(data__keywords): + if not isinstance(data__keywords_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".keywords[{data__keywords_x}]".format(**locals()) + " must be string", value=data__keywords_item, name="" + (name_prefix or "data") + ".keywords[{data__keywords_x}]".format(**locals()) + "", definition={'type': 'string'}, rule='type') + if "classifiers" in data_keys: + data_keys.remove("classifiers") + data__classifiers = data["classifiers"] + if not isinstance(data__classifiers, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".classifiers must be array", value=data__classifiers, name="" + (name_prefix or "data") + ".classifiers", definition={'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, rule='type') + data__classifiers_is_list = isinstance(data__classifiers, (list, tuple)) + if data__classifiers_is_list: + data__classifiers_len = len(data__classifiers) + for data__classifiers_x, data__classifiers_item in enumerate(data__classifiers): + if not isinstance(data__classifiers_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".classifiers[{data__classifiers_x}]".format(**locals()) + " must be string", value=data__classifiers_item, name="" + (name_prefix or "data") + ".classifiers[{data__classifiers_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, rule='type') + if isinstance(data__classifiers_item, str): + if not custom_formats["trove-classifier"](data__classifiers_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".classifiers[{data__classifiers_x}]".format(**locals()) + " must be trove-classifier", value=data__classifiers_item, name="" + (name_prefix or "data") + ".classifiers[{data__classifiers_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, rule='format') + if "urls" in data_keys: + data_keys.remove("urls") + data__urls = data["urls"] + if not isinstance(data__urls, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".urls must be object", value=data__urls, name="" + (name_prefix or "data") + ".urls", definition={'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, rule='type') + data__urls_is_dict = isinstance(data__urls, dict) + if data__urls_is_dict: + data__urls_keys = set(data__urls.keys()) + for data__urls_key, data__urls_val in data__urls.items(): + if REGEX_PATTERNS['^.+$'].search(data__urls_key): + if data__urls_key in data__urls_keys: + data__urls_keys.remove(data__urls_key) + if not isinstance(data__urls_val, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".urls.{data__urls_key}".format(**locals()) + " must be string", value=data__urls_val, name="" + (name_prefix or "data") + ".urls.{data__urls_key}".format(**locals()) + "", definition={'type': 'string', 'format': 'url'}, rule='type') + if isinstance(data__urls_val, str): + if not custom_formats["url"](data__urls_val): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".urls.{data__urls_key}".format(**locals()) + " must be url", value=data__urls_val, name="" + (name_prefix or "data") + ".urls.{data__urls_key}".format(**locals()) + "", definition={'type': 'string', 'format': 'url'}, rule='format') + if data__urls_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".urls must not contain "+str(data__urls_keys)+" properties", value=data__urls, name="" + (name_prefix or "data") + ".urls", definition={'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, rule='additionalProperties') + if "scripts" in data_keys: + data_keys.remove("scripts") + data__scripts = data["scripts"] + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_entry_point_group(data__scripts, custom_formats, (name_prefix or "data") + ".scripts") + if "gui-scripts" in data_keys: + data_keys.remove("gui-scripts") + data__guiscripts = data["gui-scripts"] + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_entry_point_group(data__guiscripts, custom_formats, (name_prefix or "data") + ".gui-scripts") + if "entry-points" in data_keys: + data_keys.remove("entry-points") + data__entrypoints = data["entry-points"] + data__entrypoints_is_dict = isinstance(data__entrypoints, dict) + if data__entrypoints_is_dict: + data__entrypoints_keys = set(data__entrypoints.keys()) + for data__entrypoints_key, data__entrypoints_val in data__entrypoints.items(): + if REGEX_PATTERNS['^.+$'].search(data__entrypoints_key): + if data__entrypoints_key in data__entrypoints_keys: + data__entrypoints_keys.remove(data__entrypoints_key) + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_entry_point_group(data__entrypoints_val, custom_formats, (name_prefix or "data") + ".entry-points.{data__entrypoints_key}".format(**locals())) + if data__entrypoints_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".entry-points must not contain "+str(data__entrypoints_keys)+" properties", value=data__entrypoints, name="" + (name_prefix or "data") + ".entry-points", definition={'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}}}, rule='additionalProperties') + data__entrypoints_len = len(data__entrypoints) + if data__entrypoints_len != 0: + data__entrypoints_property_names = True + for data__entrypoints_key in data__entrypoints: + try: + if isinstance(data__entrypoints_key, str): + if not custom_formats["python-entrypoint-group"](data__entrypoints_key): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".entry-points must be python-entrypoint-group", value=data__entrypoints_key, name="" + (name_prefix or "data") + ".entry-points", definition={'format': 'python-entrypoint-group'}, rule='format') + except JsonSchemaValueException: + data__entrypoints_property_names = False + if not data__entrypoints_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".entry-points must be named by propertyName definition", value=data__entrypoints, name="" + (name_prefix or "data") + ".entry-points", definition={'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}}}, rule='propertyNames') + if "dependencies" in data_keys: + data_keys.remove("dependencies") + data__dependencies = data["dependencies"] + if not isinstance(data__dependencies, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dependencies must be array", value=data__dependencies, name="" + (name_prefix or "data") + ".dependencies", definition={'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}, rule='type') + data__dependencies_is_list = isinstance(data__dependencies, (list, tuple)) + if data__dependencies_is_list: + data__dependencies_len = len(data__dependencies) + for data__dependencies_x, data__dependencies_item in enumerate(data__dependencies): + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_dependency(data__dependencies_item, custom_formats, (name_prefix or "data") + ".dependencies[{data__dependencies_x}]".format(**locals())) + if "optional-dependencies" in data_keys: + data_keys.remove("optional-dependencies") + data__optionaldependencies = data["optional-dependencies"] + if not isinstance(data__optionaldependencies, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional-dependencies must be object", value=data__optionaldependencies, name="" + (name_prefix or "data") + ".optional-dependencies", definition={'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, rule='type') + data__optionaldependencies_is_dict = isinstance(data__optionaldependencies, dict) + if data__optionaldependencies_is_dict: + data__optionaldependencies_keys = set(data__optionaldependencies.keys()) + for data__optionaldependencies_key, data__optionaldependencies_val in data__optionaldependencies.items(): + if REGEX_PATTERNS['^.+$'].search(data__optionaldependencies_key): + if data__optionaldependencies_key in data__optionaldependencies_keys: + data__optionaldependencies_keys.remove(data__optionaldependencies_key) + if not isinstance(data__optionaldependencies_val, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional-dependencies.{data__optionaldependencies_key}".format(**locals()) + " must be array", value=data__optionaldependencies_val, name="" + (name_prefix or "data") + ".optional-dependencies.{data__optionaldependencies_key}".format(**locals()) + "", definition={'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}, rule='type') + data__optionaldependencies_val_is_list = isinstance(data__optionaldependencies_val, (list, tuple)) + if data__optionaldependencies_val_is_list: + data__optionaldependencies_val_len = len(data__optionaldependencies_val) + for data__optionaldependencies_val_x, data__optionaldependencies_val_item in enumerate(data__optionaldependencies_val): + validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_dependency(data__optionaldependencies_val_item, custom_formats, (name_prefix or "data") + ".optional-dependencies.{data__optionaldependencies_key}[{data__optionaldependencies_val_x}]".format(**locals())) + if data__optionaldependencies_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional-dependencies must not contain "+str(data__optionaldependencies_keys)+" properties", value=data__optionaldependencies, name="" + (name_prefix or "data") + ".optional-dependencies", definition={'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, rule='additionalProperties') + data__optionaldependencies_len = len(data__optionaldependencies) + if data__optionaldependencies_len != 0: + data__optionaldependencies_property_names = True + for data__optionaldependencies_key in data__optionaldependencies: + try: + if isinstance(data__optionaldependencies_key, str): + if not custom_formats["pep508-identifier"](data__optionaldependencies_key): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional-dependencies must be pep508-identifier", value=data__optionaldependencies_key, name="" + (name_prefix or "data") + ".optional-dependencies", definition={'format': 'pep508-identifier'}, rule='format') + except JsonSchemaValueException: + data__optionaldependencies_property_names = False + if not data__optionaldependencies_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional-dependencies must be named by propertyName definition", value=data__optionaldependencies, name="" + (name_prefix or "data") + ".optional-dependencies", definition={'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, rule='propertyNames') + if "import-names" in data_keys: + data_keys.remove("import-names") + data__importnames = data["import-names"] + if not isinstance(data__importnames, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".import-names must be array", value=data__importnames, name="" + (name_prefix or "data") + ".import-names", definition={'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, rule='type') + data__importnames_is_list = isinstance(data__importnames, (list, tuple)) + if data__importnames_is_list: + data__importnames_len = len(data__importnames) + for data__importnames_x, data__importnames_item in enumerate(data__importnames): + if not isinstance(data__importnames_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".import-names[{data__importnames_x}]".format(**locals()) + " must be string", value=data__importnames_item, name="" + (name_prefix or "data") + ".import-names[{data__importnames_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'import-name'}, rule='type') + if isinstance(data__importnames_item, str): + if not custom_formats["import-name"](data__importnames_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".import-names[{data__importnames_x}]".format(**locals()) + " must be import-name", value=data__importnames_item, name="" + (name_prefix or "data") + ".import-names[{data__importnames_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'import-name'}, rule='format') + if "import-namespaces" in data_keys: + data_keys.remove("import-namespaces") + data__importnamespaces = data["import-namespaces"] + if not isinstance(data__importnamespaces, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".import-namespaces must be array", value=data__importnamespaces, name="" + (name_prefix or "data") + ".import-namespaces", definition={'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, rule='type') + data__importnamespaces_is_list = isinstance(data__importnamespaces, (list, tuple)) + if data__importnamespaces_is_list: + data__importnamespaces_len = len(data__importnamespaces) + for data__importnamespaces_x, data__importnamespaces_item in enumerate(data__importnamespaces): + if not isinstance(data__importnamespaces_item, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".import-namespaces[{data__importnamespaces_x}]".format(**locals()) + " must be string", value=data__importnamespaces_item, name="" + (name_prefix or "data") + ".import-namespaces[{data__importnamespaces_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'import-name'}, rule='type') + if isinstance(data__importnamespaces_item, str): + if not custom_formats["import-name"](data__importnamespaces_item): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".import-namespaces[{data__importnamespaces_x}]".format(**locals()) + " must be import-name", value=data__importnamespaces_item, name="" + (name_prefix or "data") + ".import-namespaces[{data__importnamespaces_x}]".format(**locals()) + "", definition={'type': 'string', 'format': 'import-name'}, rule='format') + if "dynamic" in data_keys: + data_keys.remove("dynamic") + data__dynamic = data["dynamic"] + if not isinstance(data__dynamic, (list, tuple)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic must be array", value=data__dynamic, name="" + (name_prefix or "data") + ".dynamic", definition={'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}, rule='type') + data__dynamic_is_list = isinstance(data__dynamic, (list, tuple)) + if data__dynamic_is_list: + data__dynamic_len = len(data__dynamic) + for data__dynamic_x, data__dynamic_item in enumerate(data__dynamic): + if data__dynamic_item not in ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']: + raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic[{data__dynamic_x}]".format(**locals()) + " must be one of ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']", value=data__dynamic_item, name="" + (name_prefix or "data") + ".dynamic[{data__dynamic_x}]".format(**locals()) + "", definition={'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}, rule='enum') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$schema': 'http://json-schema.org/draft-07/schema#', '$id': 'https://packaging.python.org/en/latest/specifications/pyproject-toml/', 'title': 'Package metadata stored in the ``project`` table', '$$description': ['Data structure for the **project** table inside ``pyproject.toml``', '(as initially defined in :pep:`621`)'], 'type': 'object', 'properties': {'name': {'type': 'string', 'description': 'The name (primary identifier) of the project. MUST be statically defined.', 'format': 'pep508-identifier'}, 'version': {'type': 'string', 'description': 'The version of the project as supported by :pep:`440`.', 'format': 'pep440'}, 'description': {'type': 'string', '$$description': ['The `summary description of the project', '`_']}, 'readme': {'$$description': ['`Full/detailed description of the project in the form of a README', '`_', "with meaning similar to the one defined in `core metadata's Description", '`_'], 'oneOf': [{'type': 'string', '$$description': ['Relative path to a text file (UTF-8) containing the full description', 'of the project. If the file path ends in case-insensitive ``.md`` or', '``.rst`` suffixes, then the content-type is respectively', '``text/markdown`` or ``text/x-rst``']}, {'type': 'object', 'allOf': [{'anyOf': [{'properties': {'file': {'type': 'string', '$$description': ['Relative path to a text file containing the full description', 'of the project.']}}, 'required': ['file']}, {'properties': {'text': {'type': 'string', 'description': 'Full text describing the project.'}}, 'required': ['text']}]}, {'properties': {'content-type': {'type': 'string', '$$description': ['Content-type (:rfc:`1341`) of the full description', '(e.g. ``text/markdown``). The ``charset`` parameter is assumed', 'UTF-8 when not present.'], '$comment': 'TODO: add regex pattern or format?'}}, 'required': ['content-type']}]}]}, 'requires-python': {'type': 'string', 'format': 'pep508-versionspec', '$$description': ['`The Python version requirements of the project', '`_.']}, 'license': {'description': '`Project license `_.', 'oneOf': [{'type': 'string', 'description': 'An SPDX license identifier', 'format': 'SPDX'}, {'type': 'object', 'properties': {'file': {'type': 'string', '$$description': ['Relative path to the file (UTF-8) which contains the license for the', 'project.']}}, 'required': ['file']}, {'type': 'object', 'properties': {'text': {'type': 'string', '$$description': ['The license of the project whose meaning is that of the', '`License field from the core metadata', '`_.']}}, 'required': ['text']}]}, 'license-files': {'description': 'Paths or globs to paths of license files', 'type': 'array', 'items': {'type': 'string'}}, 'authors': {'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'authors' of the project.", 'The exact meaning is open to interpretation (e.g. original or primary authors,', 'current maintainers, or owners of the package).']}, 'maintainers': {'type': 'array', 'items': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, '$$description': ["The people or organizations considered to be the 'maintainers' of the project.", 'Similarly to ``authors``, the exact meaning is open to interpretation.']}, 'keywords': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of keywords to assist searching for the distribution in a larger catalog.'}, 'classifiers': {'type': 'array', 'items': {'type': 'string', 'format': 'trove-classifier', 'description': '`PyPI classifier `_.'}, '$$description': ['`Trove classifiers `_', 'which apply to the project.']}, 'urls': {'type': 'object', 'description': 'URLs associated with the project in the form ``label => value``.', 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', 'format': 'url'}}}, 'scripts': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'gui-scripts': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'entry-points': {'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}}}, 'dependencies': {'type': 'array', 'description': 'Project (mandatory) dependencies.', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}, 'optional-dependencies': {'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, 'import-names': {'description': 'Lists import names which a project, when installed, would exclusively provide.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'import-namespaces': {'description': 'Lists import names that, when installed, would be provided by the project, but not exclusively.', 'type': 'array', 'items': {'type': 'string', 'format': 'import-name'}}, 'dynamic': {'type': 'array', '$$description': ['Specifies which fields are intentionally unspecified and expected to be', 'dynamically provided by build tools'], 'items': {'enum': ['version', 'description', 'readme', 'requires-python', 'license', 'license-files', 'authors', 'maintainers', 'keywords', 'classifiers', 'urls', 'scripts', 'gui-scripts', 'entry-points', 'dependencies', 'optional-dependencies', 'import-names', 'import-namespaces']}}}, 'required': ['name'], 'additionalProperties': False, 'allOf': [{'if': {'not': {'required': ['dynamic'], 'properties': {'dynamic': {'contains': {'const': 'version'}, '$$description': ['version is listed in ``dynamic``']}}}, '$$comment': ['According to :pep:`621`:', ' If the core metadata specification lists a field as "Required", then', ' the metadata MUST specify the field statically or list it in dynamic', 'In turn, `core metadata`_ defines:', ' The required fields are: Metadata-Version, Name, Version.', ' All the other fields are optional.', 'Since ``Metadata-Version`` is defined by the build back-end, ``name`` and', '``version`` are the only mandatory information in ``pyproject.toml``.', '.. _core metadata: https://packaging.python.org/specifications/core-metadata/']}, 'then': {'required': ['version'], '$$description': ['version should be statically defined in the ``version`` field']}}, {'if': {'required': ['license-files']}, 'then': {'properties': {'license': {'type': 'string'}}}}], 'definitions': {'author': {'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, 'entry-point-group': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, 'dependency': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}, rule='additionalProperties') + return data + +def validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_dependency(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be string", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}, rule='type') + if isinstance(data, str): + if not custom_formats["pep508"](data): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be pep508", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}, rule='format') + return data + +def validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_entry_point_group(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, rule='type') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + for data_key, data_val in data.items(): + if REGEX_PATTERNS['^.+$'].search(data_key): + if data_key in data_keys: + data_keys.remove(data_key) + if not isinstance(data_val, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".{data_key}".format(**locals()) + " must be string", value=data_val, name="" + (name_prefix or "data") + ".{data_key}".format(**locals()) + "", definition={'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}, rule='type') + if isinstance(data_val, str): + if not custom_formats["python-entrypoint-reference"](data_val): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".{data_key}".format(**locals()) + " must be python-entrypoint-reference", value=data_val, name="" + (name_prefix or "data") + ".{data_key}".format(**locals()) + "", definition={'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}, rule='format') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, rule='additionalProperties') + data_len = len(data) + if data_len != 0: + data_property_names = True + for data_key in data: + try: + if isinstance(data_key, str): + if not custom_formats["python-entrypoint-name"](data_key): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be python-entrypoint-name", value=data_key, name="" + (name_prefix or "data") + "", definition={'format': 'python-entrypoint-name'}, rule='format') + except JsonSchemaValueException: + data_property_names = False + if not data_property_names: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be named by propertyName definition", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '`_', 'and `setuptools docs', '`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}, rule='propertyNames') + return data + +def validate_https___packaging_python_org_en_latest_specifications_pyproject_toml___definitions_author(data, custom_formats={}, name_prefix=None): + if not isinstance(data, (dict)): + raise JsonSchemaValueException("" + (name_prefix or "data") + " must be object", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, rule='type') + data_any_of_count15 = 0 + if not data_any_of_count15: + try: + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['name']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'required': ['name']}, rule='required') + data_any_of_count15 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count15: + try: + data_is_dict = isinstance(data, dict) + if data_is_dict: + data__missing_keys = set(['email']) - data.keys() + if data__missing_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must contain " + (str(sorted(data__missing_keys)) + " properties"), value=data, name="" + (name_prefix or "data") + "", definition={'required': ['email']}, rule='required') + data_any_of_count15 += 1 + except JsonSchemaValueException: pass + if not data_any_of_count15: + raise JsonSchemaValueException("" + (name_prefix or "data") + " cannot be validated by any definition", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, rule='anyOf') + data_is_dict = isinstance(data, dict) + if data_is_dict: + data_keys = set(data.keys()) + if "name" in data_keys: + data_keys.remove("name") + data__name = data["name"] + if not isinstance(data__name, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".name must be string", value=data__name, name="" + (name_prefix or "data") + ".name", definition={'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, rule='type') + if "email" in data_keys: + data_keys.remove("email") + data__email = data["email"] + if not isinstance(data__email, (str)): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".email must be string", value=data__email, name="" + (name_prefix or "data") + ".email", definition={'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}, rule='type') + if isinstance(data__email, str): + if not REGEX_PATTERNS["idn-email_re_pattern"].match(data__email): + raise JsonSchemaValueException("" + (name_prefix or "data") + ".email must be idn-email", value=data__email, name="" + (name_prefix or "data") + ".email", definition={'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}, rule='format') + if data_keys: + raise JsonSchemaValueException("" + (name_prefix or "data") + " must not contain "+str(data_keys)+" properties", value=data, name="" + (name_prefix or "data") + "", definition={'$id': '#/definitions/author', 'title': 'Author or Maintainer', '$comment': 'https://peps.python.org/pep-0621/#authors-maintainers', 'type': 'object', 'additionalProperties': False, 'properties': {'name': {'type': 'string', '$$description': ['MUST be a valid email name, i.e. whatever can be put as a name, before an', 'email, in :rfc:`822`.']}, 'email': {'type': 'string', 'format': 'idn-email', 'description': 'MUST be a valid email address'}}, 'anyOf': [{'required': ['name']}, {'required': ['email']}]}, rule='additionalProperties') + return data diff --git a/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/formats.py b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/formats.py new file mode 100644 index 0000000000000000000000000000000000000000..fe958cc52a4a6477686231a6bfe4cb8c15357162 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/config/_validate_pyproject/formats.py @@ -0,0 +1,464 @@ +""" +The functions in this module are used to validate schemas with the +`format JSON Schema keyword +`_. + +The correspondence is given by replacing the ``_`` character in the name of the +function with a ``-`` to obtain the format name and vice versa. +""" + +from __future__ import annotations + +import keyword +import logging +import os +import re +import string +import typing +from itertools import chain as _chain + +if typing.TYPE_CHECKING: + import builtins + + from typing_extensions import Literal + +_logger = logging.getLogger(__name__) + +# ------------------------------------------------------------------------------------- +# PEP 440 + +VERSION_PATTERN = r""" + v? + (?: + (?:(?P[0-9]+)!)? # epoch + (?P[0-9]+(?:\.[0-9]+)*) # release segment + (?P
                                          # pre-release
+            [-_\.]?
+            (?Palpha|a|beta|b|preview|pre|c|rc)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+        (?P                                         # post release
+            (?:-(?P[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?Ppost|rev|r)
+                [-_\.]?
+                (?P[0-9]+)?
+            )
+        )?
+        (?P                                          # dev release
+            [-_\.]?
+            (?Pdev)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+    )
+    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
+"""
+
+VERSION_REGEX = re.compile(
+    r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE
+)
+
+
+def pep440(version: str) -> bool:
+    """See :ref:`PyPA's version specification `
+    (initially introduced in :pep:`440`).
+    """
+    return VERSION_REGEX.match(version) is not None
+
+
+# -------------------------------------------------------------------------------------
+# PEP 508
+
+PEP508_IDENTIFIER_PATTERN = r"([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])"
+PEP508_IDENTIFIER_REGEX = re.compile(f"^{PEP508_IDENTIFIER_PATTERN}$", re.IGNORECASE)
+
+
+def pep508_identifier(name: str) -> bool:
+    """See :ref:`PyPA's name specification `
+    (initially introduced in :pep:`508#names`).
+    """
+    return PEP508_IDENTIFIER_REGEX.match(name) is not None
+
+
+try:
+    try:
+        from packaging import requirements as _req
+    except ImportError:  # pragma: no cover
+        # let's try setuptools vendored version
+        from setuptools._vendor.packaging import (  # type: ignore[no-redef]
+            requirements as _req,
+        )
+
+    def pep508(value: str) -> bool:
+        """See :ref:`PyPA's dependency specifiers `
+        (initially introduced in :pep:`508`).
+        """
+        try:
+            _req.Requirement(value)
+        except _req.InvalidRequirement:
+            return False
+        return True
+
+except ImportError:  # pragma: no cover
+    _logger.warning(
+        "Could not find an installation of `packaging`. Requirements, dependencies and "
+        "versions might not be validated. "
+        "To enforce validation, please install `packaging`."
+    )
+
+    def pep508(value: str) -> bool:  # noqa: ARG001
+        return True
+
+
+def pep508_versionspec(value: str) -> bool:
+    """Expression that can be used to specify/lock versions (including ranges)
+    See ``versionspec`` in :ref:`PyPA's dependency specifiers
+    ` (initially introduced in :pep:`508`).
+    """
+    if any(c in value for c in (";", "]", "@")):
+        # In PEP 508:
+        # conditional markers, extras and URL specs are not included in the
+        # versionspec
+        return False
+    # Let's pretend we have a dependency called `requirement` with the given
+    # version spec, then we can reuse the pep508 function for validation:
+    return pep508(f"requirement{value}")
+
+
+# -------------------------------------------------------------------------------------
+# PEP 517
+
+
+def pep517_backend_reference(value: str) -> bool:
+    """See PyPA's specification for defining build-backend references
+    introduced in :pep:`517#source-trees`.
+
+    This is similar to an entry-point reference (e.g., ``package.module:object``).
+    """
+    module, _, obj = value.partition(":")
+    identifiers = (i.strip() for i in _chain(module.split("."), obj.split(".")))
+    return all(python_identifier(i) for i in identifiers if i)
+
+
+# -------------------------------------------------------------------------------------
+# Classifiers - PEP 301
+
+
+def _download_classifiers() -> str:
+    import ssl
+    from email.message import Message
+    from urllib.request import urlopen
+
+    url = "https://pypi.org/pypi?:action=list_classifiers"
+    context = ssl.create_default_context()
+    with urlopen(url, context=context) as response:  # noqa: S310 (audit URLs)
+        headers = Message()
+        headers["content_type"] = response.getheader("content-type", "text/plain")
+        return response.read().decode(headers.get_param("charset", "utf-8"))  # type: ignore[no-any-return]
+
+
+class _TroveClassifier:
+    """The ``trove_classifiers`` package is the official way of validating classifiers,
+    however this package might not be always available.
+    As a workaround we can still download a list from PyPI.
+    We also don't want to be over strict about it, so simply skipping silently is an
+    option (classifiers will be validated anyway during the upload to PyPI).
+    """
+
+    downloaded: None | Literal[False] | set[str]
+    """
+    None => not cached yet
+    False => unavailable
+    set => cached values
+    """
+
+    def __init__(self) -> None:
+        self.downloaded = None
+        self._skip_download = False
+        self.__name__ = "trove_classifier"  # Emulate a public function
+
+    def _disable_download(self) -> None:
+        # This is a private API. Only setuptools has the consent of using it.
+        self._skip_download = True
+
+    def __call__(self, value: str) -> bool:
+        if self.downloaded is False or self._skip_download is True:
+            return True
+
+        if os.getenv("NO_NETWORK") or os.getenv("VALIDATE_PYPROJECT_NO_NETWORK"):
+            self.downloaded = False
+            msg = (
+                "Install ``trove-classifiers`` to ensure proper validation. "
+                "Skipping download of classifiers list from PyPI (NO_NETWORK)."
+            )
+            _logger.debug(msg)
+            return True
+
+        if self.downloaded is None:
+            msg = (
+                "Install ``trove-classifiers`` to ensure proper validation. "
+                "Meanwhile a list of classifiers will be downloaded from PyPI."
+            )
+            _logger.debug(msg)
+            try:
+                self.downloaded = set(_download_classifiers().splitlines())
+            except Exception:  # noqa: BLE001
+                self.downloaded = False
+                _logger.debug("Problem with download, skipping validation")
+                return True
+
+        return value in self.downloaded or value.lower().startswith("private ::")
+
+
+try:
+    from trove_classifiers import classifiers as _trove_classifiers
+
+    def trove_classifier(value: str) -> bool:
+        """See https://pypi.org/classifiers/"""
+        return value in _trove_classifiers or value.lower().startswith("private ::")
+
+except ImportError:  # pragma: no cover
+    trove_classifier = _TroveClassifier()
+
+
+# -------------------------------------------------------------------------------------
+# Stub packages - PEP 561
+
+
+def pep561_stub_name(value: str) -> bool:
+    """Name of a directory containing type stubs.
+    It must follow the name scheme ``-stubs`` as defined in
+    :pep:`561#stub-only-packages`.
+    """
+    top, *children = value.split(".")
+    if not top.endswith("-stubs"):
+        return False
+    return python_module_name(".".join([top[: -len("-stubs")], *children]))
+
+
+# -------------------------------------------------------------------------------------
+# Non-PEP related
+
+
+def url(value: str) -> bool:
+    """Valid URL (validation uses :obj:`urllib.parse`).
+    For maximum compatibility please make sure to include a ``scheme`` prefix
+    in your URL (e.g. ``http://``).
+    """
+    from urllib.parse import urlparse
+
+    try:
+        parts = urlparse(value)
+        if not parts.scheme:
+            _logger.warning(
+                "For maximum compatibility please make sure to include a "
+                "`scheme` prefix in your URL (e.g. 'http://'). "
+                f"Given value: {value}"
+            )
+            if not (value.startswith(("/", "\\")) or "@" in value):
+                parts = urlparse(f"http://{value}")
+
+        return bool(parts.scheme and parts.netloc)
+    except Exception:  # noqa: BLE001
+        return False
+
+
+# https://packaging.python.org/specifications/entry-points/
+ENTRYPOINT_PATTERN = r"[^\[\s=]([^=]*[^\s=])?"
+ENTRYPOINT_REGEX = re.compile(f"^{ENTRYPOINT_PATTERN}$", re.IGNORECASE)
+RECOMMEDED_ENTRYPOINT_PATTERN = r"[\w.-]+"
+RECOMMEDED_ENTRYPOINT_REGEX = re.compile(
+    f"^{RECOMMEDED_ENTRYPOINT_PATTERN}$", re.IGNORECASE
+)
+ENTRYPOINT_GROUP_PATTERN = r"\w+(\.\w+)*"
+ENTRYPOINT_GROUP_REGEX = re.compile(f"^{ENTRYPOINT_GROUP_PATTERN}$", re.IGNORECASE)
+
+
+def python_identifier(value: str) -> bool:
+    """Can be used as identifier in Python.
+    (Validation uses :obj:`str.isidentifier`).
+    """
+    return value.isidentifier()
+
+
+def python_qualified_identifier(value: str) -> bool:
+    """
+    Python "dotted identifier", i.e. a sequence of :obj:`python_identifier`
+    concatenated with ``"."`` (e.g.: ``package.module.submodule``).
+    """
+    if value.startswith(".") or value.endswith("."):
+        return False
+    return all(python_identifier(m) for m in value.split("."))
+
+
+def python_module_name(value: str) -> bool:
+    """Module name that can be used in an ``import``-statement in Python.
+    See :obj:`python_qualified_identifier`.
+    """
+    return python_qualified_identifier(value)
+
+
+def python_module_name_relaxed(value: str) -> bool:
+    """Similar to :obj:`python_module_name`, but relaxed to also accept
+    dash characters (``-``) and cover special cases like ``pip-run``.
+
+    It is recommended, however, that beginners avoid dash characters,
+    as they require advanced knowledge about Python internals.
+
+    The following are disallowed:
+
+    * names starting/ending in dashes,
+    * names ending in ``-stubs`` (potentially collide with :obj:`pep561_stub_name`).
+    """
+    if value.startswith("-") or value.endswith("-"):
+        return False
+    if value.endswith("-stubs"):
+        return False  # Avoid collision with PEP 561
+    return python_module_name(value.replace("-", "_"))
+
+
+def python_entrypoint_group(value: str) -> bool:
+    """See ``Data model > group`` in the :ref:`PyPA's entry-points specification
+    `.
+    """
+    return ENTRYPOINT_GROUP_REGEX.match(value) is not None
+
+
+def python_entrypoint_name(value: str) -> bool:
+    """See ``Data model > name`` in the :ref:`PyPA's entry-points specification
+    `.
+    """
+    if not ENTRYPOINT_REGEX.match(value):
+        return False
+    if not RECOMMEDED_ENTRYPOINT_REGEX.match(value):
+        msg = f"Entry point `{value}` does not follow recommended pattern: "
+        msg += RECOMMEDED_ENTRYPOINT_PATTERN
+        _logger.warning(msg)
+    return True
+
+
+def python_entrypoint_reference(value: str) -> bool:
+    """Reference to a Python object using in the format::
+
+        importable.module:object.attr
+
+    See ``Data model >object reference`` in the :ref:`PyPA's entry-points specification
+    `.
+    """
+    module, _, rest = value.partition(":")
+    if "[" in rest:
+        obj, _, extras_ = rest.partition("[")
+        if extras_.strip()[-1] != "]":
+            return False
+        extras = (x.strip() for x in extras_.strip(string.whitespace + "[]").split(","))
+        if not all(pep508_identifier(e) for e in extras):
+            return False
+        _logger.warning(f"`{value}` - using extras for entry points is not recommended")
+    else:
+        obj = rest
+
+    module_parts = module.split(".")
+    identifiers = _chain(module_parts, obj.split(".")) if rest else iter(module_parts)
+    return all(python_identifier(i.strip()) for i in identifiers)
+
+
+def uint8(value: builtins.int) -> bool:
+    r"""Unsigned 8-bit integer (:math:`0 \leq x < 2^8`)"""
+    return 0 <= value < 2**8
+
+
+def uint16(value: builtins.int) -> bool:
+    r"""Unsigned 16-bit integer (:math:`0 \leq x < 2^{16}`)"""
+    return 0 <= value < 2**16
+
+
+def uint32(value: builtins.int) -> bool:
+    r"""Unsigned 32-bit integer (:math:`0 \leq x < 2^{32}`)"""
+    return 0 <= value < 2**32
+
+
+def uint64(value: builtins.int) -> bool:
+    r"""Unsigned 64-bit integer (:math:`0 \leq x < 2^{64}`)"""
+    return 0 <= value < 2**64
+
+
+def uint(value: builtins.int) -> bool:
+    r"""Signed 64-bit integer (:math:`0 \leq x < 2^{64}`)"""
+    return 0 <= value < 2**64
+
+
+def int8(value: builtins.int) -> bool:
+    r"""Signed 8-bit integer (:math:`-2^{7} \leq x < 2^{7}`)"""
+    return -(2**7) <= value < 2**7
+
+
+def int16(value: builtins.int) -> bool:
+    r"""Signed 16-bit integer (:math:`-2^{15} \leq x < 2^{15}`)"""
+    return -(2**15) <= value < 2**15
+
+
+def int32(value: builtins.int) -> bool:
+    r"""Signed 32-bit integer (:math:`-2^{31} \leq x < 2^{31}`)"""
+    return -(2**31) <= value < 2**31
+
+
+def int64(value: builtins.int) -> bool:
+    r"""Signed 64-bit integer (:math:`-2^{63} \leq x < 2^{63}`)"""
+    return -(2**63) <= value < 2**63
+
+
+def int(value: builtins.int) -> bool:
+    r"""Signed 64-bit integer (:math:`-2^{63} \leq x < 2^{63}`)"""
+    return -(2**63) <= value < 2**63
+
+
+try:
+    from packaging import licenses as _licenses
+
+    def SPDX(value: str) -> bool:
+        """See :ref:`PyPA's License-Expression specification
+        ` (added in :pep:`639`).
+        """
+        try:
+            _licenses.canonicalize_license_expression(value)
+        except _licenses.InvalidLicenseExpression:
+            return False
+        return True
+
+except ImportError:  # pragma: no cover
+    _logger.warning(
+        "Could not find an up-to-date installation of `packaging`. "
+        "License expressions might not be validated. "
+        "To enforce validation, please install `packaging>=24.2`."
+    )
+
+    def SPDX(value: str) -> bool:  # noqa: ARG001
+        return True
+
+
+VALID_IMPORT_NAME = re.compile(
+    r"""
+    ^                                  # start of string
+        [A-Za-z_][A-Za-z_0-9]+         # a valid Python identifier
+        (?:\.[A-Za-z_][A-Za-z_0-9]*)*  # optionally followed by .identifier's
+    (?:\s*;\s*private)?                # optionally followed by ; private
+    $                                  # end of string
+    """,
+    re.VERBOSE,
+)
+
+
+def import_name(value: str) -> bool:
+    """This is a valid import name. It has to be series of python identifiers
+    (not keywords), separated by dots, optionally followed by a semicolon and
+    the keyword "private".
+    """
+    if VALID_IMPORT_NAME.match(value) is None:
+        return False
+
+    idents, _, _ = value.partition(";")
+    return all(not keyword.iskeyword(ident) for ident in idents.rstrip().split("."))
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/__init__.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..64dc2eef3439a7812e1b60250cfdda809b847b1a
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/__init__.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/contexts.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/contexts.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..01f7a136f37d5bfae1d57c231ab941d00c141089
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/contexts.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/environment.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/environment.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..78c99481824b2378b7d7135efe6a1a6360e5b9e8
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/environment.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/fixtures.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/fixtures.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d86f1ba28673ff7b459ad378d94c837c02269250
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/fixtures.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/mod_with_constant.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/mod_with_constant.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c41093f597156e247acef18f5f98920ecf6c0dcf
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/mod_with_constant.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/namespaces.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/namespaces.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e512075125c88c80e256dae76d185de26c136f51
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/namespaces.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/script-with-bom.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/script-with-bom.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..38cc5a219d281d498ab31cc334f43b84739a5fcc
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/script-with-bom.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_archive_util.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_archive_util.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0b211409f0a8c3ad206b0f95e65edbdde3fd16d7
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_archive_util.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_deprecations.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_deprecations.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ed573e2892e810d79bf0cd8bbcd51520044d9d05
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_deprecations.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_egg.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_egg.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1a1ed7c866f7ddc9c4e479a421d48a09938b7742
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_egg.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_wheel.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_wheel.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..efaca1a358f0bab5ed50f0c66ce0cf70aad9b633
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_bdist_wheel.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d945625939a3635c25343cb971eb807c722eca9e
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_clib.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_clib.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fc891b19fba9bbaa35fa61cba8f1b6c5c8a92673
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_clib.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_ext.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_ext.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6f27183c394f886aa13faf43a865104167d3908f
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_ext.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_meta.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_meta.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..04545024eece9b8b2505d3b3c19f46852b6cca79
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_meta.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_py.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_py.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..60cbf3222477d1978f7da680cb3a7de2b8d96ec1
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_build_py.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_config_discovery.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_config_discovery.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c111a59caacbf54745d1148a431589fccf3b9dff
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_config_discovery.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_core_metadata.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_core_metadata.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4b9b3e2c0eba88f45b38c79a46973ab27fec3d3c
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_core_metadata.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_depends.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_depends.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..70b8969df1ba01547f28092bc93fda2639516718
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_depends.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_develop.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_develop.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..49e1856f054dadd8c89885ea70a608875bf64671
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_develop.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_dist.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_dist.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3970b6130f214736a04fe3fdba2821538d57e2b9
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_dist.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_dist_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_dist_info.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..79ef289e9069042a37f4144209930ba1eff45b70
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_dist_info.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_distutils_adoption.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_distutils_adoption.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3f40514b7a43a85e7619733333ff7dc22ed9b823
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_distutils_adoption.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_editable_install.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_editable_install.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a18f0f72dd603789419e7b22e9c61f9ece18ecdf
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_editable_install.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_egg_info.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_egg_info.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..67c3f50db217dc644cf9878deedf0e0fb8ebfe34
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_egg_info.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_extern.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_extern.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a71a9d72afe4ffa8d36fad90b09893b591dd3b00
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_extern.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_find_packages.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_find_packages.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0a0c43ca2aa2646db329fd2887129eac6b2b2b12
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_find_packages.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_find_py_modules.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_find_py_modules.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bf8e26bc366b8f18a2b0d865f72420a4c93df9f9
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_find_py_modules.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_glob.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_glob.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a2cb93c5026e9f2e7c90af530d75cc50a6575c3f
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_glob.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_install_scripts.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_install_scripts.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b517bd6d5593d6005fdfedc3019c1353037bb583
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_install_scripts.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_logging.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_logging.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8ee4c9bddff2a2385f03e7e181058c44b207a9aa
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_logging.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_manifest.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_manifest.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..84e9ec722abf37b7d96c1e3236fc5620e6c7004f
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_manifest.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_namespaces.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_namespaces.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e5275224b53873c2675c57b381c2cf11eef02343
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_namespaces.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_scripts.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_scripts.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3c6314eb1be039d30e71b42381bc4c2a4987451a
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_scripts.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_sdist.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_sdist.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..137d8b8fe6824b720e3b702363ef1260369b5b2d
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_sdist.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_setopt.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_setopt.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..eba079c7b8fa76b6664b7d32ad7eedeaaf0383c7
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_setopt.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_setuptools.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_setuptools.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..db00e9ec525209fc71695b654c6175823c6d0e7b
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_setuptools.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_shutil_wrapper.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_shutil_wrapper.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..de51a272b2e8b7f838a9f737e7ad5d13c0d6dd2b
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_shutil_wrapper.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_unicode_utils.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_unicode_utils.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..75545f8564efd4fe9715da287942c8172abae918
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_unicode_utils.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_virtualenv.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_virtualenv.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..454ccd9abae2a6f23224c699883cfbfbe25e0daf
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_virtualenv.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_warnings.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_warnings.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5720bcfd1513bfb76d112facb1acc8284bb1247d
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_warnings.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_wheel.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_wheel.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..218247d9d63bd541af3c681ee10aed36d2c65288
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_wheel.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_windows_wrappers.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_windows_wrappers.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c08b1c9c04381eeb88a66c6924e1d2810f65dc14
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/test_windows_wrappers.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/text.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/text.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0de37d0c9a5d9d7d54a10c6605518836dad0137c
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/text.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/textwrap.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/textwrap.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bf939d87fa0ebc2833830dcb8dd10848f91ef7d9
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/__pycache__/textwrap.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/compat/__init__.py b/python/user_packages/Python313/site-packages/setuptools/tests/compat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/compat/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/compat/__pycache__/__init__.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0175726a02f4c2f524067c7ce1bb15cabff3a262
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/compat/__pycache__/__init__.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/compat/__pycache__/py39.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/compat/__pycache__/py39.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5a179f2a01fa67b0a2c3e2322e574936ea4a67be
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/compat/__pycache__/py39.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/compat/py39.py b/python/user_packages/Python313/site-packages/setuptools/tests/compat/py39.py
new file mode 100644
index 0000000000000000000000000000000000000000..1fdb9dac1fa3f121a634082515d1a305fc09793c
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/compat/py39.py
@@ -0,0 +1,3 @@
+from jaraco.test.cpython import from_test_support, try_import
+
+os_helper = try_import('os_helper') or from_test_support('can_symlink')
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__init__.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/__init__.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9bc7e2812b03091c64110b28471bd7b9f0394449
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/__init__.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_apply_pyprojecttoml.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_apply_pyprojecttoml.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0a31e8fa4f81251f454a815cbfa0ed9d0470ce00
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_apply_pyprojecttoml.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_expand.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_expand.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6958250d0ab09900e0820cb67559ff6f95250dee
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_expand.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_pyprojecttoml.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_pyprojecttoml.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7eeeea4b25cd7e2e0840a483ad06f629f3dff8fe
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_pyprojecttoml.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_pyprojecttoml_dynamic_deps.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_pyprojecttoml_dynamic_deps.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9f8466ff55fb6f79e92de4d3ed3835b47e3f0a9c
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_pyprojecttoml_dynamic_deps.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_setupcfg.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_setupcfg.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..490d316566006efbccb5668e72a3d57303b59598
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/__pycache__/test_setupcfg.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__init__.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..00a16423f448e7773f5e6dc9b365efe80f40a778
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__init__.py
@@ -0,0 +1,59 @@
+from __future__ import annotations
+
+import re
+import time
+from pathlib import Path
+from urllib.error import HTTPError
+from urllib.request import urlopen
+
+__all__ = ["DOWNLOAD_DIR", "retrieve_file", "output_file", "urls_from_file"]
+
+
+NAME_REMOVE = ("http://", "https://", "github.com/", "/raw/")
+DOWNLOAD_DIR = Path(__file__).parent
+
+
+# ----------------------------------------------------------------------
+# Please update ./preload.py accordingly when modifying this file
+# ----------------------------------------------------------------------
+
+
+def output_file(url: str, download_dir: Path = DOWNLOAD_DIR) -> Path:
+    file_name = url.strip()
+    for part in NAME_REMOVE:
+        file_name = file_name.replace(part, '').strip().strip('/:').strip()
+    return Path(download_dir, re.sub(r"[^\-_\.\w\d]+", "_", file_name))
+
+
+def retrieve_file(url: str, download_dir: Path = DOWNLOAD_DIR, wait: float = 5) -> Path:
+    path = output_file(url, download_dir)
+    if path.exists():
+        print(f"Skipping {url} (already exists: {path})")
+    else:
+        download_dir.mkdir(exist_ok=True, parents=True)
+        print(f"Downloading {url} to {path}")
+        try:
+            download(url, path)
+        except HTTPError:
+            time.sleep(wait)  # wait a few seconds and try again.
+            download(url, path)
+    return path
+
+
+def urls_from_file(list_file: Path) -> list[str]:
+    """``list_file`` should be a text file where each line corresponds to a URL to
+    download.
+    """
+    print(f"file: {list_file}")
+    content = list_file.read_text(encoding="utf-8")
+    return [url for url in content.splitlines() if not url.startswith("#")]
+
+
+def download(url: str, dest: Path):
+    with urlopen(url) as f:
+        data = f.read()
+
+    with open(dest, "wb") as f:
+        f.write(data)
+
+    assert Path(dest).exists()
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__pycache__/__init__.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..61fe4c78476a05d2ce6392151331f5083f2cf9b0
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__pycache__/__init__.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__pycache__/preload.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__pycache__/preload.cpython-313.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c90b1c013451f58b5e59efcbadcf8fb89b92dac3
Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/__pycache__/preload.cpython-313.pyc differ
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/preload.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/preload.py
new file mode 100644
index 0000000000000000000000000000000000000000..8eeb5dd75d3dcb375cee5acaf11ad385084bff5a
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/downloads/preload.py
@@ -0,0 +1,18 @@
+"""This file can be used to preload files needed for testing.
+
+For example you can use::
+
+    cd setuptools/tests/config
+    python -m downloads.preload setupcfg_examples.txt
+
+to make sure the `setup.cfg` examples are downloaded before starting the tests.
+"""
+
+import sys
+from pathlib import Path
+
+from . import retrieve_file, urls_from_file
+
+if __name__ == "__main__":
+    urls = urls_from_file(Path(sys.argv[1]))
+    list(map(retrieve_file, urls))
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/setupcfg_examples.txt b/python/user_packages/Python313/site-packages/setuptools/tests/config/setupcfg_examples.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6aab887ff1fe631d97f1abea90a8448040746a12
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/setupcfg_examples.txt
@@ -0,0 +1,22 @@
+# ====================================================================
+# Some popular packages that use setup.cfg (and others not so popular)
+# Reference: https://hugovk.github.io/top-pypi-packages/
+# ====================================================================
+https://github.com/pypa/setuptools/raw/52c990172fec37766b3566679724aa8bf70ae06d/setup.cfg
+https://github.com/pypa/wheel/raw/0acd203cd896afec7f715aa2ff5980a403459a3b/setup.cfg
+https://github.com/python/importlib_metadata/raw/2f05392ca980952a6960d82b2f2d2ea10aa53239/setup.cfg
+https://github.com/jaraco/skeleton/raw/d9008b5c510cd6969127a6a2ab6f832edddef296/setup.cfg
+https://github.com/jaraco/zipp/raw/700d3a96390e970b6b962823bfea78b4f7e1c537/setup.cfg
+https://github.com/pallets/jinja/raw/7d72eb7fefb7dce065193967f31f805180508448/setup.cfg
+https://github.com/tkem/cachetools/raw/2fd87a94b8d3861d80e9e4236cd480bfdd21c90d/setup.cfg
+https://github.com/aio-libs/aiohttp/raw/5e0e6b7080f2408d5f1dd544c0e1cf88378b7b10/setup.cfg
+https://github.com/pallets/flask/raw/9486b6cf57bd6a8a261f67091aca8ca78eeec1e3/setup.cfg
+https://github.com/pallets/click/raw/6411f425fae545f42795665af4162006b36c5e4a/setup.cfg
+https://github.com/sqlalchemy/sqlalchemy/raw/533f5718904b620be8d63f2474229945d6f8ba5d/setup.cfg
+https://github.com/pytest-dev/pluggy/raw/461ef63291d13589c4e21aa182cd1529257e9a0a/setup.cfg
+https://github.com/pytest-dev/pytest/raw/c7be96dae487edbd2f55b561b31b68afac1dabe6/setup.cfg
+https://github.com/platformdirs/platformdirs/raw/7b7852128dd6f07511b618d6edea35046bd0c6ff/setup.cfg
+https://github.com/pandas-dev/pandas/raw/bc17343f934a33dc231c8c74be95d8365537c376/setup.cfg
+https://github.com/django/django/raw/4e249d11a6e56ca8feb4b055b681cec457ef3a3d/setup.cfg
+https://github.com/pyscaffold/pyscaffold/raw/de7aa5dc059fbd04307419c667cc4961bc9df4b8/setup.cfg
+https://github.com/pypa/virtualenv/raw/f92eda6e3da26a4d28c2663ffb85c4960bdb990c/setup.cfg
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/test_apply_pyprojecttoml.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_apply_pyprojecttoml.py
new file mode 100644
index 0000000000000000000000000000000000000000..b6b21a3e9bb176b06208a1e9d4c6424aa77d0e82
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_apply_pyprojecttoml.py
@@ -0,0 +1,794 @@
+"""Make sure that applying the configuration from pyproject.toml is equivalent to
+applying a similar configuration from setup.cfg
+
+To run these tests offline, please have a look on ``./downloads/preload.py``
+"""
+
+from __future__ import annotations
+
+import io
+import re
+import tarfile
+from inspect import cleandoc
+from pathlib import Path
+from unittest.mock import Mock
+
+import pytest
+from ini2toml.api import LiteTranslator
+from packaging.metadata import Metadata
+
+import setuptools  # noqa: F401 # ensure monkey patch to metadata
+from setuptools._static import is_static
+from setuptools.command.egg_info import write_requirements
+from setuptools.config import expand, pyprojecttoml, setupcfg
+from setuptools.config._apply_pyprojecttoml import _MissingDynamic, _some_attrgetter
+from setuptools.dist import Distribution
+from setuptools.errors import InvalidConfigError, RemovedConfigError
+from setuptools.warnings import InformationOnly, SetuptoolsDeprecationWarning
+
+from .downloads import retrieve_file, urls_from_file
+
+HERE = Path(__file__).parent
+EXAMPLES_FILE = "setupcfg_examples.txt"
+
+
+def makedist(path, **attrs):
+    return Distribution({"src_root": path, **attrs})
+
+
+def _mock_expand_patterns(patterns, *_, **__):
+    """
+    Allow comparing the given patterns for 2 dist objects.
+    We need to strip special chars to avoid errors when validating.
+    """
+    return [
+        re.sub("[^a-z0-9]+", "", p, flags=re.IGNORECASE) or "empty" for p in patterns
+    ]
+
+
+@pytest.mark.parametrize("url", urls_from_file(HERE / EXAMPLES_FILE))
+@pytest.mark.filterwarnings("ignore")
+@pytest.mark.uses_network
+def test_apply_pyproject_equivalent_to_setupcfg(url, monkeypatch, tmp_path):
+    monkeypatch.setattr(expand, "read_attr", Mock(return_value="0.0.1"))
+    monkeypatch.setattr(
+        Distribution, "_expand_patterns", Mock(side_effect=_mock_expand_patterns)
+    )
+    setupcfg_example = retrieve_file(url)
+    pyproject_example = Path(tmp_path, "pyproject.toml")
+    setupcfg_text = setupcfg_example.read_text(encoding="utf-8")
+    toml_config = LiteTranslator().translate(setupcfg_text, "setup.cfg")
+    pyproject_example.write_text(toml_config, encoding="utf-8")
+
+    dist_toml = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject_example)
+    dist_cfg = setupcfg.apply_configuration(makedist(tmp_path), setupcfg_example)
+
+    pkg_info_toml = core_metadata(dist_toml)
+    pkg_info_cfg = core_metadata(dist_cfg)
+    assert pkg_info_toml == pkg_info_cfg
+
+    if any(getattr(d, "license_files", None) for d in (dist_toml, dist_cfg)):
+        assert set(dist_toml.license_files) == set(dist_cfg.license_files)
+
+    if any(getattr(d, "entry_points", None) for d in (dist_toml, dist_cfg)):
+        print(dist_cfg.entry_points)
+        ep_toml = {
+            (k, *sorted(i.replace(" ", "") for i in v))
+            for k, v in dist_toml.entry_points.items()
+        }
+        ep_cfg = {
+            (k, *sorted(i.replace(" ", "") for i in v))
+            for k, v in dist_cfg.entry_points.items()
+        }
+        assert ep_toml == ep_cfg
+
+    if any(getattr(d, "package_data", None) for d in (dist_toml, dist_cfg)):
+        pkg_data_toml = {(k, *sorted(v)) for k, v in dist_toml.package_data.items()}
+        pkg_data_cfg = {(k, *sorted(v)) for k, v in dist_cfg.package_data.items()}
+        assert pkg_data_toml == pkg_data_cfg
+
+    if any(getattr(d, "data_files", None) for d in (dist_toml, dist_cfg)):
+        data_files_toml = {(k, *sorted(v)) for k, v in dist_toml.data_files}
+        data_files_cfg = {(k, *sorted(v)) for k, v in dist_cfg.data_files}
+        assert data_files_toml == data_files_cfg
+
+    assert set(dist_toml.install_requires) == set(dist_cfg.install_requires)
+    if any(getattr(d, "extras_require", None) for d in (dist_toml, dist_cfg)):
+        extra_req_toml = {(k, *sorted(v)) for k, v in dist_toml.extras_require.items()}
+        extra_req_cfg = {(k, *sorted(v)) for k, v in dist_cfg.extras_require.items()}
+        assert extra_req_toml == extra_req_cfg
+
+
+PEP621_EXAMPLE = """\
+[project]
+name = "spam"
+version = "2020.0.0"
+description = "Lovely Spam! Wonderful Spam!"
+readme = "README.rst"
+requires-python = ">=3.8"
+license-files = ["LICENSE.txt"]  # Updated to be PEP 639 compliant
+keywords = ["egg", "bacon", "sausage", "tomatoes", "Lobster Thermidor"]
+authors = [
+  {email = "hi@pradyunsg.me"},
+  {name = "Tzu-Ping Chung"}
+]
+maintainers = [
+  {name = "Brett Cannon", email = "brett@python.org"},
+  {name = "John X. Ãørçeč", email = "john@utf8.org"},
+  {name = "Γαμα קּ 東", email = "gama@utf8.org"},
+]
+classifiers = [
+  "Development Status :: 4 - Beta",
+  "Programming Language :: Python"
+]
+
+dependencies = [
+  "httpx",
+  "gidgethub[httpx]>4.0.0",
+  "django>2.1; os_name != 'nt'",
+  "django>2.0; os_name == 'nt'"
+]
+
+[project.optional-dependencies]
+test = [
+  "pytest < 5.0.0",
+  "pytest-cov[all]"
+]
+
+[project.urls]
+homepage = "http://example.com"
+documentation = "http://readthedocs.org"
+repository = "http://github.com"
+changelog = "http://github.com/me/spam/blob/master/CHANGELOG.md"
+
+[project.scripts]
+spam-cli = "spam:main_cli"
+
+[project.gui-scripts]
+spam-gui = "spam:main_gui"
+
+[project.entry-points."spam.magical"]
+tomatoes = "spam:main_tomatoes"
+"""
+
+PEP621_INTERNATIONAL_EMAIL_EXAMPLE = """\
+[project]
+name = "spam"
+version = "2020.0.0"
+authors = [
+  {email = "hi@pradyunsg.me"},
+  {name = "Tzu-Ping Chung"}
+]
+maintainers = [
+  {name = "अंकित अहलावत", email = "ankit@example.com"},
+]
+"""
+
+PEP621_EXAMPLE_SCRIPT = """
+def main_cli(): pass
+def main_gui(): pass
+def main_tomatoes(): pass
+"""
+
+PEP639_LICENSE_TEXT = """\
+[project]
+name = "spam"
+version = "2020.0.0"
+authors = [
+  {email = "hi@pradyunsg.me"},
+  {name = "Tzu-Ping Chung"}
+]
+license = {text = "MIT"}
+"""
+
+PEP639_LICENSE_EXPRESSION = """\
+[project]
+name = "spam"
+version = "2020.0.0"
+authors = [
+  {email = "hi@pradyunsg.me"},
+  {name = "Tzu-Ping Chung"}
+]
+license = "mit or apache-2.0"  # should be normalized in metadata
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Programming Language :: Python",
+]
+"""
+
+
+def _pep621_example_project(
+    tmp_path,
+    readme="README.rst",
+    pyproject_text=PEP621_EXAMPLE,
+):
+    pyproject = tmp_path / "pyproject.toml"
+    text = pyproject_text
+    replacements = {'readme = "README.rst"': f'readme = "{readme}"'}
+    for orig, subst in replacements.items():
+        text = text.replace(orig, subst)
+    pyproject.write_text(text, encoding="utf-8")
+
+    (tmp_path / readme).write_text("hello world", encoding="utf-8")
+    (tmp_path / "LICENSE.txt").write_text("--- LICENSE stub ---", encoding="utf-8")
+    (tmp_path / "spam.py").write_text(PEP621_EXAMPLE_SCRIPT, encoding="utf-8")
+    return pyproject
+
+
+def test_pep621_example(tmp_path):
+    """Make sure the example in PEP 621 works"""
+    pyproject = _pep621_example_project(tmp_path)
+    dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+    assert set(dist.metadata.license_files) == {"LICENSE.txt"}
+
+
+@pytest.mark.parametrize(
+    ("readme", "ctype"),
+    [
+        ("Readme.txt", "text/plain"),
+        ("readme.md", "text/markdown"),
+        ("text.rst", "text/x-rst"),
+    ],
+)
+def test_readme_content_type(tmp_path, readme, ctype):
+    pyproject = _pep621_example_project(tmp_path, readme)
+    dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+    assert dist.metadata.long_description_content_type == ctype
+
+
+def test_undefined_content_type(tmp_path):
+    pyproject = _pep621_example_project(tmp_path, "README.tex")
+    with pytest.raises(ValueError, match="Undefined content type for README.tex"):
+        pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+
+def test_no_explicit_content_type_for_missing_extension(tmp_path):
+    pyproject = _pep621_example_project(tmp_path, "README")
+    dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+    assert dist.metadata.long_description_content_type is None
+
+
+@pytest.mark.parametrize(
+    ("pyproject_text", "expected_maintainers_meta_value"),
+    (
+        pytest.param(
+            PEP621_EXAMPLE,
+            (
+                'Brett Cannon , "John X. Ãørçeč" , '
+                'Γαμα קּ 東 '
+            ),
+            id='non-international-emails',
+        ),
+        pytest.param(
+            PEP621_INTERNATIONAL_EMAIL_EXAMPLE,
+            'Ankit Ahlawat <अंकित@उदाहरण.भारत>',
+            marks=pytest.mark.xfail(
+                reason="CPython's `email.headerregistry.Address` only supports "
+                'RFC 5322, as of Oct 20, 2025 and latest Python 3.13.0',
+                strict=True,
+            ),
+            id='international-email',
+        ),
+    ),
+)
+def test_utf8_maintainer_in_metadata(  # issue-3663
+    expected_maintainers_meta_value,
+    pyproject_text,
+    tmp_path,
+):
+    pyproject = _pep621_example_project(
+        tmp_path,
+        "README",
+        pyproject_text=pyproject_text,
+    )
+    dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+    assert dist.metadata.maintainer_email == expected_maintainers_meta_value
+    pkg_file = tmp_path / "PKG-FILE"
+    with open(pkg_file, "w", encoding="utf-8") as fh:
+        dist.metadata.write_pkg_file(fh)
+    content = pkg_file.read_text(encoding="utf-8")
+    assert f"Maintainer-email: {expected_maintainers_meta_value}" in content
+
+
+@pytest.mark.parametrize(
+    (
+        'pyproject_text',
+        'license',
+        'license_expression',
+        'content_str',
+        'not_content_str',
+    ),
+    (
+        pytest.param(
+            PEP639_LICENSE_TEXT,
+            'MIT',
+            None,
+            'License: MIT',
+            'License-Expression: ',
+            id='license-text',
+            marks=[
+                pytest.mark.filterwarnings(
+                    "ignore:.project.license. as a TOML table is deprecated",
+                )
+            ],
+        ),
+        pytest.param(
+            PEP639_LICENSE_EXPRESSION,
+            None,
+            'MIT OR Apache-2.0',
+            'License-Expression: MIT OR Apache-2.0',
+            'License: ',
+            id='license-expression',
+        ),
+    ),
+)
+def test_license_in_metadata(
+    license,
+    license_expression,
+    content_str,
+    not_content_str,
+    pyproject_text,
+    tmp_path,
+):
+    pyproject = _pep621_example_project(
+        tmp_path,
+        "README",
+        pyproject_text=pyproject_text,
+    )
+    dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+    assert dist.metadata.license == license
+    assert dist.metadata.license_expression == license_expression
+    pkg_file = tmp_path / "PKG-FILE"
+    with open(pkg_file, "w", encoding="utf-8") as fh:
+        dist.metadata.write_pkg_file(fh)
+    content = pkg_file.read_text(encoding="utf-8")
+    assert "Metadata-Version: 2.4" in content
+    assert content_str in content
+    assert not_content_str not in content
+
+
+def test_license_classifier_with_license_expression(tmp_path):
+    text = PEP639_LICENSE_EXPRESSION.rsplit("\n", 2)[0]
+    pyproject = _pep621_example_project(
+        tmp_path,
+        "README",
+        f"{text}\n    \"License :: OSI Approved :: MIT License\"\n]",
+    )
+    msg = "License classifiers have been superseded by license expressions"
+    with pytest.raises(InvalidConfigError, match=msg) as exc:
+        pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+    assert "License :: OSI Approved :: MIT License" in str(exc.value)
+
+
+def test_license_classifier_without_license_expression(tmp_path):
+    text = """\
+    [project]
+    name = "spam"
+    version = "2020.0.0"
+    license = {text = "mit or apache-2.0"}
+    classifiers = ["License :: OSI Approved :: MIT License"]
+    """
+    pyproject = _pep621_example_project(tmp_path, "README", text)
+
+    msg1 = "License classifiers are deprecated(?:.|\n)*MIT License"
+    msg2 = ".project.license. as a TOML table is deprecated"
+    with (
+        pytest.warns(SetuptoolsDeprecationWarning, match=msg1),
+        pytest.warns(SetuptoolsDeprecationWarning, match=msg2),
+    ):
+        dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+    # Check license classifier is still included
+    assert dist.metadata.get_classifiers() == ["License :: OSI Approved :: MIT License"]
+
+
+class TestLicenseFiles:
+    def base_pyproject(
+        self,
+        tmp_path,
+        additional_text="",
+        license_toml='license = {file = "LICENSE.txt"}\n',
+    ):
+        text = PEP639_LICENSE_EXPRESSION
+
+        # Sanity-check
+        assert 'license = "mit or apache-2.0"' in text
+        assert 'license-files' not in text
+        assert "[tool.setuptools]" not in text
+
+        text = re.sub(
+            r"(license = .*)\n",
+            license_toml,
+            text,
+            count=1,
+        )
+        assert license_toml in text  # sanity check
+        text = f"{text}\n{additional_text}\n"
+        pyproject = _pep621_example_project(tmp_path, "README", pyproject_text=text)
+        return pyproject
+
+    def base_pyproject_license_pep639(self, tmp_path, additional_text=""):
+        return self.base_pyproject(
+            tmp_path,
+            additional_text=additional_text,
+            license_toml='license = "licenseref-Proprietary"'
+            '\nlicense-files = ["_FILE*"]\n',
+        )
+
+    def test_both_license_and_license_files_defined(self, tmp_path):
+        setuptools_config = '[tool.setuptools]\nlicense-files = ["_FILE*"]'
+        pyproject = self.base_pyproject(tmp_path, setuptools_config)
+
+        (tmp_path / "_FILE.txt").touch()
+        (tmp_path / "_FILE.rst").touch()
+
+        # Would normally match the `license_files` patterns, but we want to exclude it
+        # by being explicit. On the other hand, contents should be added to `license`
+        license = tmp_path / "LICENSE.txt"
+        license.write_text("LicenseRef-Proprietary\n", encoding="utf-8")
+
+        msg1 = "'tool.setuptools.license-files' is deprecated in favor of 'project.license-files'"
+        msg2 = ".project.license. as a TOML table is deprecated"
+        with (
+            pytest.warns(SetuptoolsDeprecationWarning, match=msg1),
+            pytest.warns(SetuptoolsDeprecationWarning, match=msg2),
+        ):
+            dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+        assert set(dist.metadata.license_files) == {"_FILE.rst", "_FILE.txt"}
+        assert dist.metadata.license == "LicenseRef-Proprietary\n"
+
+    def test_both_license_and_license_files_defined_pep639(self, tmp_path):
+        # Set license and license-files
+        pyproject = self.base_pyproject_license_pep639(tmp_path)
+
+        (tmp_path / "_FILE.txt").touch()
+        (tmp_path / "_FILE.rst").touch()
+
+        msg = "Normalizing.*LicenseRef"
+        with pytest.warns(InformationOnly, match=msg):
+            dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+        assert set(dist.metadata.license_files) == {"_FILE.rst", "_FILE.txt"}
+        assert dist.metadata.license is None
+        assert dist.metadata.license_expression == "LicenseRef-Proprietary"
+
+    def test_license_files_defined_twice(self, tmp_path):
+        # Set project.license-files and tools.setuptools.license-files
+        setuptools_config = '[tool.setuptools]\nlicense-files = ["_FILE*"]'
+        pyproject = self.base_pyproject_license_pep639(tmp_path, setuptools_config)
+
+        msg = "'project.license-files' is defined already. Remove 'tool.setuptools.license-files'"
+        with pytest.raises(InvalidConfigError, match=msg):
+            pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+    def test_default_patterns(self, tmp_path):
+        setuptools_config = '[tool.setuptools]\nzip-safe = false'
+        # ^ used just to trigger section validation
+        pyproject = self.base_pyproject(tmp_path, setuptools_config, license_toml="")
+
+        license_files = "LICENCE-a.html COPYING-abc.txt AUTHORS-xyz NOTICE,def".split()
+
+        for fname in license_files:
+            (tmp_path / fname).write_text(f"{fname}\n", encoding="utf-8")
+
+        dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+        assert (tmp_path / "LICENSE.txt").exists()  # from base example
+        assert set(dist.metadata.license_files) == {*license_files, "LICENSE.txt"}
+
+    def test_missing_patterns(self, tmp_path):
+        pyproject = self.base_pyproject_license_pep639(tmp_path)
+        assert list(tmp_path.glob("_FILE*")) == []  # sanity check
+
+        msg1 = "Cannot find any files for the given pattern.*"
+        msg2 = "Normalizing 'licenseref-Proprietary' to 'LicenseRef-Proprietary'"
+        with (
+            pytest.warns(SetuptoolsDeprecationWarning, match=msg1),
+            pytest.warns(InformationOnly, match=msg2),
+        ):
+            pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+    def test_deprecated_file_expands_to_text(self, tmp_path):
+        """Make sure the old example with ``license = {text = ...}`` works"""
+
+        assert 'license-files = ["LICENSE.txt"]' in PEP621_EXAMPLE  # sanity check
+        text = PEP621_EXAMPLE.replace(
+            'license-files = ["LICENSE.txt"]',
+            'license = {file = "LICENSE.txt"}',
+        )
+        pyproject = _pep621_example_project(tmp_path, pyproject_text=text)
+
+        msg = ".project.license. as a TOML table is deprecated"
+        with pytest.warns(SetuptoolsDeprecationWarning, match=msg):
+            dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+        assert dist.metadata.license == "--- LICENSE stub ---"
+        assert set(dist.metadata.license_files) == {"LICENSE.txt"}  # auto-filled
+
+
+class TestPyModules:
+    # https://github.com/pypa/setuptools/issues/4316
+
+    def dist(self, name):
+        toml_config = f"""
+        [project]
+        name = "test"
+        version = "42.0"
+        [tool.setuptools]
+        py-modules = [{name!r}]
+        """
+        pyproject = Path("pyproject.toml")
+        pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
+        return pyprojecttoml.apply_configuration(Distribution({}), pyproject)
+
+    @pytest.mark.parametrize("module", ["pip-run", "abc-d.λ-xyz-e"])
+    def test_valid_module_name(self, tmp_path, monkeypatch, module):
+        monkeypatch.chdir(tmp_path)
+        assert module in self.dist(module).py_modules
+
+    @pytest.mark.parametrize("module", ["pip run", "-pip-run", "pip-run-stubs"])
+    def test_invalid_module_name(self, tmp_path, monkeypatch, module):
+        monkeypatch.chdir(tmp_path)
+        with pytest.raises(ValueError, match="py-modules"):
+            self.dist(module).py_modules
+
+
+class TestExtModules:
+    def make_dist(self, toml_config):
+        pyproject = Path("pyproject.toml")
+        pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
+        with pytest.warns(pyprojecttoml._ExperimentalConfiguration):
+            return pyprojecttoml.apply_configuration(Distribution({}), pyproject)
+
+    def test_pyproject_sets_attribute(self, tmp_path, monkeypatch):
+        monkeypatch.chdir(tmp_path)
+        toml_config = """
+        [project]
+        name = "test"
+        version = "42.0"
+        [tool.setuptools]
+        ext-modules = [
+          {name = "my.ext", sources = ["hello.c", "world.c"]}
+        ]
+        """
+        dist = self.make_dist(toml_config)
+        assert len(dist.ext_modules) == 1
+        assert dist.ext_modules[0].name == "my.ext"
+        assert set(dist.ext_modules[0].sources) == {"hello.c", "world.c"}
+
+    def test_pyproject_define_macros_as_tuples(self, tmp_path, monkeypatch):
+        # https://github.com/pypa/setuptools/issues/4810
+        monkeypatch.chdir(tmp_path)
+        toml_config = """
+        [project]
+        name = "test"
+        version = "42.0"
+        [[tool.setuptools.ext-modules]]
+        name = "my.ext"
+        sources = ["hello.c", "world.c"]
+        define-macros = [["FIRST_SINGLE"], ["SECOND_TWO", "1"]]
+        """
+        dist = self.make_dist(toml_config)
+        assert isinstance(dist.ext_modules[0].define_macros[0], tuple)
+        assert dist.ext_modules[0].define_macros[0] == ("FIRST_SINGLE",)
+        assert dist.ext_modules[0].define_macros[1] == ("SECOND_TWO", "1")
+
+
+class TestDeprecatedFields:
+    def test_namespace_packages(self, tmp_path):
+        pyproject = tmp_path / "pyproject.toml"
+        config = """
+        [project]
+        name = "myproj"
+        version = "42"
+        [tool.setuptools]
+        namespace-packages = ["myproj.pkg"]
+        """
+        pyproject.write_text(cleandoc(config), encoding="utf-8")
+        with pytest.raises(RemovedConfigError, match="namespace-packages"):
+            pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+
+
+class TestPresetField:
+    def pyproject(self, tmp_path, dynamic, extra_content=""):
+        content = f"[project]\nname = 'proj'\ndynamic = {dynamic!r}\n"
+        if "version" not in dynamic:
+            content += "version = '42'\n"
+        file = tmp_path / "pyproject.toml"
+        file.write_text(content + extra_content, encoding="utf-8")
+        return file
+
+    @pytest.mark.parametrize(
+        ("attr", "field", "value"),
+        [
+            ("license_expression", "license", "MIT"),
+            pytest.param(
+                *("license", "license", "Not SPDX"),
+                marks=[pytest.mark.filterwarnings("ignore:.*license. overwritten")],
+            ),
+            ("classifiers", "classifiers", ["Private :: Classifier"]),
+            ("entry_points", "scripts", {"console_scripts": ["foobar=foobar:main"]}),
+            ("entry_points", "gui-scripts", {"gui_scripts": ["bazquux=bazquux:main"]}),
+            pytest.param(
+                *("install_requires", "dependencies", ["six"]),
+                marks=[
+                    pytest.mark.filterwarnings("ignore:.*install_requires. overwritten")
+                ],
+            ),
+        ],
+    )
+    def test_not_listed_in_dynamic(self, tmp_path, attr, field, value):
+        """Setuptools cannot set a field if not listed in ``dynamic``"""
+        pyproject = self.pyproject(tmp_path, [])
+        dist = makedist(tmp_path, **{attr: value})
+        msg = re.compile(f"defined outside of `pyproject.toml`:.*{field}", re.DOTALL)
+        with pytest.warns(_MissingDynamic, match=msg):
+            dist = pyprojecttoml.apply_configuration(dist, pyproject)
+
+        dist_value = _some_attrgetter(f"metadata.{attr}", attr)(dist)
+        assert not dist_value
+
+    @pytest.mark.parametrize(
+        ("attr", "field", "value"),
+        [
+            ("license_expression", "license", "MIT"),
+            ("install_requires", "dependencies", []),
+            ("extras_require", "optional-dependencies", {}),
+            ("install_requires", "dependencies", ["six"]),
+            ("classifiers", "classifiers", ["Private :: Classifier"]),
+        ],
+    )
+    def test_listed_in_dynamic(self, tmp_path, attr, field, value):
+        pyproject = self.pyproject(tmp_path, [field])
+        dist = makedist(tmp_path, **{attr: value})
+        dist = pyprojecttoml.apply_configuration(dist, pyproject)
+        dist_value = _some_attrgetter(f"metadata.{attr}", attr)(dist)
+        assert dist_value == value
+
+    def test_license_files_exempt_from_dynamic(self, monkeypatch, tmp_path):
+        """
+        license-file is currently not considered in the context of dynamic.
+        As per 2025-02-19, https://packaging.python.org/en/latest/specifications/pyproject-toml/#license-files
+        allows setuptools to fill-in `license-files` the way it sees fit:
+
+        > If the license-files key is not defined, tools can decide how to handle license files.
+        > For example they can choose not to include any files or use their own
+        > logic to discover the appropriate files in the distribution.
+
+        Using license_files from setup.py to fill-in the value is in accordance
+        with this rule.
+        """
+        monkeypatch.chdir(tmp_path)
+        pyproject = self.pyproject(tmp_path, [])
+        dist = makedist(tmp_path, license_files=["LIC*"])
+        (tmp_path / "LIC1").write_text("42", encoding="utf-8")
+        dist = pyprojecttoml.apply_configuration(dist, pyproject)
+        assert dist.metadata.license_files == ["LIC1"]
+
+    def test_warning_overwritten_dependencies(self, tmp_path):
+        src = "[project]\nname='pkg'\nversion='0.1'\ndependencies=['click']\n"
+        pyproject = tmp_path / "pyproject.toml"
+        pyproject.write_text(src, encoding="utf-8")
+        dist = makedist(tmp_path, install_requires=["wheel"])
+        with pytest.warns(match="`install_requires` overwritten"):
+            dist = pyprojecttoml.apply_configuration(dist, pyproject)
+        assert "wheel" not in dist.install_requires
+
+    def test_optional_dependencies_dont_remove_env_markers(self, tmp_path):
+        """
+        Internally setuptools converts dependencies with markers to "extras".
+        If ``install_requires`` is given by ``setup.py``, we have to ensure that
+        applying ``optional-dependencies`` does not overwrite the mandatory
+        dependencies with markers (see #3204).
+        """
+        # If setuptools replace its internal mechanism that uses `requires.txt`
+        # this test has to be rewritten to adapt accordingly
+        extra = "\n[project.optional-dependencies]\nfoo = ['bar>1']\n"
+        pyproject = self.pyproject(tmp_path, ["dependencies"], extra)
+        install_req = ['importlib-resources (>=3.0.0) ; python_version < "3.7"']
+        dist = makedist(tmp_path, install_requires=install_req)
+        dist = pyprojecttoml.apply_configuration(dist, pyproject)
+        assert "foo" in dist.extras_require
+        egg_info = dist.get_command_obj("egg_info")
+        write_requirements(egg_info, tmp_path, tmp_path / "requires.txt")
+        reqs = (tmp_path / "requires.txt").read_text(encoding="utf-8")
+        assert "importlib-resources" in reqs
+        assert "bar" in reqs
+        assert ':python_version < "3.7"' in reqs
+
+    @pytest.mark.parametrize(
+        ("field", "group"),
+        [("scripts", "console_scripts"), ("gui-scripts", "gui_scripts")],
+    )
+    @pytest.mark.filterwarnings("error")
+    def test_scripts_dont_require_dynamic_entry_points(self, tmp_path, field, group):
+        # Issue 3862
+        pyproject = self.pyproject(tmp_path, [field])
+        dist = makedist(tmp_path, entry_points={group: ["foobar=foobar:main"]})
+        dist = pyprojecttoml.apply_configuration(dist, pyproject)
+        assert group in dist.entry_points
+
+
+class TestMeta:
+    def test_example_file_in_sdist(self, setuptools_sdist):
+        """Meta test to ensure tests can run from sdist"""
+        with tarfile.open(setuptools_sdist) as tar:
+            assert any(name.endswith(EXAMPLES_FILE) for name in tar.getnames())
+
+
+class TestInteropCommandLineParsing:
+    def test_version(self, tmp_path, monkeypatch, capsys):
+        # See pypa/setuptools#4047
+        # This test can be removed once the CLI interface of setup.py is removed
+        monkeypatch.chdir(tmp_path)
+        toml_config = """
+        [project]
+        name = "test"
+        version = "42.0"
+        """
+        pyproject = Path(tmp_path, "pyproject.toml")
+        pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
+        opts = {"script_args": ["--version"]}
+        dist = pyprojecttoml.apply_configuration(Distribution(opts), pyproject)
+        dist.parse_command_line()  # <-- there should be no exception here.
+        captured = capsys.readouterr()
+        assert "42.0" in captured.out
+
+
+class TestStaticConfig:
+    def test_mark_static_fields(self, tmp_path, monkeypatch):
+        monkeypatch.chdir(tmp_path)
+        toml_config = """
+        [project]
+        name = "test"
+        version = "42.0"
+        dependencies = ["hello"]
+        keywords = ["world"]
+        classifiers = ["private :: hello world"]
+        [tool.setuptools]
+        obsoletes = ["abcd"]
+        provides = ["abcd"]
+        platforms = ["abcd"]
+        """
+        pyproject = Path(tmp_path, "pyproject.toml")
+        pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
+        dist = pyprojecttoml.apply_configuration(Distribution({}), pyproject)
+        assert is_static(dist.install_requires)
+        assert is_static(dist.metadata.keywords)
+        assert is_static(dist.metadata.classifiers)
+        assert is_static(dist.metadata.obsoletes)
+        assert is_static(dist.metadata.provides)
+        assert is_static(dist.metadata.platforms)
+
+
+# --- Auxiliary Functions ---
+
+
+def core_metadata(dist) -> str:
+    with io.StringIO() as buffer:
+        dist.metadata.write_pkg_file(buffer)
+        pkg_file_txt = buffer.getvalue()
+
+    # Make sure core metadata is valid
+    Metadata.from_email(pkg_file_txt, validate=True)  # can raise exceptions
+
+    skip_prefixes: tuple[str, ...] = ()
+    skip_lines = set()
+    # ---- DIFF NORMALISATION ----
+    # PEP 621 is very particular about author/maintainer metadata conversion, so skip
+    skip_prefixes += ("Author:", "Author-email:", "Maintainer:", "Maintainer-email:")
+    # May be redundant with Home-page
+    skip_prefixes += ("Project-URL: Homepage,", "Home-page:")
+    # May be missing in original (relying on default) but backfilled in the TOML
+    skip_prefixes += ("Description-Content-Type:",)
+    # Remove empty lines
+    skip_lines.add("")
+
+    result = []
+    for line in pkg_file_txt.splitlines():
+        if line.startswith(skip_prefixes) or line in skip_lines:
+            continue
+        result.append(line + "\n")
+
+    return "".join(result)
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/test_expand.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_expand.py
new file mode 100644
index 0000000000000000000000000000000000000000..c5710ec63d7d9d4ed7b709203bb2fc4b512f2093
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_expand.py
@@ -0,0 +1,247 @@
+import os
+import sys
+from pathlib import Path
+
+import pytest
+
+from setuptools._static import is_static
+from setuptools.config import expand
+from setuptools.discovery import find_package_path
+
+from distutils.errors import DistutilsOptionError
+
+
+def write_files(files, root_dir):
+    for file, content in files.items():
+        path = root_dir / file
+        path.parent.mkdir(exist_ok=True, parents=True)
+        path.write_text(content, encoding="utf-8")
+
+
+def test_glob_relative(tmp_path, monkeypatch):
+    files = {
+        "dir1/dir2/dir3/file1.txt",
+        "dir1/dir2/file2.txt",
+        "dir1/file3.txt",
+        "a.ini",
+        "b.ini",
+        "dir1/c.ini",
+        "dir1/dir2/a.ini",
+    }
+
+    write_files({k: "" for k in files}, tmp_path)
+    patterns = ["**/*.txt", "[ab].*", "**/[ac].ini"]
+    monkeypatch.chdir(tmp_path)
+    assert set(expand.glob_relative(patterns)) == files
+    # Make sure the same APIs work outside cwd
+    assert set(expand.glob_relative(patterns, tmp_path)) == files
+
+
+def test_read_files(tmp_path, monkeypatch):
+    dir_ = tmp_path / "dir_"
+    (tmp_path / "_dir").mkdir(exist_ok=True)
+    (tmp_path / "a.txt").touch()
+    files = {"a.txt": "a", "dir1/b.txt": "b", "dir1/dir2/c.txt": "c"}
+    write_files(files, dir_)
+
+    secrets = Path(str(dir_) + "secrets")
+    secrets.mkdir(exist_ok=True)
+    write_files({"secrets.txt": "secret keys"}, secrets)
+
+    with monkeypatch.context() as m:
+        m.chdir(dir_)
+        assert expand.read_files(list(files)) == "a\nb\nc"
+
+        cannot_access_msg = r"Cannot access '.*\.\..a\.txt'"
+        with pytest.raises(DistutilsOptionError, match=cannot_access_msg):
+            expand.read_files(["../a.txt"])
+
+        cannot_access_secrets_msg = r"Cannot access '.*secrets\.txt'"
+        with pytest.raises(DistutilsOptionError, match=cannot_access_secrets_msg):
+            expand.read_files(["../dir_secrets/secrets.txt"])
+
+    # Make sure the same APIs work outside cwd
+    assert expand.read_files(list(files), dir_) == "a\nb\nc"
+    with pytest.raises(DistutilsOptionError, match=cannot_access_msg):
+        expand.read_files(["../a.txt"], dir_)
+
+
+class TestReadAttr:
+    @pytest.mark.parametrize(
+        "example",
+        [
+            # No cookie means UTF-8:
+            b"__version__ = '\xc3\xa9'\nraise SystemExit(1)\n",
+            # If a cookie is present, honor it:
+            b"# -*- coding: utf-8 -*-\n__version__ = '\xc3\xa9'\nraise SystemExit(1)\n",
+            b"# -*- coding: latin1 -*-\n__version__ = '\xe9'\nraise SystemExit(1)\n",
+        ],
+    )
+    def test_read_attr_encoding_cookie(self, example, tmp_path):
+        (tmp_path / "mod.py").write_bytes(example)
+        assert expand.read_attr('mod.__version__', root_dir=tmp_path) == 'é'
+
+    def test_read_attr(self, tmp_path, monkeypatch):
+        files = {
+            "pkg/__init__.py": "",
+            "pkg/sub/__init__.py": "VERSION = '0.1.1'",
+            "pkg/sub/mod.py": (
+                "VALUES = {'a': 0, 'b': {42}, 'c': (0, 1, 1)}\nraise SystemExit(1)"
+            ),
+        }
+        write_files(files, tmp_path)
+
+        with monkeypatch.context() as m:
+            m.chdir(tmp_path)
+            # Make sure it can read the attr statically without evaluating the module
+            version = expand.read_attr('pkg.sub.VERSION')
+            values = expand.read_attr('lib.mod.VALUES', {'lib': 'pkg/sub'})
+
+        assert version == '0.1.1'
+        assert is_static(values)
+
+        assert values['a'] == 0
+        assert values['b'] == {42}
+        assert is_static(values)
+
+        # Make sure the same APIs work outside cwd
+        assert expand.read_attr('pkg.sub.VERSION', root_dir=tmp_path) == '0.1.1'
+        values = expand.read_attr('lib.mod.VALUES', {'lib': 'pkg/sub'}, tmp_path)
+        assert values['c'] == (0, 1, 1)
+
+    @pytest.mark.parametrize(
+        "example",
+        [
+            "VERSION: str\nVERSION = '0.1.1'\nraise SystemExit(1)\n",
+            "VERSION: str = '0.1.1'\nraise SystemExit(1)\n",
+        ],
+    )
+    def test_read_annotated_attr(self, tmp_path, example):
+        files = {
+            "pkg/__init__.py": "",
+            "pkg/sub/__init__.py": example,
+        }
+        write_files(files, tmp_path)
+        # Make sure this attribute can be read statically
+        version = expand.read_attr('pkg.sub.VERSION', root_dir=tmp_path)
+        assert version == '0.1.1'
+        assert is_static(version)
+
+    @pytest.mark.parametrize(
+        "example",
+        [
+            "VERSION = (lambda: '0.1.1')()\n",
+            "def fn(): return '0.1.1'\nVERSION = fn()\n",
+            "VERSION: str = (lambda: '0.1.1')()\n",
+        ],
+    )
+    def test_read_dynamic_attr(self, tmp_path, monkeypatch, example):
+        files = {
+            "pkg/__init__.py": "",
+            "pkg/sub/__init__.py": example,
+        }
+        write_files(files, tmp_path)
+        monkeypatch.chdir(tmp_path)
+        version = expand.read_attr('pkg.sub.VERSION')
+        assert version == '0.1.1'
+        assert not is_static(version)
+
+    def test_import_order(self, tmp_path):
+        """
+        Sometimes the import machinery will import the parent package of a nested
+        module, which triggers side-effects and might create problems (see issue #3176)
+
+        ``read_attr`` should bypass these limitations by resolving modules statically
+        (via ast.literal_eval).
+        """
+        files = {
+            "src/pkg/__init__.py": "from .main import func\nfrom .about import version",
+            "src/pkg/main.py": "import super_complicated_dep\ndef func(): return 42",
+            "src/pkg/about.py": "version = '42'",
+        }
+        write_files(files, tmp_path)
+        attr_desc = "pkg.about.version"
+        package_dir = {"": "src"}
+        # `import super_complicated_dep` should not run, otherwise the build fails
+        assert expand.read_attr(attr_desc, package_dir, tmp_path) == "42"
+
+
+@pytest.mark.parametrize(
+    ("package_dir", "file", "module", "return_value"),
+    [
+        ({"": "src"}, "src/pkg/main.py", "pkg.main", 42),
+        ({"pkg": "lib"}, "lib/main.py", "pkg.main", 13),
+        ({}, "single_module.py", "single_module", 70),
+        ({}, "flat_layout/pkg.py", "flat_layout.pkg", 836),
+    ],
+)
+def test_resolve_class(monkeypatch, tmp_path, package_dir, file, module, return_value):
+    monkeypatch.setattr(sys, "modules", {})  # reproducibility
+    files = {file: f"class Custom:\n    def testing(self): return {return_value}"}
+    write_files(files, tmp_path)
+    cls = expand.resolve_class(f"{module}.Custom", package_dir, tmp_path)
+    assert cls().testing() == return_value
+
+
+@pytest.mark.parametrize(
+    ("args", "pkgs"),
+    [
+        ({"where": ["."], "namespaces": False}, {"pkg", "other"}),
+        ({"where": [".", "dir1"], "namespaces": False}, {"pkg", "other", "dir2"}),
+        ({"namespaces": True}, {"pkg", "other", "dir1", "dir1.dir2"}),
+        ({}, {"pkg", "other", "dir1", "dir1.dir2"}),  # default value for `namespaces`
+    ],
+)
+def test_find_packages(tmp_path, args, pkgs):
+    files = {
+        "pkg/__init__.py",
+        "other/__init__.py",
+        "dir1/dir2/__init__.py",
+    }
+    write_files({k: "" for k in files}, tmp_path)
+
+    package_dir = {}
+    kwargs = {"root_dir": tmp_path, "fill_package_dir": package_dir, **args}
+    where = kwargs.get("where", ["."])
+    assert set(expand.find_packages(**kwargs)) == pkgs
+    for pkg in pkgs:
+        pkg_path = find_package_path(pkg, package_dir, tmp_path)
+        assert os.path.exists(pkg_path)
+
+    # Make sure the same APIs work outside cwd
+    where = [
+        str((tmp_path / p).resolve()).replace(os.sep, "/")  # ensure posix-style paths
+        for p in args.pop("where", ["."])
+    ]
+
+    assert set(expand.find_packages(where=where, **args)) == pkgs
+
+
+@pytest.mark.parametrize(
+    ("files", "where", "expected_package_dir"),
+    [
+        (["pkg1/__init__.py", "pkg1/other.py"], ["."], {}),
+        (["pkg1/__init__.py", "pkg2/__init__.py"], ["."], {}),
+        (["src/pkg1/__init__.py", "src/pkg1/other.py"], ["src"], {"": "src"}),
+        (["src/pkg1/__init__.py", "src/pkg2/__init__.py"], ["src"], {"": "src"}),
+        (
+            ["src1/pkg1/__init__.py", "src2/pkg2/__init__.py"],
+            ["src1", "src2"],
+            {"pkg1": "src1/pkg1", "pkg2": "src2/pkg2"},
+        ),
+        (
+            ["src/pkg1/__init__.py", "pkg2/__init__.py"],
+            ["src", "."],
+            {"pkg1": "src/pkg1"},
+        ),
+    ],
+)
+def test_fill_package_dir(tmp_path, files, where, expected_package_dir):
+    write_files({k: "" for k in files}, tmp_path)
+    pkg_dir = {}
+    kwargs = {"root_dir": tmp_path, "fill_package_dir": pkg_dir, "namespaces": False}
+    pkgs = expand.find_packages(where=where, **kwargs)
+    assert set(pkg_dir.items()) == set(expected_package_dir.items())
+    for pkg in pkgs:
+        pkg_path = find_package_path(pkg, pkg_dir, tmp_path)
+        assert os.path.exists(pkg_path)
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/test_pyprojecttoml.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_pyprojecttoml.py
new file mode 100644
index 0000000000000000000000000000000000000000..e031ea810bcac94f54e5cd4e6515470233a9189d
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_pyprojecttoml.py
@@ -0,0 +1,421 @@
+import re
+from configparser import ConfigParser
+from inspect import cleandoc
+
+import jaraco.path
+import pytest
+import tomli_w
+from path import Path
+
+import setuptools  # noqa: F401 # force distutils.core to be patched
+from setuptools.config.pyprojecttoml import (
+    _ToolsTypoInMetadata,
+    apply_configuration,
+    expand_configuration,
+    read_configuration,
+    validate,
+)
+from setuptools.dist import Distribution
+from setuptools.errors import OptionError
+
+import distutils.core
+
+EXAMPLE = """
+[project]
+name = "myproj"
+keywords = ["some", "key", "words"]
+dynamic = ["version", "readme"]
+requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+dependencies = [
+    'importlib-metadata>=0.12;python_version<"3.8"',
+    'importlib-resources>=1.0;python_version<"3.7"',
+    'pathlib2>=2.3.3,<3;python_version < "3.4" and sys.platform != "win32"',
+]
+
+[project.optional-dependencies]
+docs = [
+    "sphinx>=3",
+    "sphinx-argparse>=0.2.5",
+    "sphinx-rtd-theme>=0.4.3",
+]
+testing = [
+    "pytest>=1",
+    "coverage>=3,<5",
+]
+
+[project.scripts]
+exec = "pkg.__main__:exec"
+
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"
+
+[tool.setuptools]
+package-dir = {"" = "src"}
+zip-safe = true
+platforms = ["any"]
+
+[tool.setuptools.packages.find]
+where = ["src"]
+
+[tool.setuptools.cmdclass]
+sdist = "pkg.mod.CustomSdist"
+
+[tool.setuptools.dynamic.version]
+attr = "pkg.__version__.VERSION"
+
+[tool.setuptools.dynamic.readme]
+file = ["README.md"]
+content-type = "text/markdown"
+
+[tool.setuptools.package-data]
+"*" = ["*.txt"]
+
+[tool.setuptools.data-files]
+"data" = ["_files/*.txt"]
+
+[tool.distutils.sdist]
+formats = "gztar"
+
+[tool.distutils.bdist_wheel]
+universal = true
+"""
+
+
+def create_example(path, pkg_root):
+    files = {
+        "pyproject.toml": EXAMPLE,
+        "README.md": "hello world",
+        "_files": {
+            "file.txt": "",
+        },
+    }
+    packages = {
+        "pkg": {
+            "__init__.py": "",
+            "mod.py": "class CustomSdist: pass",
+            "__version__.py": "VERSION = (3, 10)",
+            "__main__.py": "def exec(): print('hello')",
+        },
+    }
+
+    assert pkg_root  # Meta-test: cannot be empty string.
+
+    if pkg_root == ".":
+        files = {**files, **packages}
+        # skip other files: flat-layout will raise error for multi-package dist
+    else:
+        # Use this opportunity to ensure namespaces are discovered
+        files[pkg_root] = {**packages, "other": {"nested": {"__init__.py": ""}}}
+
+    jaraco.path.build(files, prefix=path)
+
+
+def verify_example(config, path, pkg_root):
+    pyproject = path / "pyproject.toml"
+    pyproject.write_text(tomli_w.dumps(config), encoding="utf-8")
+    expanded = expand_configuration(config, path)
+    expanded_project = expanded["project"]
+    assert read_configuration(pyproject, expand=True) == expanded
+    assert expanded_project["version"] == "3.10"
+    assert expanded_project["readme"]["text"] == "hello world"
+    assert "packages" in expanded["tool"]["setuptools"]
+    if pkg_root == ".":
+        # Auto-discovery will raise error for multi-package dist
+        assert set(expanded["tool"]["setuptools"]["packages"]) == {"pkg"}
+    else:
+        assert set(expanded["tool"]["setuptools"]["packages"]) == {
+            "pkg",
+            "other",
+            "other.nested",
+        }
+    assert expanded["tool"]["setuptools"]["include-package-data"] is True
+    assert "" in expanded["tool"]["setuptools"]["package-data"]
+    assert "*" not in expanded["tool"]["setuptools"]["package-data"]
+    assert expanded["tool"]["setuptools"]["data-files"] == [
+        ("data", ["_files/file.txt"])
+    ]
+
+
+def test_read_configuration(tmp_path):
+    create_example(tmp_path, "src")
+    pyproject = tmp_path / "pyproject.toml"
+
+    config = read_configuration(pyproject, expand=False)
+    assert config["project"].get("version") is None
+    assert config["project"].get("readme") is None
+
+    verify_example(config, tmp_path, "src")
+
+
+@pytest.mark.parametrize(
+    ("pkg_root", "opts"),
+    [
+        (".", {}),
+        ("src", {}),
+        ("lib", {"packages": {"find": {"where": ["lib"]}}}),
+    ],
+)
+def test_discovered_package_dir_with_attr_directive_in_config(tmp_path, pkg_root, opts):
+    create_example(tmp_path, pkg_root)
+
+    pyproject = tmp_path / "pyproject.toml"
+
+    config = read_configuration(pyproject, expand=False)
+    assert config["project"].get("version") is None
+    assert config["project"].get("readme") is None
+    config["tool"]["setuptools"].pop("packages", None)
+    config["tool"]["setuptools"].pop("package-dir", None)
+
+    config["tool"]["setuptools"].update(opts)
+    verify_example(config, tmp_path, pkg_root)
+
+
+ENTRY_POINTS = {
+    "console_scripts": {"a": "mod.a:func"},
+    "gui_scripts": {"b": "mod.b:func"},
+    "other": {"c": "mod.c:func [extra]"},
+}
+
+
+class TestEntryPoints:
+    def write_entry_points(self, tmp_path):
+        entry_points = ConfigParser()
+        entry_points.read_dict(ENTRY_POINTS)
+        with open(tmp_path / "entry-points.txt", "w", encoding="utf-8") as f:
+            entry_points.write(f)
+
+    def pyproject(self, dynamic=None):
+        project = {"dynamic": dynamic or ["scripts", "gui-scripts", "entry-points"]}
+        tool = {"dynamic": {"entry-points": {"file": "entry-points.txt"}}}
+        return {"project": project, "tool": {"setuptools": tool}}
+
+    def test_all_listed_in_dynamic(self, tmp_path):
+        self.write_entry_points(tmp_path)
+        expanded = expand_configuration(self.pyproject(), tmp_path)
+        expanded_project = expanded["project"]
+        assert len(expanded_project["scripts"]) == 1
+        assert expanded_project["scripts"]["a"] == "mod.a:func"
+        assert len(expanded_project["gui-scripts"]) == 1
+        assert expanded_project["gui-scripts"]["b"] == "mod.b:func"
+        assert len(expanded_project["entry-points"]) == 1
+        assert expanded_project["entry-points"]["other"]["c"] == "mod.c:func [extra]"
+
+    @pytest.mark.parametrize("missing_dynamic", ("scripts", "gui-scripts"))
+    def test_scripts_not_listed_in_dynamic(self, tmp_path, missing_dynamic):
+        self.write_entry_points(tmp_path)
+        dynamic = {"scripts", "gui-scripts", "entry-points"} - {missing_dynamic}
+
+        msg = f"defined outside of `pyproject.toml`:.*{missing_dynamic}"
+        with pytest.raises(OptionError, match=re.compile(msg, re.DOTALL)):
+            expand_configuration(self.pyproject(dynamic), tmp_path)
+
+
+class TestClassifiers:
+    def test_dynamic(self, tmp_path):
+        # Let's create a project example that has dynamic classifiers
+        # coming from a txt file.
+        create_example(tmp_path, "src")
+        classifiers = cleandoc(
+            """
+            Framework :: Flask
+            Programming Language :: Haskell
+            """
+        )
+        (tmp_path / "classifiers.txt").write_text(classifiers, encoding="utf-8")
+
+        pyproject = tmp_path / "pyproject.toml"
+        config = read_configuration(pyproject, expand=False)
+        dynamic = config["project"]["dynamic"]
+        config["project"]["dynamic"] = list({*dynamic, "classifiers"})
+        dynamic_config = config["tool"]["setuptools"]["dynamic"]
+        dynamic_config["classifiers"] = {"file": "classifiers.txt"}
+
+        # When the configuration is expanded,
+        # each line of the file should be an different classifier.
+        validate(config, pyproject)
+        expanded = expand_configuration(config, tmp_path)
+
+        assert set(expanded["project"]["classifiers"]) == {
+            "Framework :: Flask",
+            "Programming Language :: Haskell",
+        }
+
+    def test_dynamic_without_config(self, tmp_path):
+        config = """
+        [project]
+        name = "myproj"
+        version = '42'
+        dynamic = ["classifiers"]
+        """
+
+        pyproject = tmp_path / "pyproject.toml"
+        pyproject.write_text(cleandoc(config), encoding="utf-8")
+        with pytest.raises(OptionError, match="No configuration .* .classifiers."):
+            read_configuration(pyproject)
+
+    def test_dynamic_readme_from_setup_script_args(self, tmp_path):
+        config = """
+        [project]
+        name = "myproj"
+        version = '42'
+        dynamic = ["readme"]
+        """
+        pyproject = tmp_path / "pyproject.toml"
+        pyproject.write_text(cleandoc(config), encoding="utf-8")
+        dist = Distribution(attrs={"long_description": "42"})
+        # No error should occur because of missing `readme`
+        dist = apply_configuration(dist, pyproject)
+        assert dist.metadata.long_description == "42"
+
+    def test_dynamic_without_file(self, tmp_path):
+        config = """
+        [project]
+        name = "myproj"
+        version = '42'
+        dynamic = ["classifiers"]
+
+        [tool.setuptools.dynamic]
+        classifiers = {file = ["classifiers.txt"]}
+        """
+
+        pyproject = tmp_path / "pyproject.toml"
+        pyproject.write_text(cleandoc(config), encoding="utf-8")
+        with pytest.warns(UserWarning, match="File .*classifiers.txt. cannot be found"):
+            expanded = read_configuration(pyproject)
+        assert "classifiers" not in expanded["project"]
+
+
+class TestImportNames:
+    EXAMPLES = [
+        'import-names = ["hello", "world"]',
+        'import-namespaces = ["hello", "world"]',
+        'dynamic = ["import-names"]',
+        'dynamic = ["import-namespaces"]',
+    ]
+
+    @pytest.mark.parametrize("example", EXAMPLES)
+    def test_not_implemented(self, monkeypatch, tmp_path, example):
+        monkeypatch.chdir(tmp_path)
+        pyproject = Path("pyproject.toml")
+        toml_config = f"""
+        [project]
+        name = 'proj'
+        version = '42'
+        {example}
+        """
+        pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
+        with pytest.raises(NotImplementedError, match='import-names'):
+            apply_configuration(Distribution({}), pyproject)
+
+
+@pytest.mark.parametrize(
+    "example",
+    (
+        """
+        [project]
+        name = "myproj"
+        version = "1.2"
+
+        [my-tool.that-disrespect.pep518]
+        value = 42
+        """,
+    ),
+)
+def test_ignore_unrelated_config(tmp_path, example):
+    pyproject = tmp_path / "pyproject.toml"
+    pyproject.write_text(cleandoc(example), encoding="utf-8")
+
+    # Make sure no error is raised due to 3rd party configs in pyproject.toml
+    assert read_configuration(pyproject) is not None
+
+
+@pytest.mark.parametrize(
+    ("example", "error_msg"),
+    [
+        (
+            """
+            [project]
+            name = "myproj"
+            version = "1.2"
+            requires = ['pywin32; platform_system=="Windows"' ]
+            """,
+            "configuration error: .project. must not contain ..requires.. properties",
+        ),
+    ],
+)
+def test_invalid_example(tmp_path, example, error_msg):
+    pyproject = tmp_path / "pyproject.toml"
+    pyproject.write_text(cleandoc(example), encoding="utf-8")
+
+    pattern = re.compile(
+        f"invalid pyproject.toml.*{error_msg}.*", re.MULTILINE | re.DOTALL
+    )
+    with pytest.raises(ValueError, match=pattern):
+        read_configuration(pyproject)
+
+
+@pytest.mark.parametrize("config", ("", "[tool.something]\nvalue = 42"))
+def test_empty(tmp_path, config):
+    pyproject = tmp_path / "pyproject.toml"
+    pyproject.write_text(config, encoding="utf-8")
+
+    # Make sure no error is raised
+    assert read_configuration(pyproject) == {}
+
+
+@pytest.mark.parametrize("config", ("[project]\nname = 'myproj'\nversion='42'\n",))
+def test_include_package_data_by_default(tmp_path, config):
+    """Builds with ``pyproject.toml`` should consider ``include-package-data=True`` as
+    default.
+    """
+    pyproject = tmp_path / "pyproject.toml"
+    pyproject.write_text(config, encoding="utf-8")
+
+    config = read_configuration(pyproject)
+    assert config["tool"]["setuptools"]["include-package-data"] is True
+
+
+def test_include_package_data_in_setuppy(tmp_path):
+    """Builds with ``pyproject.toml`` should consider ``include_package_data`` set in
+    ``setup.py``.
+
+    See https://github.com/pypa/setuptools/issues/3197#issuecomment-1079023889
+    """
+    files = {
+        "pyproject.toml": "[project]\nname = 'myproj'\nversion='42'\n",
+        "setup.py": "__import__('setuptools').setup(include_package_data=False)",
+    }
+    jaraco.path.build(files, prefix=tmp_path)
+
+    with Path(tmp_path):
+        dist = distutils.core.run_setup("setup.py", {}, stop_after="config")
+
+    assert dist.get_name() == "myproj"
+    assert dist.get_version() == "42"
+    assert dist.include_package_data is False
+
+
+def test_warn_tools_typo(tmp_path):
+    """Test that the common ``tools.setuptools`` typo in ``pyproject.toml`` issues a warning
+
+    See https://github.com/pypa/setuptools/issues/4150
+    """
+    config = """
+    [build-system]
+    requires = ["setuptools"]
+    build-backend = "setuptools.build_meta"
+
+    [project]
+    name = "myproj"
+    version = '42'
+
+    [tools.setuptools]
+    packages = ["package"]
+    """
+
+    pyproject = tmp_path / "pyproject.toml"
+    pyproject.write_text(cleandoc(config), encoding="utf-8")
+
+    with pytest.warns(_ToolsTypoInMetadata):
+        read_configuration(pyproject)
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py
new file mode 100644
index 0000000000000000000000000000000000000000..9fc8050743c4b1a8497d5ea20c571b565d074e59
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_pyprojecttoml_dynamic_deps.py
@@ -0,0 +1,111 @@
+from inspect import cleandoc
+
+import pytest
+from jaraco import path
+
+from setuptools.config.pyprojecttoml import apply_configuration
+from setuptools.dist import Distribution
+from setuptools.warnings import SetuptoolsWarning
+
+
+def test_dynamic_dependencies(tmp_path):
+    files = {
+        "requirements.txt": "six\n  # comment\n",
+        "pyproject.toml": cleandoc(
+            """
+            [project]
+            name = "myproj"
+            version = "1.0"
+            dynamic = ["dependencies"]
+
+            [build-system]
+            requires = ["setuptools", "wheel"]
+            build-backend = "setuptools.build_meta"
+
+            [tool.setuptools.dynamic.dependencies]
+            file = ["requirements.txt"]
+            """
+        ),
+    }
+    path.build(files, prefix=tmp_path)
+    dist = Distribution()
+    dist = apply_configuration(dist, tmp_path / "pyproject.toml")
+    assert dist.install_requires == ["six"]
+
+
+def test_dynamic_optional_dependencies(tmp_path):
+    files = {
+        "requirements-docs.txt": "sphinx\n  # comment\n",
+        "pyproject.toml": cleandoc(
+            """
+            [project]
+            name = "myproj"
+            version = "1.0"
+            dynamic = ["optional-dependencies"]
+
+            [tool.setuptools.dynamic.optional-dependencies.docs]
+            file = ["requirements-docs.txt"]
+
+            [build-system]
+            requires = ["setuptools", "wheel"]
+            build-backend = "setuptools.build_meta"
+            """
+        ),
+    }
+    path.build(files, prefix=tmp_path)
+    dist = Distribution()
+    dist = apply_configuration(dist, tmp_path / "pyproject.toml")
+    assert dist.extras_require == {"docs": ["sphinx"]}
+
+
+def test_mixed_dynamic_optional_dependencies(tmp_path):
+    """
+    Test that if PEP 621 was loosened to allow mixing of dynamic and static
+    configurations in the case of fields containing sub-fields (groups),
+    things would work out.
+    """
+    files = {
+        "requirements-images.txt": "pillow~=42.0\n  # comment\n",
+        "pyproject.toml": cleandoc(
+            """
+            [project]
+            name = "myproj"
+            version = "1.0"
+            dynamic = ["optional-dependencies"]
+
+            [project.optional-dependencies]
+            docs = ["sphinx"]
+
+            [tool.setuptools.dynamic.optional-dependencies.images]
+            file = ["requirements-images.txt"]
+            """
+        ),
+    }
+
+    path.build(files, prefix=tmp_path)
+    pyproject = tmp_path / "pyproject.toml"
+    with pytest.raises(ValueError, match="project.optional-dependencies"):
+        apply_configuration(Distribution(), pyproject)
+
+
+def test_mixed_extras_require_optional_dependencies(tmp_path):
+    files = {
+        "pyproject.toml": cleandoc(
+            """
+            [project]
+            name = "myproj"
+            version = "1.0"
+            optional-dependencies.docs = ["sphinx"]
+            """
+        ),
+    }
+
+    path.build(files, prefix=tmp_path)
+    pyproject = tmp_path / "pyproject.toml"
+
+    dist = Distribution({"extras_require": {"hello": ["world"]}})
+
+    with pytest.warns(SetuptoolsWarning, match=".extras_require. overwritten"):
+        dist = apply_configuration(dist, pyproject)
+
+    assert dist.extras_require == {"docs": ["sphinx"]}
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/config/test_setupcfg.py b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_setupcfg.py
new file mode 100644
index 0000000000000000000000000000000000000000..495337a9a5815e3d2a0aefa584b8ee81f5136d95
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/config/test_setupcfg.py
@@ -0,0 +1,987 @@
+import configparser
+import contextlib
+import inspect
+import re
+import sys
+from pathlib import Path
+from unittest.mock import Mock, patch
+
+import pytest
+from packaging.requirements import InvalidRequirement
+
+from setuptools.config.setupcfg import ConfigHandler, Target, read_configuration
+from setuptools.dist import Distribution, _Distribution
+from setuptools.warnings import SetuptoolsDeprecationWarning
+
+from ..textwrap import DALS
+
+from distutils.errors import DistutilsFileError, DistutilsOptionError
+
+IS_PYPY = '__pypy__' in sys.builtin_module_names
+
+
+class ErrConfigHandler(ConfigHandler[Target]):
+    """Erroneous handler. Fails to implement required methods."""
+
+    section_prefix = "**err**"
+
+
+def make_package_dir(name, base_dir, ns=False):
+    dir_package = base_dir
+    for dir_name in name.split('/'):
+        dir_package = dir_package.mkdir(dir_name)
+    init_file = None
+    if not ns:
+        init_file = dir_package.join('__init__.py')
+        init_file.write('')
+    return dir_package, init_file
+
+
+def fake_env(
+    tmpdir, setup_cfg, setup_py=None, encoding='ascii', package_path='fake_package'
+):
+    if setup_py is None:
+        setup_py = 'from setuptools import setup\nsetup()\n'
+
+    tmpdir.join('setup.py').write(setup_py)
+    config = tmpdir.join('setup.cfg')
+    config.write(setup_cfg.encode(encoding), mode='wb')
+
+    package_dir, init_file = make_package_dir(package_path, tmpdir)
+
+    init_file.write(
+        'VERSION = (1, 2, 3)\n'
+        '\n'
+        'VERSION_MAJOR = 1'
+        '\n'
+        'def get_version():\n'
+        '    return [3, 4, 5, "dev"]\n'
+        '\n'
+    )
+
+    return package_dir, config
+
+
+@contextlib.contextmanager
+def get_dist(tmpdir, kwargs_initial=None, parse=True):
+    kwargs_initial = kwargs_initial or {}
+
+    with tmpdir.as_cwd():
+        dist = Distribution(kwargs_initial)
+        dist.script_name = 'setup.py'
+        parse and dist.parse_config_files()
+
+        yield dist
+
+
+def test_parsers_implemented():
+    with pytest.raises(NotImplementedError):
+        handler = ErrConfigHandler(None, {}, False, Mock())
+        handler.parsers
+
+
+class TestConfigurationReader:
+    def test_basic(self, tmpdir):
+        _, config = fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'version = 10.1.1\n'
+            'keywords = one, two\n'
+            '\n'
+            '[options]\n'
+            'scripts = bin/a.py, bin/b.py\n',
+        )
+        config_dict = read_configuration(str(config))
+        assert config_dict['metadata']['version'] == '10.1.1'
+        assert config_dict['metadata']['keywords'] == ['one', 'two']
+        assert config_dict['options']['scripts'] == ['bin/a.py', 'bin/b.py']
+
+    def test_no_config(self, tmpdir):
+        with pytest.raises(DistutilsFileError):
+            read_configuration(str(tmpdir.join('setup.cfg')))
+
+    def test_ignore_errors(self, tmpdir):
+        _, config = fake_env(
+            tmpdir,
+            '[metadata]\nversion = attr: none.VERSION\nkeywords = one, two\n',
+        )
+        with pytest.raises(ImportError):
+            read_configuration(str(config))
+
+        config_dict = read_configuration(str(config), ignore_option_errors=True)
+
+        assert config_dict['metadata']['keywords'] == ['one', 'two']
+        assert 'version' not in config_dict['metadata']
+
+        config.remove()
+
+
+class TestMetadata:
+    def test_basic(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'version = 10.1.1\n'
+            'description = Some description\n'
+            'long_description_content_type = text/something\n'
+            'long_description = file: README\n'
+            'name = fake_name\n'
+            'keywords = one, two\n'
+            'provides = package, package.sub\n'
+            'license = otherlic\n'
+            'download_url = http://test.test.com/test/\n'
+            'maintainer_email = test@test.com\n',
+        )
+
+        tmpdir.join('README').write('readme contents\nline2')
+
+        meta_initial = {
+            # This will be used so `otherlic` won't replace it.
+            'license': 'BSD 3-Clause License',
+        }
+
+        with get_dist(tmpdir, meta_initial) as dist:
+            metadata = dist.metadata
+
+            assert metadata.version == '10.1.1'
+            assert metadata.description == 'Some description'
+            assert metadata.long_description_content_type == 'text/something'
+            assert metadata.long_description == 'readme contents\nline2'
+            assert metadata.provides == ['package', 'package.sub']
+            assert metadata.license == 'BSD 3-Clause License'
+            assert metadata.name == 'fake_name'
+            assert metadata.keywords == ['one', 'two']
+            assert metadata.download_url == 'http://test.test.com/test/'
+            assert metadata.maintainer_email == 'test@test.com'
+
+    def test_license_cfg(self, tmpdir):
+        fake_env(
+            tmpdir,
+            DALS(
+                """
+            [metadata]
+            name=foo
+            version=0.0.1
+            license=Apache 2.0
+            """
+            ),
+        )
+
+        with get_dist(tmpdir) as dist:
+            metadata = dist.metadata
+
+            assert metadata.name == "foo"
+            assert metadata.version == "0.0.1"
+            assert metadata.license == "Apache 2.0"
+
+    def test_file_mixed(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\nlong_description = file: README.rst, CHANGES.rst\n\n',
+        )
+
+        tmpdir.join('README.rst').write('readme contents\nline2')
+        tmpdir.join('CHANGES.rst').write('changelog contents\nand stuff')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.long_description == (
+                'readme contents\nline2\nchangelog contents\nand stuff'
+            )
+
+    def test_file_sandboxed(self, tmpdir):
+        tmpdir.ensure("README")
+        project = tmpdir.join('depth1', 'depth2')
+        project.ensure(dir=True)
+        fake_env(project, '[metadata]\nlong_description = file: ../../README\n')
+
+        with get_dist(project, parse=False) as dist:
+            with pytest.raises(DistutilsOptionError):
+                dist.parse_config_files()  # file: out of sandbox
+
+    def test_aliases(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'author_email = test@test.com\n'
+            'home_page = http://test.test.com/test/\n'
+            'summary = Short summary\n'
+            'platform = a, b\n'
+            'classifier =\n'
+            '  Framework :: Django\n'
+            '  Programming Language :: Python :: 3.5\n',
+        )
+
+        with get_dist(tmpdir) as dist:
+            metadata = dist.metadata
+            assert metadata.author_email == 'test@test.com'
+            assert metadata.url == 'http://test.test.com/test/'
+            assert metadata.description == 'Short summary'
+            assert metadata.platforms == ['a', 'b']
+            assert metadata.classifiers == [
+                'Framework :: Django',
+                'Programming Language :: Python :: 3.5',
+            ]
+
+    def test_multiline(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'name = fake_name\n'
+            'keywords =\n'
+            '  one\n'
+            '  two\n'
+            'classifiers =\n'
+            '  Framework :: Django\n'
+            '  Programming Language :: Python :: 3.5\n',
+        )
+        with get_dist(tmpdir) as dist:
+            metadata = dist.metadata
+            assert metadata.keywords == ['one', 'two']
+            assert metadata.classifiers == [
+                'Framework :: Django',
+                'Programming Language :: Python :: 3.5',
+            ]
+
+    def test_dict(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'project_urls =\n'
+            '  Link One = https://example.com/one/\n'
+            '  Link Two = https://example.com/two/\n',
+        )
+        with get_dist(tmpdir) as dist:
+            metadata = dist.metadata
+            assert metadata.project_urls == {
+                'Link One': 'https://example.com/one/',
+                'Link Two': 'https://example.com/two/',
+            }
+
+    def test_version(self, tmpdir):
+        package_dir, config = fake_env(
+            tmpdir, '[metadata]\nversion = attr: fake_package.VERSION\n'
+        )
+
+        sub_a = package_dir.mkdir('subpkg_a')
+        sub_a.join('__init__.py').write('')
+        sub_a.join('mod.py').write('VERSION = (2016, 11, 26)')
+
+        sub_b = package_dir.mkdir('subpkg_b')
+        sub_b.join('__init__.py').write('')
+        sub_b.join('mod.py').write(
+            'import third_party_module\nVERSION = (2016, 11, 26)'
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '1.2.3'
+
+        config.write('[metadata]\nversion = attr: fake_package.get_version\n')
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '3.4.5.dev'
+
+        config.write('[metadata]\nversion = attr: fake_package.VERSION_MAJOR\n')
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '1'
+
+        config.write('[metadata]\nversion = attr: fake_package.subpkg_a.mod.VERSION\n')
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '2016.11.26'
+
+        config.write('[metadata]\nversion = attr: fake_package.subpkg_b.mod.VERSION\n')
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '2016.11.26'
+
+    def test_version_file(self, tmpdir):
+        fake_env(tmpdir, '[metadata]\nversion = file: fake_package/version.txt\n')
+        tmpdir.join('fake_package', 'version.txt').write('1.2.3\n')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '1.2.3'
+
+        tmpdir.join('fake_package', 'version.txt').write('1.2.3\n4.5.6\n')
+        with pytest.raises(DistutilsOptionError):
+            with get_dist(tmpdir) as dist:
+                dist.metadata.version
+
+    def test_version_with_package_dir_simple(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'version = attr: fake_package_simple.VERSION\n'
+            '[options]\n'
+            'package_dir =\n'
+            '    = src\n',
+            package_path='src/fake_package_simple',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '1.2.3'
+
+    def test_version_with_package_dir_rename(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'version = attr: fake_package_rename.VERSION\n'
+            '[options]\n'
+            'package_dir =\n'
+            '    fake_package_rename = fake_dir\n',
+            package_path='fake_dir',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '1.2.3'
+
+    def test_version_with_package_dir_complex(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'version = attr: fake_package_complex.VERSION\n'
+            '[options]\n'
+            'package_dir =\n'
+            '    fake_package_complex = src/fake_dir\n',
+            package_path='src/fake_dir',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.version == '1.2.3'
+
+    def test_unknown_meta_item(self, tmpdir):
+        fake_env(tmpdir, '[metadata]\nname = fake_name\nunknown = some\n')
+        with get_dist(tmpdir, parse=False) as dist:
+            dist.parse_config_files()  # Skip unknown.
+
+    def test_usupported_section(self, tmpdir):
+        fake_env(tmpdir, '[metadata.some]\nkey = val\n')
+        with get_dist(tmpdir, parse=False) as dist:
+            with pytest.raises(DistutilsOptionError):
+                dist.parse_config_files()
+
+    def test_classifiers(self, tmpdir):
+        expected = set([
+            'Framework :: Django',
+            'Programming Language :: Python :: 3',
+            'Programming Language :: Python :: 3.5',
+        ])
+
+        # From file.
+        _, config = fake_env(tmpdir, '[metadata]\nclassifiers = file: classifiers\n')
+
+        tmpdir.join('classifiers').write(
+            'Framework :: Django\n'
+            'Programming Language :: Python :: 3\n'
+            'Programming Language :: Python :: 3.5\n'
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert set(dist.metadata.classifiers) == expected
+
+        # From list notation
+        config.write(
+            '[metadata]\n'
+            'classifiers =\n'
+            '    Framework :: Django\n'
+            '    Programming Language :: Python :: 3\n'
+            '    Programming Language :: Python :: 3.5\n'
+        )
+        with get_dist(tmpdir) as dist:
+            assert set(dist.metadata.classifiers) == expected
+
+    def test_interpolation(self, tmpdir):
+        fake_env(tmpdir, '[metadata]\ndescription = %(message)s\n')
+        with pytest.raises(configparser.InterpolationMissingOptionError):
+            with get_dist(tmpdir):
+                pass
+
+    def test_non_ascii_1(self, tmpdir):
+        fake_env(tmpdir, '[metadata]\ndescription = éàïôñ\n', encoding='utf-8')
+        with get_dist(tmpdir):
+            pass
+
+    def test_non_ascii_3(self, tmpdir):
+        fake_env(tmpdir, '\n# -*- coding: invalid\n')
+        with get_dist(tmpdir):
+            pass
+
+    def test_non_ascii_4(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '# -*- coding: utf-8\n[metadata]\ndescription = éàïôñ\n',
+            encoding='utf-8',
+        )
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.description == 'éàïôñ'
+
+    def test_not_utf8(self, tmpdir):
+        """
+        Config files encoded not in UTF-8 will fail
+        """
+        fake_env(
+            tmpdir,
+            '# vim: set fileencoding=iso-8859-15 :\n[metadata]\ndescription = éàïôñ\n',
+            encoding='iso-8859-15',
+        )
+        with pytest.raises(UnicodeDecodeError):
+            with get_dist(tmpdir):
+                pass
+
+    @pytest.mark.parametrize(
+        ("error_msg", "config", "invalid"),
+        [
+            (
+                "Invalid dash-separated key 'author-email' in 'metadata' (setup.cfg)",
+                DALS(
+                    """
+                    [metadata]
+                    author-email = test@test.com
+                    maintainer_email = foo@foo.com
+                    """
+                ),
+                {"author-email": "test@test.com"},
+            ),
+            (
+                "Invalid uppercase key 'Name' in 'metadata' (setup.cfg)",
+                DALS(
+                    """
+                    [metadata]
+                    Name = foo
+                    description = Some description
+                    """
+                ),
+                {"Name": "foo"},
+            ),
+        ],
+    )
+    def test_invalid_options_previously_deprecated(
+        self, tmpdir, error_msg, config, invalid
+    ):
+        # This test and related methods can be removed when no longer needed.
+        # Deprecation postponed due to push-back from the community in
+        # https://github.com/pypa/setuptools/issues/4910
+        fake_env(tmpdir, config)
+        with pytest.warns(SetuptoolsDeprecationWarning, match=re.escape(error_msg)):
+            dist = get_dist(tmpdir).__enter__()
+
+        tmpdir.join('setup.cfg').remove()
+
+        for field, value in invalid.items():
+            attr = field.replace("-", "_").lower()
+            assert getattr(dist.metadata, attr) == value
+
+
+class TestOptions:
+    def test_basic(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options]\n'
+            'zip_safe = True\n'
+            'include_package_data = yes\n'
+            'package_dir = b=c, =src\n'
+            'packages = pack_a, pack_b.subpack\n'
+            'namespace_packages = pack1, pack2\n'
+            'scripts = bin/one.py, bin/two.py\n'
+            'eager_resources = bin/one.py, bin/two.py\n'
+            'install_requires = docutils>=0.3; pack ==1.1, ==1.3; hey\n'
+            'setup_requires = docutils>=0.3; spack ==1.1, ==1.3; there\n'
+            'dependency_links = http://some.com/here/1, '
+            'http://some.com/there/2\n'
+            'python_requires = >=1.0, !=2.8\n'
+            'py_modules = module1, module2\n',
+        )
+        deprec = pytest.warns(SetuptoolsDeprecationWarning, match="namespace_packages")
+        with deprec, get_dist(tmpdir) as dist:
+            assert dist.zip_safe
+            assert dist.include_package_data
+            assert dist.package_dir == {'': 'src', 'b': 'c'}
+            assert dist.packages == ['pack_a', 'pack_b.subpack']
+            assert dist.namespace_packages == ['pack1', 'pack2']
+            assert dist.scripts == ['bin/one.py', 'bin/two.py']
+            assert dist.dependency_links == ([
+                'http://some.com/here/1',
+                'http://some.com/there/2',
+            ])
+            assert dist.install_requires == ([
+                'docutils>=0.3',
+                'pack==1.1,==1.3',
+                'hey',
+            ])
+            assert dist.setup_requires == ([
+                'docutils>=0.3',
+                'spack ==1.1, ==1.3',
+                'there',
+            ])
+            assert dist.python_requires == '>=1.0, !=2.8'
+            assert dist.py_modules == ['module1', 'module2']
+
+    def test_multiline(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options]\n'
+            'package_dir = \n'
+            '  b=c\n'
+            '  =src\n'
+            'packages = \n'
+            '  pack_a\n'
+            '  pack_b.subpack\n'
+            'namespace_packages = \n'
+            '  pack1\n'
+            '  pack2\n'
+            'scripts = \n'
+            '  bin/one.py\n'
+            '  bin/two.py\n'
+            'eager_resources = \n'
+            '  bin/one.py\n'
+            '  bin/two.py\n'
+            'install_requires = \n'
+            '  docutils>=0.3\n'
+            '  pack ==1.1, ==1.3\n'
+            '  hey\n'
+            'setup_requires = \n'
+            '  docutils>=0.3\n'
+            '  spack ==1.1, ==1.3\n'
+            '  there\n'
+            'dependency_links = \n'
+            '  http://some.com/here/1\n'
+            '  http://some.com/there/2\n',
+        )
+        deprec = pytest.warns(SetuptoolsDeprecationWarning, match="namespace_packages")
+        with deprec, get_dist(tmpdir) as dist:
+            assert dist.package_dir == {'': 'src', 'b': 'c'}
+            assert dist.packages == ['pack_a', 'pack_b.subpack']
+            assert dist.namespace_packages == ['pack1', 'pack2']
+            assert dist.scripts == ['bin/one.py', 'bin/two.py']
+            assert dist.dependency_links == ([
+                'http://some.com/here/1',
+                'http://some.com/there/2',
+            ])
+            assert dist.install_requires == ([
+                'docutils>=0.3',
+                'pack==1.1,==1.3',
+                'hey',
+            ])
+            assert dist.setup_requires == ([
+                'docutils>=0.3',
+                'spack ==1.1, ==1.3',
+                'there',
+            ])
+
+    def test_package_dir_fail(self, tmpdir):
+        fake_env(tmpdir, '[options]\npackage_dir = a b\n')
+        with get_dist(tmpdir, parse=False) as dist:
+            with pytest.raises(DistutilsOptionError):
+                dist.parse_config_files()
+
+    def test_package_data(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options.package_data]\n'
+            '* = *.txt, *.rst\n'
+            'hello = *.msg\n'
+            '\n'
+            '[options.exclude_package_data]\n'
+            '* = fake1.txt, fake2.txt\n'
+            'hello = *.dat\n',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.package_data == {
+                '': ['*.txt', '*.rst'],
+                'hello': ['*.msg'],
+            }
+            assert dist.exclude_package_data == {
+                '': ['fake1.txt', 'fake2.txt'],
+                'hello': ['*.dat'],
+            }
+
+    def test_packages(self, tmpdir):
+        fake_env(tmpdir, '[options]\npackages = find:\n')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.packages == ['fake_package']
+
+    def test_find_directive(self, tmpdir):
+        dir_package, config = fake_env(tmpdir, '[options]\npackages = find:\n')
+
+        make_package_dir('sub_one', dir_package)
+        make_package_dir('sub_two', dir_package)
+
+        with get_dist(tmpdir) as dist:
+            assert set(dist.packages) == set([
+                'fake_package',
+                'fake_package.sub_two',
+                'fake_package.sub_one',
+            ])
+
+        config.write(
+            '[options]\n'
+            'packages = find:\n'
+            '\n'
+            '[options.packages.find]\n'
+            'where = .\n'
+            'include =\n'
+            '    fake_package.sub_one\n'
+            '    two\n'
+        )
+        with get_dist(tmpdir) as dist:
+            assert dist.packages == ['fake_package.sub_one']
+
+        config.write(
+            '[options]\n'
+            'packages = find:\n'
+            '\n'
+            '[options.packages.find]\n'
+            'exclude =\n'
+            '    fake_package.sub_one\n'
+        )
+        with get_dist(tmpdir) as dist:
+            assert set(dist.packages) == set(['fake_package', 'fake_package.sub_two'])
+
+    def test_find_namespace_directive(self, tmpdir):
+        dir_package, config = fake_env(
+            tmpdir, '[options]\npackages = find_namespace:\n'
+        )
+
+        make_package_dir('sub_one', dir_package)
+        make_package_dir('sub_two', dir_package, ns=True)
+
+        with get_dist(tmpdir) as dist:
+            assert set(dist.packages) == {
+                'fake_package',
+                'fake_package.sub_two',
+                'fake_package.sub_one',
+            }
+
+        config.write(
+            '[options]\n'
+            'packages = find_namespace:\n'
+            '\n'
+            '[options.packages.find]\n'
+            'where = .\n'
+            'include =\n'
+            '    fake_package.sub_one\n'
+            '    two\n'
+        )
+        with get_dist(tmpdir) as dist:
+            assert dist.packages == ['fake_package.sub_one']
+
+        config.write(
+            '[options]\n'
+            'packages = find_namespace:\n'
+            '\n'
+            '[options.packages.find]\n'
+            'exclude =\n'
+            '    fake_package.sub_one\n'
+        )
+        with get_dist(tmpdir) as dist:
+            assert set(dist.packages) == {'fake_package', 'fake_package.sub_two'}
+
+    def test_extras_require(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options.extras_require]\n'
+            'pdf = ReportLab>=1.2; RXP\n'
+            'rest = \n'
+            '  docutils>=0.3\n'
+            '  pack ==1.1, ==1.3\n',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.extras_require == {
+                'pdf': ['ReportLab>=1.2', 'RXP'],
+                'rest': ['docutils>=0.3', 'pack==1.1,==1.3'],
+            }
+            assert set(dist.metadata.provides_extras) == {'pdf', 'rest'}
+
+    @pytest.mark.parametrize(
+        "config",
+        [
+            "[options.extras_require]\nfoo = bar;python_version<'3'",
+            "[options.extras_require]\nfoo = bar;os_name=='linux'",
+            "[options.extras_require]\nfoo = bar;python_version<'3'\n",
+            "[options.extras_require]\nfoo = bar;os_name=='linux'\n",
+            "[options]\ninstall_requires = bar;python_version<'3'",
+            "[options]\ninstall_requires = bar;os_name=='linux'",
+            "[options]\ninstall_requires = bar;python_version<'3'\n",
+            "[options]\ninstall_requires = bar;os_name=='linux'\n",
+        ],
+    )
+    @pytest.mark.xfail(IS_PYPY, reason="Exceptions missing on PyPy")
+    # TODO: investigate PyPy problem
+    def test_raises_accidental_env_marker_misconfig(self, config, tmpdir):
+        fake_env(tmpdir, config)
+        match = (
+            r"One of the parsed requirements in `(install_requires|extras_require.+)` "
+            "looks like a valid environment marker.*"
+        )
+        with pytest.raises(InvalidRequirement, match=match):
+            with get_dist(tmpdir) as _:
+                pass
+
+    @pytest.mark.parametrize(
+        "config",
+        [
+            "[options.extras_require]\nfoo = bar;python_version<3",
+            "[options.extras_require]\nfoo = bar;python_version<3\n",
+            "[options]\ninstall_requires = bar;python_version<3",
+            "[options]\ninstall_requires = bar;python_version<3\n",
+        ],
+    )
+    @pytest.mark.xfail(IS_PYPY, reason="Warnings missing on PyPy (minor issue)")
+    # TODO: investigate PyPy problem
+    def test_warn_accidental_env_marker_misconfig(self, config, tmpdir):
+        fake_env(tmpdir, config)
+        match = (
+            r"One of the parsed requirements in `(install_requires|extras_require.+)` "
+            "looks like a valid environment marker.*"
+        )
+        with pytest.warns(SetuptoolsDeprecationWarning, match=match):
+            with get_dist(tmpdir) as _:
+                pass
+
+    @pytest.mark.parametrize(
+        "config",
+        [
+            "[options.extras_require]\nfoo =\n    bar;python_version<'3'",
+            "[options.extras_require]\nfoo = bar;baz\nboo = xxx;yyy",
+            "[options.extras_require]\nfoo =\n    bar;python_version<'3'\n",
+            "[options.extras_require]\nfoo = bar;baz\nboo = xxx;yyy\n",
+            "[options.extras_require]\nfoo =\n    bar\n    python_version<3\n",
+            "[options]\ninstall_requires =\n    bar;python_version<'3'",
+            "[options]\ninstall_requires = bar;baz\nboo = xxx;yyy",
+            "[options]\ninstall_requires =\n    bar;python_version<'3'\n",
+            "[options]\ninstall_requires = bar;baz\nboo = xxx;yyy\n",
+            "[options]\ninstall_requires =\n    bar\n    python_version<3\n",
+        ],
+    )
+    @pytest.mark.filterwarnings("error::setuptools.SetuptoolsDeprecationWarning")
+    def test_nowarn_accidental_env_marker_misconfig(self, config, tmpdir, recwarn):
+        fake_env(tmpdir, config)
+        num_warnings = len(recwarn)
+        with get_dist(tmpdir) as _:
+            pass
+        # The examples are valid, no warnings shown
+        assert len(recwarn) == num_warnings
+
+    def test_dash_preserved_extras_require(self, tmpdir):
+        fake_env(tmpdir, '[options.extras_require]\nfoo-a = foo\nfoo_b = test\n')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.extras_require == {'foo-a': ['foo'], 'foo_b': ['test']}
+
+    def test_entry_points(self, tmpdir):
+        _, config = fake_env(
+            tmpdir,
+            '[options.entry_points]\n'
+            'group1 = point1 = pack.module:func, '
+            '.point2 = pack.module2:func_rest [rest]\n'
+            'group2 = point3 = pack.module:func2\n',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.entry_points == {
+                'group1': [
+                    'point1 = pack.module:func',
+                    '.point2 = pack.module2:func_rest [rest]',
+                ],
+                'group2': ['point3 = pack.module:func2'],
+            }
+
+        expected = (
+            '[blogtool.parsers]\n'
+            '.rst = some.nested.module:SomeClass.some_classmethod[reST]\n'
+        )
+
+        tmpdir.join('entry_points').write(expected)
+
+        # From file.
+        config.write('[options]\nentry_points = file: entry_points\n')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.entry_points == expected
+
+    def test_case_sensitive_entry_points(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options.entry_points]\n'
+            'GROUP1 = point1 = pack.module:func, '
+            '.point2 = pack.module2:func_rest [rest]\n'
+            'group2 = point3 = pack.module:func2\n',
+        )
+
+        with get_dist(tmpdir) as dist:
+            assert dist.entry_points == {
+                'GROUP1': [
+                    'point1 = pack.module:func',
+                    '.point2 = pack.module2:func_rest [rest]',
+                ],
+                'group2': ['point3 = pack.module:func2'],
+            }
+
+    def test_data_files(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options.data_files]\n'
+            'cfg =\n'
+            '      a/b.conf\n'
+            '      c/d.conf\n'
+            'data = e/f.dat, g/h.dat\n',
+        )
+
+        with get_dist(tmpdir) as dist:
+            expected = [
+                ('cfg', ['a/b.conf', 'c/d.conf']),
+                ('data', ['e/f.dat', 'g/h.dat']),
+            ]
+            assert sorted(dist.data_files) == sorted(expected)
+
+    def test_data_files_globby(self, tmpdir):
+        fake_env(
+            tmpdir,
+            '[options.data_files]\n'
+            'cfg =\n'
+            '      a/b.conf\n'
+            '      c/d.conf\n'
+            'data = *.dat\n'
+            'icons = \n'
+            '      *.ico\n'
+            'audio = \n'
+            '      *.wav\n'
+            '      sounds.db\n',
+        )
+
+        # Create dummy files for glob()'s sake:
+        tmpdir.join('a.dat').write('')
+        tmpdir.join('b.dat').write('')
+        tmpdir.join('c.dat').write('')
+        tmpdir.join('a.ico').write('')
+        tmpdir.join('b.ico').write('')
+        tmpdir.join('c.ico').write('')
+        tmpdir.join('beep.wav').write('')
+        tmpdir.join('boop.wav').write('')
+        tmpdir.join('sounds.db').write('')
+
+        with get_dist(tmpdir) as dist:
+            expected = [
+                ('cfg', ['a/b.conf', 'c/d.conf']),
+                ('data', ['a.dat', 'b.dat', 'c.dat']),
+                ('icons', ['a.ico', 'b.ico', 'c.ico']),
+                ('audio', ['beep.wav', 'boop.wav', 'sounds.db']),
+            ]
+            assert sorted(dist.data_files) == sorted(expected)
+
+    def test_python_requires_simple(self, tmpdir):
+        fake_env(
+            tmpdir,
+            DALS(
+                """
+            [options]
+            python_requires=>=2.7
+            """
+            ),
+        )
+        with get_dist(tmpdir) as dist:
+            dist.parse_config_files()
+
+    def test_python_requires_compound(self, tmpdir):
+        fake_env(
+            tmpdir,
+            DALS(
+                """
+            [options]
+            python_requires=>=2.7,!=3.0.*
+            """
+            ),
+        )
+        with get_dist(tmpdir) as dist:
+            dist.parse_config_files()
+
+    def test_python_requires_invalid(self, tmpdir):
+        fake_env(
+            tmpdir,
+            DALS(
+                """
+            [options]
+            python_requires=invalid
+            """
+            ),
+        )
+        with pytest.raises(Exception):
+            with get_dist(tmpdir) as dist:
+                dist.parse_config_files()
+
+    def test_cmdclass(self, tmpdir):
+        module_path = Path(tmpdir, "src/custom_build.py")  # auto discovery for src
+        module_path.parent.mkdir(parents=True, exist_ok=True)
+        module_path.write_text(
+            "from distutils.core import Command\nclass CustomCmd(Command): pass\n",
+            encoding="utf-8",
+        )
+
+        setup_cfg = """
+            [options]
+            cmdclass =
+                customcmd = custom_build.CustomCmd
+        """
+        fake_env(tmpdir, inspect.cleandoc(setup_cfg))
+
+        with get_dist(tmpdir) as dist:
+            cmdclass = dist.cmdclass['customcmd']
+            assert cmdclass.__name__ == "CustomCmd"
+            assert cmdclass.__module__ == "custom_build"
+            assert module_path.samefile(inspect.getfile(cmdclass))
+
+    def test_requirements_file(self, tmpdir):
+        fake_env(
+            tmpdir,
+            DALS(
+                """
+            [options]
+            install_requires = file:requirements.txt
+            [options.extras_require]
+            colors = file:requirements-extra.txt
+            """
+            ),
+        )
+
+        tmpdir.join('requirements.txt').write('\ndocutils>=0.3\n\n')
+        tmpdir.join('requirements-extra.txt').write('colorama')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.install_requires == ['docutils>=0.3']
+            assert dist.extras_require == {'colors': ['colorama']}
+
+
+saved_dist_init = _Distribution.__init__
+
+
+class TestExternalSetters:
+    # During creation of the setuptools Distribution() object, we call
+    # the init of the parent distutils Distribution object via
+    # _Distribution.__init__ ().
+    #
+    # It's possible distutils calls out to various keyword
+    # implementations (i.e. distutils.setup_keywords entry points)
+    # that may set a range of variables.
+    #
+    # This wraps distutil's Distribution.__init__ and simulates
+    # pbr or something else setting these values.
+    def _fake_distribution_init(self, dist, attrs):
+        saved_dist_init(dist, attrs)
+        # see self._DISTUTILS_UNSUPPORTED_METADATA
+        dist.metadata.long_description_content_type = 'text/something'
+        # Test overwrite setup() args
+        dist.metadata.project_urls = {
+            'Link One': 'https://example.com/one/',
+            'Link Two': 'https://example.com/two/',
+        }
+
+    @patch.object(_Distribution, '__init__', autospec=True)
+    def test_external_setters(self, mock_parent_init, tmpdir):
+        mock_parent_init.side_effect = self._fake_distribution_init
+
+        dist = Distribution(attrs={'project_urls': {'will_be': 'ignored'}})
+
+        assert dist.metadata.long_description_content_type == 'text/something'
+        assert dist.metadata.project_urls == {
+            'Link One': 'https://example.com/one/',
+            'Link Two': 'https://example.com/two/',
+        }
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/indexes/test_links_priority/external.html b/python/user_packages/Python313/site-packages/setuptools/tests/indexes/test_links_priority/external.html
new file mode 100644
index 0000000000000000000000000000000000000000..92e4702f634dfb37a404bec3103b76f6afcaa917
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/indexes/test_links_priority/external.html
@@ -0,0 +1,3 @@
+
+bad old link
+
diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/indexes/test_links_priority/simple/foobar/index.html b/python/user_packages/Python313/site-packages/setuptools/tests/indexes/test_links_priority/simple/foobar/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..fefb028bd3ee7d45a414d6e96a7b2a21ffd7eda7
--- /dev/null
+++ b/python/user_packages/Python313/site-packages/setuptools/tests/indexes/test_links_priority/simple/foobar/index.html
@@ -0,0 +1,4 @@
+
+foobar-0.1.tar.gz
+external homepage
+ diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/__init__.py b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/__init__.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1e72348e1fdca97a0cf2b4658d7a2eec5a33e9bc Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/__init__.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/helpers.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/helpers.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a61b26b92a76a6bede546ae78f4758e40e753467 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/helpers.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/test_pbr.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/test_pbr.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9d7c5562bbcf67f77b710c80d286a5eced1bcad Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/test_pbr.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/test_pip_install_sdist.cpython-313.pyc b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/test_pip_install_sdist.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..40680de9eeb375c20a735956bd62bbb3e28e4c57 Binary files /dev/null and b/python/user_packages/Python313/site-packages/setuptools/tests/integration/__pycache__/test_pip_install_sdist.cpython-313.pyc differ diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/helpers.py b/python/user_packages/Python313/site-packages/setuptools/tests/integration/helpers.py new file mode 100644 index 0000000000000000000000000000000000000000..16b13022913f62ba86df6b2480d22e3119cdb8cc --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/tests/integration/helpers.py @@ -0,0 +1,80 @@ +"""Reusable functions and classes for different types of integration tests. + +For example ``Archive`` can be used to check the contents of distribution built +with setuptools, and ``run`` will always try to be as verbose as possible to +facilitate debugging. +""" + +from __future__ import annotations + +import os +import subprocess +import tarfile +from collections.abc import Iterator +from pathlib import Path +from zipfile import ZipFile, ZipInfo + + +def run(cmd, env=None): + r = subprocess.run( + cmd, + capture_output=True, + text=True, + encoding="utf-8", + env={**os.environ, **(env or {})}, + # ^-- allow overwriting instead of discarding the current env + ) + + out = r.stdout + "\n" + r.stderr + # pytest omits stdout/err by default, if the test fails they help debugging + print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + print(f"Command: {cmd}\nreturn code: {r.returncode}\n\n{out}") + + if r.returncode == 0: + return out + raise subprocess.CalledProcessError(r.returncode, cmd, r.stdout, r.stderr) + + +class Archive: + """Compatibility layer for ZipFile/Info and TarFile/Info""" + + def __init__(self, filename) -> None: + self._filename = filename + if filename.endswith("tar.gz"): + self._obj: tarfile.TarFile | ZipFile = tarfile.open(filename, "r:gz") + elif filename.endswith("zip"): + self._obj = ZipFile(filename) + else: + raise ValueError(f"{filename} doesn't seem to be a zip or tar.gz") + + def __iter__(self) -> Iterator[ZipInfo] | Iterator[tarfile.TarInfo]: + if hasattr(self._obj, "infolist"): + return iter(self._obj.infolist()) + return iter(self._obj) + + def get_name(self, zip_or_tar_info): + if hasattr(zip_or_tar_info, "filename"): + return zip_or_tar_info.filename + return zip_or_tar_info.name + + def get_content(self, zip_or_tar_info): + if hasattr(self._obj, "extractfile"): + content = self._obj.extractfile(zip_or_tar_info) + if content is None: + msg = f"Invalid {zip_or_tar_info.name} in {self._filename}" + raise ValueError(msg) + return str(content.read(), "utf-8") + return str(self._obj.read(zip_or_tar_info), "utf-8") + + +def get_sdist_members(sdist_path): + with tarfile.open(sdist_path, "r:gz") as tar: + files = [Path(f) for f in tar.getnames()] + # remove root folder + relative_files = ("/".join(f.parts[1:]) for f in files) + return {f for f in relative_files if f} + + +def get_wheel_members(wheel_path): + with ZipFile(wheel_path) as zipfile: + return set(zipfile.namelist()) diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/test_pbr.py b/python/user_packages/Python313/site-packages/setuptools/tests/integration/test_pbr.py new file mode 100644 index 0000000000000000000000000000000000000000..f89e5b8b2151430d0994836dd609f1b75490a336 --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/tests/integration/test_pbr.py @@ -0,0 +1,20 @@ +import subprocess + +import pytest + + +@pytest.mark.uses_network +def test_pbr_integration(pbr_package, venv): + """Ensure pbr packages install.""" + cmd = [ + 'python', + '-m', + 'pip', + '-v', + 'install', + '--no-build-isolation', + pbr_package, + ] + venv.run(cmd, stderr=subprocess.STDOUT) + out = venv.run(["python", "-c", "import mypkg.hello"]) + assert "Hello world!" in out diff --git a/python/user_packages/Python313/site-packages/setuptools/tests/integration/test_pip_install_sdist.py b/python/user_packages/Python313/site-packages/setuptools/tests/integration/test_pip_install_sdist.py new file mode 100644 index 0000000000000000000000000000000000000000..4e84f218323e6ad67adfbce07cea5a16e91a311c --- /dev/null +++ b/python/user_packages/Python313/site-packages/setuptools/tests/integration/test_pip_install_sdist.py @@ -0,0 +1,223 @@ +# https://github.com/python/mypy/issues/16936 +# mypy: disable-error-code="has-type" +"""Integration tests for setuptools that focus on building packages via pip. + +The idea behind these tests is not to exhaustively check all the possible +combinations of packages, operating systems, supporting libraries, etc, but +rather check a limited number of popular packages and how they interact with +the exposed public API. This way if any change in API is introduced, we hope to +identify backward compatibility problems before publishing a release. + +The number of tested packages is purposefully kept small, to minimise duration +and the associated maintenance cost (changes in the way these packages define +their build process may require changes in the tests). +""" + +import json +import os +import shutil +import sys +from enum import Enum +from glob import glob +from hashlib import md5 +from urllib.request import urlopen + +import pytest +from packaging.requirements import Requirement + +from .helpers import Archive, run + +pytestmark = pytest.mark.integration + + +(LATEST,) = Enum("v", "LATEST") # type: ignore[misc] # https://github.com/python/mypy/issues/16936 +"""Default version to be checked""" +# There are positive and negative aspects of checking the latest version of the +# packages. +# The main positive aspect is that the latest version might have already +# removed the use of APIs deprecated in previous releases of setuptools. + + +# Packages to be tested: +# (Please notice the test environment cannot support EVERY library required for +# compiling binary extensions. In Ubuntu/Debian nomenclature, we only assume +# that `build-essential`, `gfortran` and `libopenblas-dev` are installed, +# due to their relevance to the numerical/scientific programming ecosystem) +EXAMPLES = [ + ("pip", LATEST), # just in case... + ("pytest", LATEST), # uses setuptools_scm + ("mypy", LATEST), # custom build_py + ext_modules + # --- Popular packages: https://hugovk.github.io/top-pypi-packages/ --- + ("botocore", LATEST), + ("kiwisolver", LATEST), # build_ext + ("brotli", LATEST), # not in the list but used by urllib3 + ("pyyaml", LATEST), # cython + custom build_ext + custom distclass + ("charset-normalizer", LATEST), # uses mypyc, used by aiohttp + ("protobuf", LATEST), + # ("requests", LATEST), # XXX: https://github.com/psf/requests/pull/6920 + ("celery", LATEST), + # When adding packages to this list, make sure they expose a `__version__` + # attribute, or modify the tests below +] + + +# Some packages have "optional" dependencies that modify their build behaviour +# and are not listed in pyproject.toml, others still use `setup_requires` +EXTRA_BUILD_DEPS = { + "pyyaml": ("Cython<3.0",), # constraint to avoid errors + "charset-normalizer": ("mypy>=1.4.1",), # no pyproject.toml available +} + +EXTRA_ENV_VARS = { + "pyyaml": {"PYYAML_FORCE_CYTHON": "1"}, + "charset-normalizer": {"CHARSET_NORMALIZER_USE_MYPYC": "1"}, +} + +IMPORT_NAME = { + "pyyaml": "yaml", + "protobuf": "google.protobuf", +} + + +VIRTUALENV = (sys.executable, "-m", "virtualenv") + + +# By default, pip will try to build packages in isolation (PEP 517), which +# means it will download the previous stable version of setuptools. +# `pip` flags can avoid that (the version of setuptools under test +# should be the one to be used) +INSTALL_OPTIONS = ( + "--ignore-installed", + "--no-build-isolation", + # Omit "--no-binary :all:" the sdist is supplied directly. + # Allows dependencies as wheels. +) +# The downside of `--no-build-isolation` is that pip will not download build +# dependencies. The test script will have to also handle that. + + +@pytest.fixture +def venv_python(tmp_path): + run([*VIRTUALENV, str(tmp_path / ".venv")]) + possible_path = (str(p.parent) for p in tmp_path.glob(".venv/*/python*")) + return shutil.which("python", path=os.pathsep.join(possible_path)) + + +@pytest.fixture(autouse=True) +def _prepare(tmp_path, venv_python, monkeypatch): + download_path = os.getenv("DOWNLOAD_PATH", str(tmp_path)) + os.makedirs(download_path, exist_ok=True) + + # Environment vars used for building some of the packages + monkeypatch.setenv("USE_MYPYC", "1") + + yield + + # Let's provide the maximum amount of information possible in the case + # it is necessary to debug the tests directly from the CI logs. + print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + print("Temporary directory:") + map(print, tmp_path.glob("*")) + print("Virtual environment:") + run([venv_python, "-m", "pip", "freeze"]) + + +@pytest.mark.parametrize(("package", "version"), EXAMPLES) +@pytest.mark.uses_network +def test_install_sdist(package, version, tmp_path, venv_python, setuptools_wheel): + venv_pip = (venv_python, "-m", "pip") + sdist = retrieve_sdist(package, version, tmp_path) + deps = build_deps(package, sdist) + if deps: + print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + print("Dependencies:", deps) + run([*venv_pip, "install", *deps]) + + # Use a virtualenv to simulate PEP 517 isolation + # but install fresh setuptools wheel to ensure the version under development + env = EXTRA_ENV_VARS.get(package, {}) + run([*venv_pip, "install", "--force-reinstall", setuptools_wheel]) + run([*venv_pip, "install", *INSTALL_OPTIONS, sdist], env) + + # Execute a simple script to make sure the package was installed correctly + pkg = IMPORT_NAME.get(package, package).replace("-", "_") + script = f"import {pkg}; print(getattr({pkg}, '__version__', 0))" + run([venv_python, "-c", script]) + + +# ---- Helper Functions ---- + + +def retrieve_sdist(package, version, tmp_path): + """Either use cached sdist file or download it from PyPI""" + # `pip download` cannot be used due to + # https://github.com/pypa/pip/issues/1884 + # https://discuss.python.org/t/pep-625-file-name-of-a-source-distribution/4686 + # We have to find the correct distribution file and download it + download_path = os.getenv("DOWNLOAD_PATH", str(tmp_path)) + dist = retrieve_pypi_sdist_metadata(package, version) + + # Remove old files to prevent cache to grow indefinitely + for file in glob(os.path.join(download_path, f"{package}*")): + if dist["filename"] != file: + os.unlink(file) + + dist_file = os.path.join(download_path, dist["filename"]) + if not os.path.exists(dist_file): + download(dist["url"], dist_file, dist["md5_digest"]) + return dist_file + + +def retrieve_pypi_sdist_metadata(package, version): + # https://warehouse.pypa.io/api-reference/json.html + id_ = package if version is LATEST else f"{package}/{version}" + with urlopen(f"https://pypi.org/pypi/{id_}/json") as f: + metadata = json.load(f) + + if metadata["info"]["yanked"]: + raise ValueError(f"Release for {package} {version} was yanked") + + version = metadata["info"]["version"] + release = metadata["releases"][version] if version is LATEST else metadata["urls"] + (sdist,) = filter(lambda d: d["packagetype"] == "sdist", release) + return sdist + + +def download(url, dest, md5_digest): + with urlopen(url) as f: + data = f.read() + + assert md5(data).hexdigest() == md5_digest + + with open(dest, "wb") as f: + f.write(data) + + assert os.path.exists(dest) + + +def build_deps(package, sdist_file): + """Find out what are the build dependencies for a package. + + "Manually" install them, since pip will not install build + deps with `--no-build-isolation`. + """ + # delay importing, since pytest discovery phase may hit this file from a + # testenv without tomli + from setuptools.compat.py310 import tomllib + + archive = Archive(sdist_file) + info = tomllib.loads(_read_pyproject(archive)) + deps = info.get("build-system", {}).get("requires", []) + deps += EXTRA_BUILD_DEPS.get(package, []) + # Remove setuptools from requirements (and deduplicate) + requirements = {Requirement(d).name: d for d in deps} + return [v for k, v in requirements.items() if k != "setuptools"] + + +def _read_pyproject(archive): + contents = ( + archive.get_content(member) + for member in archive + if os.path.basename(archive.get_name(member)) == "pyproject.toml" + ) + return next(contents, "")

' : '\U0001d4ab', + '\\' : '\U0001d4ac', + '\\' : '\U0000211b', + '\\' : '\U0001d4ae', + '\\' : '\U0001d4af', + '\\' : '\U0001d4b0', + '\\' : '\U0001d4b1', + '\\' : '\U0001d4b2', + '\\' : '\U0001d4b3', + '\\' : '\U0001d4b4', + '\\' : '\U0001d4b5', + '\\' : '\U0001d5ba', + '\\' : '\U0001d5bb', + '\\' : '\U0001d5bc', + '\\' : '\U0001d5bd', + '\\' : '\U0001d5be', + '\\' : '\U0001d5bf', + '\\' : '\U0001d5c0', + '\\' : '\U0001d5c1', + '\\' : '\U0001d5c2', + '\\' : '\U0001d5c3', + '\\' : '\U0001d5c4', + '\\' : '\U0001d5c5', + '\\' : '\U0001d5c6', + '\\' : '\U0001d5c7', + '\\' : '\U0001d5c8', + '\\

' : '\U0001d4ab', + '\\' : '\U0001d4ac', + '\\' : '\U0000211b', + '\\' : '\U0001d4ae', + '\\' : '\U0001d4af', + '\\' : '\U0001d4b0', + '\\' : '\U0001d4b1', + '\\' : '\U0001d4b2', + '\\' : '\U0001d4b3', + '\\' : '\U0001d4b4', + '\\' : '\U0001d4b5', + '\\' : '\U0001d5ba', + '\\' : '\U0001d5bb', + '\\' : '\U0001d5bc', + '\\' : '\U0001d5bd', + '\\' : '\U0001d5be', + '\\' : '\U0001d5bf', + '\\' : '\U0001d5c0', + '\\' : '\U0001d5c1', + '\\' : '\U0001d5c2', + '\\' : '\U0001d5c3', + '\\' : '\U0001d5c4', + '\\' : '\U0001d5c5', + '\\' : '\U0001d5c6', + '\\' : '\U0001d5c7', + '\\' : '\U0001d5c8', + '\\