├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── COPYING.txt ├── addon ├── globalPlugins │ └── chessmart │ │ ├── __init__.py │ │ ├── algebraic_type.py │ │ ├── bin │ │ ├── fairy_stockfish │ │ │ ├── AUTHORS │ │ │ ├── Copying.txt │ │ │ └── fairy-stockfish-largeboard_x86-64.exe │ │ ├── rsvg_convert │ │ │ ├── COPYING │ │ │ ├── etc │ │ │ │ └── fonts │ │ │ │ │ ├── conf.d │ │ │ │ │ ├── 10-base-rendering.conf │ │ │ │ │ ├── 10-scale-bitmap-fonts.conf │ │ │ │ │ ├── 20-unhint-small-dejavu-sans-mono.conf │ │ │ │ │ ├── 20-unhint-small-dejavu-sans.conf │ │ │ │ │ ├── 20-unhint-small-dejavu-serif.conf │ │ │ │ │ ├── 20-unhint-small-vera.conf │ │ │ │ │ ├── 28-user.conf │ │ │ │ │ ├── 29-local.conf │ │ │ │ │ ├── 30-metric-aliases.conf │ │ │ │ │ ├── 30-urw-aliases.conf │ │ │ │ │ ├── 31-cantarell.conf │ │ │ │ │ ├── 35-repl-custom.conf │ │ │ │ │ ├── 37-repl-webfonts.conf │ │ │ │ │ ├── 38-repl-webfonts-custom.conf │ │ │ │ │ ├── 40-non-latin-microsoft.conf │ │ │ │ │ ├── 40-non-latin-misc.conf │ │ │ │ │ ├── 40-nonlatin.conf │ │ │ │ │ ├── 45-latin-microsoft.conf │ │ │ │ │ ├── 45-latin-misc.conf │ │ │ │ │ ├── 45-latin.conf │ │ │ │ │ ├── 49-sansserif.conf │ │ │ │ │ ├── 50-user.conf │ │ │ │ │ ├── 51-local.conf │ │ │ │ │ ├── 57-dejavu-sans-mono.conf │ │ │ │ │ ├── 57-dejavu-sans.conf │ │ │ │ │ ├── 57-dejavu-serif.conf │ │ │ │ │ ├── 60-latin.conf │ │ │ │ │ ├── 65-fonts-persian.conf │ │ │ │ │ ├── 65-nonlatin.conf │ │ │ │ │ ├── 67-override-aliases.conf │ │ │ │ │ ├── 68-override.conf │ │ │ │ │ ├── 69-unifont.conf │ │ │ │ │ ├── 80-delicious.conf │ │ │ │ │ ├── 82-no-embedded-bitmaps.conf │ │ │ │ │ ├── 82-no-force-autohint.conf │ │ │ │ │ ├── 82-no-ttf-as-bitmap.conf │ │ │ │ │ ├── 83-yes-bitmaps.conf │ │ │ │ │ ├── 83-yes-postscript.conf │ │ │ │ │ ├── 88-forced-synthetic.conf │ │ │ │ │ ├── 90-non-tt-fonts.conf │ │ │ │ │ ├── 90-synthetic.conf │ │ │ │ │ ├── 90-tt-fonts-microsoft.conf │ │ │ │ │ ├── 90-tt-fonts-misc.conf │ │ │ │ │ ├── 92-selective-rendering-microsoft.conf │ │ │ │ │ ├── 92-selective-rendering-misc.conf │ │ │ │ │ ├── 93-final-rendering.conf │ │ │ │ │ ├── 94-no-synthetic.conf │ │ │ │ │ ├── 95-reject.conf │ │ │ │ │ ├── 97-selective-rendering-custom.conf │ │ │ │ │ └── README │ │ │ │ │ └── fonts.conf │ │ │ └── rsvg_convert.exe │ │ └── stockfish_14 │ │ │ ├── AUTHORS │ │ │ ├── Copying.txt │ │ │ ├── info.txt │ │ │ └── stockfish_14_32bit.exe │ │ ├── chessboard.py │ │ ├── concurrency.py │ │ ├── game_elements.py │ │ ├── graphical_interface │ │ ├── __init__.py │ │ ├── components.py │ │ └── new_game_dialog.py │ │ ├── helpers.py │ │ ├── ibca_notation.py │ │ ├── internet_chess │ │ ├── __init__.py │ │ ├── abstract │ │ │ ├── __init__.py │ │ │ ├── client.py │ │ │ ├── events.py │ │ │ └── exceptions.py │ │ └── lichess.py │ │ ├── lib │ │ ├── _asyncio.pyd │ │ ├── _multiprocessing.pyd │ │ ├── _overlapped.pyd │ │ ├── asyncio │ │ │ ├── __init__.py │ │ │ ├── base_events.py │ │ │ ├── base_futures.py │ │ │ ├── base_subprocess.py │ │ │ ├── base_tasks.py │ │ │ ├── constants.py │ │ │ ├── coroutines.py │ │ │ ├── events.py │ │ │ ├── format_helpers.py │ │ │ ├── futures.py │ │ │ ├── locks.py │ │ │ ├── log.py │ │ │ ├── proactor_events.py │ │ │ ├── protocols.py │ │ │ ├── queues.py │ │ │ ├── runners.py │ │ │ ├── selector_events.py │ │ │ ├── sslproto.py │ │ │ ├── streams.py │ │ │ ├── subprocess.py │ │ │ ├── tasks.py │ │ │ ├── transports.py │ │ │ ├── unix_events.py │ │ │ ├── windows_events.py │ │ │ └── windows_utils.py │ │ ├── blinker │ │ │ ├── __init__.py │ │ │ ├── _async.py │ │ │ ├── _saferef.py │ │ │ ├── _utilities.py │ │ │ └── base.py │ │ ├── cached_property.py │ │ ├── chess │ │ │ ├── __init__.py │ │ │ ├── _interactive.py │ │ │ ├── engine.py │ │ │ ├── gaviota.py │ │ │ ├── pgn.py │ │ │ ├── polyglot.py │ │ │ ├── py.typed │ │ │ ├── svg.py │ │ │ ├── syzygy.py │ │ │ └── variant.py │ │ ├── chess_clock │ │ │ ├── __init__.py │ │ │ └── chess_clock.py │ │ ├── concurrent │ │ │ ├── __init__.py │ │ │ └── futures │ │ │ │ ├── __init__.py │ │ │ │ ├── _base.py │ │ │ │ ├── process.py │ │ │ │ └── thread.py │ │ ├── http │ │ │ ├── __init__.py │ │ │ ├── client.py │ │ │ ├── cookiejar.py │ │ │ ├── cookies.py │ │ │ └── server.py │ │ ├── lichess │ │ │ ├── aiohttp │ │ │ │ ├── .hash │ │ │ │ │ ├── _cparser.pxd.hash │ │ │ │ │ ├── _find_header.pxd.hash │ │ │ │ │ ├── _frozenlist.pyx.hash │ │ │ │ │ ├── _helpers.pyi.hash │ │ │ │ │ ├── _helpers.pyx.hash │ │ │ │ │ ├── _http_parser.pyx.hash │ │ │ │ │ ├── _http_writer.pyx.hash │ │ │ │ │ ├── _websocket.pyx.hash │ │ │ │ │ ├── frozenlist.pyi.hash │ │ │ │ │ ├── hdrs.py.hash │ │ │ │ │ └── signals.pyi.hash │ │ │ │ ├── __init__.py │ │ │ │ ├── _cparser.pxd │ │ │ │ ├── _find_header.c │ │ │ │ ├── _find_header.h │ │ │ │ ├── _find_header.pxd │ │ │ │ ├── _frozenlist.c │ │ │ │ ├── _frozenlist.cp37-win32.pyd │ │ │ │ ├── _frozenlist.pyx │ │ │ │ ├── _headers.pxi │ │ │ │ ├── _helpers.c │ │ │ │ ├── _helpers.cp37-win32.pyd │ │ │ │ ├── _helpers.pyi │ │ │ │ ├── _helpers.pyx │ │ │ │ ├── _http_parser.c │ │ │ │ ├── _http_parser.cp37-win32.pyd │ │ │ │ ├── _http_parser.pyx │ │ │ │ ├── _http_writer.c │ │ │ │ ├── _http_writer.cp37-win32.pyd │ │ │ │ ├── _http_writer.pyx │ │ │ │ ├── _websocket.c │ │ │ │ ├── _websocket.cp37-win32.pyd │ │ │ │ ├── _websocket.pyx │ │ │ │ ├── abc.py │ │ │ │ ├── base_protocol.py │ │ │ │ ├── client.py │ │ │ │ ├── client_exceptions.py │ │ │ │ ├── client_proto.py │ │ │ │ ├── client_reqrep.py │ │ │ │ ├── client_ws.py │ │ │ │ ├── connector.py │ │ │ │ ├── cookiejar.py │ │ │ │ ├── formdata.py │ │ │ │ ├── frozenlist.py │ │ │ │ ├── frozenlist.pyi │ │ │ │ ├── hdrs.py │ │ │ │ ├── helpers.py │ │ │ │ ├── http.py │ │ │ │ ├── http_exceptions.py │ │ │ │ ├── http_parser.py │ │ │ │ ├── http_websocket.py │ │ │ │ ├── http_writer.py │ │ │ │ ├── locks.py │ │ │ │ ├── log.py │ │ │ │ ├── multipart.py │ │ │ │ ├── payload.py │ │ │ │ ├── payload_streamer.py │ │ │ │ ├── py.typed │ │ │ │ ├── pytest_plugin.py │ │ │ │ ├── resolver.py │ │ │ │ ├── signals.py │ │ │ │ ├── signals.pyi │ │ │ │ ├── streams.py │ │ │ │ ├── tcp_helpers.py │ │ │ │ ├── test_utils.py │ │ │ │ ├── tracing.py │ │ │ │ ├── typedefs.py │ │ │ │ ├── web.py │ │ │ │ ├── web_app.py │ │ │ │ ├── web_exceptions.py │ │ │ │ ├── web_fileresponse.py │ │ │ │ ├── web_log.py │ │ │ │ ├── web_middlewares.py │ │ │ │ ├── web_protocol.py │ │ │ │ ├── web_request.py │ │ │ │ ├── web_response.py │ │ │ │ ├── web_routedef.py │ │ │ │ ├── web_runner.py │ │ │ │ ├── web_server.py │ │ │ │ ├── web_urldispatcher.py │ │ │ │ ├── web_ws.py │ │ │ │ └── worker.py │ │ │ ├── async_timeout │ │ │ │ ├── __init__.py │ │ │ │ └── py.typed │ │ │ ├── attr │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyi │ │ │ │ ├── _cmp.py │ │ │ │ ├── _cmp.pyi │ │ │ │ ├── _compat.py │ │ │ │ ├── _config.py │ │ │ │ ├── _funcs.py │ │ │ │ ├── _make.py │ │ │ │ ├── _next_gen.py │ │ │ │ ├── _version_info.py │ │ │ │ ├── _version_info.pyi │ │ │ │ ├── converters.py │ │ │ │ ├── converters.pyi │ │ │ │ ├── exceptions.py │ │ │ │ ├── exceptions.pyi │ │ │ │ ├── filters.py │ │ │ │ ├── filters.pyi │ │ │ │ ├── py.typed │ │ │ │ ├── setters.py │ │ │ │ ├── setters.pyi │ │ │ │ ├── validators.py │ │ │ │ └── validators.pyi │ │ │ ├── cgi.py │ │ │ ├── chardet │ │ │ │ ├── __init__.py │ │ │ │ ├── big5freq.py │ │ │ │ ├── big5prober.py │ │ │ │ ├── chardistribution.py │ │ │ │ ├── charsetgroupprober.py │ │ │ │ ├── charsetprober.py │ │ │ │ ├── cli │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── chardetect.py │ │ │ │ ├── codingstatemachine.py │ │ │ │ ├── compat.py │ │ │ │ ├── cp949prober.py │ │ │ │ ├── enums.py │ │ │ │ ├── escprober.py │ │ │ │ ├── escsm.py │ │ │ │ ├── eucjpprober.py │ │ │ │ ├── euckrfreq.py │ │ │ │ ├── euckrprober.py │ │ │ │ ├── euctwfreq.py │ │ │ │ ├── euctwprober.py │ │ │ │ ├── gb2312freq.py │ │ │ │ ├── gb2312prober.py │ │ │ │ ├── hebrewprober.py │ │ │ │ ├── jisfreq.py │ │ │ │ ├── jpcntx.py │ │ │ │ ├── langbulgarianmodel.py │ │ │ │ ├── langgreekmodel.py │ │ │ │ ├── langhebrewmodel.py │ │ │ │ ├── langhungarianmodel.py │ │ │ │ ├── langrussianmodel.py │ │ │ │ ├── langthaimodel.py │ │ │ │ ├── langturkishmodel.py │ │ │ │ ├── latin1prober.py │ │ │ │ ├── mbcharsetprober.py │ │ │ │ ├── mbcsgroupprober.py │ │ │ │ ├── mbcssm.py │ │ │ │ ├── metadata │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── languages.py │ │ │ │ ├── sbcharsetprober.py │ │ │ │ ├── sbcsgroupprober.py │ │ │ │ ├── sjisprober.py │ │ │ │ ├── universaldetector.py │ │ │ │ ├── utf8prober.py │ │ │ │ └── version.py │ │ │ ├── idna │ │ │ │ ├── __init__.py │ │ │ │ ├── codec.py │ │ │ │ ├── compat.py │ │ │ │ ├── core.py │ │ │ │ ├── idnadata.py │ │ │ │ ├── intranges.py │ │ │ │ ├── package_data.py │ │ │ │ ├── py.typed │ │ │ │ └── uts46data.py │ │ │ ├── ipaddress.py │ │ │ ├── lichess_client │ │ │ │ ├── __init__.py │ │ │ │ ├── abstract_endpoints │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── abstract_account.py │ │ │ │ │ ├── abstract_boards.py │ │ │ │ │ ├── abstract_bots.py │ │ │ │ │ ├── abstract_broadcast.py │ │ │ │ │ ├── abstract_challenges.py │ │ │ │ │ ├── abstract_chess_bot.py │ │ │ │ │ ├── abstract_games.py │ │ │ │ │ ├── abstract_messaging.py │ │ │ │ │ ├── abstract_relations.py │ │ │ │ │ ├── abstract_simulations.py │ │ │ │ │ ├── abstract_studies.py │ │ │ │ │ ├── abstract_teams.py │ │ │ │ │ ├── abstract_tournaments.py │ │ │ │ │ └── abstract_users.py │ │ │ │ ├── clients │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── abstract_client.py │ │ │ │ │ ├── base_client.py │ │ │ │ │ └── client.py │ │ │ │ ├── endpoints │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── account.py │ │ │ │ │ ├── boards.py │ │ │ │ │ ├── bots.py │ │ │ │ │ ├── broadcast.py │ │ │ │ │ ├── challenges.py │ │ │ │ │ ├── chess_bot.py │ │ │ │ │ ├── games.py │ │ │ │ │ ├── messaging.py │ │ │ │ │ ├── relations.py │ │ │ │ │ ├── simulations.py │ │ │ │ │ ├── studies.py │ │ │ │ │ ├── teams.py │ │ │ │ │ ├── tournaments.py │ │ │ │ │ └── users.py │ │ │ │ ├── helpers │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── response_helpers.py │ │ │ │ └── utils │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── client_errors.py │ │ │ │ │ ├── enums.py │ │ │ │ │ └── hrefs.py │ │ │ ├── multidict │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyi │ │ │ │ ├── _abc.py │ │ │ │ ├── _compat.py │ │ │ │ ├── _multidict.c │ │ │ │ ├── _multidict.cp37-win32.pyd │ │ │ │ ├── _multidict_base.py │ │ │ │ ├── _multidict_py.py │ │ │ │ ├── _multilib │ │ │ │ │ ├── defs.h │ │ │ │ │ ├── dict.h │ │ │ │ │ ├── istr.h │ │ │ │ │ ├── iter.h │ │ │ │ │ ├── pair_list.h │ │ │ │ │ └── views.h │ │ │ │ └── py.typed │ │ │ ├── ndjson │ │ │ │ ├── __init__.py │ │ │ │ ├── api.py │ │ │ │ └── codecs.py │ │ │ ├── pathlib.py │ │ │ ├── typing_extensions.py │ │ │ └── yarl │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyi │ │ │ │ ├── _quoting.py │ │ │ │ ├── _quoting_c.c │ │ │ │ ├── _quoting_c.cp37-win32.pyd │ │ │ │ ├── _quoting_c.pyi │ │ │ │ ├── _quoting_c.pyx │ │ │ │ ├── _quoting_py.py │ │ │ │ ├── _url.py │ │ │ │ └── py.typed │ │ ├── old_time_control.py │ │ ├── opnieuw │ │ │ ├── __init__.py │ │ │ ├── clock.py │ │ │ ├── exceptions.py │ │ │ ├── py.typed │ │ │ ├── retries.py │ │ │ └── test_util.py │ │ ├── sqlite │ │ │ ├── apsw.cp37-win32.pyd │ │ │ ├── peewee.py │ │ │ └── playhouse │ │ │ │ ├── __init__.py │ │ │ │ ├── apsw_ext.py │ │ │ │ └── sqlite_ext.py │ │ ├── wx_lib_sized_controls.py │ │ ├── wx_svg │ │ │ ├── __init__.py │ │ │ └── _nanosvg.cp37-win32.pyd │ │ └── xml │ │ │ ├── __init__.py │ │ │ ├── dom │ │ │ ├── NodeFilter.py │ │ │ ├── __init__.py │ │ │ ├── domreg.py │ │ │ ├── expatbuilder.py │ │ │ ├── minicompat.py │ │ │ ├── minidom.py │ │ │ ├── pulldom.py │ │ │ └── xmlbuilder.py │ │ │ ├── etree │ │ │ ├── ElementInclude.py │ │ │ ├── ElementPath.py │ │ │ ├── ElementTree.py │ │ │ ├── __init__.py │ │ │ └── cElementTree.py │ │ │ ├── parsers │ │ │ ├── __init__.py │ │ │ └── expat.py │ │ │ └── sax │ │ │ ├── __init__.py │ │ │ ├── _exceptions.py │ │ │ ├── expatreader.py │ │ │ ├── handler.py │ │ │ ├── saxutils.py │ │ │ └── xmlreader.py │ │ ├── puzzle_database │ │ ├── __init__.py │ │ ├── lichess.puzzles.mini.sqlite │ │ └── models.py │ │ ├── signals.py │ │ ├── sounds │ │ ├── black_square.wav │ │ ├── capture.wav │ │ ├── castling.wav │ │ ├── chat.wav │ │ ├── check.wav │ │ ├── chess_pieces.wav │ │ ├── drawn.wav │ │ ├── drop_move.wav │ │ ├── drop_piece.wav │ │ ├── drop_target.wav │ │ ├── en_passant.wav │ │ ├── error.wav │ │ ├── game_over.wav │ │ ├── invalid.wav │ │ ├── menu_open.wav │ │ ├── pick_piece.wav │ │ ├── promotion.wav │ │ ├── puzzle_solved.wav │ │ ├── request_promotion.wav │ │ ├── resigned.wav │ │ ├── score_list_close.wav │ │ ├── score_list_open.wav │ │ ├── start_game.wav │ │ ├── time_critical.wav │ │ ├── time_forfeit.wav │ │ ├── time_pass.wav │ │ └── you_won.wav │ │ ├── spoken_messages.py │ │ ├── time_control.py │ │ └── virtual_chessboard │ │ ├── __init__.py │ │ ├── base.py │ │ ├── internet_chessboard.py │ │ ├── pgn_player.py │ │ ├── puzzle_board.py │ │ ├── ui_components.py │ │ ├── user_driven.py │ │ ├── user_engine.py │ │ └── user_user.py └── locale │ └── .gitkeep ├── buildVars.py ├── manifest-translated.ini.tpl ├── manifest.ini.tpl ├── readme.md ├── sconstruct ├── site_scons └── site_tools │ └── gettexttool │ └── __init__.py └── style.css /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Try to ensure that po files in the repo does not include 5 | # source code line numbers. 6 | # Every person expected to commit po files should change their personal config file as described here: 7 | # https://mail.gnome.org/archives/kupfer-list/2010-June/msg00002.html 8 | *.po filter=cleanpo 9 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build add-on 2 | 3 | on: 4 | push: 5 | tags: ["v*"] 6 | 7 | jobs: 8 | build: 9 | runs-on: windows-latest 10 | steps: 11 | - name: Checkout code 12 | uses: actions/checkout@v2 13 | - name: setup python 14 | uses: actions/setup-python@v2 15 | with: 16 | python-version: '3.9' 17 | architecture: 'x64' 18 | - name: Update pip 19 | run: python -m pip install --upgrade pip setuptools wheel 20 | - name: Install dependencies 21 | run: python -m pip install scons Markdown 22 | - name: Build add-on file 23 | run: scons 24 | - name: Upload artifacts 25 | uses: actions/upload-artifact@v2 26 | with: 27 | name: chessmart.nvda-addon 28 | path: "*.nvda-addon" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | addon/doc/*.css 2 | addon/doc/en/ 3 | *_docHandler.py 4 | *.html 5 | *.ini 6 | *.mo 7 | *.pot 8 | *.py[co] 9 | *.nvda-addon 10 | .sconsign.dblite 11 | 12 | # pip related stuff 13 | Pipfile 14 | Pipfile.lock 15 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/algebraic_type.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import types 4 | import dataclasses 5 | 6 | 7 | class Variant: 8 | """Provides member definition""" 9 | 10 | def __init__(self, **kwargs): 11 | self.kwargs = kwargs 12 | 13 | def __call__(self, cls_type, name, bases=(), namespace=None): 14 | namespace = namespace or {} 15 | namespace["__member_name__"] = name 16 | namespace["__member_type__"] = cls_type 17 | return dataclasses.make_dataclass( 18 | name.title(), 19 | tuple(self.kwargs.items()), 20 | bases=bases, 21 | namespace=namespace, 22 | repr=True, 23 | frozen=True, 24 | ) 25 | 26 | 27 | class AlgebraicTypeMeta(type): 28 | def __repr__(cls): 29 | parent_cls = cls.__dict__.get("__member_type__") 30 | if parent_cls is None: 31 | return f"" 32 | return f"<{parent_cls.__name__}.{cls.__member_name__}>" 33 | 34 | 35 | class AlgebraicType(metaclass=AlgebraicTypeMeta): 36 | """Represents an algebraic type.""" 37 | 38 | @classmethod 39 | def __init_subclass__(cls, **kwargs): 40 | super().__init_subclass__(**kwargs) 41 | attributes = { 42 | key: value(cls, key, bases=(cls,)) 43 | for key, value in cls.__dict__.items() 44 | if isinstance(value, Variant) 45 | } 46 | for key, value in attributes.items(): 47 | setattr(cls, key, value) 48 | cls.__members__ = types.MappingProxyType(attributes) 49 | 50 | def of_type(self, variant): 51 | return isinstance(self, variant) 52 | 53 | def of_any_type_of(self, *it_types): 54 | return any(self.of_type(t) for t in it_types) 55 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/fairy_stockfish/fairy-stockfish-largeboard_x86-64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/bin/fairy_stockfish/fairy-stockfish-largeboard_x86-64.exe -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/10-base-rendering.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | rgb 9 | 10 | 11 | true 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | 19 | 20 | hintslight 21 | 22 | 23 | lcddefault 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/10-scale-bitmap-fonts.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | false 8 | 9 | 10 | 11 | pixelsize 12 | pixelsize 13 | 14 | 15 | 16 | 17 | 18 | false 19 | 20 | 21 | 22 | 23 | pixelsizefixupfactor 24 | 1.2 25 | 26 | 27 | pixelsizefixupfactor 28 | 0.8 29 | 30 | 31 | 32 | 33 | 37 | 38 | 39 | false 40 | 41 | 42 | 64 43 | 44 | 45 | true 46 | 47 | 48 | true 49 | 50 | 51 | 1.0 52 | 53 | 54 | 57 | 58 | 59 | false 60 | 61 | 62 | 1.0 63 | 64 | 65 | 66 | matrix 67 | 68 | pixelsizefixupfactor 0 69 | 0 pixelsizefixupfactor 70 | 71 | 72 | 73 | 74 | 75 | size 76 | pixelsizefixupfactor 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | DejaVu Sans Mono 18 | 19 | 20 | 7.5 21 | 22 | 23 | false 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | DejaVu Sans 18 | 19 | 20 | 7.5 21 | 22 | 23 | false 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | DejaVu Serif 18 | 19 | 20 | 7.5 21 | 22 | 23 | false 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/20-unhint-small-vera.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | Bitstream Vera Sans 15 | 16 | 17 | 7.5 18 | 19 | 20 | false 21 | 22 | 23 | 24 | 25 | 26 | Bitstream Vera Serif 27 | 28 | 29 | 7.5 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 37 | 38 | Bitstream Vera Sans Mono 39 | 40 | 41 | 7.5 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/28-user.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | fontconfig/conf.d 12 | fontconfig/fonts.conf 13 | 14 | 15 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/29-local.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | local.conf 7 | 8 | 9 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/30-urw-aliases.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | Zapf Dingbats 10 | Dingbats 11 | 12 | 13 | ITC Zapf Dingbats 14 | Dingbats 15 | 16 | 17 | 18 | Symbol 19 | 20 | 21 | Standard Symbols L 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/31-cantarell.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | Cantarell 13 | 14 | 15 | Cantarell 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/35-repl-custom.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 29 | 30 | 31 | 32 | 33 | 41 | 42 | 43 | 51 | 52 | 53 | 61 | 62 | 63 | 71 | 72 | 73 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/38-repl-webfonts-custom.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | @font-face:WEBFONT TO REPLACE 16 | 17 | 18 | LOCAL REPLACEMENT FONT 19 | 20 | 21 | 22 | 23 | @font-face:WEBFONT TO REPLACE 24 | 25 | 26 | LOCAL REPLACEMENT FONT 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/49-sansserif.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | sans-serif 9 | 10 | 11 | serif 12 | 13 | 14 | monospace 15 | 16 | 17 | sans-serif 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/50-user.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | fontconfig/conf.d 11 | fontconfig/fonts.conf 12 | 13 | ~/.fonts.conf.d 14 | ~/.fonts.conf 15 | 16 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/51-local.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | local.conf 6 | 7 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/57-dejavu-sans-mono.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | Bepa Mono 14 | 15 | DejaVu Sans Mono 16 | 17 | 18 | 19 | Bitstream Prima Sans Mono 20 | 21 | DejaVu Sans Mono 22 | 23 | 24 | 25 | Bitstream Vera Sans Mono 26 | 27 | DejaVu Sans Mono 28 | 29 | 30 | 31 | DejaVu LGC Sans Mono 32 | 33 | DejaVu Sans Mono 34 | 35 | 36 | 37 | Olwen Sans Mono 38 | 39 | DejaVu Sans Mono 40 | 41 | 42 | 43 | SUSE Sans Mono 44 | 45 | DejaVu Sans Mono 46 | 47 | 48 | 49 | 50 | DejaVu Sans Mono 51 | 52 | monospace 53 | 54 | 55 | 56 | 57 | monospace 58 | 59 | DejaVu Sans Mono 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/57-dejavu-sans.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | Arev Sans 14 | 15 | DejaVu Sans 16 | 17 | 18 | 19 | Bepa 20 | 21 | DejaVu Sans 22 | 23 | 24 | 25 | Bitstream Prima Sans 26 | 27 | DejaVu Sans 28 | 29 | 30 | 31 | Bitstream Vera Sans 32 | 33 | DejaVu Sans 34 | 35 | 36 | 37 | DejaVu LGC Sans 38 | 39 | DejaVu Sans 40 | 41 | 42 | 43 | Hunky Sans 44 | 45 | DejaVu Sans 46 | 47 | 48 | 49 | Olwen Sans 50 | 51 | DejaVu Sans 52 | 53 | 54 | 55 | SUSE Sans 56 | 57 | DejaVu Sans 58 | 59 | 60 | 61 | Verajja 62 | 63 | DejaVu Sans 64 | 65 | 66 | 67 | 68 | VerajjaPDA 69 | 70 | DejaVu Sans 71 | 72 | 73 | 74 | 75 | DejaVu Sans 76 | 77 | sans-serif 78 | 79 | 80 | 81 | 82 | sans-serif 83 | 84 | DejaVu Sans 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/57-dejavu-serif.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | Bitstream Prima Serif 14 | 15 | DejaVu Serif 16 | 17 | 18 | 19 | Bitstream Vera Serif 20 | 21 | DejaVu Serif 22 | 23 | 24 | 25 | DejaVu LGC Serif 26 | 27 | DejaVu Serif 28 | 29 | 30 | 31 | Hunky Serif 32 | 33 | DejaVu Serif 34 | 35 | 36 | 37 | Olwen Serif 38 | 39 | DejaVu Serif 40 | 41 | 42 | 43 | SUSE Serif 44 | 45 | DejaVu Serif 46 | 47 | 48 | 49 | 50 | Verajja Serif 51 | 52 | DejaVu Serif 53 | 54 | 55 | 56 | 57 | DejaVu Serif 58 | 59 | serif 60 | 61 | 62 | 63 | 64 | serif 65 | 66 | DejaVu Serif 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/60-latin.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | serif 6 | 7 | Bitstream Vera Serif 8 | DejaVu Serif 9 | Times New Roman 10 | Thorndale AMT 11 | Luxi Serif 12 | Nimbus Roman No9 L 13 | Times 14 | 15 | 16 | 17 | sans-serif 18 | 19 | Bitstream Vera Sans 20 | DejaVu Sans 21 | Verdana 22 | Arial 23 | Albany AMT 24 | Luxi Sans 25 | Nimbus Sans L 26 | Helvetica 27 | Lucida Sans Unicode 28 | BPG Glaho International 29 | Tahoma 30 | 31 | 32 | 33 | monospace 34 | 35 | Bitstream Vera Sans Mono 36 | DejaVu Sans Mono 37 | Inconsolata 38 | Andale Mono 39 | Courier New 40 | Cumberland AMT 41 | Luxi Mono 42 | Nimbus Mono L 43 | Courier 44 | 45 | 46 | 49 | 50 | fantasy 51 | 52 | Impact 53 | Copperplate Gothic Std 54 | Cooper Std 55 | Bauhaus Std 56 | 57 | 58 | 61 | 62 | cursive 63 | 64 | ITC Zapf Chancery Std 65 | Zapfino 66 | Comic Sans MS 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/67-override-aliases.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Inconsolata 8 | 9 | Inconsolata-zi4 10 | 11 | 12 | Inconsolatazi4 13 | 14 | 15 | Inconsolatazi4 16 | 17 | 18 | 19 | 20 | 21 | Linux Biolinum 22 | 23 | Linux Biolinum 24 | 25 | 26 | Linux Biolinum O 27 | 28 | 29 | Linux Biolinum O 30 | 31 | 32 | 33 | 34 | 35 | Linux Libertine 36 | 37 | Linux Libertine 38 | 39 | 40 | Linux Libertine O 41 | 42 | 43 | Linux Libertine O 44 | 45 | 46 | 47 | 48 | 49 | OFL Sorts Mill Goudy TT 50 | 51 | Sorts Mill Goudy TT 52 | 53 | 54 | Sorts Mill Goudy 55 | 56 | 57 | Sorts Mill Goudy 58 | 59 | 60 | 61 | 62 | 63 | OFL Sorts Mill Goudy 64 | 65 | Sorts Mill Goudy TT 66 | 67 | 68 | Sorts Mill Goudy 69 | 70 | 71 | Sorts Mill Goudy 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/69-unifont.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | serif 6 | 7 | FreeSerif 8 | Code2000 9 | Code2001 10 | 11 | 12 | 13 | sans-serif 14 | 15 | FreeSans 16 | Arial Unicode MS 17 | Arial Unicode 18 | Code2000 19 | Code2001 20 | 21 | 22 | 23 | monospace 24 | 25 | FreeMono 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/80-delicious.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Delicious 10 | 11 | 12 | Heavy 13 | 14 | 15 | heavy 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/82-no-embedded-bitmaps.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | false 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/82-no-force-autohint.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | false 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/82-no-ttf-as-bitmap.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | false 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/83-yes-bitmaps.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | false 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/83-yes-postscript.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | Type 1 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/88-forced-synthetic.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | roman 15 | 16 | 17 | 18 | roman 19 | 20 | 21 | 22 | 23 | matrix 24 | 25 | 1 26 | 0.2 27 | 0 28 | 1 29 | 30 | 31 | 32 | 33 | 34 | oblique 35 | 36 | 37 | 38 | false 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | medium 47 | 48 | 49 | 50 | medium 51 | 52 | 54 | 55 | true 56 | 57 | 59 | 60 | bold 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/90-synthetic.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | roman 12 | 13 | 14 | 15 | roman 16 | 17 | 18 | 19 | 20 | matrix 21 | 10.2 22 | 01 23 | 24 | 25 | 26 | 27 | 28 | oblique 29 | 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | medium 44 | 45 | 46 | 47 | medium 48 | 49 | 53 | 54 | true 55 | 56 | 60 | 61 | bold 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/93-final-rendering.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 35 | 36 | 37 | 38 | 39 | regular 40 | 41 | 42 | 24.5 43 | 44 | 45 | true 46 | 47 | 48 | hintfull 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/95-reject.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 20 | 21 | 22 | 23 | 24 | /opt/texlive/texmf-dist/fonts/opentype/public/inconsolata/* 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/97-selective-rendering-custom.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/etc/fonts/conf.d/README: -------------------------------------------------------------------------------- 1 | conf.d/README 2 | 3 | Each file in this directory is a fontconfig configuration file. Fontconfig 4 | scans this directory, loading all files of the form [0-9][0-9]*.conf. 5 | These files are normally installed in @TEMPLATEDIR@ 6 | and then symlinked here, allowing them to be easily installed and then 7 | enabled/disabled by adjusting the symlinks. 8 | 9 | The files are loaded in numeric order, the structure of the configuration 10 | has led to the following conventions in usage: 11 | 12 | Files begining with: Contain: 13 | 14 | 00 through 09 Font directories 15 | 10 through 19 system rendering defaults (AA, etc) 16 | 20 through 29 font rendering options 17 | 30 through 39 family substitution 18 | 40 through 49 generic identification, map family->generic 19 | 50 through 59 alternate config file loading 20 | 60 through 69 generic aliases, map generic->family 21 | 70 through 79 select font (adjust which fonts are available) 22 | 80 through 89 match target="scan" (modify scanned patterns) 23 | 90 through 99 font synthesis 24 | 25 | If you are using fontconfig-infinality-ultimate from the infinality-bundle 26 | collection, templates are located in /e/rtvc100-64/share/fontconfig/conf.avail.infinality and they 27 | are symlinked here instead. Besides, there are three more subdirectories 28 | located in the main template directory, each containing collection-specific 29 | fontconfig configuration files: 30 | 31 | /e/rtvc100-64/share/fontconfig/conf.avail.infinality/combi - for a custom, user-compiled collection 32 | /e/rtvc100-64/share/fontconfig/conf.avail.infinality/free - for the free font collection, available in the 33 | infinality-bundle-fonts repository (default in 34 | Arch Linux) 35 | /e/rtvc100-64/share/fontconfig/conf.avail.infinality/ms - for the proprietary font collection available 36 | with Microsoft Windows and Office software 37 | (not freely available) 38 | 39 | Symbolic links in conf.d to all five *.conf files from one of either combi, 40 | free or ms need to be created in order for default aliases and font 41 | substitution rules to work properly. 42 | 43 | The stock fontconfig template directory and configuration files are still 44 | available for compatibility reasons and should not be removed. 45 | 46 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/rsvg_convert/rsvg_convert.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/bin/rsvg_convert/rsvg_convert.exe -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/stockfish_14/info.txt: -------------------------------------------------------------------------------- 1 | This is a non official build of a Stockfish development version. Use it at your own risk. 2 | The source code of this version can be found at https://github.com/official-stockfish/Stockfish/tree/773dff020968f7a6f590cfd53e8fd89f12e15e36 3 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/bin/stockfish_14/stockfish_14_32bit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/bin/stockfish_14/stockfish_14_32bit.exe -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/concurrency.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import threading 4 | import typing as t 5 | from functools import wraps 6 | from logHandler import log 7 | from .helpers import import_bundled 8 | 9 | 10 | with import_bundled(): 11 | import asyncio 12 | from concurrent.futures import ThreadPoolExecutor 13 | 14 | 15 | THREADED_EXECUTOR = ThreadPoolExecutor(max_workers=8, thread_name_prefix="chessmart") 16 | ASYNCIO_EVENT_LOOP = asyncio.new_event_loop() 17 | ASYNCIO_LOOP_THREAD = None 18 | 19 | 20 | def start_asyncio_event_loop(): 21 | global ASYNCIO_LOOP_THREAD, ASYNCIO_EVENT_LOOP 22 | if ASYNCIO_LOOP_THREAD: 23 | log.debug("Attempted to start the asyncio eventloop while it is already running") 24 | return 25 | 26 | def _thread_target(): 27 | log.info("Starting asyncio event loop") 28 | asyncio.set_event_loop(ASYNCIO_EVENT_LOOP) 29 | ASYNCIO_EVENT_LOOP.run_forever() 30 | 31 | ASYNCIO_LOOP_THREAD = threading.Thread(target=_thread_target, daemon=True, name="chessmart.asyncio.thread") 32 | ASYNCIO_LOOP_THREAD.start() 33 | 34 | 35 | def terminate(): 36 | global THREADED_EXECUTOR, ASYNCIO_LOOP_THREAD, ASYNCIO_EVENT_LOOP 37 | log.info("Shutting down the thread pool executor") 38 | THREADED_EXECUTOR.shutdown() 39 | if ASYNCIO_LOOP_THREAD: 40 | log.info("Shutting down asyncio event loop") 41 | ASYNCIO_EVENT_LOOP.call_soon_threadsafe(ASYNCIO_EVENT_LOOP.stop) 42 | 43 | 44 | def asyncio_coroutine_to_concurrent_future(func): 45 | """Returns a concurrent.futures.Future that wrapps the decorated async function.""" 46 | 47 | @wraps(func) 48 | def wrapper(*args, **kwargs): 49 | return asyncio.run_coroutine_threadsafe(func(*args, **kwargs), ASYNCIO_EVENT_LOOP) 50 | 51 | return wrapper 52 | 53 | 54 | def call_threaded(func: t.Callable[..., None]) -> t.Callable[..., "Future"]: 55 | """Call `func` in a separate thread. It wraps the function 56 | in another function that returns a `concurrent.futures.Future` 57 | object when called. 58 | """ 59 | 60 | @wraps(func) 61 | def wrapper(*args, **kwargs): 62 | try: 63 | return THREADED_EXECUTOR.submit(func, *args, **kwargs) 64 | except RuntimeError: 65 | log.debug( 66 | f"Failed to submit function {func}." 67 | ) 68 | 69 | return wrapper 70 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/graphical_interface/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/helpers.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # Copyright (c) 2021 Blind Pandas Team 4 | # This file is covered by the GNU General Public License. 5 | 6 | import sys 7 | import os 8 | import platform 9 | import contextlib 10 | import enum 11 | import queueHandler 12 | import speech 13 | from nvwave import playWaveFile 14 | 15 | 16 | PLUGIN_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) 17 | LIB_DIRECTORY = os.path.join(PLUGIN_DIRECTORY, "lib") 18 | BIN_DIRECTORY = os.path.join(PLUGIN_DIRECTORY, "bin") 19 | SOUNDS_DIRECTORY = os.path.join(PLUGIN_DIRECTORY, "sounds") 20 | 21 | 22 | class GameSound(enum.Enum): 23 | black_square = "black_square" 24 | start_game = "start_game" 25 | chess_pieces = "chess_pieces" 26 | invalid = "invalid" 27 | request_promotion = "request_promotion" 28 | promotion = "promotion" 29 | capture = "capture" 30 | en_passant = "en_passant" 31 | check = "check" 32 | castling = "castling" 33 | pick_piece = "pick_piece" 34 | drop_piece = "drop_piece" 35 | drop_move = "drop_move" 36 | drop_target = "drop_target" 37 | game_over = "game_over" 38 | error = "error" 39 | resigned = "resigned" 40 | drawn = "drawn" 41 | time_pass = "time_pass" 42 | time_critical = "time_critical" 43 | time_forfeit = "time_forfeit" 44 | score_list_open = "score_list_open" 45 | score_list_close = "score_list_close" 46 | menu_open = "menu_open" 47 | chat = "chat" 48 | you_won = "you_won" 49 | puzzle_solved = "puzzle_solved" 50 | 51 | def __init__(self, filename): 52 | self.filename = os.path.join(SOUNDS_DIRECTORY, f"{filename}.wav") 53 | 54 | def play(self): 55 | playWaveFile(self.filename) 56 | 57 | 58 | class Color(enum.Enum): 59 | Red = "#96D454" 60 | Blue = "#0000FF" 61 | Green = "#00B050" 62 | Yellow = "#FFFF00" 63 | Purple = "#953553" 64 | DarkGray = "#3C3C3C" 65 | 66 | 67 | @contextlib.contextmanager 68 | def import_bundled(packages_path=LIB_DIRECTORY): 69 | sys.path.insert(0, packages_path) 70 | try: 71 | yield 72 | finally: 73 | sys.path.remove(packages_path) 74 | 75 | 76 | def is_64bit_windows() -> bool: 77 | return platform.machine().endswith("64") 78 | 79 | 80 | def intersperse(lst, item): 81 | """Taken from: https://stackoverflow.com/a/5921708""" 82 | result = [item] * (len(lst) * 2 - 1) 83 | result[0::2] = lst 84 | return result 85 | 86 | 87 | def speak_next( 88 | speech_sequence: speech.SpeechSequence, priority: speech.Spri = speech.Spri.NEXT 89 | ) -> None: 90 | speech.speak(speech_sequence, priority=priority) 91 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/ibca_notation.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | 4 | from .helpers import import_bundled 5 | 6 | with import_bundled(): 7 | import chess 8 | 9 | 10 | IBCA_COLOR_NAMES = {chess.WHITE: "schwarts", chess.BLACK: "Schwarze Farbe"} 11 | 12 | IBCA_FILE_NAMES = { 13 | "a": "Anna", 14 | "b": "Belia", 15 | "c": "Ceasar", 16 | "d": "David", 17 | "e": "Eva", 18 | "f": "Felix", 19 | "g": "Gustav", 20 | "h": "Hector", 21 | } 22 | IBCA_FILE_MAP = dict(enumerate(IBCA_FILE_NAMES.values())) 23 | 24 | IBCA_RANK_NAMES = [ 25 | "eyns", 26 | "tsvey ", 27 | "dry", 28 | "feer", 29 | "fuhnf", 30 | "zex", 31 | "Zeebin", 32 | "akt", 33 | ] 34 | IBCA_RANK_MAP = dict(enumerate(IBCA_RANK_NAMES)) 35 | 36 | IBCA_PIECE_NAMES = { 37 | chess.KING: "Koenig", 38 | chess.QUEEN: "Dame", 39 | chess.BISHOP: "Laeufer", 40 | chess.KNIGHT: "Springer", 41 | chess.ROOK: "Turm", 42 | chess.PAWN: "Bauer", 43 | } 44 | 45 | 46 | IBCA_KING_SIDE_CASTLING = "Kurtze Rochade" 47 | IBCA_QUEEN_SIDE_CASTLING = "Lange Rochade" 48 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/internet_chess/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from .abstract.exceptions import ( 4 | InternetChessConnectionError, 5 | AuthenticationError, 6 | OperationTimeout, 7 | ChallengeRejected, 8 | InternetChessConnectionError, 9 | ChallengedUserIsOffline, 10 | ) 11 | from .lichess import LichessAPIClient 12 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/internet_chess/abstract/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/internet_chess/abstract/client.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import dataclasses 4 | import wx 5 | import functools 6 | import contextlib 7 | from abc import ABC, abstractmethod 8 | from ...helpers import import_bundled 9 | from ...game_elements import GameInfo 10 | from ...time_control import ChessTimeControl 11 | 12 | 13 | with import_bundled(): 14 | import chess 15 | 16 | 17 | 18 | @dataclasses.dataclass 19 | class InternetGameInfo: 20 | white_username: str 21 | black_username: str 22 | time_control: ChessTimeControl 23 | user_color: chess.Color 24 | white_rating: int 25 | black_rating: int 26 | 27 | 28 | class InternetChessAPIClient(ABC): 29 | """Represents an internet chess client.""" 30 | 31 | def __init__(self, game_info: GameInfo): 32 | self.game_info = game_info 33 | 34 | def close(self): 35 | self.disconnect() 36 | 37 | @abstractmethod 38 | def connect(self): 39 | """ 40 | Connect to the server, handling any authentication. 41 | Raise AuthenticationError when the provided credentials are invalid. 42 | """ 43 | 44 | @abstractmethod 45 | def disconnect(self): 46 | """Disconnect the client.""" 47 | 48 | @abstractmethod 49 | def create_challenge(self, opponent_username: str, **kwargs): 50 | """Create a challenge with a specific user.""" 51 | 52 | @abstractmethod 53 | def seek_game(self, **kwargs): 54 | """Request to play a game.""" 55 | 56 | def __del__(self): 57 | try: 58 | self.disconnect() 59 | except: 60 | pass 61 | 62 | 63 | class InternetChessBoardClient(ABC): 64 | """Represents events related to a single game.""" 65 | 66 | def __init__(self, board): 67 | self.board = board 68 | 69 | @abstractmethod 70 | def abort_game(self): 71 | """abort the current game.""" 72 | 73 | @abstractmethod 74 | def offer_draw(self): 75 | """Offer a draw in an on going game.""" 76 | 77 | @abstractmethod 78 | def handle_draw_offer(self, accept): 79 | """Handle a draw offer from the opponent.""" 80 | 81 | @abstractmethod 82 | def resign_game(self): 83 | """Resign a game.""" 84 | 85 | @abstractmethod 86 | def send_chat_message(self, msg): 87 | """Send a chat message to your apponent.""" 88 | 89 | @abstractmethod 90 | def send_move(self, move, draw=False): 91 | """Send a move to an on going game.""" 92 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/internet_chess/abstract/events.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import typing as t 4 | from ...algebraic_type import AlgebraicType, Variant 5 | from ...time_control import ChessTimeControl 6 | from ...helpers import import_bundled 7 | from .client import InternetGameInfo 8 | 9 | 10 | with import_bundled(): 11 | import chess 12 | 13 | 14 | class InternetChessAPIEvent(AlgebraicType): 15 | initialize_board = Variant(board_client="BoardClient") 16 | challenge_recieved = Variant( 17 | from_whom=str, playing_as_color=chess.Color, time_control=ChessTimeControl 18 | ) 19 | challenge_cancelled = Variant(by_whom=str) 20 | challenge_accepted = Variant(by_whom=str) 21 | 22 | 23 | class InternetChessBoardEvent(AlgebraicType): 24 | """Represents events related to a single game.""" 25 | 26 | game_started = Variant(info=InternetGameInfo) 27 | game_drawn = Variant() 28 | game_time_forfeit = Variant(loser=chess.Color) 29 | game_resigned = Variant(loser=chess.Color) 30 | game_aborted = Variant(loser=chess.Color) 31 | move_made = Variant(move=chess.Move, player=chess.Color) 32 | clock_tick = Variant(time_control=ChessTimeControl) 33 | draw_offered = Variant(offered_by=chess.Color) 34 | draw_offer_rejected = Variant(rejected_by=chess.Color) 35 | chat_message_recieved = Variant(from_whom=str, message=str) 36 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/internet_chess/abstract/exceptions.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """Exceptions raised by remote internet chess servers.""" 4 | 5 | 6 | class InternetChessClientError(Exception): 7 | """The base exception of all internet client operations.""" 8 | 9 | 10 | class InternetChessConnectionError(InternetChessClientError, ConnectionError): 11 | """Raised when a network problem occurs.""" 12 | 13 | 14 | class AuthenticationError(InternetChessClientError): 15 | """Invalid credentials provided.""" 16 | 17 | 18 | class OperationTimeout(InternetChessClientError, TimeoutError): 19 | """Raised when an operation timeout.""" 20 | 21 | def __init__(self, game_id): 22 | self.game_id = game_id 23 | 24 | 25 | class ChallengedUserIsOffline(InternetChessClientError): 26 | """The user you're trying to challenge is offline.""" 27 | 28 | def __init__(self, username): 29 | self.username = username 30 | 31 | 32 | class ChallengeRejected(InternetChessClientError): 33 | """Raised when the challenge is rejected.""" 34 | 35 | def __init__(self, game_id): 36 | self.game_id = game_id 37 | 38 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/_asyncio.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/_asyncio.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/_multiprocessing.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/_multiprocessing.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/_overlapped.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/_overlapped.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/__init__.py: -------------------------------------------------------------------------------- 1 | """The asyncio package, tracking PEP 3156.""" 2 | 3 | # flake8: noqa 4 | 5 | import sys 6 | 7 | # This relies on each of the submodules having an __all__ variable. 8 | from .base_events import * 9 | from .coroutines import * 10 | from .events import * 11 | from .futures import * 12 | from .locks import * 13 | from .protocols import * 14 | from .runners import * 15 | from .queues import * 16 | from .streams import * 17 | from .subprocess import * 18 | from .tasks import * 19 | from .transports import * 20 | 21 | # Exposed for _asynciomodule.c to implement now deprecated 22 | # Task.all_tasks() method. This function will be removed in 3.9. 23 | from .tasks import _all_tasks_compat # NoQA 24 | 25 | __all__ = ( 26 | base_events.__all__ 27 | + coroutines.__all__ 28 | + events.__all__ 29 | + futures.__all__ 30 | + locks.__all__ 31 | + protocols.__all__ 32 | + runners.__all__ 33 | + queues.__all__ 34 | + streams.__all__ 35 | + subprocess.__all__ 36 | + tasks.__all__ 37 | + transports.__all__ 38 | ) 39 | 40 | if sys.platform == "win32": # pragma: no cover 41 | from .windows_events import * 42 | 43 | __all__ += windows_events.__all__ 44 | else: 45 | from .unix_events import * # pragma: no cover 46 | 47 | __all__ += unix_events.__all__ 48 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/base_futures.py: -------------------------------------------------------------------------------- 1 | __all__ = () 2 | 3 | import concurrent.futures._base 4 | import reprlib 5 | 6 | from . import format_helpers 7 | 8 | Error = concurrent.futures._base.Error 9 | CancelledError = concurrent.futures.CancelledError 10 | TimeoutError = concurrent.futures.TimeoutError 11 | 12 | 13 | class InvalidStateError(Error): 14 | """The operation is not allowed in this state.""" 15 | 16 | 17 | # States for Future. 18 | _PENDING = "PENDING" 19 | _CANCELLED = "CANCELLED" 20 | _FINISHED = "FINISHED" 21 | 22 | 23 | def isfuture(obj): 24 | """Check for a Future. 25 | 26 | This returns True when obj is a Future instance or is advertising 27 | itself as duck-type compatible by setting _asyncio_future_blocking. 28 | See comment in Future for more details. 29 | """ 30 | return ( 31 | hasattr(obj.__class__, "_asyncio_future_blocking") 32 | and obj._asyncio_future_blocking is not None 33 | ) 34 | 35 | 36 | def _format_callbacks(cb): 37 | """helper function for Future.__repr__""" 38 | size = len(cb) 39 | if not size: 40 | cb = "" 41 | 42 | def format_cb(callback): 43 | return format_helpers._format_callback_source(callback, ()) 44 | 45 | if size == 1: 46 | cb = format_cb(cb[0][0]) 47 | elif size == 2: 48 | cb = "{}, {}".format(format_cb(cb[0][0]), format_cb(cb[1][0])) 49 | elif size > 2: 50 | cb = "{}, <{} more>, {}".format( 51 | format_cb(cb[0][0]), size - 2, format_cb(cb[-1][0]) 52 | ) 53 | return f"cb=[{cb}]" 54 | 55 | 56 | def _future_repr_info(future): 57 | # (Future) -> str 58 | """helper function for Future.__repr__""" 59 | info = [future._state.lower()] 60 | if future._state == _FINISHED: 61 | if future._exception is not None: 62 | info.append(f"exception={future._exception!r}") 63 | else: 64 | # use reprlib to limit the length of the output, especially 65 | # for very long strings 66 | result = reprlib.repr(future._result) 67 | info.append(f"result={result}") 68 | if future._callbacks: 69 | info.append(_format_callbacks(future._callbacks)) 70 | if future._source_traceback: 71 | frame = future._source_traceback[-1] 72 | info.append(f"created at {frame[0]}:{frame[1]}") 73 | return info 74 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/base_tasks.py: -------------------------------------------------------------------------------- 1 | import linecache 2 | import traceback 3 | 4 | from . import base_futures 5 | from . import coroutines 6 | 7 | 8 | def _task_repr_info(task): 9 | info = base_futures._future_repr_info(task) 10 | 11 | if task._must_cancel: 12 | # replace status 13 | info[0] = "cancelling" 14 | 15 | coro = coroutines._format_coroutine(task._coro) 16 | info.insert(1, f"coro=<{coro}>") 17 | 18 | if task._fut_waiter is not None: 19 | info.insert(2, f"wait_for={task._fut_waiter!r}") 20 | return info 21 | 22 | 23 | def _task_get_stack(task, limit): 24 | frames = [] 25 | try: 26 | # 'async def' coroutines 27 | f = task._coro.cr_frame 28 | except AttributeError: 29 | f = task._coro.gi_frame 30 | if f is not None: 31 | while f is not None: 32 | if limit is not None: 33 | if limit <= 0: 34 | break 35 | limit -= 1 36 | frames.append(f) 37 | f = f.f_back 38 | frames.reverse() 39 | elif task._exception is not None: 40 | tb = task._exception.__traceback__ 41 | while tb is not None: 42 | if limit is not None: 43 | if limit <= 0: 44 | break 45 | limit -= 1 46 | frames.append(tb.tb_frame) 47 | tb = tb.tb_next 48 | return frames 49 | 50 | 51 | def _task_print_stack(task, limit, file): 52 | extracted_list = [] 53 | checked = set() 54 | for f in task.get_stack(limit=limit): 55 | lineno = f.f_lineno 56 | co = f.f_code 57 | filename = co.co_filename 58 | name = co.co_name 59 | if filename not in checked: 60 | checked.add(filename) 61 | linecache.checkcache(filename) 62 | line = linecache.getline(filename, lineno, f.f_globals) 63 | extracted_list.append((filename, lineno, name, line)) 64 | 65 | exc = task._exception 66 | if not extracted_list: 67 | print(f"No stack for {task!r}", file=file) 68 | elif exc is not None: 69 | print(f"Traceback for {task!r} (most recent call last):", file=file) 70 | else: 71 | print(f"Stack for {task!r} (most recent call last):", file=file) 72 | 73 | traceback.print_list(extracted_list, file=file) 74 | if exc is not None: 75 | for line in traceback.format_exception_only(exc.__class__, exc): 76 | print(line, file=file, end="") 77 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/constants.py: -------------------------------------------------------------------------------- 1 | import enum 2 | 3 | # After the connection is lost, log warnings after this many write()s. 4 | LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5 5 | 6 | # Seconds to wait before retrying accept(). 7 | ACCEPT_RETRY_DELAY = 1 8 | 9 | # Number of stack entries to capture in debug mode. 10 | # The larger the number, the slower the operation in debug mode 11 | # (see extract_stack() in format_helpers.py). 12 | DEBUG_STACK_DEPTH = 10 13 | 14 | # Number of seconds to wait for SSL handshake to complete 15 | # The default timeout matches that of Nginx. 16 | SSL_HANDSHAKE_TIMEOUT = 60.0 17 | 18 | # Used in sendfile fallback code. We use fallback for platforms 19 | # that don't support sendfile, or for TLS connections. 20 | SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256 21 | 22 | # The enum should be here to break circular dependencies between 23 | # base_events and sslproto 24 | class _SendfileMode(enum.Enum): 25 | UNSUPPORTED = enum.auto() 26 | TRY_NATIVE = enum.auto() 27 | FALLBACK = enum.auto() 28 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/format_helpers.py: -------------------------------------------------------------------------------- 1 | import functools 2 | import inspect 3 | import reprlib 4 | import sys 5 | import traceback 6 | 7 | from . import constants 8 | 9 | 10 | def _get_function_source(func): 11 | func = inspect.unwrap(func) 12 | if inspect.isfunction(func): 13 | code = func.__code__ 14 | return (code.co_filename, code.co_firstlineno) 15 | if isinstance(func, functools.partial): 16 | return _get_function_source(func.func) 17 | if isinstance(func, functools.partialmethod): 18 | return _get_function_source(func.func) 19 | return None 20 | 21 | 22 | def _format_callback_source(func, args): 23 | func_repr = _format_callback(func, args, None) 24 | source = _get_function_source(func) 25 | if source: 26 | func_repr += f" at {source[0]}:{source[1]}" 27 | return func_repr 28 | 29 | 30 | def _format_args_and_kwargs(args, kwargs): 31 | """Format function arguments and keyword arguments. 32 | 33 | Special case for a single parameter: ('hello',) is formatted as ('hello'). 34 | """ 35 | # use reprlib to limit the length of the output 36 | items = [] 37 | if args: 38 | items.extend(reprlib.repr(arg) for arg in args) 39 | if kwargs: 40 | items.extend(f"{k}={reprlib.repr(v)}" for k, v in kwargs.items()) 41 | return "({})".format(", ".join(items)) 42 | 43 | 44 | def _format_callback(func, args, kwargs, suffix=""): 45 | if isinstance(func, functools.partial): 46 | suffix = _format_args_and_kwargs(args, kwargs) + suffix 47 | return _format_callback(func.func, func.args, func.keywords, suffix) 48 | 49 | if hasattr(func, "__qualname__") and func.__qualname__: 50 | func_repr = func.__qualname__ 51 | elif hasattr(func, "__name__") and func.__name__: 52 | func_repr = func.__name__ 53 | else: 54 | func_repr = repr(func) 55 | 56 | func_repr += _format_args_and_kwargs(args, kwargs) 57 | if suffix: 58 | func_repr += suffix 59 | return func_repr 60 | 61 | 62 | def extract_stack(f=None, limit=None): 63 | """Replacement for traceback.extract_stack() that only does the 64 | necessary work for asyncio debug mode. 65 | """ 66 | if f is None: 67 | f = sys._getframe().f_back 68 | if limit is None: 69 | # Limit the amount of work to a reasonable amount, as extract_stack() 70 | # can be called for each coroutine and future in debug mode. 71 | limit = constants.DEBUG_STACK_DEPTH 72 | stack = traceback.StackSummary.extract( 73 | traceback.walk_stack(f), limit=limit, lookup_lines=False 74 | ) 75 | stack.reverse() 76 | return stack 77 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/log.py: -------------------------------------------------------------------------------- 1 | """Logging configuration.""" 2 | 3 | import logging 4 | 5 | 6 | # Name the logger after the package. 7 | logger = logging.getLogger(__package__) 8 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/asyncio/runners.py: -------------------------------------------------------------------------------- 1 | __all__ = ("run",) 2 | 3 | from . import coroutines 4 | from . import events 5 | from . import tasks 6 | 7 | 8 | def run(main, *, debug=False): 9 | """Execute the coroutine and return the result. 10 | 11 | This function runs the passed coroutine, taking care of 12 | managing the asyncio event loop and finalizing asynchronous 13 | generators. 14 | 15 | This function cannot be called when another asyncio event loop is 16 | running in the same thread. 17 | 18 | If debug is True, the event loop will be run in debug mode. 19 | 20 | This function always creates a new event loop and closes it at the end. 21 | It should be used as a main entry point for asyncio programs, and should 22 | ideally only be called once. 23 | 24 | Example: 25 | 26 | async def main(): 27 | await asyncio.sleep(1) 28 | print('hello') 29 | 30 | asyncio.run(main()) 31 | """ 32 | if events._get_running_loop() is not None: 33 | raise RuntimeError("asyncio.run() cannot be called from a running event loop") 34 | 35 | if not coroutines.iscoroutine(main): 36 | raise ValueError("a coroutine was expected, got {!r}".format(main)) 37 | 38 | loop = events.new_event_loop() 39 | try: 40 | events.set_event_loop(loop) 41 | loop.set_debug(debug) 42 | return loop.run_until_complete(main) 43 | finally: 44 | try: 45 | _cancel_all_tasks(loop) 46 | loop.run_until_complete(loop.shutdown_asyncgens()) 47 | finally: 48 | events.set_event_loop(None) 49 | loop.close() 50 | 51 | 52 | def _cancel_all_tasks(loop): 53 | to_cancel = tasks.all_tasks(loop) 54 | if not to_cancel: 55 | return 56 | 57 | for task in to_cancel: 58 | task.cancel() 59 | 60 | loop.run_until_complete(tasks.gather(*to_cancel, loop=loop, return_exceptions=True)) 61 | 62 | for task in to_cancel: 63 | if task.cancelled(): 64 | continue 65 | if task.exception() is not None: 66 | loop.call_exception_handler( 67 | { 68 | "message": "unhandled exception during asyncio.run() shutdown", 69 | "exception": task.exception(), 70 | "task": task, 71 | } 72 | ) 73 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/blinker/__init__.py: -------------------------------------------------------------------------------- 1 | from blinker.base import ( 2 | ANY, 3 | NamedSignal, 4 | Namespace, 5 | Signal, 6 | WeakNamespace, 7 | receiver_connected, 8 | signal, 9 | ) 10 | 11 | __all__ = [ 12 | "ANY", 13 | "NamedSignal", 14 | "Namespace", 15 | "Signal", 16 | "WeakNamespace", 17 | "receiver_connected", 18 | "signal", 19 | ] 20 | 21 | 22 | __version__ = "1.5dev" 23 | 24 | try: 25 | import blinker._async 26 | except (ImportError, SyntaxError): 27 | pass 28 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/blinker/_async.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from blinker.base import Signal 4 | 5 | 6 | try: 7 | schedule = asyncio.create_task 8 | except AttributeError: 9 | schedule = asyncio.ensure_future 10 | 11 | 12 | @asyncio.coroutine 13 | def _wrap_plain_value(value): 14 | """Pass through a coroutine *value* or wrap a plain value.""" 15 | if asyncio.iscoroutine(value): 16 | value = yield from value 17 | return value 18 | 19 | 20 | def send_async(self, *sender, **kwargs): 21 | return [ 22 | (receiver, schedule(_wrap_plain_value(value))) 23 | for receiver, value in self.send(*sender, **kwargs) 24 | ] 25 | 26 | 27 | send_async.__doc__ = Signal.send_async.__doc__ 28 | Signal.send_async = send_async 29 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/chess/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/chess/py.typed -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/chess_clock/__init__.py: -------------------------------------------------------------------------------- 1 | """Top-level package for chess_clock.""" 2 | 3 | 4 | from .chess_clock import ChessClock 5 | from .chess_clock import ClockState 6 | from .chess_clock import Seconds 7 | 8 | __author__ = """Musharraf Omer""" 9 | __email__ = 'ibnomer2011@hotmail.com' 10 | __version__ = '0.1.0' 11 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/concurrent/__init__.py: -------------------------------------------------------------------------------- 1 | # This directory is a Python package. 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/concurrent/futures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2009 Brian Quinlan. All Rights Reserved. 2 | # Licensed to PSF under a Contributor Agreement. 3 | 4 | """Execute computations asynchronously using threads or processes.""" 5 | 6 | __author__ = "Brian Quinlan (brian@sweetapp.com)" 7 | 8 | from concurrent.futures._base import ( 9 | FIRST_COMPLETED, 10 | FIRST_EXCEPTION, 11 | ALL_COMPLETED, 12 | CancelledError, 13 | TimeoutError, 14 | BrokenExecutor, 15 | Future, 16 | Executor, 17 | wait, 18 | as_completed, 19 | ) 20 | 21 | __all__ = ( 22 | "FIRST_COMPLETED", 23 | "FIRST_EXCEPTION", 24 | "ALL_COMPLETED", 25 | "CancelledError", 26 | "TimeoutError", 27 | "BrokenExecutor", 28 | "Future", 29 | "Executor", 30 | "wait", 31 | "as_completed", 32 | "ProcessPoolExecutor", 33 | "ThreadPoolExecutor", 34 | ) 35 | 36 | 37 | def __dir__(): 38 | return __all__ + ("__author__", "__doc__") 39 | 40 | 41 | def __getattr__(name): 42 | global ProcessPoolExecutor, ThreadPoolExecutor 43 | 44 | if name == "ProcessPoolExecutor": 45 | from .process import ProcessPoolExecutor as pe 46 | 47 | ProcessPoolExecutor = pe 48 | return pe 49 | 50 | if name == "ThreadPoolExecutor": 51 | from .thread import ThreadPoolExecutor as te 52 | 53 | ThreadPoolExecutor = te 54 | return te 55 | 56 | raise AttributeError(f"module {__name__} has no attribute {name}") 57 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_cparser.pxd.hash: -------------------------------------------------------------------------------- 1 | c6fb0b975dd95d7c871b26f652ced6b0b9dc9dd42bc61c860782979ef6ec46d4 *D:/a/aiohttp/aiohttp/aiohttp/_cparser.pxd 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_find_header.pxd.hash: -------------------------------------------------------------------------------- 1 | 0455129b185e981b5b96ac738f31f7c74dc57f1696953cae0083b3f18679fe73 *D:/a/aiohttp/aiohttp/aiohttp/_find_header.pxd 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_frozenlist.pyx.hash: -------------------------------------------------------------------------------- 1 | 481f39d4a9ad5a9889d99074e53a68e3ce795640b246d80cb3ce375b3f2415e8 *D:/a/aiohttp/aiohttp/aiohttp/_frozenlist.pyx 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_helpers.pyi.hash: -------------------------------------------------------------------------------- 1 | d87779202d197f8613109e35dacbb2ca1b21d64572543bf9838b2d832a362ac7 *D:/a/aiohttp/aiohttp/aiohttp/_helpers.pyi 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_helpers.pyx.hash: -------------------------------------------------------------------------------- 1 | b6097b7d987440c4fa7237f88d227c89a3ba0dd403dc638ddbe487e0de7f1138 *D:/a/aiohttp/aiohttp/aiohttp/_helpers.pyx 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_http_parser.pyx.hash: -------------------------------------------------------------------------------- 1 | 83c05185224ad57f133f7fd5d56c331f4f9e101cd52f91237e7b6568b5459e1c *D:/a/aiohttp/aiohttp/aiohttp/_http_parser.pyx 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_http_writer.pyx.hash: -------------------------------------------------------------------------------- 1 | ac1cdb93ec6b2163b6843d242a8e482ca48ab16fd4f177f5e4800f9ea487db74 *D:/a/aiohttp/aiohttp/aiohttp/_http_writer.pyx 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/_websocket.pyx.hash: -------------------------------------------------------------------------------- 1 | a3d27bca2f5cdbe8d3063137754917c610d62af456273e4665fc8bb202506b7f *D:/a/aiohttp/aiohttp/aiohttp/_websocket.pyx 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/frozenlist.pyi.hash: -------------------------------------------------------------------------------- 1 | 9011bd27ad72982aa252f064ae3b1119599f6a49a4ce4e8a1e665b76044b0996 *D:/a/aiohttp/aiohttp/aiohttp/frozenlist.pyi 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/hdrs.py.hash: -------------------------------------------------------------------------------- 1 | 5f2bdc50368865ef87528ae8fd6820c8b35677209c5430b669c8857abedb9e94 *D:/a/aiohttp/aiohttp/aiohttp/hdrs.py 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/.hash/signals.pyi.hash: -------------------------------------------------------------------------------- 1 | 1273686ce37b6b3150d5f1d28a496f6ebbd07d05273993e2de7ffaa4a1335e83 *D:/a/aiohttp/aiohttp/aiohttp/signals.pyi 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_find_header.h: -------------------------------------------------------------------------------- 1 | #ifndef _FIND_HEADERS_H 2 | #define _FIND_HEADERS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int find_header(const char *str, int size); 9 | 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_find_header.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "_find_header.h": 2 | int find_header(char *, int) 3 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_frozenlist.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/aiohttp/_frozenlist.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_headers.pxi: -------------------------------------------------------------------------------- 1 | # The file is autogenerated from aiohttp/hdrs.py 2 | # Run ./tools/gen.py to update it after the origin changing. 3 | 4 | from . import hdrs 5 | cdef tuple headers = ( 6 | hdrs.ACCEPT, 7 | hdrs.ACCEPT_CHARSET, 8 | hdrs.ACCEPT_ENCODING, 9 | hdrs.ACCEPT_LANGUAGE, 10 | hdrs.ACCEPT_RANGES, 11 | hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS, 12 | hdrs.ACCESS_CONTROL_ALLOW_HEADERS, 13 | hdrs.ACCESS_CONTROL_ALLOW_METHODS, 14 | hdrs.ACCESS_CONTROL_ALLOW_ORIGIN, 15 | hdrs.ACCESS_CONTROL_EXPOSE_HEADERS, 16 | hdrs.ACCESS_CONTROL_MAX_AGE, 17 | hdrs.ACCESS_CONTROL_REQUEST_HEADERS, 18 | hdrs.ACCESS_CONTROL_REQUEST_METHOD, 19 | hdrs.AGE, 20 | hdrs.ALLOW, 21 | hdrs.AUTHORIZATION, 22 | hdrs.CACHE_CONTROL, 23 | hdrs.CONNECTION, 24 | hdrs.CONTENT_DISPOSITION, 25 | hdrs.CONTENT_ENCODING, 26 | hdrs.CONTENT_LANGUAGE, 27 | hdrs.CONTENT_LENGTH, 28 | hdrs.CONTENT_LOCATION, 29 | hdrs.CONTENT_MD5, 30 | hdrs.CONTENT_RANGE, 31 | hdrs.CONTENT_TRANSFER_ENCODING, 32 | hdrs.CONTENT_TYPE, 33 | hdrs.COOKIE, 34 | hdrs.DATE, 35 | hdrs.DESTINATION, 36 | hdrs.DIGEST, 37 | hdrs.ETAG, 38 | hdrs.EXPECT, 39 | hdrs.EXPIRES, 40 | hdrs.FORWARDED, 41 | hdrs.FROM, 42 | hdrs.HOST, 43 | hdrs.IF_MATCH, 44 | hdrs.IF_MODIFIED_SINCE, 45 | hdrs.IF_NONE_MATCH, 46 | hdrs.IF_RANGE, 47 | hdrs.IF_UNMODIFIED_SINCE, 48 | hdrs.KEEP_ALIVE, 49 | hdrs.LAST_EVENT_ID, 50 | hdrs.LAST_MODIFIED, 51 | hdrs.LINK, 52 | hdrs.LOCATION, 53 | hdrs.MAX_FORWARDS, 54 | hdrs.ORIGIN, 55 | hdrs.PRAGMA, 56 | hdrs.PROXY_AUTHENTICATE, 57 | hdrs.PROXY_AUTHORIZATION, 58 | hdrs.RANGE, 59 | hdrs.REFERER, 60 | hdrs.RETRY_AFTER, 61 | hdrs.SEC_WEBSOCKET_ACCEPT, 62 | hdrs.SEC_WEBSOCKET_EXTENSIONS, 63 | hdrs.SEC_WEBSOCKET_KEY, 64 | hdrs.SEC_WEBSOCKET_KEY1, 65 | hdrs.SEC_WEBSOCKET_PROTOCOL, 66 | hdrs.SEC_WEBSOCKET_VERSION, 67 | hdrs.SERVER, 68 | hdrs.SET_COOKIE, 69 | hdrs.TE, 70 | hdrs.TRAILER, 71 | hdrs.TRANSFER_ENCODING, 72 | hdrs.URI, 73 | hdrs.UPGRADE, 74 | hdrs.USER_AGENT, 75 | hdrs.VARY, 76 | hdrs.VIA, 77 | hdrs.WWW_AUTHENTICATE, 78 | hdrs.WANT_DIGEST, 79 | hdrs.WARNING, 80 | hdrs.X_FORWARDED_FOR, 81 | hdrs.X_FORWARDED_HOST, 82 | hdrs.X_FORWARDED_PROTO, 83 | ) 84 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_helpers.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/aiohttp/_helpers.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_helpers.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | class reify: 4 | def __init__(self, wrapped: Any) -> None: ... 5 | def __get__(self, inst: Any, owner: Any) -> Any: ... 6 | def __set__(self, inst: Any, value: Any) -> None: ... 7 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_helpers.pyx: -------------------------------------------------------------------------------- 1 | cdef class reify: 2 | """Use as a class method decorator. It operates almost exactly like 3 | the Python `@property` decorator, but it puts the result of the 4 | method it decorates into the instance dict after the first call, 5 | effectively replacing the function it decorates with an instance 6 | variable. It is, in Python parlance, a data descriptor. 7 | 8 | """ 9 | 10 | cdef object wrapped 11 | cdef object name 12 | 13 | def __init__(self, wrapped): 14 | self.wrapped = wrapped 15 | self.name = wrapped.__name__ 16 | 17 | @property 18 | def __doc__(self): 19 | return self.wrapped.__doc__ 20 | 21 | def __get__(self, inst, owner): 22 | try: 23 | try: 24 | return inst._cache[self.name] 25 | except KeyError: 26 | val = self.wrapped(inst) 27 | inst._cache[self.name] = val 28 | return val 29 | except AttributeError: 30 | if inst is None: 31 | return self 32 | raise 33 | 34 | def __set__(self, inst, value): 35 | raise AttributeError("reified property is read-only") 36 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_http_parser.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/aiohttp/_http_parser.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_http_writer.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/aiohttp/_http_writer.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_websocket.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/aiohttp/_websocket.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/_websocket.pyx: -------------------------------------------------------------------------------- 1 | from cpython cimport PyBytes_AsString 2 | 3 | 4 | #from cpython cimport PyByteArray_AsString # cython still not exports that 5 | cdef extern from "Python.h": 6 | char* PyByteArray_AsString(bytearray ba) except NULL 7 | 8 | from libc.stdint cimport uint32_t, uint64_t, uintmax_t 9 | 10 | 11 | def _websocket_mask_cython(object mask, object data): 12 | """Note, this function mutates its `data` argument 13 | """ 14 | cdef: 15 | Py_ssize_t data_len, i 16 | # bit operations on signed integers are implementation-specific 17 | unsigned char * in_buf 18 | const unsigned char * mask_buf 19 | uint32_t uint32_msk 20 | uint64_t uint64_msk 21 | 22 | assert len(mask) == 4 23 | 24 | if not isinstance(mask, bytes): 25 | mask = bytes(mask) 26 | 27 | if isinstance(data, bytearray): 28 | data = data 29 | else: 30 | data = bytearray(data) 31 | 32 | data_len = len(data) 33 | in_buf = PyByteArray_AsString(data) 34 | mask_buf = PyBytes_AsString(mask) 35 | uint32_msk = (mask_buf)[0] 36 | 37 | # TODO: align in_data ptr to achieve even faster speeds 38 | # does it need in python ?! malloc() always aligns to sizeof(long) bytes 39 | 40 | if sizeof(size_t) >= 8: 41 | uint64_msk = uint32_msk 42 | uint64_msk = (uint64_msk << 32) | uint32_msk 43 | 44 | while data_len >= 8: 45 | (in_buf)[0] ^= uint64_msk 46 | in_buf += 8 47 | data_len -= 8 48 | 49 | 50 | while data_len >= 4: 51 | (in_buf)[0] ^= uint32_msk 52 | in_buf += 4 53 | data_len -= 4 54 | 55 | for i in range(0, data_len): 56 | in_buf[i] ^= mask_buf[i] 57 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/frozenlist.py: -------------------------------------------------------------------------------- 1 | from collections.abc import MutableSequence 2 | from functools import total_ordering 3 | 4 | from .helpers import NO_EXTENSIONS 5 | 6 | 7 | @total_ordering 8 | class FrozenList(MutableSequence): 9 | 10 | __slots__ = ("_frozen", "_items") 11 | 12 | def __init__(self, items=None): 13 | self._frozen = False 14 | if items is not None: 15 | items = list(items) 16 | else: 17 | items = [] 18 | self._items = items 19 | 20 | @property 21 | def frozen(self): 22 | return self._frozen 23 | 24 | def freeze(self): 25 | self._frozen = True 26 | 27 | def __getitem__(self, index): 28 | return self._items[index] 29 | 30 | def __setitem__(self, index, value): 31 | if self._frozen: 32 | raise RuntimeError("Cannot modify frozen list.") 33 | self._items[index] = value 34 | 35 | def __delitem__(self, index): 36 | if self._frozen: 37 | raise RuntimeError("Cannot modify frozen list.") 38 | del self._items[index] 39 | 40 | def __len__(self): 41 | return self._items.__len__() 42 | 43 | def __iter__(self): 44 | return self._items.__iter__() 45 | 46 | def __reversed__(self): 47 | return self._items.__reversed__() 48 | 49 | def __eq__(self, other): 50 | return list(self) == other 51 | 52 | def __le__(self, other): 53 | return list(self) <= other 54 | 55 | def insert(self, pos, item): 56 | if self._frozen: 57 | raise RuntimeError("Cannot modify frozen list.") 58 | self._items.insert(pos, item) 59 | 60 | def __repr__(self): 61 | return f"" 62 | 63 | 64 | PyFrozenList = FrozenList 65 | 66 | try: 67 | from aiohttp._frozenlist import FrozenList as CFrozenList # type: ignore 68 | 69 | if not NO_EXTENSIONS: 70 | FrozenList = CFrozenList # type: ignore 71 | except ImportError: # pragma: no cover 72 | pass 73 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/frozenlist.pyi: -------------------------------------------------------------------------------- 1 | from typing import ( 2 | Generic, 3 | Iterable, 4 | Iterator, 5 | List, 6 | MutableSequence, 7 | Optional, 8 | TypeVar, 9 | Union, 10 | overload, 11 | ) 12 | 13 | _T = TypeVar("_T") 14 | _Arg = Union[List[_T], Iterable[_T]] 15 | 16 | class FrozenList(MutableSequence[_T], Generic[_T]): 17 | def __init__(self, items: Optional[_Arg[_T]] = ...) -> None: ... 18 | @property 19 | def frozen(self) -> bool: ... 20 | def freeze(self) -> None: ... 21 | @overload 22 | def __getitem__(self, i: int) -> _T: ... 23 | @overload 24 | def __getitem__(self, s: slice) -> FrozenList[_T]: ... 25 | @overload 26 | def __setitem__(self, i: int, o: _T) -> None: ... 27 | @overload 28 | def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... 29 | @overload 30 | def __delitem__(self, i: int) -> None: ... 31 | @overload 32 | def __delitem__(self, i: slice) -> None: ... 33 | def __len__(self) -> int: ... 34 | def __iter__(self) -> Iterator[_T]: ... 35 | def __reversed__(self) -> Iterator[_T]: ... 36 | def __eq__(self, other: object) -> bool: ... 37 | def __le__(self, other: FrozenList[_T]) -> bool: ... 38 | def __ne__(self, other: object) -> bool: ... 39 | def __lt__(self, other: FrozenList[_T]) -> bool: ... 40 | def __ge__(self, other: FrozenList[_T]) -> bool: ... 41 | def __gt__(self, other: FrozenList[_T]) -> bool: ... 42 | def insert(self, pos: int, item: _T) -> None: ... 43 | def __repr__(self) -> str: ... 44 | 45 | # types for C accelerators are the same 46 | CFrozenList = PyFrozenList = FrozenList 47 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/http.py: -------------------------------------------------------------------------------- 1 | import http.server 2 | import sys 3 | from typing import Mapping, Tuple 4 | 5 | from . import __version__ 6 | from .http_exceptions import HttpProcessingError as HttpProcessingError 7 | from .http_parser import ( 8 | HeadersParser as HeadersParser, 9 | HttpParser as HttpParser, 10 | HttpRequestParser as HttpRequestParser, 11 | HttpResponseParser as HttpResponseParser, 12 | RawRequestMessage as RawRequestMessage, 13 | RawResponseMessage as RawResponseMessage, 14 | ) 15 | from .http_websocket import ( 16 | WS_CLOSED_MESSAGE as WS_CLOSED_MESSAGE, 17 | WS_CLOSING_MESSAGE as WS_CLOSING_MESSAGE, 18 | WS_KEY as WS_KEY, 19 | WebSocketError as WebSocketError, 20 | WebSocketReader as WebSocketReader, 21 | WebSocketWriter as WebSocketWriter, 22 | WSCloseCode as WSCloseCode, 23 | WSMessage as WSMessage, 24 | WSMsgType as WSMsgType, 25 | ws_ext_gen as ws_ext_gen, 26 | ws_ext_parse as ws_ext_parse, 27 | ) 28 | from .http_writer import ( 29 | HttpVersion as HttpVersion, 30 | HttpVersion10 as HttpVersion10, 31 | HttpVersion11 as HttpVersion11, 32 | StreamWriter as StreamWriter, 33 | ) 34 | 35 | __all__ = ( 36 | "HttpProcessingError", 37 | "RESPONSES", 38 | "SERVER_SOFTWARE", 39 | # .http_writer 40 | "StreamWriter", 41 | "HttpVersion", 42 | "HttpVersion10", 43 | "HttpVersion11", 44 | # .http_parser 45 | "HeadersParser", 46 | "HttpParser", 47 | "HttpRequestParser", 48 | "HttpResponseParser", 49 | "RawRequestMessage", 50 | "RawResponseMessage", 51 | # .http_websocket 52 | "WS_CLOSED_MESSAGE", 53 | "WS_CLOSING_MESSAGE", 54 | "WS_KEY", 55 | "WebSocketReader", 56 | "WebSocketWriter", 57 | "ws_ext_gen", 58 | "ws_ext_parse", 59 | "WSMessage", 60 | "WebSocketError", 61 | "WSMsgType", 62 | "WSCloseCode", 63 | ) 64 | 65 | 66 | SERVER_SOFTWARE = "Python/{0[0]}.{0[1]} aiohttp/{1}".format( 67 | sys.version_info, __version__ 68 | ) # type: str 69 | 70 | RESPONSES = ( 71 | http.server.BaseHTTPRequestHandler.responses 72 | ) # type: Mapping[int, Tuple[str, str]] 73 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/locks.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import collections 3 | from typing import Any, Optional 4 | 5 | try: 6 | from typing import Deque 7 | except ImportError: 8 | from typing_extensions import Deque 9 | 10 | 11 | class EventResultOrError: 12 | """ 13 | This class wrappers the Event asyncio lock allowing either awake the 14 | locked Tasks without any error or raising an exception. 15 | 16 | thanks to @vorpalsmith for the simple design. 17 | """ 18 | 19 | def __init__(self, loop: asyncio.AbstractEventLoop) -> None: 20 | self._loop = loop 21 | self._exc = None # type: Optional[BaseException] 22 | self._event = asyncio.Event() 23 | self._waiters = collections.deque() # type: Deque[asyncio.Future[Any]] 24 | 25 | def set(self, exc: Optional[BaseException] = None) -> None: 26 | self._exc = exc 27 | self._event.set() 28 | 29 | async def wait(self) -> Any: 30 | waiter = self._loop.create_task(self._event.wait()) 31 | self._waiters.append(waiter) 32 | try: 33 | val = await waiter 34 | finally: 35 | self._waiters.remove(waiter) 36 | 37 | if self._exc is not None: 38 | raise self._exc 39 | 40 | return val 41 | 42 | def cancel(self) -> None: 43 | """Cancel all waiters""" 44 | for waiter in self._waiters: 45 | waiter.cancel() 46 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/log.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | access_logger = logging.getLogger("aiohttp.access") 4 | client_logger = logging.getLogger("aiohttp.client") 5 | internal_logger = logging.getLogger("aiohttp.internal") 6 | server_logger = logging.getLogger("aiohttp.server") 7 | web_logger = logging.getLogger("aiohttp.web") 8 | ws_logger = logging.getLogger("aiohttp.websocket") 9 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/payload_streamer.py: -------------------------------------------------------------------------------- 1 | """ Payload implemenation for coroutines as data provider. 2 | 3 | As a simple case, you can upload data from file:: 4 | 5 | @aiohttp.streamer 6 | async def file_sender(writer, file_name=None): 7 | with open(file_name, 'rb') as f: 8 | chunk = f.read(2**16) 9 | while chunk: 10 | await writer.write(chunk) 11 | 12 | chunk = f.read(2**16) 13 | 14 | Then you can use `file_sender` like this: 15 | 16 | async with session.post('http://httpbin.org/post', 17 | data=file_sender(file_name='huge_file')) as resp: 18 | print(await resp.text()) 19 | 20 | ..note:: Coroutine must accept `writer` as first argument 21 | 22 | """ 23 | 24 | import types 25 | import warnings 26 | from typing import Any, Awaitable, Callable, Dict, Tuple 27 | 28 | from .abc import AbstractStreamWriter 29 | from .payload import Payload, payload_type 30 | 31 | __all__ = ("streamer",) 32 | 33 | 34 | class _stream_wrapper: 35 | def __init__( 36 | self, 37 | coro: Callable[..., Awaitable[None]], 38 | args: Tuple[Any, ...], 39 | kwargs: Dict[str, Any], 40 | ) -> None: 41 | self.coro = types.coroutine(coro) 42 | self.args = args 43 | self.kwargs = kwargs 44 | 45 | async def __call__(self, writer: AbstractStreamWriter) -> None: 46 | await self.coro(writer, *self.args, **self.kwargs) # type: ignore 47 | 48 | 49 | class streamer: 50 | def __init__(self, coro: Callable[..., Awaitable[None]]) -> None: 51 | warnings.warn( 52 | "@streamer is deprecated, use async generators instead", 53 | DeprecationWarning, 54 | stacklevel=2, 55 | ) 56 | self.coro = coro 57 | 58 | def __call__(self, *args: Any, **kwargs: Any) -> _stream_wrapper: 59 | return _stream_wrapper(self.coro, args, kwargs) 60 | 61 | 62 | @payload_type(_stream_wrapper) 63 | class StreamWrapperPayload(Payload): 64 | async def write(self, writer: AbstractStreamWriter) -> None: 65 | await self._value(writer) 66 | 67 | 68 | @payload_type(streamer) 69 | class StreamPayload(StreamWrapperPayload): 70 | def __init__(self, value: Any, *args: Any, **kwargs: Any) -> None: 71 | super().__init__(value(), *args, **kwargs) 72 | 73 | async def write(self, writer: AbstractStreamWriter) -> None: 74 | await self._value(writer) 75 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/py.typed: -------------------------------------------------------------------------------- 1 | Marker 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/signals.py: -------------------------------------------------------------------------------- 1 | from aiohttp.frozenlist import FrozenList 2 | 3 | __all__ = ("Signal",) 4 | 5 | 6 | class Signal(FrozenList): 7 | """Coroutine-based signal implementation. 8 | 9 | To connect a callback to a signal, use any list method. 10 | 11 | Signals are fired using the send() coroutine, which takes named 12 | arguments. 13 | """ 14 | 15 | __slots__ = ("_owner",) 16 | 17 | def __init__(self, owner): 18 | super().__init__() 19 | self._owner = owner 20 | 21 | def __repr__(self): 22 | return "".format( 23 | self._owner, self.frozen, list(self) 24 | ) 25 | 26 | async def send(self, *args, **kwargs): 27 | """ 28 | Sends data to all registered receivers. 29 | """ 30 | if not self.frozen: 31 | raise RuntimeError("Cannot send non-frozen signal.") 32 | 33 | for receiver in self: 34 | await receiver(*args, **kwargs) # type: ignore 35 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/signals.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any, Generic, TypeVar 2 | 3 | from aiohttp.frozenlist import FrozenList 4 | 5 | __all__ = ("Signal",) 6 | 7 | _T = TypeVar("_T") 8 | 9 | class Signal(FrozenList[_T], Generic[_T]): 10 | def __init__(self, owner: Any) -> None: ... 11 | def __repr__(self) -> str: ... 12 | async def send(self, *args: Any, **kwargs: Any) -> None: ... 13 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/tcp_helpers.py: -------------------------------------------------------------------------------- 1 | """Helper methods to tune a TCP connection""" 2 | 3 | import asyncio 4 | import socket 5 | from contextlib import suppress 6 | from typing import Optional # noqa 7 | 8 | __all__ = ("tcp_keepalive", "tcp_nodelay") 9 | 10 | 11 | if hasattr(socket, "SO_KEEPALIVE"): 12 | 13 | def tcp_keepalive(transport: asyncio.Transport) -> None: 14 | sock = transport.get_extra_info("socket") 15 | if sock is not None: 16 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) 17 | 18 | 19 | else: 20 | 21 | def tcp_keepalive(transport: asyncio.Transport) -> None: # pragma: no cover 22 | pass 23 | 24 | 25 | def tcp_nodelay(transport: asyncio.Transport, value: bool) -> None: 26 | sock = transport.get_extra_info("socket") 27 | 28 | if sock is None: 29 | return 30 | 31 | if sock.family not in (socket.AF_INET, socket.AF_INET6): 32 | return 33 | 34 | value = bool(value) 35 | 36 | # socket may be closed already, on windows OSError get raised 37 | with suppress(OSError): 38 | sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, value) 39 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/typedefs.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import pathlib 4 | import sys 5 | from typing import TYPE_CHECKING, Any, Callable, Iterable, Mapping, Tuple, Union 6 | 7 | from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy, istr 8 | from yarl import URL 9 | 10 | DEFAULT_JSON_ENCODER = json.dumps 11 | DEFAULT_JSON_DECODER = json.loads 12 | 13 | if TYPE_CHECKING: # pragma: no cover 14 | _CIMultiDict = CIMultiDict[str] 15 | _CIMultiDictProxy = CIMultiDictProxy[str] 16 | _MultiDict = MultiDict[str] 17 | _MultiDictProxy = MultiDictProxy[str] 18 | from http.cookies import BaseCookie, Morsel 19 | else: 20 | _CIMultiDict = CIMultiDict 21 | _CIMultiDictProxy = CIMultiDictProxy 22 | _MultiDict = MultiDict 23 | _MultiDictProxy = MultiDictProxy 24 | 25 | Byteish = Union[bytes, bytearray, memoryview] 26 | JSONEncoder = Callable[[Any], str] 27 | JSONDecoder = Callable[[str], Any] 28 | LooseHeaders = Union[Mapping[Union[str, istr], str], _CIMultiDict, _CIMultiDictProxy] 29 | RawHeaders = Tuple[Tuple[bytes, bytes], ...] 30 | StrOrURL = Union[str, URL] 31 | 32 | LooseCookiesMappings = Mapping[str, Union[str, "BaseCookie[str]", "Morsel[Any]"]] 33 | LooseCookiesIterables = Iterable[ 34 | Tuple[str, Union[str, "BaseCookie[str]", "Morsel[Any]"]] 35 | ] 36 | LooseCookies = Union[ 37 | LooseCookiesMappings, 38 | LooseCookiesIterables, 39 | "BaseCookie[str]", 40 | ] 41 | 42 | 43 | if sys.version_info >= (3, 6): 44 | PathLike = Union[str, "os.PathLike[str]"] 45 | else: 46 | PathLike = Union[str, pathlib.PurePath] 47 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/aiohttp/web_server.py: -------------------------------------------------------------------------------- 1 | """Low level HTTP server.""" 2 | import asyncio 3 | from typing import Any, Awaitable, Callable, Dict, List, Optional # noqa 4 | 5 | from .abc import AbstractStreamWriter 6 | from .helpers import get_running_loop 7 | from .http_parser import RawRequestMessage 8 | from .streams import StreamReader 9 | from .web_protocol import RequestHandler, _RequestFactory, _RequestHandler 10 | from .web_request import BaseRequest 11 | 12 | __all__ = ("Server",) 13 | 14 | 15 | class Server: 16 | def __init__( 17 | self, 18 | handler: _RequestHandler, 19 | *, 20 | request_factory: Optional[_RequestFactory] = None, 21 | loop: Optional[asyncio.AbstractEventLoop] = None, 22 | **kwargs: Any 23 | ) -> None: 24 | self._loop = get_running_loop(loop) 25 | self._connections = {} # type: Dict[RequestHandler, asyncio.Transport] 26 | self._kwargs = kwargs 27 | self.requests_count = 0 28 | self.request_handler = handler 29 | self.request_factory = request_factory or self._make_request 30 | 31 | @property 32 | def connections(self) -> List[RequestHandler]: 33 | return list(self._connections.keys()) 34 | 35 | def connection_made( 36 | self, handler: RequestHandler, transport: asyncio.Transport 37 | ) -> None: 38 | self._connections[handler] = transport 39 | 40 | def connection_lost( 41 | self, handler: RequestHandler, exc: Optional[BaseException] = None 42 | ) -> None: 43 | if handler in self._connections: 44 | del self._connections[handler] 45 | 46 | def _make_request( 47 | self, 48 | message: RawRequestMessage, 49 | payload: StreamReader, 50 | protocol: RequestHandler, 51 | writer: AbstractStreamWriter, 52 | task: "asyncio.Task[None]", 53 | ) -> BaseRequest: 54 | return BaseRequest(message, payload, protocol, writer, task, self._loop) 55 | 56 | async def shutdown(self, timeout: Optional[float] = None) -> None: 57 | coros = [conn.shutdown(timeout) for conn in self._connections] 58 | await asyncio.gather(*coros) 59 | self._connections.clear() 60 | 61 | def __call__(self) -> RequestHandler: 62 | return RequestHandler(self, loop=self._loop, **self._kwargs) 63 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/async_timeout/py.typed: -------------------------------------------------------------------------------- 1 | Placeholder -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import sys 4 | 5 | from functools import partial 6 | 7 | from . import converters, exceptions, filters, setters, validators 8 | from ._cmp import cmp_using 9 | from ._config import get_run_validators, set_run_validators 10 | from ._funcs import asdict, assoc, astuple, evolve, has, resolve_types 11 | from ._make import ( 12 | NOTHING, 13 | Attribute, 14 | Factory, 15 | attrib, 16 | attrs, 17 | fields, 18 | fields_dict, 19 | make_class, 20 | validate, 21 | ) 22 | from ._version_info import VersionInfo 23 | 24 | 25 | __version__ = "21.2.0" 26 | __version_info__ = VersionInfo._from_version_string(__version__) 27 | 28 | __title__ = "attrs" 29 | __description__ = "Classes Without Boilerplate" 30 | __url__ = "https://www.attrs.org/" 31 | __uri__ = __url__ 32 | __doc__ = __description__ + " <" + __uri__ + ">" 33 | 34 | __author__ = "Hynek Schlawack" 35 | __email__ = "hs@ox.cx" 36 | 37 | __license__ = "MIT" 38 | __copyright__ = "Copyright (c) 2015 Hynek Schlawack" 39 | 40 | 41 | s = attributes = attrs 42 | ib = attr = attrib 43 | dataclass = partial(attrs, auto_attribs=True) # happy Easter ;) 44 | 45 | __all__ = [ 46 | "Attribute", 47 | "Factory", 48 | "NOTHING", 49 | "asdict", 50 | "assoc", 51 | "astuple", 52 | "attr", 53 | "attrib", 54 | "attributes", 55 | "attrs", 56 | "cmp_using", 57 | "converters", 58 | "evolve", 59 | "exceptions", 60 | "fields", 61 | "fields_dict", 62 | "filters", 63 | "get_run_validators", 64 | "has", 65 | "ib", 66 | "make_class", 67 | "resolve_types", 68 | "s", 69 | "set_run_validators", 70 | "setters", 71 | "validate", 72 | "validators", 73 | ] 74 | 75 | if sys.version_info[:2] >= (3, 6): 76 | from ._next_gen import define, field, frozen, mutable 77 | 78 | __all__.extend((define, field, frozen, mutable)) 79 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/_cmp.pyi: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from . import _CompareWithType 4 | 5 | def cmp_using( 6 | eq: Optional[_CompareWithType], 7 | lt: Optional[_CompareWithType], 8 | le: Optional[_CompareWithType], 9 | gt: Optional[_CompareWithType], 10 | ge: Optional[_CompareWithType], 11 | require_same_type: bool, 12 | class_name: str, 13 | ) -> Type: ... 14 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/_config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | 4 | __all__ = ["set_run_validators", "get_run_validators"] 5 | 6 | _run_validators = True 7 | 8 | 9 | def set_run_validators(run): 10 | """ 11 | Set whether or not validators are run. By default, they are run. 12 | """ 13 | if not isinstance(run, bool): 14 | raise TypeError("'run' must be bool.") 15 | global _run_validators 16 | _run_validators = run 17 | 18 | 19 | def get_run_validators(): 20 | """ 21 | Return whether or not validators are run. 22 | """ 23 | return _run_validators 24 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/_version_info.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | from functools import total_ordering 4 | 5 | from ._funcs import astuple 6 | from ._make import attrib, attrs 7 | 8 | 9 | @total_ordering 10 | @attrs(eq=False, order=False, slots=True, frozen=True) 11 | class VersionInfo(object): 12 | """ 13 | A version object that can be compared to tuple of length 1--4: 14 | 15 | >>> attr.VersionInfo(19, 1, 0, "final") <= (19, 2) 16 | True 17 | >>> attr.VersionInfo(19, 1, 0, "final") < (19, 1, 1) 18 | True 19 | >>> vi = attr.VersionInfo(19, 2, 0, "final") 20 | >>> vi < (19, 1, 1) 21 | False 22 | >>> vi < (19,) 23 | False 24 | >>> vi == (19, 2,) 25 | True 26 | >>> vi == (19, 2, 1) 27 | False 28 | 29 | .. versionadded:: 19.2 30 | """ 31 | 32 | year = attrib(type=int) 33 | minor = attrib(type=int) 34 | micro = attrib(type=int) 35 | releaselevel = attrib(type=str) 36 | 37 | @classmethod 38 | def _from_version_string(cls, s): 39 | """ 40 | Parse *s* and return a _VersionInfo. 41 | """ 42 | v = s.split(".") 43 | if len(v) == 3: 44 | v.append("final") 45 | 46 | return cls(year=int(v[0]), minor=int(v[1]), micro=int(v[2]), releaselevel=v[3]) 47 | 48 | def _ensure_tuple(self, other): 49 | """ 50 | Ensure *other* is a tuple of a valid length. 51 | 52 | Returns a possibly transformed *other* and ourselves as a tuple of 53 | the same length as *other*. 54 | """ 55 | 56 | if self.__class__ is other.__class__: 57 | other = astuple(other) 58 | 59 | if not isinstance(other, tuple): 60 | raise NotImplementedError 61 | 62 | if not (1 <= len(other) <= 4): 63 | raise NotImplementedError 64 | 65 | return astuple(self)[: len(other)], other 66 | 67 | def __eq__(self, other): 68 | try: 69 | us, them = self._ensure_tuple(other) 70 | except NotImplementedError: 71 | return NotImplemented 72 | 73 | return us == them 74 | 75 | def __lt__(self, other): 76 | try: 77 | us, them = self._ensure_tuple(other) 78 | except NotImplementedError: 79 | return NotImplemented 80 | 81 | # Since alphabetically "dev0" < "final" < "post1" < "post2", we don't 82 | # have to do anything special with releaselevel for now. 83 | return us < them 84 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/_version_info.pyi: -------------------------------------------------------------------------------- 1 | class VersionInfo: 2 | @property 3 | def year(self) -> int: ... 4 | @property 5 | def minor(self) -> int: ... 6 | @property 7 | def micro(self) -> int: ... 8 | @property 9 | def releaselevel(self) -> str: ... 10 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/converters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Callable, Optional, TypeVar, overload 2 | 3 | from . import _ConverterType 4 | 5 | _T = TypeVar("_T") 6 | 7 | def pipe(*validators: _ConverterType) -> _ConverterType: ... 8 | def optional(converter: _ConverterType) -> _ConverterType: ... 9 | @overload 10 | def default_if_none(default: _T) -> _ConverterType: ... 11 | @overload 12 | def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType: ... 13 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/exceptions.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | 4 | class FrozenError(AttributeError): 5 | """ 6 | A frozen/immutable instance or attribute have been attempted to be 7 | modified. 8 | 9 | It mirrors the behavior of ``namedtuples`` by using the same error message 10 | and subclassing `AttributeError`. 11 | 12 | .. versionadded:: 20.1.0 13 | """ 14 | 15 | msg = "can't set attribute" 16 | args = [msg] 17 | 18 | 19 | class FrozenInstanceError(FrozenError): 20 | """ 21 | A frozen instance has been attempted to be modified. 22 | 23 | .. versionadded:: 16.1.0 24 | """ 25 | 26 | 27 | class FrozenAttributeError(FrozenError): 28 | """ 29 | A frozen attribute has been attempted to be modified. 30 | 31 | .. versionadded:: 20.1.0 32 | """ 33 | 34 | 35 | class AttrsAttributeNotFoundError(ValueError): 36 | """ 37 | An ``attrs`` function couldn't find an attribute that the user asked for. 38 | 39 | .. versionadded:: 16.2.0 40 | """ 41 | 42 | 43 | class NotAnAttrsClassError(ValueError): 44 | """ 45 | A non-``attrs`` class has been passed into an ``attrs`` function. 46 | 47 | .. versionadded:: 16.2.0 48 | """ 49 | 50 | 51 | class DefaultAlreadySetError(RuntimeError): 52 | """ 53 | A default has been set using ``attr.ib()`` and is attempted to be reset 54 | using the decorator. 55 | 56 | .. versionadded:: 17.1.0 57 | """ 58 | 59 | 60 | class UnannotatedAttributeError(RuntimeError): 61 | """ 62 | A class with ``auto_attribs=True`` has an ``attr.ib()`` without a type 63 | annotation. 64 | 65 | .. versionadded:: 17.3.0 66 | """ 67 | 68 | 69 | class PythonTooOldError(RuntimeError): 70 | """ 71 | It was attempted to use an ``attrs`` feature that requires a newer Python 72 | version. 73 | 74 | .. versionadded:: 18.2.0 75 | """ 76 | 77 | 78 | class NotCallableError(TypeError): 79 | """ 80 | A ``attr.ib()`` requiring a callable has been set with a value 81 | that is not callable. 82 | 83 | .. versionadded:: 19.2.0 84 | """ 85 | 86 | def __init__(self, msg, value): 87 | super(TypeError, self).__init__(msg, value) 88 | self.msg = msg 89 | self.value = value 90 | 91 | def __str__(self): 92 | return str(self.msg) 93 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/exceptions.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | class FrozenError(AttributeError): 4 | msg: str = ... 5 | 6 | class FrozenInstanceError(FrozenError): ... 7 | class FrozenAttributeError(FrozenError): ... 8 | class AttrsAttributeNotFoundError(ValueError): ... 9 | class NotAnAttrsClassError(ValueError): ... 10 | class DefaultAlreadySetError(RuntimeError): ... 11 | class UnannotatedAttributeError(RuntimeError): ... 12 | class PythonTooOldError(RuntimeError): ... 13 | 14 | class NotCallableError(TypeError): 15 | msg: str = ... 16 | value: Any = ... 17 | def __init__(self, msg: str, value: Any) -> None: ... 18 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/filters.py: -------------------------------------------------------------------------------- 1 | """ 2 | Commonly useful filters for `attr.asdict`. 3 | """ 4 | 5 | from __future__ import absolute_import, division, print_function 6 | 7 | from ._compat import isclass 8 | from ._make import Attribute 9 | 10 | 11 | def _split_what(what): 12 | """ 13 | Returns a tuple of `frozenset`s of classes and attributes. 14 | """ 15 | return ( 16 | frozenset(cls for cls in what if isclass(cls)), 17 | frozenset(cls for cls in what if isinstance(cls, Attribute)), 18 | ) 19 | 20 | 21 | def include(*what): 22 | """ 23 | Whitelist *what*. 24 | 25 | :param what: What to whitelist. 26 | :type what: `list` of `type` or `attr.Attribute`\\ s 27 | 28 | :rtype: `callable` 29 | """ 30 | cls, attrs = _split_what(what) 31 | 32 | def include_(attribute, value): 33 | return value.__class__ in cls or attribute in attrs 34 | 35 | return include_ 36 | 37 | 38 | def exclude(*what): 39 | """ 40 | Blacklist *what*. 41 | 42 | :param what: What to blacklist. 43 | :type what: `list` of classes or `attr.Attribute`\\ s. 44 | 45 | :rtype: `callable` 46 | """ 47 | cls, attrs = _split_what(what) 48 | 49 | def exclude_(attribute, value): 50 | return value.__class__ not in cls and attribute not in attrs 51 | 52 | return exclude_ 53 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/filters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any, Union 2 | 3 | from . import Attribute, _FilterType 4 | 5 | def include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ... 6 | def exclude(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ... 7 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/attr/py.typed -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/setters.py: -------------------------------------------------------------------------------- 1 | """ 2 | Commonly used hooks for on_setattr. 3 | """ 4 | 5 | from __future__ import absolute_import, division, print_function 6 | 7 | from . import _config 8 | from .exceptions import FrozenAttributeError 9 | 10 | 11 | def pipe(*setters): 12 | """ 13 | Run all *setters* and return the return value of the last one. 14 | 15 | .. versionadded:: 20.1.0 16 | """ 17 | 18 | def wrapped_pipe(instance, attrib, new_value): 19 | rv = new_value 20 | 21 | for setter in setters: 22 | rv = setter(instance, attrib, rv) 23 | 24 | return rv 25 | 26 | return wrapped_pipe 27 | 28 | 29 | def frozen(_, __, ___): 30 | """ 31 | Prevent an attribute to be modified. 32 | 33 | .. versionadded:: 20.1.0 34 | """ 35 | raise FrozenAttributeError() 36 | 37 | 38 | def validate(instance, attrib, new_value): 39 | """ 40 | Run *attrib*'s validator on *new_value* if it has one. 41 | 42 | .. versionadded:: 20.1.0 43 | """ 44 | if _config._run_validators is False: 45 | return new_value 46 | 47 | v = attrib.validator 48 | if not v: 49 | return new_value 50 | 51 | v(instance, attrib, new_value) 52 | 53 | return new_value 54 | 55 | 56 | def convert(instance, attrib, new_value): 57 | """ 58 | Run *attrib*'s converter -- if it has one -- on *new_value* and return the 59 | result. 60 | 61 | .. versionadded:: 20.1.0 62 | """ 63 | c = attrib.converter 64 | if c: 65 | return c(new_value) 66 | 67 | return new_value 68 | 69 | 70 | NO_OP = object() 71 | """ 72 | Sentinel for disabling class-wide *on_setattr* hooks for certain attributes. 73 | 74 | Does not work in `pipe` or within lists. 75 | 76 | .. versionadded:: 20.1.0 77 | """ 78 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/setters.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any, NewType, NoReturn, TypeVar, cast 2 | 3 | from . import Attribute, _OnSetAttrType 4 | 5 | _T = TypeVar("_T") 6 | 7 | def frozen(instance: Any, attribute: Attribute[Any], new_value: Any) -> NoReturn: ... 8 | def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ... 9 | def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ... 10 | 11 | # convert is allowed to return Any, because they can be chained using pipe. 12 | def convert(instance: Any, attribute: Attribute[Any], new_value: Any) -> Any: ... 13 | 14 | _NoOpType = NewType("_NoOpType", object) 15 | NO_OP: _NoOpType 16 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/attr/validators.pyi: -------------------------------------------------------------------------------- 1 | from typing import ( 2 | Any, 3 | AnyStr, 4 | Callable, 5 | Container, 6 | Iterable, 7 | List, 8 | Mapping, 9 | Match, 10 | Optional, 11 | Tuple, 12 | Type, 13 | TypeVar, 14 | Union, 15 | overload, 16 | ) 17 | 18 | from . import _ValidatorType 19 | 20 | _T = TypeVar("_T") 21 | _T1 = TypeVar("_T1") 22 | _T2 = TypeVar("_T2") 23 | _T3 = TypeVar("_T3") 24 | _I = TypeVar("_I", bound=Iterable) 25 | _K = TypeVar("_K") 26 | _V = TypeVar("_V") 27 | _M = TypeVar("_M", bound=Mapping) 28 | 29 | # To be more precise on instance_of use some overloads. 30 | # If there are more than 3 items in the tuple then we fall back to Any 31 | @overload 32 | def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ... 33 | @overload 34 | def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ... 35 | @overload 36 | def instance_of( 37 | type: Tuple[Type[_T1], Type[_T2]] 38 | ) -> _ValidatorType[Union[_T1, _T2]]: ... 39 | @overload 40 | def instance_of( 41 | type: Tuple[Type[_T1], Type[_T2], Type[_T3]] 42 | ) -> _ValidatorType[Union[_T1, _T2, _T3]]: ... 43 | @overload 44 | def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ... 45 | def provides(interface: Any) -> _ValidatorType[Any]: ... 46 | def optional( 47 | validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]] 48 | ) -> _ValidatorType[Optional[_T]]: ... 49 | def in_(options: Container[_T]) -> _ValidatorType[_T]: ... 50 | def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ... 51 | def matches_re( 52 | regex: AnyStr, 53 | flags: int = ..., 54 | func: Optional[Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]]] = ..., 55 | ) -> _ValidatorType[AnyStr]: ... 56 | def deep_iterable( 57 | member_validator: _ValidatorType[_T], 58 | iterable_validator: Optional[_ValidatorType[_I]] = ..., 59 | ) -> _ValidatorType[_I]: ... 60 | def deep_mapping( 61 | key_validator: _ValidatorType[_K], 62 | value_validator: _ValidatorType[_V], 63 | mapping_validator: Optional[_ValidatorType[_M]] = ..., 64 | ) -> _ValidatorType[_M]: ... 65 | def is_callable() -> _ValidatorType[_T]: ... 66 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/big5prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Communicator client code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import Big5DistributionAnalysis 31 | from .mbcssm import BIG5_SM_MODEL 32 | 33 | 34 | class Big5Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | super(Big5Prober, self).__init__() 37 | self.coding_sm = CodingStateMachine(BIG5_SM_MODEL) 38 | self.distribution_analyzer = Big5DistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self): 43 | return "Big5" 44 | 45 | @property 46 | def language(self): 47 | return "Chinese" 48 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/cli/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/compat.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # Contributor(s): 3 | # Dan Blanchard 4 | # Ian Cordasco 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 | # 02110-1301 USA 20 | ######################### END LICENSE BLOCK ######################### 21 | 22 | import sys 23 | 24 | 25 | if sys.version_info < (3, 0): 26 | PY2 = True 27 | PY3 = False 28 | string_types = (str, unicode) 29 | text_type = unicode 30 | iteritems = dict.iteritems 31 | else: 32 | PY2 = False 33 | PY3 = True 34 | string_types = (bytes, str) 35 | text_type = str 36 | iteritems = dict.items 37 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/cp949prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .chardistribution import EUCKRDistributionAnalysis 29 | from .codingstatemachine import CodingStateMachine 30 | from .mbcharsetprober import MultiByteCharSetProber 31 | from .mbcssm import CP949_SM_MODEL 32 | 33 | 34 | class CP949Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | super(CP949Prober, self).__init__() 37 | self.coding_sm = CodingStateMachine(CP949_SM_MODEL) 38 | # NOTE: CP949 is a superset of EUC-KR, so the distribution should be 39 | # not different. 40 | self.distribution_analyzer = EUCKRDistributionAnalysis() 41 | self.reset() 42 | 43 | @property 44 | def charset_name(self): 45 | return "CP949" 46 | 47 | @property 48 | def language(self): 49 | return "Korean" 50 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/enums.py: -------------------------------------------------------------------------------- 1 | """ 2 | All of the Enums that are used throughout the chardet package. 3 | 4 | :author: Dan Blanchard (dan.blanchard@gmail.com) 5 | """ 6 | 7 | 8 | class InputState(object): 9 | """ 10 | This enum represents the different states a universal detector can be in. 11 | """ 12 | 13 | PURE_ASCII = 0 14 | ESC_ASCII = 1 15 | HIGH_BYTE = 2 16 | 17 | 18 | class LanguageFilter(object): 19 | """ 20 | This enum represents the different language filters we can apply to a 21 | ``UniversalDetector``. 22 | """ 23 | 24 | CHINESE_SIMPLIFIED = 0x01 25 | CHINESE_TRADITIONAL = 0x02 26 | JAPANESE = 0x04 27 | KOREAN = 0x08 28 | NON_CJK = 0x10 29 | ALL = 0x1F 30 | CHINESE = CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL 31 | CJK = CHINESE | JAPANESE | KOREAN 32 | 33 | 34 | class ProbingState(object): 35 | """ 36 | This enum represents the different states a prober can be in. 37 | """ 38 | 39 | DETECTING = 0 40 | FOUND_IT = 1 41 | NOT_ME = 2 42 | 43 | 44 | class MachineState(object): 45 | """ 46 | This enum represents the different states a state machine can be in. 47 | """ 48 | 49 | START = 0 50 | ERROR = 1 51 | ITS_ME = 2 52 | 53 | 54 | class SequenceLikelihood(object): 55 | """ 56 | This enum represents the likelihood of a character following the previous one. 57 | """ 58 | 59 | NEGATIVE = 0 60 | UNLIKELY = 1 61 | LIKELY = 2 62 | POSITIVE = 3 63 | 64 | @classmethod 65 | def get_num_categories(cls): 66 | """:returns: The number of likelihood categories in the enum.""" 67 | return 4 68 | 69 | 70 | class CharacterCategory(object): 71 | """ 72 | This enum represents the different categories language models for 73 | ``SingleByteCharsetProber`` put characters into. 74 | 75 | Anything less than CONTROL is considered a letter. 76 | """ 77 | 78 | UNDEFINED = 255 79 | LINE_BREAK = 254 80 | SYMBOL = 253 81 | DIGIT = 252 82 | CONTROL = 251 83 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/euckrprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCKRDistributionAnalysis 31 | from .mbcssm import EUCKR_SM_MODEL 32 | 33 | 34 | class EUCKRProber(MultiByteCharSetProber): 35 | def __init__(self): 36 | super(EUCKRProber, self).__init__() 37 | self.coding_sm = CodingStateMachine(EUCKR_SM_MODEL) 38 | self.distribution_analyzer = EUCKRDistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self): 43 | return "EUC-KR" 44 | 45 | @property 46 | def language(self): 47 | return "Korean" 48 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/euctwprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import EUCTWDistributionAnalysis 31 | from .mbcssm import EUCTW_SM_MODEL 32 | 33 | 34 | class EUCTWProber(MultiByteCharSetProber): 35 | def __init__(self): 36 | super(EUCTWProber, self).__init__() 37 | self.coding_sm = CodingStateMachine(EUCTW_SM_MODEL) 38 | self.distribution_analyzer = EUCTWDistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self): 43 | return "EUC-TW" 44 | 45 | @property 46 | def language(self): 47 | return "Taiwan" 48 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/gb2312prober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is mozilla.org code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 1998 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # 12 | # This library is free software; you can redistribute it and/or 13 | # modify it under the terms of the GNU Lesser General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2.1 of the License, or (at your option) any later version. 16 | # 17 | # This library is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | # Lesser General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU Lesser General Public 23 | # License along with this library; if not, write to the Free Software 24 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 25 | # 02110-1301 USA 26 | ######################### END LICENSE BLOCK ######################### 27 | 28 | from .mbcharsetprober import MultiByteCharSetProber 29 | from .codingstatemachine import CodingStateMachine 30 | from .chardistribution import GB2312DistributionAnalysis 31 | from .mbcssm import GB2312_SM_MODEL 32 | 33 | 34 | class GB2312Prober(MultiByteCharSetProber): 35 | def __init__(self): 36 | super(GB2312Prober, self).__init__() 37 | self.coding_sm = CodingStateMachine(GB2312_SM_MODEL) 38 | self.distribution_analyzer = GB2312DistributionAnalysis() 39 | self.reset() 40 | 41 | @property 42 | def charset_name(self): 43 | return "GB2312" 44 | 45 | @property 46 | def language(self): 47 | return "Chinese" 48 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/mbcsgroupprober.py: -------------------------------------------------------------------------------- 1 | ######################## BEGIN LICENSE BLOCK ######################## 2 | # The Original Code is Mozilla Universal charset detector code. 3 | # 4 | # The Initial Developer of the Original Code is 5 | # Netscape Communications Corporation. 6 | # Portions created by the Initial Developer are Copyright (C) 2001 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Mark Pilgrim - port to Python 11 | # Shy Shalom - original C code 12 | # Proofpoint, Inc. 13 | # 14 | # This library is free software; you can redistribute it and/or 15 | # modify it under the terms of the GNU Lesser General Public 16 | # License as published by the Free Software Foundation; either 17 | # version 2.1 of the License, or (at your option) any later version. 18 | # 19 | # This library is distributed in the hope that it will be useful, 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | # Lesser General Public License for more details. 23 | # 24 | # You should have received a copy of the GNU Lesser General Public 25 | # License along with this library; if not, write to the Free Software 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 27 | # 02110-1301 USA 28 | ######################### END LICENSE BLOCK ######################### 29 | 30 | from .charsetgroupprober import CharSetGroupProber 31 | from .utf8prober import UTF8Prober 32 | from .sjisprober import SJISProber 33 | from .eucjpprober import EUCJPProber 34 | from .gb2312prober import GB2312Prober 35 | from .euckrprober import EUCKRProber 36 | from .cp949prober import CP949Prober 37 | from .big5prober import Big5Prober 38 | from .euctwprober import EUCTWProber 39 | 40 | 41 | class MBCSGroupProber(CharSetGroupProber): 42 | def __init__(self, lang_filter=None): 43 | super(MBCSGroupProber, self).__init__(lang_filter=lang_filter) 44 | self.probers = [ 45 | UTF8Prober(), 46 | SJISProber(), 47 | EUCJPProber(), 48 | GB2312Prober(), 49 | EUCKRProber(), 50 | CP949Prober(), 51 | Big5Prober(), 52 | EUCTWProber(), 53 | ] 54 | self.reset() 55 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/metadata/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/chardet/metadata/__init__.py -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/chardet/version.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module exists only to simplify retrieving the version number of chardet 3 | from within setup.py and from chardet subpackages. 4 | 5 | :author: Dan Blanchard (dan.blanchard@gmail.com) 6 | """ 7 | 8 | __version__ = "4.0.0" 9 | VERSION = __version__.split(".") 10 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/idna/__init__.py: -------------------------------------------------------------------------------- 1 | from .package_data import __version__ 2 | from .core import ( 3 | IDNABidiError, 4 | IDNAError, 5 | InvalidCodepoint, 6 | InvalidCodepointContext, 7 | alabel, 8 | check_bidi, 9 | check_hyphen_ok, 10 | check_initial_combiner, 11 | check_label, 12 | check_nfc, 13 | decode, 14 | encode, 15 | ulabel, 16 | uts46_remap, 17 | valid_contextj, 18 | valid_contexto, 19 | valid_label_length, 20 | valid_string_length, 21 | ) 22 | from .intranges import intranges_contain 23 | 24 | __all__ = [ 25 | "IDNABidiError", 26 | "IDNAError", 27 | "InvalidCodepoint", 28 | "InvalidCodepointContext", 29 | "alabel", 30 | "check_bidi", 31 | "check_hyphen_ok", 32 | "check_initial_combiner", 33 | "check_label", 34 | "check_nfc", 35 | "decode", 36 | "encode", 37 | "intranges_contain", 38 | "ulabel", 39 | "uts46_remap", 40 | "valid_contextj", 41 | "valid_contexto", 42 | "valid_label_length", 43 | "valid_string_length", 44 | ] 45 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/idna/compat.py: -------------------------------------------------------------------------------- 1 | from .core import * 2 | from .codec import * 3 | from typing import Any, Union 4 | 5 | 6 | def ToASCII(label): 7 | # type: (str) -> bytes 8 | return encode(label) 9 | 10 | 11 | def ToUnicode(label): 12 | # type: (Union[bytes, bytearray]) -> str 13 | return decode(label) 14 | 15 | 16 | def nameprep(s): 17 | # type: (Any) -> None 18 | raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol") 19 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/idna/intranges.py: -------------------------------------------------------------------------------- 1 | """ 2 | Given a list of integers, made up of (hopefully) a small number of long runs 3 | of consecutive integers, compute a representation of the form 4 | ((start1, end1), (start2, end2) ...). Then answer the question "was x present 5 | in the original list?" in time O(log(# runs)). 6 | """ 7 | 8 | import bisect 9 | from typing import List, Tuple 10 | 11 | 12 | def intranges_from_list(list_): 13 | # type: (List[int]) -> Tuple[int, ...] 14 | """Represent a list of integers as a sequence of ranges: 15 | ((start_0, end_0), (start_1, end_1), ...), such that the original 16 | integers are exactly those x such that start_i <= x < end_i for some i. 17 | 18 | Ranges are encoded as single integers (start << 32 | end), not as tuples. 19 | """ 20 | 21 | sorted_list = sorted(list_) 22 | ranges = [] 23 | last_write = -1 24 | for i in range(len(sorted_list)): 25 | if i + 1 < len(sorted_list): 26 | if sorted_list[i] == sorted_list[i + 1] - 1: 27 | continue 28 | current_range = sorted_list[last_write + 1 : i + 1] 29 | ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) 30 | last_write = i 31 | 32 | return tuple(ranges) 33 | 34 | 35 | def _encode_range(start, end): 36 | # type: (int, int) -> int 37 | return (start << 32) | end 38 | 39 | 40 | def _decode_range(r): 41 | # type: (int) -> Tuple[int, int] 42 | return (r >> 32), (r & ((1 << 32) - 1)) 43 | 44 | 45 | def intranges_contain(int_, ranges): 46 | # type: (int, Tuple[int, ...]) -> bool 47 | """Determine if `int_` falls into one of the ranges in `ranges`.""" 48 | tuple_ = _encode_range(int_, 0) 49 | pos = bisect.bisect_left(ranges, tuple_) 50 | # we could be immediately ahead of a tuple (start, end) 51 | # with start < int_ <= end 52 | if pos > 0: 53 | left, right = _decode_range(ranges[pos - 1]) 54 | if left <= int_ < right: 55 | return True 56 | # or we could be immediately behind a tuple (int_, end) 57 | if pos < len(ranges): 58 | left, _ = _decode_range(ranges[pos]) 59 | if left == int_: 60 | return True 61 | return False 62 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/idna/package_data.py: -------------------------------------------------------------------------------- 1 | __version__ = "3.2" 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/idna/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/idna/py.typed -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/__init__.py: -------------------------------------------------------------------------------- 1 | from lichess_client.clients import APIClient 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/__init__.py -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_account.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractAccount(ABC): 5 | """An abstract class for Account API Endpoint""" 6 | 7 | @abstractmethod 8 | def get_my_profile(self): 9 | """ 10 | Public information about the logged in user. 11 | """ 12 | pass 13 | 14 | @abstractmethod 15 | def get_my_email_address(self): 16 | """ 17 | Read the email address of the logged in user. 18 | """ 19 | pass 20 | 21 | @abstractmethod 22 | def get_my_preferences(self): 23 | """ 24 | Read the preferences of the logged in user. 25 | """ 26 | pass 27 | 28 | @abstractmethod 29 | def get_my_kid_mode_status(self): 30 | """ 31 | Read the kid mode status of the logged in user. 32 | """ 33 | pass 34 | 35 | @abstractmethod 36 | def set_my_kid_mode_status(self, *, turned_on: bool): 37 | """ 38 | Set the kid mode status of the logged in user. 39 | 40 | Parameters 41 | ---------- 42 | turned_on: bool, required 43 | The indicator to turn on or turn off the kid mode. 44 | """ 45 | pass 46 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_boards.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import TYPE_CHECKING 3 | 4 | if TYPE_CHECKING: 5 | from lichess_client.utils.enums import VariantTypes, ColorType, RoomTypes 6 | 7 | 8 | class AbstractBoards(ABC): 9 | """An abstract class for Bots API Endpoint""" 10 | 11 | @abstractmethod 12 | def stream_incoming_events(self): 13 | """ 14 | Stream the events reaching a lichess user in real time. 15 | """ 16 | pass 17 | 18 | @abstractmethod 19 | def create_a_seek( 20 | self, 21 | time: int, 22 | increment: int, 23 | variant: "VariantTypes", 24 | color: "ColorType", 25 | rated: bool, 26 | rating_range, 27 | ): 28 | """ 29 | Create a public seek, to start a game with a random player. 30 | """ 31 | pass 32 | 33 | @abstractmethod 34 | def stream_game_state(self, game_id: str): 35 | """ 36 | Stream the state of a game being played with the Board API 37 | """ 38 | pass 39 | 40 | @abstractmethod 41 | def make_move(self, game_id: str, move: str, draw: bool): 42 | """Make a move in a game being played with the Board API.""" 43 | pass 44 | 45 | @abstractmethod 46 | def abort_game(self, game_id: str): 47 | """Abort a game being played with the Board API.""" 48 | pass 49 | 50 | @abstractmethod 51 | def resign_game(self, game_id: str): 52 | """Resign a game being played with the Board API.""" 53 | pass 54 | 55 | @abstractmethod 56 | def write_in_chat(self, game_id: str, room: "RoomTypes", message: str): 57 | """Post a message to the player or spectator chat, in a game being played with the Board API.""" 58 | pass 59 | 60 | @abstractmethod 61 | def handle_draw(self, game_id: str, accept: bool = True): 62 | """Create/accept/decline draw offers.""" 63 | pass 64 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_bots.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractBots(ABC): 5 | """An abstract class for Bots API Endpoint""" 6 | 7 | @abstractmethod 8 | def stream_incoming_events(self): 9 | """ 10 | Stream the events reaching a lichess user in real time. 11 | """ 12 | pass 13 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_broadcast.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractBroadcast(ABC): 5 | """An abstract class for Broadcast API Endpoint""" 6 | 7 | @abstractmethod 8 | def create( 9 | self, 10 | name: str, 11 | description: str, 12 | source_url: str = None, 13 | markdown: str = None, 14 | credit: str = None, 15 | start_time: int = None, 16 | ): 17 | """Create a new broadcast to relay external games.""" 18 | pass 19 | 20 | @abstractmethod 21 | def get(self, broadcast_id: str): 22 | """Get information about a broadcast that you created.""" 23 | pass 24 | 25 | @abstractmethod 26 | def update( 27 | self, 28 | broadcast_id: str, 29 | name: str, 30 | description: str, 31 | source_url: str = None, 32 | markdown: str = None, 33 | credit: str = None, 34 | start_time: int = None, 35 | ): 36 | """Update information about a broadcast that you created.""" 37 | pass 38 | 39 | @abstractmethod 40 | def push_pgn(self, broadcast_id: str, games: str): 41 | """Update your broadcast with new PGN.""" 42 | pass 43 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_challenges.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import TYPE_CHECKING 3 | 4 | if TYPE_CHECKING: 5 | from lichess_client.utils.enums import VariantTypes, ColorType 6 | 7 | 8 | class AbstractChallenges(ABC): 9 | """An abstract class for Challenges API Endpoint""" 10 | 11 | @abstractmethod 12 | def stream_incoming_events(self): 13 | pass 14 | 15 | @abstractmethod 16 | def create( 17 | self, 18 | username: str, 19 | time_limit: int, 20 | time_increment: int, 21 | rated: bool, 22 | days: int, 23 | color: "ColorType", 24 | variant: "VariantTypes", 25 | position: str, 26 | ): 27 | """Challenge someone to play.""" 28 | pass 29 | 30 | @abstractmethod 31 | def accept(self, challenge_id: str): 32 | """Accept an incoming challenge.""" 33 | pass 34 | 35 | @abstractmethod 36 | def decline(self, challenge_id: str): 37 | """Decline an incoming challenge.""" 38 | pass 39 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_chess_bot.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | 4 | class AbstractChessBot(ABC): 5 | """An abstract class for Chess Bot API Endpoint""" 6 | 7 | pass 8 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_games.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import TYPE_CHECKING, List 3 | 4 | if TYPE_CHECKING: 5 | from lichess_client.utils.enums import VariantTypes, ColorType 6 | 7 | 8 | class AbstractGames(ABC): 9 | """An abstract class for Games API Endpoint""" 10 | 11 | @abstractmethod 12 | def export_one_game(self, game_id: str): 13 | """Download one game. Only finished games can be downloaded.""" 14 | pass 15 | 16 | @abstractmethod 17 | def export_games_of_a_user( 18 | self, 19 | username: str, 20 | since: int = None, 21 | until: int = None, 22 | max: int = None, 23 | vs: str = None, 24 | rated: bool = None, 25 | variant: "VariantTypes" = None, 26 | color: "ColorType" = None, 27 | analysed: bool = None, 28 | ongoing: bool = False, 29 | ): 30 | """Download all games of any user in PGN format.""" 31 | pass 32 | 33 | @abstractmethod 34 | def export_games_by_ids(self, game_ids: List[str]): 35 | """Download games by IDs.""" 36 | pass 37 | 38 | @abstractmethod 39 | def stream_current_games(self, users: List[str]): 40 | """Stream current games between users.""" 41 | pass 42 | 43 | @abstractmethod 44 | def get_ongoing_games(self, limit: int = 9): 45 | """Get the ongoing games of the current user.""" 46 | pass 47 | 48 | @abstractmethod 49 | def get_current_tv_games(self): 50 | """Get basic info about the best games being played for each speed and variant, 51 | but also computer games and bot games.""" 52 | pass 53 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_messaging.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractMessaging(ABC): 5 | """An abstract class for Messaging API Endpoint""" 6 | 7 | @abstractmethod 8 | def send(self, username: str, text: str): 9 | """Send a private message to another player.""" 10 | pass 11 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_relations.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractRelations(ABC): 5 | """An abstract class for Relations API Endpoint""" 6 | 7 | @abstractmethod 8 | def get_users_followed_by_a_user(self, username: str): 9 | """Fetching all users followed by current user. 10 | This is a streaming endpoint.""" 11 | pass 12 | 13 | @abstractmethod 14 | def get_users_who_follow_a_user(self, username: str): 15 | """Fetching all users who follow this user. 16 | This is a streaming endpoint.""" 17 | pass 18 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_simulations.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractSimulations(ABC): 5 | """An abstract class for Simulations API Endpoint""" 6 | 7 | @abstractmethod 8 | def get_current(self): 9 | """Get recently finished, ongoing, and upcoming simuls.""" 10 | pass 11 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_studies.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractStudies(ABC): 5 | """An abstract class for Studies API Endpoint""" 6 | 7 | @abstractmethod 8 | def export_chapter(self, study_id: str, chapter_id: str): 9 | """Download one study chapter in PGN format.""" 10 | pass 11 | 12 | @abstractmethod 13 | def export_all_chapters(self, study_id: str): 14 | """Download all chapters of a study in PGN format.""" 15 | pass 16 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_teams.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class AbstractTeams(ABC): 5 | """An abstract class for Teams API Endpoint""" 6 | 7 | @abstractmethod 8 | def get_members_of_a_team(self): 9 | """Not implemented""" 10 | pass 11 | 12 | @abstractmethod 13 | def join_a_team(self, team_id: str): 14 | """Join a team.""" 15 | pass 16 | 17 | @abstractmethod 18 | def leave_a_team(self, team_id: str): 19 | """Leave a team.""" 20 | pass 21 | 22 | @abstractmethod 23 | def kick_a_user_from_your_team(self, team_id: str, user_id: str): 24 | """Kick a member out of one of your teams.""" 25 | pass 26 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_tournaments.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import TYPE_CHECKING 3 | 4 | if TYPE_CHECKING: 5 | from lichess_client.utils.enums import VariantTypes 6 | 7 | 8 | class AbstractTournaments(ABC): 9 | """An abstract class for Tournaments API Endpoint""" 10 | 11 | @abstractmethod 12 | def get_current(self): 13 | """Get recently finished, ongoing, and upcoming tournaments.""" 14 | pass 15 | 16 | @abstractmethod 17 | def create( 18 | self, 19 | clock_time: int, 20 | clock_increment: int, 21 | minutes: int, 22 | name: str, 23 | wait_minutes: int, 24 | start_date: int, 25 | variant: "VariantTypes", 26 | rated: bool, 27 | position: str, 28 | berserk: bool, 29 | password: str, 30 | team_id: str, 31 | min_rating: int, 32 | max_rating: int, 33 | number_of_rated_games: int, 34 | ): 35 | """Create a public or private tournament to your taste.""" 36 | pass 37 | 38 | @abstractmethod 39 | def export_games(self, tournament_id: str): 40 | """Download games of a tournament.""" 41 | pass 42 | 43 | @abstractmethod 44 | def get_results(self, tournament_id: str, limit: int = 10): 45 | """Players of a tournament, with their score and performance, sorted by rank (best first).""" 46 | pass 47 | 48 | @abstractmethod 49 | def get_tournaments_created_by_a_user(self, username: str, limit: int = 10): 50 | """Get all tournaments created by a given user.""" 51 | pass 52 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/abstract_endpoints/abstract_users.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import List 3 | 4 | from lichess_client.utils.enums import VariantTypes 5 | 6 | 7 | class AbstractUsers(ABC): 8 | """An abstract class for Users API Endpoint""" 9 | 10 | @abstractmethod 11 | def get_real_time_users_status(self, users_ids: List[str]): 12 | """ 13 | Read the online, playing and streaming flags of several users. 14 | 15 | This API is very fast and cheap on lichess side. So you can call it quite often (like once every 5 seconds). 16 | 17 | Use it to track players and know when they're connected on lichess and playing games.""" 18 | pass 19 | 20 | @abstractmethod 21 | def get_all_top_10(self): 22 | """Get the top 10 players for each speed and variant.""" 23 | pass 24 | 25 | @abstractmethod 26 | def get_one_leaderboard(self, variant: "VariantTypes", limit: int = 10): 27 | """ 28 | Get the leaderboard for a single speed or variant (a.k.a. perfType). 29 | There is no leaderboard for correspondence or puzzles. 30 | """ 31 | pass 32 | 33 | @abstractmethod 34 | def get_user_public_data(self, username: str): 35 | """Read public data of a user.""" 36 | pass 37 | 38 | @abstractmethod 39 | def get_rating_history_of_a_user(self, username: str): 40 | """Read rating history of a user, for all perf types. There is at most one entry per day. 41 | Format of an entry is [year, month, day, rating]. month starts at zero (January).""" 42 | pass 43 | 44 | @abstractmethod 45 | def get_user_activity(self, username: str): 46 | """Read data to generate the activity feed of a user.""" 47 | pass 48 | 49 | @abstractmethod 50 | def get_your_puzzle_activity(self, limit: int = None): 51 | """Download your puzzle activity in ndjson format. 52 | Puzzle activity is sorted by reverse chronological order (most recent first)""" 53 | pass 54 | 55 | @abstractmethod 56 | def get_users_by_id(self, users_ids: List[str]): 57 | """Get several users by their IDs. Users are returned in the order same order as the IDs. 58 | The method is POST so a longer list of IDs can be sent in the request body.""" 59 | pass 60 | 61 | @abstractmethod 62 | def get_members_of_a_team(self, team_id: str): 63 | """Download your puzzle activity in ndjson format. 64 | Puzzle activity is sorted by reverse chronological order (most recent first)""" 65 | pass 66 | 67 | @abstractmethod 68 | def get_live_streamers(self): 69 | """Get basic info about currently streaming users.""" 70 | pass 71 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/clients/__init__.py: -------------------------------------------------------------------------------- 1 | from lichess_client.clients.client import APIClient 2 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/clients/abstract_client.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | 4 | class AbstractClient(ABC): 5 | """An abstract class for a Client""" 6 | 7 | pass 8 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/clients/client.py: -------------------------------------------------------------------------------- 1 | from lichess_client.clients.abstract_client import AbstractClient 2 | from lichess_client.clients.base_client import BaseClient 3 | from lichess_client.endpoints import ( 4 | Account, 5 | Broadcast, 6 | Challenges, 7 | ChessBot, 8 | Games, 9 | Messaging, 10 | Relations, 11 | Simulations, 12 | Studies, 13 | Teams, 14 | Tournaments, 15 | Users, 16 | Bots, 17 | Boards, 18 | ) 19 | 20 | 21 | class APIClient(AbstractClient): 22 | """ 23 | ASYNC APIClient class for handling secure connections with Lichees API via token usage. 24 | 25 | Parameters 26 | ---------- 27 | token: str, required 28 | String with token provided from Lichees.org account site. 29 | 30 | loop: asyncio event loop, optional 31 | Asyncio event loop for async mode operations 32 | """ 33 | 34 | def __init__(self, token: str, loop=None) -> None: 35 | self._client = BaseClient(token=token, loop=loop) 36 | 37 | self.account = Account(client=self._client) 38 | self.broadcast = Broadcast(client=self._client) 39 | self.challenges = Challenges(client=self._client) 40 | self.chess_bot = ChessBot(client=self._client) 41 | self.games = Games(client=self._client) 42 | self.messaging = Messaging(client=self._client) 43 | self.relations = Relations(client=self._client) 44 | self.simulations = Simulations(client=self._client) 45 | self.studies = Studies(client=self._client) 46 | self.teams = Teams(client=self._client) 47 | self.tournaments = Tournaments(client=self._client) 48 | self.users = Users(client=self._client) 49 | self.bots = Bots(client=self._client) 50 | self.boards = Boards(client=self._client) 51 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/__init__.py: -------------------------------------------------------------------------------- 1 | from lichess_client.endpoints.account import Account 2 | from lichess_client.endpoints.broadcast import Broadcast 3 | from lichess_client.endpoints.challenges import Challenges 4 | from lichess_client.endpoints.chess_bot import ChessBot 5 | from lichess_client.endpoints.games import Games 6 | from lichess_client.endpoints.messaging import Messaging 7 | from lichess_client.endpoints.relations import Relations 8 | from lichess_client.endpoints.simulations import Simulations 9 | from lichess_client.endpoints.studies import Studies 10 | from lichess_client.endpoints.teams import Teams 11 | from lichess_client.endpoints.tournaments import Tournaments 12 | from lichess_client.endpoints.users import Users 13 | from lichess_client.endpoints.bots import Bots 14 | from lichess_client.endpoints.boards import Boards 15 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/bots.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from lichess_client.abstract_endpoints.abstract_bots import AbstractBots 4 | from lichess_client.utils.enums import RequestMethods 5 | from lichess_client.utils.hrefs import BOTS_STREAM_INCOMING_EVENTS 6 | 7 | if TYPE_CHECKING: 8 | from lichess_client.clients.base_client import BaseClient 9 | from lichess_client.helpers import Response 10 | 11 | 12 | class Bots(AbstractBots): 13 | """Class for Bots API Endpoint""" 14 | 15 | def __init__(self, client: "BaseClient") -> None: 16 | self._client = client 17 | 18 | async def stream_incoming_events(self) -> "Response": 19 | """ 20 | Stream the events reaching a lichess user in real time. 21 | 22 | Returns 23 | ------- 24 | Response object with response content. 25 | 26 | Example 27 | ------- 28 | >>> from lichess_client import APIClient 29 | >>> client = APIClient(token='...') 30 | >>> response = client.bots.get_my_profile() 31 | """ 32 | headers = {"Content-Type": "application/json"} 33 | response = await self._client.request( 34 | method=RequestMethods.GET, url=BOTS_STREAM_INCOMING_EVENTS, headers=headers 35 | ) 36 | return response 37 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/chess_bot.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from lichess_client.abstract_endpoints.abstract_chess_bot import AbstractChessBot 4 | 5 | if TYPE_CHECKING: 6 | from lichess_client.clients.base_client import BaseClient 7 | 8 | 9 | class ChessBot(AbstractChessBot): 10 | """Class for Chess Bot API Endpoint""" 11 | 12 | def __init__(self, client: "BaseClient") -> None: 13 | self._client = client 14 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/messaging.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from lichess_client.abstract_endpoints.abstract_messaging import AbstractMessaging 4 | from lichess_client.utils.enums import RequestMethods 5 | from lichess_client.utils.hrefs import MESSAGES_SEND 6 | 7 | if TYPE_CHECKING: 8 | from lichess_client.clients.base_client import BaseClient 9 | from lichess_client.helpers import Response 10 | 11 | 12 | class Messaging(AbstractMessaging): 13 | """Class for Messaging API Endpoint""" 14 | 15 | def __init__(self, client: "BaseClient") -> None: 16 | self._client = client 17 | 18 | async def send(self, username: str, text: str) -> "Response": 19 | """ 20 | Send a private message to another player. 21 | 22 | Parameters 23 | ---------- 24 | username: str, required 25 | 26 | text: str, required 27 | 28 | Returns 29 | ------- 30 | Response object with response content. 31 | 32 | Example 33 | ------- 34 | >>> from lichess_client import APIClient 35 | >>> client = APIClient(token='...') 36 | >>> response = await client.messaging.send() 37 | """ 38 | 39 | headers = {"Content-Type": "application/x-www-form-urlencoded"} 40 | 41 | data = {"text": text} 42 | 43 | response = await self._client.request( 44 | method=RequestMethods.POST, 45 | url=MESSAGES_SEND.format(username=username), 46 | data=data, 47 | headers=headers, 48 | ) 49 | return response 50 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/relations.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from lichess_client.abstract_endpoints.abstract_relations import AbstractRelations 4 | from lichess_client.utils.enums import RequestMethods 5 | from lichess_client.utils.hrefs import RELATIONS_FOLLOWERS_URL, RELATIONS_FOLLOWING_URL 6 | 7 | if TYPE_CHECKING: 8 | from lichess_client.clients.base_client import BaseClient 9 | from lichess_client.helpers import Response 10 | 11 | 12 | class Relations(AbstractRelations): 13 | """Class for Relations API Endpoint""" 14 | 15 | def __init__(self, client: "BaseClient") -> None: 16 | self._client = client 17 | 18 | async def get_users_followed_by_a_user(self, username: str) -> "Response": 19 | """ 20 | Fetching all users followed by current user. 21 | This is a streaming endpoint. 22 | 23 | Parameters 24 | ---------- 25 | username: str, required 26 | 27 | Returns 28 | ------- 29 | Response object with response content. 30 | 31 | Example 32 | ------- 33 | >>> from lichess_client import APIClient 34 | >>> client = APIClient(token='...') 35 | >>> response = client.users.get_users_followed_by_a_user(username='amasend') 36 | """ 37 | headers = { 38 | "Content-Type": "application/x-ndjson", 39 | } 40 | response = await self._client.request_stream( 41 | method=RequestMethods.GET, 42 | url=RELATIONS_FOLLOWING_URL.format(username=username), 43 | headers=headers, 44 | ) 45 | return response 46 | 47 | async def get_users_who_follow_a_user(self, username: str) -> "Response": 48 | """ 49 | Fetching all users who follow this user. 50 | This is a streaming endpoint. 51 | 52 | Parameters 53 | ---------- 54 | username: str, required 55 | 56 | Returns 57 | ------- 58 | Response object with response content. 59 | 60 | Example 61 | ------- 62 | >>> from lichess_client import APIClient 63 | >>> client = APIClient(token='...') 64 | >>> response = client.users.get_users_who_follow_a_user(username='amasend') 65 | """ 66 | headers = { 67 | "Content-Type": "application/x-ndjson", 68 | } 69 | response = await self._client.request_stream( 70 | method=RequestMethods.GET, 71 | url=RELATIONS_FOLLOWERS_URL.format(username=username), 72 | headers=headers, 73 | ) 74 | return response 75 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/simulations.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from lichess_client.abstract_endpoints.abstract_simulations import AbstractSimulations 4 | from lichess_client.utils.enums import RequestMethods 5 | from lichess_client.utils.hrefs import SIMULATIONS_GET 6 | 7 | if TYPE_CHECKING: 8 | from lichess_client.clients.base_client import BaseClient 9 | from lichess_client.helpers import Response 10 | 11 | 12 | class Simulations(AbstractSimulations): 13 | """Class for Simulations API Endpoint""" 14 | 15 | def __init__(self, client: "BaseClient") -> None: 16 | self._client = client 17 | 18 | async def get_current(self) -> "Response": 19 | """ 20 | Get recently finished, ongoing, and upcoming simuls. 21 | 22 | Returns 23 | ------- 24 | Response object with response content. 25 | 26 | Example 27 | ------- 28 | >>> from lichess_client import APIClient 29 | >>> client = APIClient(token='...') 30 | >>> response = await client.simulations.get_current() 31 | """ 32 | 33 | response = await self._client.request( 34 | method=RequestMethods.GET, url=SIMULATIONS_GET 35 | ) 36 | return response 37 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/endpoints/studies.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from lichess_client.abstract_endpoints.abstract_studies import AbstractStudies 4 | from lichess_client.utils.enums import RequestMethods 5 | from lichess_client.utils.hrefs import ( 6 | STUDIES_EXPORT_ALL_CHAPTERS, 7 | STUDIES_EXPORT_CHAPTER, 8 | ) 9 | 10 | if TYPE_CHECKING: 11 | from lichess_client.clients.base_client import BaseClient 12 | from lichess_client.helpers import Response 13 | 14 | 15 | class Studies(AbstractStudies): 16 | """Class for Studies API Endpoint""" 17 | 18 | def __init__(self, client: "BaseClient") -> None: 19 | self._client = client 20 | 21 | async def export_chapter(self, study_id: str, chapter_id: str) -> "Response": 22 | """ 23 | Download one study chapter in PGN format. 24 | 25 | Parameters 26 | ---------- 27 | study_id: str, required 28 | 29 | chapter_id: str, required 30 | 31 | Returns 32 | ------- 33 | Response object with response content. 34 | 35 | Example 36 | ------- 37 | >>> from lichess_client import APIClient 38 | >>> client = APIClient(token='...') 39 | >>> response = await client.studies.export_chapter(study_id="...", chapter_id='...') 40 | """ 41 | 42 | response = await self._client.request( 43 | method=RequestMethods.GET, 44 | url=STUDIES_EXPORT_CHAPTER.format(studyId=study_id, chapterId=chapter_id), 45 | ) 46 | return response 47 | 48 | async def export_all_chapters(self, study_id: str) -> "Response": 49 | """ 50 | Download all chapters of a study in PGN format. 51 | 52 | Parameters 53 | ---------- 54 | study_id: str, required 55 | 56 | Returns 57 | ------- 58 | Response object with response content. 59 | 60 | Example 61 | ------- 62 | >>> from lichess_client import APIClient 63 | >>> client = APIClient(token='...') 64 | >>> response = await client.studies.export_all_chapters(study_id="...") 65 | """ 66 | 67 | response = await self._client.request( 68 | method=RequestMethods.GET, 69 | url=STUDIES_EXPORT_ALL_CHAPTERS.format(studyId=study_id), 70 | ) 71 | return response 72 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | from lichess_client.helpers.response_helpers import ( 2 | Response, 3 | ResponseEntity, 4 | ResponseMetadata, 5 | ) 6 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/helpers/response_helpers.py: -------------------------------------------------------------------------------- 1 | from typing import List, Union, TYPE_CHECKING 2 | 3 | from lichess_client.utils.enums import RequestMethods, StatusTypes 4 | 5 | if TYPE_CHECKING: 6 | from chess.pgn import Game 7 | 8 | __all__ = ["Response", "ResponseMetadata", "ResponseEntity"] 9 | 10 | 11 | class BaseHelper: 12 | """Base Helper class with defined custom magic methods, also for to dictionary conversion.""" 13 | 14 | def to_dict(self) -> dict: 15 | _dict: dict = {} 16 | for key, val in vars(self).items(): 17 | if hasattr(val, "to_dict"): 18 | _dict[key] = val.to_dict() 19 | else: 20 | _dict[key] = val 21 | return _dict 22 | 23 | def __repr__(self): 24 | return str(self.to_dict()) 25 | 26 | def __str__(self): 27 | return str(self.to_dict()) 28 | 29 | 30 | class ResponseMetadata(BaseHelper): 31 | """Metadata class for the response object.""" 32 | 33 | def __init__( 34 | self, method: str, url: str, content_type: str, timestamp: bytes 35 | ) -> None: 36 | self.method = RequestMethods[method] 37 | self.url = url 38 | self.content_type = content_type 39 | self.timestamp = timestamp 40 | 41 | 42 | class ResponseEntity(BaseHelper): 43 | """Entity class for the response object.""" 44 | 45 | def __init__( 46 | self, 47 | code: int, 48 | reason: str, 49 | status: "StatusTypes", 50 | content: Union[List[dict], dict, "Game"], 51 | ) -> None: 52 | self.code = code 53 | self.reason = reason 54 | self.status = status 55 | self.content = content 56 | 57 | 58 | class Response(BaseHelper): 59 | """The Response class. Used to store every API response in the unified way.""" 60 | 61 | def __init__(self, metadata: "ResponseMetadata", entity: "ResponseEntity") -> None: 62 | self.metadata = metadata 63 | self.entity = entity 64 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/lichess_client/utils/__init__.py -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/utils/client_errors.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from typing import Any 3 | 4 | 5 | logger = logging.getLogger("lichess_client") 6 | 7 | 8 | class BaseError(Exception): 9 | def __init__(self, value: Any, reason: str) -> None: 10 | super().__init__(value, reason) 11 | logger.debug(f"Error in: {value} Reason: {reason}") 12 | 13 | 14 | class ToManyIDs(BaseError): 15 | def __init__(self, value: Any, reason: str) -> None: 16 | super().__init__(value, reason) 17 | 18 | 19 | class LimitError(BaseError): 20 | def __init__(self, value: Any, reason: str) -> None: 21 | super().__init__(value, reason) 22 | 23 | 24 | class RatingRangeError(BaseError): 25 | def __init__(self, value: Any, reason: str) -> None: 26 | super().__init__(value, reason) 27 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/lichess_client/utils/enums.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class RequestMethods(Enum): 5 | """HTTP REST methods types""" 6 | 7 | GET = "GET" 8 | POST = "POST" 9 | PUT = "PUT" 10 | DELETE = "DELETE" 11 | 12 | 13 | class StatusTypes(str, Enum): 14 | """API response statuses""" 15 | 16 | SUCCESS = "success" 17 | ERROR = "error" 18 | 19 | 20 | class VariantTypes(str, Enum): 21 | """Game variant types""" 22 | 23 | STANDARD = "standard" 24 | ULTRA_BULLET = "ultraBullet" 25 | BULLET = "bullet" 26 | BLITZ = "blitz" 27 | RAPID = "rapid" 28 | CLASSICAL = "classical" 29 | CHESS960 = "chess960" 30 | CRAZYHOUSE = "crazyhouse" 31 | ANTICHESS = "antichess" 32 | ATOMIC = "atomic" 33 | HORDE = "horde" 34 | KING_OF_THE_HILL = "kingOfTheHill" 35 | RACING_KINGS = "racingKings" 36 | THRESS_CHECK = "threeCheck" 37 | 38 | 39 | class ColorType(str, Enum): 40 | """Color of the user pawns.""" 41 | 42 | WHITE = "white" 43 | BLACK = "black" 44 | RANDOM = "random" 45 | 46 | 47 | class RoomTypes(str, Enum): 48 | """Room types to posting user message.""" 49 | 50 | PLAYER = "player" 51 | SPECTATOR = "spectator" 52 | 53 | 54 | class SideTypes(Enum): 55 | """Side enum for Game description""" 56 | 57 | WHITE = 1 58 | BLACK = -1 59 | 60 | 61 | # TODO: check more statuses 62 | class GameStatusTypes(str, Enum): 63 | """Game status""" 64 | 65 | RESIGN = "resign" 66 | STARTED = "started" 67 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/__init__.py: -------------------------------------------------------------------------------- 1 | """Multidict implementation. 2 | 3 | HTTP Headers and URL query string require specific data structure: 4 | multidict. It behaves mostly like a dict but it can have 5 | several values for the same key. 6 | """ 7 | 8 | from ._abc import MultiMapping, MutableMultiMapping 9 | from ._compat import USE_CYTHON_EXTENSIONS 10 | 11 | __all__ = ( 12 | "MultiMapping", 13 | "MutableMultiMapping", 14 | "MultiDictProxy", 15 | "CIMultiDictProxy", 16 | "MultiDict", 17 | "CIMultiDict", 18 | "upstr", 19 | "istr", 20 | "getversion", 21 | ) 22 | 23 | __version__ = "5.2.0" 24 | 25 | 26 | try: 27 | if not USE_CYTHON_EXTENSIONS: 28 | raise ImportError 29 | from ._multidict import ( 30 | CIMultiDict, 31 | CIMultiDictProxy, 32 | MultiDict, 33 | MultiDictProxy, 34 | getversion, 35 | istr, 36 | ) 37 | except ImportError: # pragma: no cover 38 | from ._multidict_py import ( 39 | CIMultiDict, 40 | CIMultiDictProxy, 41 | MultiDict, 42 | MultiDictProxy, 43 | getversion, 44 | istr, 45 | ) 46 | 47 | 48 | upstr = istr 49 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/_abc.py: -------------------------------------------------------------------------------- 1 | import abc 2 | import sys 3 | import types 4 | from collections.abc import Mapping, MutableMapping 5 | 6 | 7 | class _TypingMeta(abc.ABCMeta): 8 | # A fake metaclass to satisfy typing deps in runtime 9 | # basically MultiMapping[str] and other generic-like type instantiations 10 | # are emulated. 11 | # Note: real type hints are provided by __init__.pyi stub file 12 | if sys.version_info >= (3, 9): 13 | 14 | def __getitem__(self, key): 15 | return types.GenericAlias(self, key) 16 | 17 | else: 18 | 19 | def __getitem__(self, key): 20 | return self 21 | 22 | 23 | class MultiMapping(Mapping, metaclass=_TypingMeta): 24 | @abc.abstractmethod 25 | def getall(self, key, default=None): 26 | raise KeyError 27 | 28 | @abc.abstractmethod 29 | def getone(self, key, default=None): 30 | raise KeyError 31 | 32 | 33 | class MutableMultiMapping(MultiMapping, MutableMapping): 34 | @abc.abstractmethod 35 | def add(self, key, value): 36 | raise NotImplementedError 37 | 38 | @abc.abstractmethod 39 | def extend(self, *args, **kwargs): 40 | raise NotImplementedError 41 | 42 | @abc.abstractmethod 43 | def popone(self, key, default=None): 44 | raise KeyError 45 | 46 | @abc.abstractmethod 47 | def popall(self, key, default=None): 48 | raise KeyError 49 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/_compat.py: -------------------------------------------------------------------------------- 1 | import os 2 | import platform 3 | 4 | NO_EXTENSIONS = bool(os.environ.get("MULTIDICT_NO_EXTENSIONS")) 5 | 6 | PYPY = platform.python_implementation() == "PyPy" 7 | 8 | USE_CYTHON_EXTENSIONS = USE_CYTHON = not NO_EXTENSIONS and not PYPY 9 | 10 | if USE_CYTHON_EXTENSIONS: 11 | try: 12 | from . import _multidict # noqa 13 | except ImportError: 14 | USE_CYTHON_EXTENSIONS = USE_CYTHON = False 15 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/_multidict.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/multidict/_multidict.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/_multilib/defs.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTIDICT_DEFS_H 2 | #define _MULTIDICT_DEFS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | _Py_IDENTIFIER(lower); 9 | 10 | /* We link this module statically for convenience. If compiled as a shared 11 | library instead, some compilers don't allow addresses of Python objects 12 | defined in other libraries to be used in static initializers here. The 13 | DEFERRED_ADDRESS macro is used to tag the slots where such addresses 14 | appear; the module init function must fill in the tagged slots at runtime. 15 | The argument is for documentation -- the macro ignores it. 16 | */ 17 | #define DEFERRED_ADDRESS(ADDR) 0 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/_multilib/dict.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTIDICT_C_H 2 | #define _MULTIDICT_C_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef struct { // 16 or 24 for GC prefix 9 | PyObject_HEAD // 16 10 | PyObject *weaklist; 11 | pair_list_t pairs; 12 | } MultiDictObject; 13 | 14 | typedef struct { 15 | PyObject_HEAD 16 | PyObject *weaklist; 17 | MultiDictObject *md; 18 | } MultiDictProxyObject; 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/_multilib/istr.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTIDICT_ISTR_H 2 | #define _MULTIDICT_ISTR_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef struct { 9 | PyUnicodeObject str; 10 | PyObject * canonical; 11 | } istrobject; 12 | 13 | PyDoc_STRVAR(istr__doc__, "istr class implementation"); 14 | 15 | static PyTypeObject istr_type; 16 | 17 | static inline void 18 | istr_dealloc(istrobject *self) 19 | { 20 | Py_XDECREF(self->canonical); 21 | PyUnicode_Type.tp_dealloc((PyObject*)self); 22 | } 23 | 24 | static inline PyObject * 25 | istr_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 26 | { 27 | PyObject *x = NULL; 28 | static char *kwlist[] = {"object", "encoding", "errors", 0}; 29 | PyObject *encoding = NULL; 30 | PyObject *errors = NULL; 31 | PyObject *s = NULL; 32 | PyObject * ret = NULL; 33 | 34 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOO:str", 35 | kwlist, &x, &encoding, &errors)) { 36 | return NULL; 37 | } 38 | if (x != NULL && Py_TYPE(x) == &istr_type) { 39 | Py_INCREF(x); 40 | return x; 41 | } 42 | ret = PyUnicode_Type.tp_new(type, args, kwds); 43 | if (!ret) { 44 | goto fail; 45 | } 46 | s =_PyObject_CallMethodId(ret, &PyId_lower, NULL); 47 | if (!s) { 48 | goto fail; 49 | } 50 | ((istrobject*)ret)->canonical = s; 51 | s = NULL; /* the reference is stollen by .canonical */ 52 | return ret; 53 | fail: 54 | Py_XDECREF(ret); 55 | return NULL; 56 | } 57 | 58 | static PyTypeObject istr_type = { 59 | PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0) 60 | "multidict._multidict.istr", 61 | sizeof(istrobject), 62 | .tp_dealloc = (destructor)istr_dealloc, 63 | .tp_flags = Py_TPFLAGS_DEFAULT 64 | | Py_TPFLAGS_BASETYPE 65 | | Py_TPFLAGS_UNICODE_SUBCLASS, 66 | .tp_doc = istr__doc__, 67 | .tp_base = DEFERRED_ADDRESS(&PyUnicode_Type), 68 | .tp_new = (newfunc)istr_new, 69 | }; 70 | 71 | 72 | static inline int 73 | istr_init(void) 74 | { 75 | istr_type.tp_base = &PyUnicode_Type; 76 | if (PyType_Ready(&istr_type) < 0) { 77 | return -1; 78 | } 79 | return 0; 80 | } 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | #endif 86 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/multidict/py.typed: -------------------------------------------------------------------------------- 1 | PEP-561 marker. -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/ndjson/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | __author__ = """Robert Grant""" 4 | __email__ = "rhgrant10@gmail.com" 5 | __version__ = "0.3.1" 6 | 7 | 8 | from .codecs import Decoder, Encoder # noqa: F401 9 | from .api import load, loads, dump, dumps, writer, reader # noqa: F401 10 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/ndjson/api.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import json 3 | 4 | from .codecs import Decoder, Encoder 5 | 6 | 7 | def load(*args, **kwargs): 8 | kwargs.setdefault("cls", Decoder) 9 | return json.load(*args, **kwargs) 10 | 11 | 12 | def loads(*args, **kwargs): 13 | kwargs.setdefault("cls", Decoder) 14 | return json.loads(*args, **kwargs) 15 | 16 | 17 | def dump(obj, fp, cls=None, **kwargs): 18 | if cls is None: 19 | cls = Encoder 20 | text = cls(**kwargs).encode(obj) 21 | fp.write(text) 22 | 23 | 24 | def dumps(*args, **kwargs): 25 | kwargs.setdefault("cls", Encoder) 26 | return json.dumps(*args, **kwargs) 27 | 28 | 29 | class writer(object): 30 | def __init__(self, f, **kwargs): 31 | self.f = f 32 | self.kwargs = kwargs 33 | 34 | def writerow(self, row): 35 | stringified = json.dumps(row, **self.kwargs) 36 | self.f.write(stringified + "\n") 37 | 38 | 39 | class reader(object): 40 | def __init__(self, f, **kwargs): 41 | self.f = f 42 | self.kwargs = kwargs 43 | 44 | def __iter__(self): 45 | return self 46 | 47 | def __next__(self): 48 | line = "" 49 | 50 | while line == "": 51 | line = next(self.f).strip() 52 | 53 | return json.loads(line, **self.kwargs) 54 | 55 | # NOTE: this is necessary to comply with py27 56 | def next(self): 57 | return self.__next__() 58 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/ndjson/codecs.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import json 3 | 4 | 5 | class Decoder(json.JSONDecoder): 6 | def decode(self, s, *args, **kwargs): 7 | lines = ",".join(s.splitlines()) 8 | text = "[{}]".format(lines) 9 | return super(Decoder, self).decode(text, *args, **kwargs) 10 | 11 | 12 | class Encoder(json.JSONEncoder): 13 | def encode(self, obj, *args, **kwargs): 14 | lines = [] 15 | for each in obj: 16 | line = super(Encoder, self).encode(each, *args, **kwargs) 17 | lines.append(line) 18 | return "\n".join(lines) 19 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/yarl/__init__.py: -------------------------------------------------------------------------------- 1 | from ._url import URL, cache_clear, cache_configure, cache_info 2 | 3 | __version__ = "1.6.3" 4 | 5 | __all__ = ("URL", "cache_clear", "cache_configure", "cache_info") 6 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/yarl/_quoting.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | __all__ = ("_Quoter", "_Unquoter") 5 | 6 | 7 | NO_EXTENSIONS = bool(os.environ.get("YARL_NO_EXTENSIONS")) # type: bool 8 | if sys.implementation.name != "cpython": 9 | NO_EXTENSIONS = True 10 | 11 | 12 | if not NO_EXTENSIONS: # pragma: no branch 13 | try: 14 | from ._quoting_c import _Quoter, _Unquoter # type: ignore[misc] 15 | except ImportError: # pragma: no cover 16 | from ._quoting_py import _Quoter, _Unquoter # type: ignore[misc] 17 | else: 18 | from ._quoting_py import _Quoter, _Unquoter # type: ignore[misc] 19 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/yarl/_quoting_c.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/lichess/yarl/_quoting_c.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/yarl/_quoting_c.pyi: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | class _Quoter: 4 | def __init__( 5 | self, 6 | *, 7 | safe: str = ..., 8 | protected: str = ..., 9 | qs: bool = ..., 10 | requote: bool = ... 11 | ) -> None: ... 12 | def __call__(self, val: Optional[str] = ...) -> Optional[str]: ... 13 | 14 | class _Unquoter: 15 | def __init__(self, *, unsafe: str = ..., qs: bool = ...) -> None: ... 16 | def __call__(self, val: Optional[str] = ...) -> Optional[str]: ... 17 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/lichess/yarl/py.typed: -------------------------------------------------------------------------------- 1 | # Placeholder -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/opnieuw/__init__.py: -------------------------------------------------------------------------------- 1 | # Opnieuw: Retries for humans 2 | # Copyright 2019 Channable 3 | # 4 | # Licensed under the 3-clause BSD license, see the LICENSE file in the repository root. 5 | 6 | from .retries import retry_async, retry 7 | from .exceptions import RetryException 8 | 9 | __all__ = ["retry_async", "retry", "RetryException"] 10 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/opnieuw/clock.py: -------------------------------------------------------------------------------- 1 | # Opnieuw: Retries for humans 2 | # Copyright 2019 Channable 3 | # 4 | # Licensed under the 3-clause BSD license, see the LICENSE file in the repository root. 5 | 6 | import time 7 | from abc import ABC, abstractmethod 8 | 9 | 10 | class Clock(ABC): 11 | @abstractmethod 12 | def seconds_since_epoch(self) -> float: 13 | """Returns seconds since epoch.""" 14 | 15 | 16 | class MonotonicClock(Clock): 17 | """Effectual clock for use in production.""" 18 | 19 | def seconds_since_epoch(self) -> float: 20 | return time.monotonic() 21 | 22 | 23 | class TestClock(Clock): 24 | """Fake clock for use in tests.""" 25 | 26 | def __init__(self) -> None: 27 | self.time = 0.0 28 | 29 | def advance_to(self, t: float) -> None: 30 | assert t >= self.time, "Clock should not go backwards" 31 | self.time = t 32 | 33 | def seconds_since_epoch(self) -> float: 34 | return self.time 35 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/opnieuw/exceptions.py: -------------------------------------------------------------------------------- 1 | # Opnieuw: Retries for humans 2 | # Copyright 2019 Channable 3 | # 4 | # Licensed under the 3-clause BSD license, see the LICENSE file in the repository root. 5 | 6 | 7 | class RetryException(Exception): 8 | """ 9 | Defines a custom RetryException that can be raised for specific errors we 10 | want to retry on. 11 | """ 12 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/opnieuw/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/opnieuw/py.typed -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/opnieuw/test_util.py: -------------------------------------------------------------------------------- 1 | from contextlib import contextmanager 2 | from typing import Iterator, Optional 3 | 4 | from .retries import DoCall, RetryState, Action, __retry_state_namespaces 5 | 6 | 7 | class WaitLessRetryState(RetryState): 8 | def __iter__(self) -> Iterator[Action]: 9 | for _ in range(self.max_calls_total): 10 | yield DoCall() 11 | 12 | 13 | @contextmanager 14 | def retry_immediately(namespace: Optional[str] = None) -> Iterator[None]: 15 | """ 16 | Contextmanager that prevents waits between retries for all `retry` and 17 | `retry_async` decorators with the provided namespace. None means all decorators 18 | without a provided namespace will not wait. 19 | """ 20 | old_state = __retry_state_namespaces[namespace] 21 | __retry_state_namespaces[namespace] = WaitLessRetryState 22 | try: 23 | yield 24 | finally: 25 | __retry_state_namespaces[namespace] = old_state 26 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/sqlite/apsw.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/sqlite/apsw.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/sqlite/playhouse/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/sqlite/playhouse/__init__.py -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/wx_svg/_nanosvg.cp37-win32.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/lib/wx_svg/_nanosvg.cp37-win32.pyd -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/xml/__init__.py: -------------------------------------------------------------------------------- 1 | """Core XML support for Python. 2 | from . import etree 3 | This package contains four sub-packages: 4 | 5 | dom -- The W3C Document Object Model. This supports DOM Level 1 + 6 | Namespaces. 7 | 8 | parsers -- Python wrappers for XML parsers (currently only supports Expat). 9 | 10 | sax -- The Simple API for XML, developed by XML-Dev, led by David 11 | Megginson and ported to Python by Lars Marius Garshol. This 12 | supports the SAX 2 API. 13 | 14 | etree -- The ElementTree XML library. This is a subset of the full 15 | ElementTree XML release. 16 | 17 | """ 18 | 19 | 20 | __all__ = ["dom", "parsers", "sax", "etree"] 21 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/xml/dom/NodeFilter.py: -------------------------------------------------------------------------------- 1 | # This is the Python mapping for interface NodeFilter from 2 | # DOM2-Traversal-Range. It contains only constants. 3 | 4 | 5 | class NodeFilter: 6 | """ 7 | This is the DOM2 NodeFilter interface. It contains only constants. 8 | """ 9 | 10 | FILTER_ACCEPT = 1 11 | FILTER_REJECT = 2 12 | FILTER_SKIP = 3 13 | 14 | SHOW_ALL = 0xFFFFFFFF 15 | SHOW_ELEMENT = 0x00000001 16 | SHOW_ATTRIBUTE = 0x00000002 17 | SHOW_TEXT = 0x00000004 18 | SHOW_CDATA_SECTION = 0x00000008 19 | SHOW_ENTITY_REFERENCE = 0x00000010 20 | SHOW_ENTITY = 0x00000020 21 | SHOW_PROCESSING_INSTRUCTION = 0x00000040 22 | SHOW_COMMENT = 0x00000080 23 | SHOW_DOCUMENT = 0x00000100 24 | SHOW_DOCUMENT_TYPE = 0x00000200 25 | SHOW_DOCUMENT_FRAGMENT = 0x00000400 26 | SHOW_NOTATION = 0x00000800 27 | 28 | def acceptNode(self, node): 29 | raise NotImplementedError 30 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/xml/etree/__init__.py: -------------------------------------------------------------------------------- 1 | # $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $ 2 | # elementtree package 3 | 4 | # -------------------------------------------------------------------- 5 | # The ElementTree toolkit is 6 | # 7 | # Copyright (c) 1999-2008 by Fredrik Lundh 8 | # 9 | # By obtaining, using, and/or copying this software and/or its 10 | # associated documentation, you agree that you have read, understood, 11 | # and will comply with the following terms and conditions: 12 | # 13 | # Permission to use, copy, modify, and distribute this software and 14 | # its associated documentation for any purpose and without fee is 15 | # hereby granted, provided that the above copyright notice appears in 16 | # all copies, and that both that copyright notice and this permission 17 | # notice appear in supporting documentation, and that the name of 18 | # Secret Labs AB or the author not be used in advertising or publicity 19 | # pertaining to distribution of the software without specific, written 20 | # prior permission. 21 | # 22 | # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD 23 | # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- 24 | # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR 25 | # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 26 | # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 27 | # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 28 | # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 29 | # OF THIS SOFTWARE. 30 | # -------------------------------------------------------------------- 31 | 32 | # Licensed to PSF under a Contributor Agreement. 33 | # See http://www.python.org/psf/license for licensing details. 34 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/xml/etree/cElementTree.py: -------------------------------------------------------------------------------- 1 | # Deprecated alias for xml.etree.ElementTree 2 | 3 | from xml.etree.ElementTree import * 4 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/xml/parsers/__init__.py: -------------------------------------------------------------------------------- 1 | """Python interfaces to XML parsers. 2 | 3 | This package contains one module: 4 | 5 | expat -- Python wrapper for James Clark's Expat parser, with namespace 6 | support. 7 | 8 | """ 9 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/lib/xml/parsers/expat.py: -------------------------------------------------------------------------------- 1 | """Interface to the Expat non-validating XML parser.""" 2 | import sys 3 | 4 | from pyexpat import * 5 | 6 | # provide pyexpat submodules as xml.parsers.expat submodules 7 | sys.modules["xml.parsers.expat.model"] = model 8 | sys.modules["xml.parsers.expat.errors"] = errors 9 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/puzzle_database/lichess.puzzles.mini.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/puzzle_database/lichess.puzzles.mini.sqlite -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/puzzle_database/models.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | 4 | import os 5 | from ..helpers import import_bundled, LIB_DIRECTORY 6 | 7 | 8 | with import_bundled(): 9 | import chess 10 | 11 | 12 | with import_bundled(os.path.join(LIB_DIRECTORY, "sqlite")): 13 | import apsw 14 | from peewee import * 15 | from playhouse.apsw_ext import APSWDatabase 16 | 17 | 18 | PUZZLE_DATABASE_FILE = os.path.join( 19 | os.path.abspath(os.path.dirname(__file__)), 20 | "lichess.puzzles.mini.sqlite" 21 | ) 22 | database = APSWDatabase(PUZZLE_DATABASE_FILE, flags=apsw.SQLITE_ACCESS_EXISTS | apsw.SQLITE_ACCESS_READ) 23 | 24 | 25 | class BaseModel(Model): 26 | class Meta: 27 | database = database 28 | 29 | 30 | class Puzzle(BaseModel): 31 | fen = CharField() 32 | moves = CharField() 33 | popularity = IntegerField() 34 | rating = IntegerField() 35 | 36 | class Meta: 37 | table_name = "puzzle" 38 | 39 | @classmethod 40 | def get_total_count(cls): 41 | return cls.select().count() 42 | 43 | 44 | class Theme(BaseModel): 45 | description = CharField() 46 | label = CharField() 47 | slug = CharField(index=True) 48 | 49 | def __repr__(self): 50 | return f"Theme(slug='{self.slug}', description='{self.description}')" 51 | 52 | class Meta: 53 | table_name = "theme" 54 | 55 | 56 | class PuzzleTheme(BaseModel): 57 | puzzle = ForeignKeyField(column_name="puzzle_id", field="id", model=Puzzle, backref="themes") 58 | theme = ForeignKeyField(column_name="theme_id", field="id", model=Theme, backref="puzzles") 59 | 60 | class Meta: 61 | table_name = "puzzle_theme" 62 | indexes = ((("puzzle", "theme"), True),) 63 | primary_key = CompositeKey("puzzle", "theme") 64 | 65 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/signals.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from .helpers import import_bundled 4 | 5 | 6 | with import_bundled(): 7 | import blinker 8 | 9 | 10 | Chessboard_signals = blinker.Namespace() 11 | chessboard_opened_signal = Chessboard_signals.signal("chessboard-opened") 12 | chessboard_closed_signal = Chessboard_signals.signal("chessboard-closed") 13 | game_started_signal = Chessboard_signals.signal("game-started") 14 | game_over_signal = Chessboard_signals.signal("game_over", "args: outcome") 15 | move_completed_signal = Chessboard_signals.signal( 16 | "move-completed", doc="args: move_maker" 17 | ) 18 | -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/black_square.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/black_square.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/capture.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/capture.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/castling.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/castling.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/chat.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/chat.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/check.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/check.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/chess_pieces.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/chess_pieces.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/drawn.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/drawn.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/drop_move.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/drop_move.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/drop_piece.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/drop_piece.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/drop_target.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/drop_target.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/en_passant.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/en_passant.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/error.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/error.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/game_over.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/game_over.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/invalid.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/invalid.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/menu_open.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/menu_open.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/pick_piece.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/pick_piece.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/promotion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/promotion.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/puzzle_solved.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/puzzle_solved.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/request_promotion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/request_promotion.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/resigned.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/resigned.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/score_list_close.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/score_list_close.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/score_list_open.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/score_list_open.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/start_game.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/start_game.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/time_critical.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/time_critical.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/time_forfeit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/time_forfeit.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/time_pass.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/time_pass.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/sounds/you_won.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/globalPlugins/chessmart/sounds/you_won.wav -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/virtual_chessboard/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | from .base import BaseVirtualChessboard 4 | from .user_engine import UserEngineChessboard 5 | from .user_user import UserUserChessboard 6 | from .pgn_player import ( 7 | PGNPlayerChessboard, 8 | PGNGame, 9 | PGNGameInfo, 10 | ) 11 | from .internet_chessboard import InternetChessboard 12 | from .puzzle_board import PuzzleChessboard -------------------------------------------------------------------------------- /addon/globalPlugins/chessmart/virtual_chessboard/user_user.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import tones 4 | import queueHandler 5 | import speech.commands 6 | from ..helpers import import_bundled 7 | from ..signals import game_started_signal 8 | from .user_driven import UserDrivenChessboard 9 | 10 | 11 | class UserUserChessboard(UserDrivenChessboard): 12 | 13 | def __init__(self, *args, **kwargs): 14 | super().__init__(*args, **kwargs) 15 | game_started_signal.send(self) 16 | 17 | @property 18 | def prospective(self): 19 | return self.board.turn 20 | 21 | @prospective.setter 22 | def prospective(self, value): 23 | pass 24 | 25 | def move_piece_and_check_game_status(self, move, pre_speech=(), post_speech=()): 26 | post_speech = list(post_speech) 27 | if self.draw_offered: 28 | post_speech.extend( 29 | [ 30 | speech.commands.BreakCommand(500), 31 | speech.commands.CallbackCommand( 32 | lambda: queueHandler.queueFunction( 33 | queueHandler.eventQueue, self.make_opponent_draw_offer 34 | ) 35 | ), 36 | ] 37 | ) 38 | self.draw_offered = False 39 | if self.board.turn is self.prospective: 40 | post_speech.append( 41 | speech.commands.CallbackCommand( 42 | lambda: eventHandler.queueEvent("gainFocus", self) 43 | ) 44 | ) 45 | return super().move_piece_and_check_game_status( 46 | move, pre_speech, post_speech=post_speech 47 | ) 48 | 49 | -------------------------------------------------------------------------------- /addon/locale/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blindpandas/chessmart/320b1ed68f7edd50777c7e575954117e6f482312/addon/locale/.gitkeep -------------------------------------------------------------------------------- /manifest-translated.ini.tpl: -------------------------------------------------------------------------------- 1 | summary = "{addon_summary}" 2 | description = """{addon_description}""" 3 | -------------------------------------------------------------------------------- /manifest.ini.tpl: -------------------------------------------------------------------------------- 1 | name = {addon_name} 2 | summary = "{addon_summary}" 3 | description = """{addon_description}""" 4 | author = "{addon_author}" 5 | url = {addon_url} 6 | version = {addon_version} 7 | docFileName = {addon_docFileName} 8 | minimumNVDAVersion = {addon_minimumNVDAVersion} 9 | lastTestedNVDAVersion = {addon_lastTestedNVDAVersion} 10 | updateChannel = {addon_updateChannel} 11 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Chessmart 2 | 3 | 4 | **Chessmart** is an add-on for NVDA that provides a completely accessible chess playing environment for blind and visually impaired chess players. 5 | 6 | ## How to use 7 | 8 | 1. Install the add-on 9 | 2. Start a new game from the add-on;s menu, which you can find in NVDA's main menu 10 | 3. Set the game options as follows: 11 | * Play mode: user versus computer, or user versus user (two players) 12 | * Chess variant: the add-on supports standard chess and other 7 different chess variants including Chess 960, Anti chess, Atomic chess, Kings of the hill, Racing kings, Hords, and Three check. 13 | * Time control: choose among classical, rapid play, blitz, bullit, or custom time controls 14 | * FEN: use a custom chessboard Fen 15 | * If the play mode is user versus computer; you can adjust the engine options, including engine strength and engine delay 16 | 4. Enjoy! 17 | 18 | ## Useful Keyboard shortcuts in the Chessboard 19 | 20 | * F1: announce the position of your pieces. 21 | * Shift + F1: announce the position of your opponent's pieces. 22 | * F2: announce your remaining time 23 | * Shift + F2: announce your opponent's remaining time 24 | * F3: announce the currently focused piece and square using IBCA notation 25 | * F4: show the scoresheet which shows a list of the moves made by you and your opponents 26 | 27 | ## What about online chess? 28 | 29 | The add-on supports online chess via [lichess.org](https://lichess.org), but it is not currently enabled due to technical considerations. If there is a demand for this feature, we will consider enabling it. 30 | -------------------------------------------------------------------------------- /site_scons/site_tools/gettexttool/__init__.py: -------------------------------------------------------------------------------- 1 | """ This tool allows generation of gettext .mo compiled files, pot files from source code files 2 | and pot files for merging. 3 | 4 | Three new builders are added into the constructed environment: 5 | 6 | - gettextMoFile: generates .mo file from .pot file using msgfmt. 7 | - gettextPotFile: Generates .pot file from source code files. 8 | - gettextMergePotFile: Creates a .pot file appropriate for merging into existing .po files. 9 | 10 | To properly configure get text, define the following variables: 11 | 12 | - gettext_package_bugs_address 13 | - gettext_package_name 14 | - gettext_package_version 15 | 16 | 17 | """ 18 | from SCons.Action import Action 19 | 20 | 21 | def exists(env): 22 | return True 23 | 24 | 25 | XGETTEXT_COMMON_ARGS = ( 26 | "--msgid-bugs-address='$gettext_package_bugs_address' " 27 | "--package-name='$gettext_package_name' " 28 | "--package-version='$gettext_package_version' " 29 | "--keyword=pgettext:1c,2 " 30 | "-c -o $TARGET $SOURCES" 31 | ) 32 | 33 | 34 | def generate(env): 35 | env.SetDefault(gettext_package_bugs_address="example@example.com") 36 | env.SetDefault(gettext_package_name="") 37 | env.SetDefault(gettext_package_version="") 38 | 39 | env['BUILDERS']['gettextMoFile'] = env.Builder( 40 | action=Action("msgfmt -o $TARGET $SOURCE", "Compiling translation $SOURCE"), 41 | suffix=".mo", 42 | src_suffix=".po" 43 | ) 44 | 45 | env['BUILDERS']['gettextPotFile'] = env.Builder( 46 | action=Action("xgettext " + XGETTEXT_COMMON_ARGS, "Generating pot file $TARGET"), 47 | suffix=".pot") 48 | 49 | env['BUILDERS']['gettextMergePotFile'] = env.Builder( 50 | action=Action( 51 | "xgettext " + "--omit-header --no-location " + XGETTEXT_COMMON_ARGS, 52 | "Generating pot file $TARGET" 53 | ), 54 | suffix=".pot" 55 | ) 56 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | body { 3 | font-family : Verdana, Arial, Helvetica, Sans-serif; 4 | line-height: 1.2em; 5 | } 6 | h1, h2 {text-align: center} 7 | dt { 8 | font-weight : bold; 9 | float : left; 10 | width: 10%; 11 | clear: left 12 | } 13 | dd { 14 | margin : 0 0 0.4em 0; 15 | float : left; 16 | width: 90%; 17 | display: block; 18 | } 19 | p { clear : both; 20 | } 21 | a { text-decoration : underline; 22 | } 23 | :active { 24 | text-decoration : none; 25 | } 26 | a:focus, a:hover {outline: solid} 27 | --------------------------------------------------------------------------------