pax_global_header 0000666 0000000 0000000 00000000064 12533556027 0014522 g ustar 00root root 0000000 0000000 52 comment=46f95b2bde26ae00e4f6e4ef390edb4d7a927f45
isbnlib-3.5.6/ 0000775 0000000 0000000 00000000000 12533556027 0013157 5 ustar 00root root 0000000 0000000 isbnlib-3.5.6/.coveragerc 0000664 0000000 0000000 00000001413 12533556027 0015277 0 ustar 00root root 0000000 0000000 [run]
source = isbnlib
branch = True
[report]
# Regexes for directories to exclude from consideration
omit =
*/test/*
*/python?.?/*
*/site-packages/nose/*
*version*
*isbndb*
*fmt*
*bouth*
*lab*
*__init__*
*files.py
*cache*
*exceptions*
*registry.py*
*console*
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
ignore_errors = True
isbnlib-3.5.6/.gitattributes 0000664 0000000 0000000 00000000263 12533556027 0016053 0 ustar 00root root 0000000 0000000 # Auto detect text files and perform LF normalization
# set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Python
*.py text eol=lf diff=python
isbnlib-3.5.6/.gitignore 0000664 0000000 0000000 00000000442 12533556027 0015147 0 ustar 00root root 0000000 0000000 *(copy)*
*bak*
*.*~
*.mo
*.egg-info
*.egg
*.EGG
*.EGG-INFO
*-local*
build/
develop-eggs/
eggs/
fake-eggs/
parts/
dist/
_build/
*.pyc
*.pyo
*.tmp*
*.swp
*.vim
.tox/
*.log
*.sh
.coverage
.metacache
*tasks
LAB/
apps/
spin/
LAB_*
CHECKLIST
TODO
*release*
.virtualenv
*yop*
Makefile
CONTRIB
LIB
isbnlib-3.5.6/.isort.cfg 0000664 0000000 0000000 00000000032 12533556027 0015051 0 ustar 00root root 0000000 0000000 [settings]
line_length=80
isbnlib-3.5.6/.noserc 0000664 0000000 0000000 00000000030 12533556027 0014442 0 ustar 00root root 0000000 0000000 [nosetests]
verbosity=1
isbnlib-3.5.6/.travis.yml 0000664 0000000 0000000 00000002015 12533556027 0015266 0 ustar 00root root 0000000 0000000 sudo: false
language: python
os:
- linux
- osx
branches:
only:
- v3.5.6
- none
matrix:
include:
- python: "2.7"
env: TOXENV=py27
- python: "3.4"
env: TOXENV=py34
- python: "3.3"
env: TOXENV=py33
- python: "2.6"
env: TOXENV=py26
- python: "pypy"
env: TOXENV=pypy
- python: "2.7"
env: TOXENV=checkers
- python: "2.7"
env: DOC=sphinx
allow_failures:
- env: TOXENV=pypy
- env: TOXENV=checkers
install:
- if [[ ! -z $TOXENV ]]; then pip install tox; fi
- if [[ ! -z $TOXENV ]]; then pip install flake8; fi
- if [[ ! -z $TOXENV ]]; then pip install pep8-naming; fi
- if [[ $TOXENV == 'py27' ]]; then pip install coveralls; fi
- if [[ $DOC == 'sphinx' ]]; then pip install sphinx; fi
script:
- if [[ ! -z $TOXENV ]]; then tox -e $TOXENV; fi
- if [[ $DOC == 'sphinx' ]]; then cd docs; sphinx-build -n -b html -d _build/.doctrees . _build/html; fi
after_success:
- if [[ $TOXENV == 'py27' ]]; then coveralls; fi
notifications:
email: false
isbnlib-3.5.6/CHANGES.txt 0000664 0000000 0000000 00000002765 12533556027 0015002 0 ustar 00root root 0000000 0000000 v3.3.3, 2014-06-16 -- Initial release (based in `isbntools 3.3.3)`.
v3.3.4, 2014-06-16 -- Fix small bug with wheel package (based in `isbntools 3.3.3)`.
v3.3.5, 2014-06-22 -- Fix bug in 'notisbn' (based in `isbntools 3.3.4)`.
v3.3.6, 2014-06-30 -- Small improvements and optional ShelveCache.
v3.3.7, 2014-07-07 -- Fix issue #2, better debug logging and expose top exceptions.
v3.3.8, 2014-07-07 -- Fix wrong logging identifier.
v3.3.9, 2014-07-13 -- Mark as not valid ISBN-13 in series not allocated yet.
v3.4.1, 2014-07-16 -- Fix bug #7 and small improvements on the API.
v3.4.2, 2014-08-13 -- Add `doi2tex` and updated data.
v3.4.3, 2015-01-13 -- Better LOOSE regex and allow 'x' in canonical.
v3.4.4, 2015-01-26 -- Helpers sprint and fake_isbn.
v3.4.5, 2015-02-05 -- Better yield for openl and better log model.
v3.4.6, 2015-02-05 -- Fix bug #13.
v3.4.7, 2015-02-11 -- Fix bug #14.
v3.4.8, 2015-02-25 -- Fix bug #16, add 'desc' and 'cover' features.
v3.4.9, 2015-02-27 -- Fix issue #17 and bug #18, data range 20150227.
v3.5.1, 2015-03-10 -- New CoversCache and better unicode printing in Windows.
v3.5.2, 2015-03-15 -- Fix bug #19, relative paths on coverscache and data range 20150310.
v3.5.3, 2015-03-26 -- Add throttling for web services, data range 20150325 and 'in memory' keys cache.
v3.5.4, 2015-04-10 -- Issue #20, fix bugs #21 and #22 and data range 20150401.
v3.5.5, 2015-04-22 -- Add logging to vias, fix bug #23, and data range 20150422.
v3.5.6, 2015-06-03 -- Deprecated 'bouth23' and data range 20150603.
isbnlib-3.5.6/CONTRIBUTING.md 0000664 0000000 0000000 00000012451 12533556027 0015413 0 ustar 00root root 0000000 0000000 # How to Contribute
`isbnlib` has a very small code base, so it is a good project to begin your
adventure in open-source.
> **NOTE**: By contributing you agree with the [license terms](LICENSE-LGPL.txt)
(**LGPL v3**) of the project.
## Main Steps
1. Make sure you have a [GitHub account](https://github.com/signup/free)
2. Submit a ticket for your issue or idea
([help](https://www.youtube.com/watch?v=TJlYiMp8FuY)),
on https://github.com/xlcnd/isbnlib/issues,
(if possible wait for some feedback before any serious commitment... :)
3. **Fork** the repository on GitHub and **clone it locally**
([help](https://help.github.com/articles/fork-a-repo)).
4. `pip install -r requirements-dev.txt` (at your local directory).
5. Do your code... (**remember the code must run on python 2.6, 2.7, 3.3, 3.4, pypy
and be OS independent** It is easier if you start to write in python 3 and then
adapt for python 2) (you will find [Travis](https://travis-ci.org/xlcnd/isbnlib) very handy for
testing with this requirement!)
6. Write tests for your code using `nose` and put then in the directory `isbnlib/test`
7. Pass **all tests** and with **coverage > 90%**.
Check the coverage in [Coveralls](https://coveralls.io/r/xlcnd/isbnlib) or locally with the command
`nosetests --with-coverage --cover-package=isbnlib`.
8. **Check if all requirements are fulfilled**!
9. **Push** your local changes to GitHub and make there a **pull request**
([help](https://help.github.com/articles/using-pull-requests/))
**using `dev` as base branch** (by the way, we follow the *fork & pull* model with this small change).
> **NOTE**: *Travis*, *coverage*, *flake8* and *pylint*, have already
configuration files adapted to the project.
## Style
Your code **must** be [PEP8](http://legacy.python.org/dev/peps/pep-0008/) compliant
and be concise as possible (check it with
`flake8` and `pylint`).
Use doc strings ([PEP257](http://legacy.python.org/dev/peps/pep-0257/))
for users and comments (**few**) as signposts
for fellow developers. Make your code as clear as possible.
## Red Lines
**Don't submit pull requests that are only comments to the code that is
already in the repo!**
Don't expect kindness if you do that :) You **can** comment and give
suggestions on the code at the
[issues](https://github.com/xlcnd/isbnlib/issues/5) page.
**No** doc tests! Remember point 6 above.
**Don't** submit pull requests without checking point 8!
## Suggestions
Read the code in a structured way at [sourcegraph](https://sourcegraph.com/github.com/xlcnd/isbnlib).
Goto [issues/enhancement](https://github.com/xlcnd/isbnlib/issues?labels=enhancement&page=1&state=open)
for possible enhancements to the code.
If you have some idea that is not there enter your own.
Select some focused issue and enter some comments on how you plan to tackle it.
Take a look at the project [isbntools](https://github.com/xlcnd/isbntools)
and see if your code can be written as a *pluggin* (a new metadata provider) or as
a *user script* [they are easier!]. For contributions to the core, you cannot use external
libraries (except standard lib), and must be pure python. There is a package prefix
`isbntools.contrib` where these requirements are not applied
(download a [template package](https://github.com/xlcnd/isbntools/raw/dev/PLUGIN.zip)).
## Important
If you don't have experience with these issues, don't be put off by these requirements,
see them as a learning opportunity. Thanks!
## Resources (for *newbies*)
### Minimum git & GitHub
- https://guides.github.com/activities/hello-world/
- https://guides.github.com/introduction/flow/index.html
- https://www.youtube.com/watch?v=IeW1Irw45hQ
- https://www.youtube.com/watch?v=U8GBXvdmHT4
- https://www.youtube.com/watch?v=9Blbj1HMROU
### More Resources by Topic
| **Topic** | **Resource** |
|----------------------------:|:------------------------------------------------------------------------|
| fork a repo | https://help.github.com/articles/fork-a-repo |
| pull request | https://help.github.com/articles/using-pull-requests/ |
| git log | https://www.youtube.com/watch?v=U8GBXvdmHT4 |
| local feature branchs | https://www.youtube.com/watch?v=ImhZj6tpXLE |
| git & GitHub tips | https://github.com/tiimgreen/github-cheat-sheet |
| | http://cbx33.github.io/gitt/intro.html |
| | http://git-scm.com/documentation |
| | http://gitimmersion.com/ |
| | http://www.youtube.com/playlist?list=PLq0VzNtDZbe9QLq8YCizFN2TVWvlLjrvX |
| nosetests | http://pythontesting.net/framework/nose/nose-introduction/ |
| contributing | https://www.youtube.com/watch?v=IXnNgLmd6BM |
| | http://openhatch.org/missions |
| | http://opensource.com/resources/how-get-started-open-source |
isbnlib-3.5.6/LICENSE-LGPL.txt 0000664 0000000 0000000 00000016743 12533556027 0015551 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
isbnlib-3.5.6/MANIFEST.in 0000664 0000000 0000000 00000000034 12533556027 0014712 0 ustar 00root root 0000000 0000000 include *.txt
include *.rst
isbnlib-3.5.6/README.rst 0000664 0000000 0000000 00000027434 12533556027 0014660 0 ustar 00root root 0000000 0000000
.. image:: https://sourcegraph.com/api/repos/github.com/xlcnd/isbnlib/.badges/status.svg
:target: https://sourcegraph.com/github.com/xlcnd/isbnlib
:alt: Graph
.. image:: https://readthedocs.org/projects/isbnlib/badge/?version=latest
:target: http://isbnlib.readthedocs.org/en/latest/
:alt: Documentation Status
.. image:: https://coveralls.io/repos/xlcnd/isbnlib/badge.svg?branch=v3.5.6
:target: https://coveralls.io/r/xlcnd/isbnlib?branch=v3.5.6
:alt: Coverage
.. image:: https://travis-ci.org/xlcnd/isbnlib.svg?branch=v3.5.6
:target: https://travis-ci.org/xlcnd/isbnlib
:alt: Built Status
.. image:: https://ci.appveyor.com/api/projects/status/github/xlcnd/isbnlib?branch=v3.5.6&svg=true
:target: https://ci.appveyor.com/project/xlcnd/isbnlib
:alt: Windows Built Status
Info
====
``isbnlib`` is a (pure) python library that provides several
useful methods and functions to validate, clean, transform, hyphenate and
get metadata for ISBN strings. Its origin was as the core of isbntools_.
This short version, is suitable to be include as a dependency in other projects.
Has a straightforward setup and a very easy programmatic api.
Typical usage (as library):
.. code-block:: python
#!/usr/bin/env python
import isbnlib
...
Note
----
The official form of an ISBN is something like ``ISBN 979-10-90636-07-1``. However for most
applications only the numbers are important, you can always 'masked' them if you need (see below).
This library works mainly with 'striped' ISBNs (only numbers and X) like '0826497527'. You can
strip an ISBN-like string by using ``canonical(isbnlike)``. You can
'mask' the ISBN by using ``mask(isbn)``. So in the examples below, when you see 'isbn'
in the argument, it is a 'striped' ISBN, when the argument is an 'isbnlike' it is a string
like ``ISBN 979-10-90636-07-1`` or even something dirty like ``asdf 979-10-90636-07-1 bla bla``.
Two important concepts: **valid ISBN** should be an ISBN that was built according with the rules,
this is distinct from **issued ISBN** that is an ISBN that was already issued to a publisher
(this is the usage of the libraries and most of the web services).
However *isbn.org*, probably by legal reasons, merges the two!
So, according to *isbn-international.org*, '9786610326266' is not valid (because the block 978-66...
has not been issued yet, however if you use ``is_isbn13('9786610326266')`` you will get ``True``
(because '9786610326266' follows the rules of an ISBN). But the situation is even murkier,
try ``meta('9786610326266')`` and you will see that this ISBN was already used!
If possible, work with ISBNs in the isbn-13 format (since 2007, only are issued ISBNs in the isbn-13
format). You can always convert isbn-10 to isbn-13, but **not** the reverse.
Read more about ISBN at isbn-international.org_ or wikipedia_.
Main Functions
--------------
``is_isbn10(isbn10like)``
Validates as ISBN-10.
``is_isbn13(isbn13like)``
Validates as ISBN-13.
``to_isbn10(isbn13)``
Transforms isbn-13 to isbn-10.
``to_isbn13(isbn10)``
Transforms isbn-10 to isbn-13.
``canonical(isbnlike)``
Keeps only numbers and X. You will get strings like `9780321534965` and `954430603X`.
``clean(isbnlike)``
Cleans ISBN (only legal characters).
``notisbn(isbnlike, level='strict')``
Check with the goal to invalidate isbn-like.
``get_isbnlike(text, level='normal')``
Extracts all substrings that seem like ISBNs (very useful for scraping).
``get_canonical_isbn(isbnlike, output='bouth')``
Extracts ISBNs and transform them to the canonical form.
``EAN13(isbnlike)``
Transforms an `isbnlike` string into an EAN13 number (validated canonical ISBN-13).
``info(isbn)``
Gets the language or country assigned to this ISBN.
``mask(isbn, separator='-')``
`Mask` (hyphenate) a canonical ISBN.
``meta(isbn, service='default', cache='default')``
Gives you the main metadata associated with the ISBN. As `service` parameter you can use:
``'wcat'`` uses **worldcat.org**
(**no key is needed**), ``'goob'`` uses the **Google Books service** (**no key is needed**),
``'isbndb'`` uses the **isbndb.com** service (**an api key is needed**),
``'openl'`` uses the **OpenLibrary.org** api (**no key is needed**), ``merge`` uses
a merged record of ``wcat`` and ``goob`` records (**no key is needed**) and
**is the default option**.
You can get an API key for the *isbndb.com service* here_. You can enter API keys
with ``config.add_apikey(service, apikey)``.
The output can be formatted as ``bibtex``, ``msword``, ``endnote``, ``refworks``,
``opf`` or ``json`` (BibJSON) bibliographic formats with ``isbnlib.registry.bibformatters``.
``cache`` only allows two values: 'default' or None. You can change the kind of cache by using
``isbnlib.registry.set_cache`` (see below).
``editions(isbn, service='wcat')``
Returns the list of ISBNs of editions related with this ISBN. By default
uses 'wcat', but other providers are available: 'thingl' (uses the
service ThingISBN from **LibraryThing**), 'merge' (merges 'wcat' with 'thingl')
and 'any' (first tries 'wcat', if no data, tries 'thingl').
``isbn_from_words(words)``
Returns the most probable ISBN from a list of words (for your geographic area).
``goom(words)``
Returns a list of references from **Google Books multiple references**.
``doi(isbn)``
Returns a DOI's ISBN-A from a ISBN-13.
``doi2tex(DOI)``
Returns metadata formated as BibTeX for a given DOI.
``ren(filename)``
Renames a file using metadata from an ISBN in his filename.
``desc(isbn)``
**BETA** Returns a small description of the book.
*Almost all data available are for US books!*
``cover(isbn)``
**BETA** Downloads an image of the cover of the book or, with
`cover(isbn, mode='url')`, returns an url of the image.
*Almost all data available are for US books!*
See files test_core_ and test_ext_ for **a lot of examples**.
Install
=======
From the command line, enter (in some cases you have to preced the
command with ``sudo``):
.. code-block:: bash
$ pip install isbnlib
or:
.. code-block:: bash
$ easy_install isbnlib
For Devs
========
API's Main Namespaces
---------------------
In the namespace ``isbnlib`` you have access to the core methods:
``is_isbn10``, ``is_isbn13``, ``to_isbn10``, ``to_isbn13``, ``canonical``,
``clean``, ``notisbn``, ``get_isbnlike``, ``get_canonical_isbn``, ``mask``,
``meta``, ``info``, ``editions``, ``goom``, ``ren``, ``doi``, ``EAN13``,
``isbn_from_words``, ``desc`` and ``cover``.
The exceptions raised by these methods can all be catched using ``ISBNLibException``.
You can extend the lib by using the classes and functions exposed in
namespace ``isbnlib.dev``, namely:
* ``WEBService`` a class that handles the access to web
services (just by passing an url) and supports ``gzip``.
You can subclass it to extend the functionality... but
probably you don't need to use it! It is used in the next class.
* ``WEBQuery`` a class that uses ``WEBService`` to retrieve and parse
data from a web service. You can build a new provider of metadata
by subclassing this class.
His main methods allow passing custom
functions (*handlers*) that specialize them to specific needs (``data_checker`` and
``parser``). It implements a **throttling mechanism** with a default rate of
one call per second per service.
* ``Metadata`` a class that structures, cleans and 'validates' records of
metadata. His method ``merge`` allows to implement a simple merging
procedure for records from different sources. The main features of this class, can be
implemented by a call to the ``stdmeta`` function instead!
* ``vias`` exposes several functions to put calls to services, just by passing the name and
a pointer to the service's ``query`` function.
``vias.parallel`` allows to put threaded calls.
You can use ``vias.serial`` to make serial calls and
``vias.multi`` to use several cores. The default is ``vias.serial``.
* ``bouth23`` (**DEPRECATED**) a small module to make it possible the code to run
in **bouth** python 2 and python 3. **It will disappear in the next major version!**.
See python-future.org_ for a built-in alternative to ``bouth23``.
The exceptions raised by these methods can all be catched using ``ISBNLibDevException``.
You **should't raise** this exception in your code, only raise the specific exceptions
exposed in ``isbnlib.dev`` whose name end in Error.
In ``isbnlib.dev.helpers`` you can find several methods, that we found very useful, some of then
are only used in ``isbntools`` (*an app and framework* that uses ``isbnlib``).
With ``isbnlib.registry`` you can change the metadata service to be used by default (``setdefaultservice``),
add a new service (``add_service``), access bibliographic formatters for metadata (``bibformatters``),
set the default formatter (``setdefaultbibformatter``), add new formatters (``add_bibformatter``) and
set a new cache (``set_cache``) (e.g. to switch off the chache ``set_cache(None)``).
The cache only works for calls through ``isbnlib.meta``. These changes only work for the 'current session',
so should be done always before calling other methods.
Finally, from ``isbnlib.config`` you can read and set configuration options:
change timeouts with ``setsocketstimeout`` and ``setthreadstimeout``,
access api keys with ``apikeys`` and add new one with ``add_apikey`` and
access and set generic and user-defined options with ``options`` and ``set_option``.
Merge Metadata
--------------
The original quality of metadata, at the several services, is not very good!
If you need high quality metadata in your app, the only solution is to use
*polling & merge* of several providers **and** a **lot** of cleaning and standardization
for fields like ``Authors`` and ``Publisher``.
A *merge* provider is now the default in ``meta``.
It gives priority to ``wcat`` but overwrites the ``Authors`` field with the value from ``goob``.
Uses the ``merge`` method of ``Metadata`` and *serial* calls to services
by default (faster for one-call to services through fast internet connections).
You can change that by using ``vias``'s other methods
(e.g. ``isbnlib.config.set_option('VIAS_MERGE', 'multi')``.
Caveats
-------
1. These classes are optimized for one-call to services and not for batch calls. However,
is very easy to produce an high volume processing system using these classes
(use ``vias.multi``) and Redis.
2. If you inspect the library, you will see that there are a lot of private modules
(their name starts with '_'). These modules **should not** be accessed directly since,
with high probability, your program will break with a further version of the library!
Help
____
If you need help, please take a look at github_ or post a question on
stackoverflow_ (with tag **isbnlib**)
----------------------------------------------------------------------------------------------
.. class:: center
Read ``isbnlib`` code in a very sctructured way at sourcegraph_ or 'the docs' at readthedocs_.
----------------------------------------------------------------------------------------------
.. _github: https://github.com/xlcnd/isbnlib/issues
.. _range: https://www.isbn-international.org/range_file_generation
.. _here: http://isbndb.com/api/v2/docs
.. _isbntools: https://pypi.python.org/pypi/isbntools
.. _sourcegraph: http://bit.ly/ISBNLib_srcgraph
.. _readthedocs: http://bit.ly/ISBNLib_rtd
.. _stackoverflow: http://stackoverflow.com/questions/tagged/isbnlib
.. _test_core: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/test/test_core.py
.. _test_ext: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/test/test_ext.py
.. _isbn-international.org: https://www.isbn-international.org/content/what-isbn
.. _wikipedia: http://en.wikipedia.org/wiki/International_Standard_Book_Number
.. _python-future.org: http://python-future.org/compatible_idioms.html
isbnlib-3.5.6/appveyor.yml 0000664 0000000 0000000 00000002425 12533556027 0015552 0 ustar 00root root 0000000 0000000 version: '3.5.6.{build}'
branches:
only:
- /v3.5.6/
environment:
matrix:
- TOXENV: "py27"
TOXPYTHON: "C:\\Python27\\python.exe"
PYTHON_HOME: "C:\\Python27"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"
- TOXENV: "py34"
TOXPYTHON: "C:\\Python34-x64\\python.exe"
PYTHON_HOME: "C:\\Python34-x64"
PYTHON_VERSION: "3.4"
PYTHON_ARCH: "64"
- TOXENV: "py27"
TOXPYTHON: "C:\\Python27-x64\\python.exe"
PYTHON_HOME: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
- TOXENV: "py33"
TOXPYTHON: "C:\\Python33\\python.exe"
PYTHON_HOME: "C:\\Python33"
PYTHON_VERSION: "3.3"
PYTHON_ARCH: "32"
init:
- "ECHO %TOXENV%"
- "ECHO %TOXPYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
install:
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
- "%TOXPYTHON% C:/get-pip.py"
- "%PYTHON_HOME%/Scripts/pip.exe install -r requirements-appveyor.txt"
build: false # First tests then build (is python not C)
test_script:
- "%PYTHON_HOME%\\Scripts\\tox -e %TOXENV%"
# clone_folder: 'c:\\projects\\isbnlib'
# after_test:
# - "%TOXPYTHON% setup.py bdist_wheel"
# - ps: "ls dist"
# artifacts:
# - path: 'dist\\*.whl'
isbnlib-3.5.6/docs/ 0000775 0000000 0000000 00000000000 12533556027 0014107 5 ustar 00root root 0000000 0000000 isbnlib-3.5.6/docs/code.rst 0000664 0000000 0000000 00000005320 12533556027 0015553 0 ustar 00root root 0000000 0000000 ====
Code
====
Search
------
Search/Browse the code at sourcegraph_ or github_
Status
------
.. image:: https://pypip.in/d/isbnlib/badge.png
:target: https://pypi.python.org/pypi/isbnlib/
:alt: Downloads
.. image:: https://pypip.in/v/isbnlib/badge.png
:target: https://pypi.python.org/pypi/isbnlib/
:alt: Latest Version
.. image:: https://pypip.in/format/isbnlib/badge.png
:target: https://pypi.python.org/pypi/isbnlib/
:alt: Download format
.. image:: https://pypip.in/license/isbnlib/badge.png
:target: https://pypi.python.org/pypi/isbnlib/
:alt: License
.. image:: https://coveralls.io/repos/xlcnd/isbnlib/badge.svg?branch=v3.5.6
:target: https://coveralls.io/r/xlcnd/isbnlib?branch=v3.5.6
:alt: Coverage
.. image:: https://sourcegraph.com/api/repos/github.com/xlcnd/isbnlib/badges/status.svg
:target: https://sourcegraph.com/github.com/xlcnd/isbnlib
:alt: Graph
.. image:: https://travis-ci.org/xlcnd/isbnlib.svg?branch=v3.5.6
:target: https://travis-ci.org/xlcnd/isbnlib
:alt: Built Status
.. image:: https://ci.appveyor.com/api/projects/status/github/xlcnd/isbnlib?branch=v3.5.6&svg=true
:target: https://ci.appveyor.com/project/xlcnd/isbnlib
:alt: Windows Built Status
-------------------------------------------------------------------------------------------------------
How to Contribute
-----------------
``isbnlib`` has a very small code base, so it is a good project to begin your
adventure in open-source...
Main Steps
^^^^^^^^^^
1. Make sure you have a GitHub account_
2. Submit a ticket for your issue or idea,
on GitHub issues_
(if possible wait for some feedback before any serious commitment... :)
3. Fork the repository on GitHub
4. ``pip install -r requirements-dev.txt``
5. Do your code... (**remember the code must run on python 2.6, 2.7, 3.3, 3.4, pypy
and be OS independent**) (you will find ``travis-ci.org`` very handy for this!)
6. Write tests for your code using ``nose`` and put then in the directory ``isbnlib/test``
7. Pass **all tests** and with **coverage > 90%**.
Check the coverage in Coveralls_.
8. **Check if all requirements are fulfilled**!
9. Make a pull request on github...
Important
^^^^^^^^^
If you don't have experience in these issues, don't be put off by these requirements,
see them as a learning opportunity. Thanks!
For full instructions read the CONTRIBUTING_ doc.
.. _sourcegraph: https://sourcegraph.com/github.com/xlcnd/isbnlib
.. _github: https://github.com/xlcnd/isbnlib
.. _account: https://github.com/signup/free
.. _issues: https://github.com/xlcnd/isbnlib/issues
.. _Coveralls: https://coveralls.io/r/xlcnd/isbnlib
.. _CONTRIBUTING: https://github.com/xlcnd/isbnlib/blob/master/CONTRIBUTING.md
isbnlib-3.5.6/docs/conf.py 0000664 0000000 0000000 00000017750 12533556027 0015420 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
#
# isbnlib documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 14 21:43:46 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'isbnlib'
copyright = u'2014, Alexandre Conde'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '3.5'
# The full version, including alpha/beta/rc tags.
release = '3.5.6'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'isbnlibdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'isbnlib.tex', u'isbnlib Documentation',
u'Alexandre Conde', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'isbnlib', u'isbnlib Documentation',
[u'Alexandre Conde'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'isbnlib', u'isbnlib Documentation',
u'Alexandre Conde', 'isbnlib', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
isbnlib-3.5.6/docs/devs.rst 0000664 0000000 0000000 00000023336 12533556027 0015611 0 ustar 00root root 0000000 0000000
For Devs
========
Note
----
The official form of an ISBN is something like ``ISBN 979-10-90636-07-1``. However for most
applications only the numbers are important and you can always masked them if you need (see below).
This library works mainly with 'striped' ISBNs (only numbers and X) like '0826497527'. You can
strip an ISBN's like string by using ``canonical(isbnlike)``. You can
'mask' the ISBN by using ``mask(isbn)``. So in the examples below, when you see 'isbn'
in the argument, it is a 'striped' ISBN, when the argument is an 'isbnlike' it is a string
like ``ISBN 979-10-90636-07-1`` or even something dirty like ``asdf 979-10-90636-07-1 bla bla``.
Two important concepts: **valid ISBN** should be an ISBN that was built according with the rules,
this is distinct from **issued ISBN** that is an ISBN that was already issued to a publisher
(this is the usage of the libraries and most of the web services).
However *isbn.org*, probably by legal reasons, merges the two!
So, according to *isbn.org*, '9786610326266' is not valid (because the block 978-66... has not been issued yet,
however if you use ``is_isbn13('9786610326266')`` you will get ``True`` (because '9786610326266' follows
the rules of an ISBN). But the situation is even murkier, try ``meta('9786610326266')`` and you will
see that this ISBN was already used!
If possible, work with ISBNs in the isbn-13 format (since 2007, only are issued ISBNs in the isbn-13
format). You can always convert isbn-10 to isbn-13, but **not** the reverse.
Read more about ISBN at isbn-international.org_.
API's Main Namespaces
---------------------
In the namespace ``isbnlib`` you have access to the core methods:
``is_isbn10(isbn10like)``
Validates as ISBN-10.
``is_isbn13(isbn13like)``
Validates as ISBN-13.
``to_isbn10(isbn13)``
Transforms an isbn-13 to isbn-10.
``to_isbn13(isbn10)``
Transforms an isbn-10 to isbn-13.
``canonical(isbnlike)``
Keeps only numbers and X. You will get strings like `9780321534965`.
``clean(isbnlike)``
Cleans ISBN (only legal characters).
``notisbn(isbnlike, level='strict')``
Check with the goal to invalidate isbn-like.
``get_isbnlike(text, level='normal')``
Extracts all substrings that seem like ISBNs (very useful for scraping).
``get_canonical_isbn(isbnlike, output='bouth')``
Extracts ISBNs and transform them to the canonical form.
``EAN13(isbnlike)``
Transforms an `isbnlike` string into an EAN13 number (validated canonical ISBN-13).
``info(isbn)``
Gets the language or country assigned to this ISBN.
``mask(isbn, separator='-')``
`Mask` (hyphenate) a canonical ISBN.
``meta(isbn, service='default', cache='default')``
Gives you the main metadata associated with the ISBN. As `service` parameter you can use:
``'wcat'`` uses **worldcat.org**
(**no key is needed**), ``'goob'`` uses the **Google Books service** (**no key is needed**),
``'isbndb'`` uses the **isbndb.com** service (**an api key is needed**),
``'openl'`` uses the **OpenLibrary.org** api (**no key is needed**), ``merge`` uses
a merged record of ``wcat`` and ``goob`` records (**no key is needed**) and
**is the default option**.
You can get an API key for the *isbndb.com service* here_. You can enter API keys
with ``isbnlib.config.add_apikey(service, apikey)``.
The output can be formatted as ``bibtex``, ``msword``, ``endnote``, ``refworks``,
``opf`` or ``json`` (BibJSON) bibliographic formats with ``isbnlib.registry.bibformatters``.
``cache`` only allows two values: 'default' or None. You can change the kind of cache by using
``isbnlib.registry.set_cache`` (see below).
``editions(isbn, service='wcat')``
Returns the list of ISBNs of editions related with this ISBN. By default
uses 'wcat', but other providers are avilable: 'thingl' (uses the
service ThingISBN from **LibraryThing**), 'merge' (merges 'wcat' with 'thingl')
and 'any' (first tries 'wcat', if no data, tries 'thingl').
``isbn_from_words(words)``
Returns the most probable ISBN from a list of words (for your geographic area).
``goom(words)``
Returns a list of references from **Google Books multiple references**.
``doi(isbn)``
Returns a DOI's ISBN-A from a ISBN-13.
``doi2tex(DOI)``
Returns metadata formated as BibTeX for a given DOI.
``ren(filename)``
Renames a file using metadata from an ISBN in his filename.
``desc(isbn)``
Returns a small description of the book.
*Almost all data available are for US books!*
``cover(isbn)``
Downloads an image of the cover of the book or, with
`cover(isbn, mode='url')`, returns an url of the image.
*Almost all data available are for US books!*
See files test_core_ and test_ext_ for **a lot of examples**.
The exceptions raised by these methods can all be catched using ``ISBNLibException``.
You can extend the lib by using the classes and functions exposed in
namespace ``isbnlib.dev``, namely:
* ``WEBService`` a class that handles the access to web
services (just by passing an url) and supports ``gzip``.
You can subclass it to extend the functionality... but
probably you don't need to use it! It is used in the next class.
* ``WEBQuery`` a class that uses ``WEBService`` to retrieve and parse
data from a web service. You can build a new provider of metadata
by subclassing this class.
His main methods allow passing custom
functions (*handlers*) that specialize them to specific needs (``data_checker`` and
``parser``). It implements a **throttling mechanism** with a default rate of
one call per second per service.
* ``Metadata`` a class that structures, cleans and 'validates' records of
metadata. His method ``merge`` allows to implement a simple merging
procedure for records from different sources. The main features can be
implemented by a call to ``stdmeta`` function!
* ``vias`` exposes several functions to put calls to services, just by passing the name and
a pointer to the service's ``query`` function.
``vias.parallel`` allows to put threaded calls. You can use ``vias.serial``
to make serial calls and
``vias.multi`` to use several cores. The default is ``vias.serial``, but
you can change that in the conf file.
* ``bouth23`` (**DEPRECATED**) a small module to make it possible the code to run
in **bouth** python 2 and python 3. **It will disappear in the next major version!**.
See python-future.org_ for a built-in alternative to ``bouth23``.
The exceptions raised by these methods can all be catched using ``ISBNLibDevException``.
You **should't raise** this exception in your code, only raise the specific exceptions
exposed in ``isbnlib.dev`` whose name end in Error.
In ``isbnlib.dev.helpers`` you can find several methods, that we found very useful, some of then
are only used in ``isbntools`` (*an app and framework* that uses ``isbnlib``).
With ``isbnlib.registry`` you can change the metadata service to be used by default (``setdefaultservice``),
add a new service (``add_service``), access bibliographic formatters for metadata (``bibformatters``),
set the default formatter (``setdefaultbibformatter``), add new formatters (``add_bibformatter``) and
set a new cache (``set_cache``) (e.g. to switch off the chache ``set_cache(None)``).
The cache only works for calls through ``isbnlib.meta``. These changes only work for the 'current session',
so should be done always before calling other methods.
Finally, from ``isbnlib.config`` you can read and set configuration options:
change timeouts with ``setsocketstimeout`` and ``setthreadstimeout``,
access api keys with ``apikeys`` and add new one with ``add_apikey`` and
access and set generic and user-defined options with ``options`` and ``set_option``.
All these classes follow a simple design pattern and, if you follow it, will be
very easy to integrate your classes with the rest of the lib.
Merge Metadata
--------------
The original quality of metadata, at the several services, is not very good!
If you need high quality metadata in your app, the only solution is to use
*polling & merge* of several providers **and** a **lot** of cleaning and standardization
for fields like ``Authors`` and ``Publisher``.
A *simple merge* provider is now the default in ``isbnlib.meta``.
It gives priority to ``wcat`` but overwrites the ``Authors`` field with the value from ``goob``.
Uses the ``merge`` method of ``Metadata`` and *serial* calls to services
by default (faster for fast Internet connections).
You can change that by using ``vias``'s other methods
(e.g. ``isbnlib.config.set_option('VIAS_MERGE', 'multi')``.
You can write your own *merging scheme* by creating a new provider (see_ ``merge`` for an example).
**Take Note**: These classes are optimized for one-calls to services and not for batch calls.
A full featured app!
--------------------
If you want a full featured app, that uses ``isbnlib``, with end user apps, configuration files and a
framework to further developement, take a look at isbntools_.
---------------------------------------------------------------------------------
**You can browse the code, in a very structured way, at** sourcegraph_ or GitHub_.
.. _wcat: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/_wcat.py
.. _isbndb: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/_isbndb.py
.. _see: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/_merge.py
.. _GitHub: https://github.com/xlcnd/isbnlib
.. _sourcegraph: https://sourcegraph.com/github.com/xlcnd/isbnlib
.. _isbntools: https://github.com/xlcnd/isbntools
.. _test_core: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/test/test_core.py
.. _test_ext: https://github.com/xlcnd/isbnlib/blob/master/isbnlib/test/test_ext.py
.. _isbn-international.org: https://www.isbn-international.org/content/what-isbn
.. _python-future.org: http://python-future.org/compatible_idioms.html
isbnlib-3.5.6/docs/index.rst 0000664 0000000 0000000 00000000732 12533556027 0015752 0 ustar 00root root 0000000 0000000 .. isbnlib documentation master file, created by
sphinx-quickstart on Mon Apr 14 21:43:46 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
=======
isbnlib
=======
**isbnlib** provides several useful methods and functions
to validate, clean, transform, hyphenate and
get metadata for ISBN strings.
Contents:
.. toctree::
:maxdepth: 2
info
install
devs
issues
isbn
code
isbnlib-3.5.6/docs/info.rst 0000664 0000000 0000000 00000002260 12533556027 0015574 0 ustar 00root root 0000000 0000000
Info
====
Typical usage (as library):
.. code-block:: python
#!/usr/bin/env python
import isbnlib
...
Just for fun, suppose I want the *most spoken about* book with certain words in his title.
For a *quick-and-dirty solution*, enter the following code in a file
and save it as ``isbn_tmsa_book.py``.
.. code-block:: python
#!/usr/bin/env python
import sys
from isbnlib import *
query = sys.argv[1].replace(' ', '+')
isbn = isbn_from_words(query)
print("The ISBN of the most `spoken-about` book with this title is %s" % isbn)
print("")
print("... and the book is:")
print("")
print((meta(isbn)))
Then in a command line (in the same directory):
.. code-block:: bash
$ python isbn_tmsa_book.py 'noise'
In my case I get::
The ISBN of the most `spoken-about` book with this title is 9780143105985
... and the book is:
{'Publisher': u'Penguin Books', 'Language': u'eng', 'Title': u'White noise',
'Year': u'2009', 'ISBN-13': u'9780143105985', 'Authors': u'Don DeLillo ;
introduction by Richard Powers.'}
Have fun!
.. _here: http://isbndb.com/api/v2/docs
.. _pdfminer: https://pypi.python.org/pypi/pdfminer
isbnlib-3.5.6/docs/install.rst 0000664 0000000 0000000 00000000503 12533556027 0016305 0 ustar 00root root 0000000 0000000
Install
=======
From the command line enter (in some cases you have to preced the
command with ``sudo``):
.. code-block:: bash
$ pip install isbnlib
or:
.. code-block:: bash
$ easy_install isbnlib
or:
.. code-block:: bash
$ pip install isbnlib-3.5.6.tar.gz
(first you have to download the file!)
isbnlib-3.5.6/docs/isbn.rst 0000664 0000000 0000000 00000000216 12533556027 0015573 0 ustar 00root root 0000000 0000000
ISBN
====
To know about ISBN:
* http://en.wikipedia.org/wiki/International_Standard_Book_Number
* http://www.isbn-international.org/
isbnlib-3.5.6/docs/issues.rst 0000664 0000000 0000000 00000002115 12533556027 0016153 0 ustar 00root root 0000000 0000000
Known Issues
============
1. The ``meta`` method sometimes give a wrong result
(this is due to errors on the chosen service), in alternative you could
try one of the others services.
2. The ``isbnlib`` works internally with unicode, however this doesn't
solve errors of lost information due to bad encode/decode at the origin!
3. Periodically, agencies, issue new blocks of ISBNs. The
range_ of these blocks is on a database that ``mask`` uses. So it could happen,
if you have a version of ``isbnlib`` that is too old, ``mask`` doesn't work for
valid (recent) issued ISBNs. The solution? **Update isbnlib often**!
4. Calls to metadata services are cached by default. You can change that by calling
``isbnlib.meta(isbn, service='default', cache=None)``
Any issue that you would like to report, please do it at github_ or post a question on
stackoverflow_ (with tag **isbnlib**).
.. _github: https://github.com/xlcnd/isbnlib/issues
.. _range: https://www.isbn-international.org/range_file_generation
.. _stackoverflow: http://stackoverflow.com/questions/tagged/isbnlib
isbnlib-3.5.6/isbnlib/ 0000775 0000000 0000000 00000000000 12533556027 0014601 5 ustar 00root root 0000000 0000000 isbnlib-3.5.6/isbnlib/__init__.py 0000664 0000000 0000000 00000003464 12533556027 0016721 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# isort:skip_file
"""Define isbnlib API and set lib environment."""
import logging as _logging
from ._exceptions import (quiet_errors, ISBNLibException,
NotRecognizedServiceError,
NotValidISBNError,
PluginNotLoadedError)
# config _logging for lib (NullHandler not available for py26)
try:
_nh = _logging.NullHandler()
except: # pragma: no cover
class NullHandler(_logging.Handler):
def emit(self, record):
pass
_nh = NullHandler()
_logging.getLogger('isbnlib').addHandler(_nh)
# configuration
from . import config # <-- first import
# main modules
from ._core import (is_isbn10, is_isbn13, to_isbn10, to_isbn13, clean,
canonical, notisbn, get_isbnlike, get_canonical_isbn,
EAN13)
from ._ext import (cover, desc, mask, meta, info, editions, isbn_from_words,
doi, ren)
from ._goom import query as goom
from ._doitotex import doi2tex
# Ranges Database date
from ._data.data4mask import RDDATE
# alias
ISBN13 = EAN13
ean13 = EAN13
# dunders
__all__ = ('is_isbn10', 'is_isbn13', 'clean', 'mask', 'info', 'meta',
'to_isbn10', 'to_isbn13', 'get_isbnlike', 'notisbn',
'ean13', 'EAN13', 'cover', 'desc',
'canonical', 'get_canonical_isbn', 'editions', 'isbn_from_words',
'quiet_errors', 'config', '__version__', '__support__',
'doi', 'ren', 'ISBN13', 'ISBNLibException',
'NotRecognizedServiceError', 'NotValidISBNError',
'PluginNotLoadedError', 'goom', 'doi2tex', 'RDDATE')
__version__ = '3.5.6' # <-- literal IDs
__support__ = 'py26, py27, py33, py34, pypy' # <-- literal IDs
isbnlib-3.5.6/isbnlib/_core.py 0000664 0000000 0000000 00000016406 12533556027 0016251 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# isbnlib - tools for extracting, cleaning and transforming ISBNs
# Copyright (C) 2014 Alexandre Lima Conde
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
"""isbnlib main file.
Tools for extracting, cleaning, transforming and validating ISBN ids.
"""
import logging
import re
LOGGER = logging.getLogger(__name__)
RE_ISBN10 = re.compile(r'ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}'
r'\1\d{1,6}\1(\d|X)$|[- 0-9X]{10,16}')
RE_ISBN13 = re.compile(r'97[89]{1}(?:-?\d){10,16}|97[89]{1}[- 0-9]{10,16}')
RE_STRICT = re.compile(r'^(?:ISBN(?:-1[03])?:? )?(?=[0-9X]{10}$|'
r'(?=(?:[0-9]+[- ]){3})'
r'[- 0-9X]{13}$|97[89][0-9]{10}$|'
r'(?=(?:[0-9]+[- ]){4})'
r'[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}'
r'[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]$',
re.I | re.M | re.S)
RE_NORMAL = re.compile(r'97[89]{1}(?:-?\d){10}|\d{9}[0-9X]{1}|'
r'[-0-9X]{10,16}',
re.I | re.M | re.S)
RE_LOOSE = re.compile(r'[- 0-9X]{10,19}', re.I | re.M | re.S)
ISBN13_PREFIX = '978'
LEGAL = '0123456789xXisbnISBN- '
def _check_digit10(firstninedigits):
"""Check sum ISBN-10."""
# minimum checks
if len(firstninedigits) != 9:
return None
try:
int(firstninedigits)
except: # pragma: no cover
return None
# checksum
val = sum((i + 2) * int(x) for
i, x in enumerate(reversed(firstninedigits)))
remainder = int(val % 11)
if remainder == 0:
tenthdigit = 0
else:
tenthdigit = 11 - remainder
if tenthdigit == 10:
tenthdigit = 'X'
return str(tenthdigit)
def _check_digit13(firsttwelvedigits):
"""Check sum ISBN-13."""
# minimum checks
if len(firsttwelvedigits) != 12:
return None
try:
int(firsttwelvedigits)
except: # pragma: no cover
return None
# checksum
val = sum((i % 2 * 2 + 1) * int(x) for
i, x in enumerate(firsttwelvedigits))
thirteenthdigit = 10 - int(val % 10)
if thirteenthdigit == 10:
thirteenthdigit = '0'
return str(thirteenthdigit)
def _check_structure10(isbn10like):
"""Check structure of an ISBN-10."""
return True if re.match(RE_ISBN10, isbn10like) else False
def _check_structure13(isbn13like):
"""Check structure of an ISBN-13."""
return True if re.match(RE_ISBN13, isbn13like) else False
def is_isbn10(isbn10):
"""Validate as ISBN-10."""
isbn10 = canonical(isbn10)
if len(isbn10) != 10:
return False # pragma: no cover
else:
return False if _check_digit10(isbn10[:-1]) != isbn10[-1] else True
def is_isbn13(isbn13):
"""Validate as ISBN-13."""
isbn13 = canonical(isbn13)
if len(isbn13) != 13:
return False # pragma: no cover
else:
if isbn13[0:3] not in ('978', '979'):
return False
return False if _check_digit13(isbn13[:-1]) != isbn13[-1] else True
def to_isbn10(isbn13):
"""Transform isbn-13 to isbn-10."""
isbn13 = canonical(isbn13)
# Check prefix
if isbn13[:3] != ISBN13_PREFIX:
return isbn13 if len(isbn13) == 10 and is_isbn10(isbn13) else None
if not is_isbn13(isbn13):
return None
isbn10 = isbn13[3:]
check = _check_digit10(isbn10[:-1])
# Change check digit
return isbn10[:-1] + check if check else None
def to_isbn13(isbn10):
"""Transform isbn-10 to isbn-13."""
isbn10 = canonical(isbn10)
if len(isbn10) == 13 and is_isbn13(isbn10):
return isbn10
if not is_isbn10(isbn10):
return None
isbn13 = ISBN13_PREFIX + isbn10[:-1]
check = _check_digit13(isbn13)
return isbn13 + check if check else None
def canonical(isbnlike):
"""Keep only numbers and X."""
numb = [c for c in isbnlike if c in '0123456789Xx']
if numb and numb[-1] == 'x':
numb[-1] = 'X'
return ''.join(numb)
def clean(isbnlike):
"""Clean ISBN (only legal characters)."""
cisbn = [c for c in isbnlike if c in LEGAL]
buf = re.sub(r'\s*-\s*', '-', ''.join(cisbn))
return re.sub(r'\s+', ' ', buf).strip()
def notisbn(isbnlike, level='strict'):
"""Check with the goal to invalidate isbn-like.
level:
strict for certain they are not ISBNs (default)
loose only filters obvious NO ISBNs
"""
if level not in ('strict', 'loose'): # pragma: no cover
LOGGER.error('level as no option %s', level)
return
isbnlike = canonical(isbnlike)
if len(isbnlike) not in (10, 13):
return True
if level != 'strict':
return False
if len(isbnlike) == 10:
return not is_isbn10(isbnlike)
else:
return not is_isbn13(isbnlike)
def get_isbnlike(text, level='normal'):
"""Extract all substrings that seem like ISBNs.
level:
strict almost as certain they are ISBNs
normal (default)
loose catch many as possible
"""
if level == 'normal': # pragma: no cover
isbnlike = RE_NORMAL
elif level == 'strict':
isbnlike = RE_STRICT
elif level == 'loose':
isbnlike = RE_LOOSE
else:
LOGGER.error('level as no option %s', level)
return
return isbnlike.findall(text)
def get_canonical_isbn(isbnlike, output='bouth'):
"""Extract ISBNs and transform them to the canonical form.
output:
isbn10
isbn13
bouth (default)
"""
if output not in ('bouth', 'isbn10', 'isbn13'): # pragma: no cover
LOGGER.error('output as no option %s', output)
return
regex = RE_NORMAL
match = regex.search(isbnlike)
if match:
# Get only canonical characters and split them into a list
cisbn = canonical(match.group())
chars = list(cisbn)
# Remove the last digit from `chars` and assign it to `last`
last = chars.pop()
buf = ''.join(chars)
if len(chars) == 9:
# Compute the ISBN-10 checksum digit
check = _check_digit10(buf)
else:
# Compute the ISBN-13 checksum digit
check = _check_digit13(buf)
# If checksum OK return a `canonical` ISBN
if str(check) == last:
if output == 'bouth':
return cisbn
if output == 'isbn10':
return cisbn if len(cisbn) == 10 else to_isbn10(cisbn)
return to_isbn13(cisbn) if len(cisbn) == 10 else cisbn
def ean13(isbnlike):
"""Transform an `isbnlike` string in an EAN number (canonical ISBN-13)."""
ib = canonical(isbnlike)
if len(ib) == 13:
return ib if is_isbn13(ib) else None
elif len(ib) == 10:
return to_isbn13(ib) if is_isbn10(ib) else None
# Alias
EAN13 = ean13
isbnlib-3.5.6/isbnlib/_cover.py 0000664 0000000 0000000 00000010637 12533556027 0016437 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Get the cover of the book."""
import logging
try: # pragma: no cover
# PY3
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
except ImportError: # pragma: no cover
# PY2
from urllib2 import Request, urlopen, HTTPError, URLError
from json import loads
from .dev._exceptions import ISBNLibHTTPError, ISBNLibURLError
from .dev.webservice import query
COVERZOOM = 2
NOIMGSIZE = (15666, 16641, 2690)
UA = "isbnlib (gzip)"
LOGGER = logging.getLogger(__name__)
def bookid(isbn):
"""Return the Google's id associated with each ISBN."""
from .registry import metadata_cache # <-- dynamic
# check the cache fist
cache = metadata_cache
if cache is not None: # pragma: no cover
key = 'gid' + isbn
try: # pragma: no cover
if cache[key]:
return cache[key]
else:
raise # <-- IMPORTANT: usually the caches don't return error!
except: # pragma: no cover
pass
url = "https://www.googleapis.com/books/v1/volumes?q="\
"isbn+{isbn}&fields=items/id&maxResults=1".format(isbn=isbn)
content = query(url, user_agent=UA)
try:
content = loads(content)
gid = content['items'][0]['id']
if gid and cache is not None:
cache[key] = gid
return gid
except: # pragma: no cover
return
def _download(url, tofile=None):
"""Download image."""
headers = {'User-Agent': UA, 'Pragma': 'no-cache'}
request = Request(url, headers=headers)
try:
response = urlopen(request)
LOGGER.debug('Request headers:\n%s', request.header_items())
except HTTPError as e: # pragma: no cover
LOGGER.critical('ISBNLibHTTPError for %s with code %s [%s]',
url, e.code, e.msg)
if e.code == 403:
# Google uses this code when the image is not
# available for any size (should use 404),
# but also when you are blacklisted by the service
LOGGER.debug('Cover not available or you are making many requests')
return True # <-- no more attempts to download
if e.code in (401, 429):
raise ISBNLibHTTPError('%s Are you are making many requests?'
% e.code)
if e.code in (502, 504):
raise ISBNLibHTTPError('%s Service temporarily unavailable!'
% e.code)
raise ISBNLibHTTPError('(%s) %s' % (e.code, e.msg))
except URLError as e: # pragma: no cover
LOGGER.critical('ISBNLibURLError for %s with reason %s',
url, e.reason)
raise ISBNLibURLError(e.reason)
content = response.read()
noimageavailable = len(content) in NOIMGSIZE
if noimageavailable: # pragma: no cover
return False
if tofile:
try: # pragma: no cover
# PY2
content_type = response.info().getheader('Content-Type')
except: # pragma: no cover
# PY3
content_type = response.getheader('Content-Type')
_, ext = content_type.split('/')
tofile = tofile.split('.')[0] + '.' + ext.split('-')[-1]
with open(tofile, 'wb') as f:
f.write(content)
else: # pragma: no cover
print(content)
return tofile
def _google_cover(gid, isbn, zoom=COVERZOOM, mode='prt'):
"""Download the cover from Google."""
tpl = "http://books.google.com/books/content?id={gid}&printsec=frontcover"\
"&img=1&zoom={zoom}&edge=curl&source=gbs_api"
url = tpl.format(gid=gid, zoom=zoom)
if mode == 'url': # pragma: no cover
return (url, None)
coverfile = _download(url, tofile=isbn)
while not coverfile: # pragma: no cover
# try a smaller resolution
zoom -= 1
if zoom > 0:
url = tpl.format(gid=gid, zoom=zoom)
else:
return (None, None)
coverfile = _download(url, tofile=isbn)
return (url, coverfile) if coverfile and coverfile is not True\
else (url, None)
def cover(isbn, size=COVERZOOM, mode='prt'):
"""Main entry point for cover."""
gid = bookid(isbn)
return _google_cover(gid, isbn, zoom=size, mode=mode) if gid\
else (None, None)
isbnlib-3.5.6/isbnlib/_data/ 0000775 0000000 0000000 00000000000 12533556027 0015651 5 ustar 00root root 0000000 0000000 isbnlib-3.5.6/isbnlib/_data/__init__.py 0000664 0000000 0000000 00000000000 12533556027 0017750 0 ustar 00root root 0000000 0000000 isbnlib-3.5.6/isbnlib/_data/data4info.py 0000664 0000000 0000000 00000020571 12533556027 0020101 0 ustar 00root root 0000000 0000000 # flake8: noqa
# GeneratedWith: mk_data4info.py (isbntools)
# MessageSource: http://www.isbn-international.org/agency?rmxml=1
# MessageDate: Wed, 3 Jun 2015 11:50:18 CEST
# MessageSerialNumber: 69eba68e-f50d-4193-9a48-c9f378be91f0
d = {'978-99970': 'Haiti', '978-7': "China, People's Republic", '978-4': 'Japan', '978-5': 'former U.S.S.R', '978-2': 'French language', '978-3': 'German language', '978-0': 'English language', '978-1': 'English language', '978-9968': 'Costa Rica', '978-9961': 'Algeria', '978-9960': 'Saudi Arabia', '978-9963': 'Cyprus', '978-9962': 'Panama', '978-9965': 'Kazakhstan', '978-9964': 'Ghana', '978-9967': 'Kyrgyz Republic', '978-9966': 'Kenya', '978-967': 'Malaysia', '978-966': 'Ukraine', '978-965': 'Israel', '978-964': 'Iran', '978-963': 'Hungary', '978-962': 'Hong Kong, China', '978-961': 'Slovenia', '978-960': 'Greece', '978-9985': 'Estonia', '978-969': 'Pakistan', '978-968': 'Mexico', '978-9984': 'Latvia', '978-99971': 'Myanmar', '978-9983': 'Gambia', '978-99972': 'Faroe Islands', '978-99973': 'Mongolia', '978-99909': 'Malta', '978-99908': 'Malawi', '978-99905': 'Bolivia', '978-99904': 'Cura\xe7ao', '978-99906': 'Kuwait', '978-99901': 'Bahrain', '978-99903': 'Mauritius', '978-99902': 'Reserved Agency', '978-99976': 'Srpska, Republic of', '978-99977': 'Rwanda', '978-974': 'Thailand', '978-975': 'Turkey', '978-976': 'Caribbean Community', '978-977': 'Egypt', '978-970': 'Mexico', '978-971': 'Philippines', '978-972': 'Portugal', '978-973': 'Romania', '978-978': 'Nigeria', '978-979': 'Indonesia', '978-99918': 'Faroe Islands', '978-99919': 'Benin', '978-99916': 'Namibia', '978-99917': 'Brunei Darussalam', '978-99914': 'Suriname', '978-99915': 'Maldives', '978-99912': 'Botswana', '978-99913': 'Andorra', '978-99910': 'Sierra Leone', '978-99911': 'Lesotho', '979-11': 'Korea, Republic', '978-90': 'Netherlands', '978-91': 'Sweden', '978-92': 'International NGO Publishers and EU Organizations', '978-93': 'India', '978-94': 'Netherlands', '978-9982': 'Zambia', '978-9981': 'Morocco', '978-9980': 'Papua New Guinea', '978-9989': 'Macedonia', '978-9988': 'Ghana', '978-99923': 'El Salvador', '978-99922': 'Guatemala', '978-99921': 'Qatar', '978-99920': 'Andorra', '978-99927': 'Albania', '978-99926': 'Honduras', '978-99925': 'Paraguay', '978-99924': 'Nicaragua', '978-99929': 'Mongolia', '978-99928': 'Georgia', '978-9932': "Lao People's Democratic Republic", '978-9933': 'Syria', '978-9930': 'Costa Rica', '978-9931': 'Algeria', '978-9936': 'Afghanistan', '978-9937': 'Nepal', '978-9934': 'Latvia', '978-9935': 'Iceland', '979-12': 'Italy', '978-9938': 'Tunisia', '978-9939': 'Armenia', '978-958': 'Colombia', '978-959': 'Cuba', '978-956': 'Chile', '978-957': 'Taiwan', '978-954': 'Bulgaria', '978-955': 'Sri Lanka', '978-952': 'Finland', '978-953': 'Croatia', '978-950': 'Argentina', '978-951': 'Finland', '978-89': 'Korea, Republic', '978-88': 'Italy', '978-87': 'Denmark', '978-86': 'former Yugoslavia', '978-85': 'Brazil', '978-84': 'Spain', '978-83': 'Poland', '978-82': 'Norway', '978-81': 'India', '978-80': 'former Czechoslovakia', '978-99934': 'Dominican Republic', '978-99935': 'Haiti', '978-99936': 'Bhutan', '978-99937': 'Macau', '978-99930': 'Armenia', '978-99931': 'Seychelles', '978-99932': 'Malta', '978-99933': 'Nepal', '978-620': 'Mauritius', '978-621': 'Philippines', '978-99938': 'Srpska, Republic of', '978-99939': 'Guatemala', '978-9925': 'Cyprus', '978-9924': 'Cambodia', '978-9927': 'Qatar', '978-9926': 'Bosnia and Herzegovina', '978-9929': 'Guatemala', '978-9928': 'Albania', '979-10': 'France', '978-9986': 'Lithuania', '978-9987': 'Tanzania', '978-99941': 'Armenia', '978-99940': 'Georgia', '978-99943': 'Albania', '978-99942': 'Sudan', '978-99945': 'Namibia', '978-99944': 'Ethiopia', '978-99947': 'Tajikistan', '978-99946': 'Nepal', '978-99949': 'Mauritius', '978-99948': 'Eritrea', '978-9950': 'Palestine', '978-9951': 'Kosova', '978-9952': 'Azerbaijan', '978-9953': 'Lebanon', '978-9954': 'Morocco', '978-9955': 'Lithuania', '978-9956': 'Cameroon', '978-9957': 'Jordan', '978-9958': 'Bosnia and Herzegovina', '978-9959': 'Libya', '978-989': 'Portugal', '978-988': 'Hong Kong, China', '978-985': 'Belarus', '978-984': 'Bangladesh', '978-987': 'Argentina', '978-986': 'Taiwan', '978-981': 'Singapore', '978-980': 'Venezuela', '978-983': 'Malaysia', '978-982': 'South Pacific', '978-99952': 'Mali', '978-99953': 'Paraguay', '978-99950': 'Cambodia', '978-99951': 'Reserved Agency', '978-99956': 'Albania', '978-99957': 'Malta', '978-99954': 'Bolivia', '978-99955': 'Srpska, Republic of', '978-99958': 'Bahrain', '978-99959': 'Luxembourg', '978-9943': 'Uzbekistan', '978-9942': 'Ecuador', '978-9941': 'Georgia', '978-9940': 'Montenegro', '978-9947': 'Algeria', '978-9946': 'Korea, P.D.R.', '978-9945': 'Dominican Republic', '978-9944': 'Turkey', '978-9949': 'Estonia', '978-9948': 'United Arab Emirates', '978-615': 'Hungary', '978-614': 'Lebanon', '978-617': 'Ukraine', '978-616': 'Thailand', '978-611': 'Thailand', '978-613': 'Mauritius', '978-612': 'Peru', '978-619': 'Bulgaria', '978-618': 'Greece', '978-99974': 'Bolivia', '978-99967': 'Paraguay', '978-99966': 'Kuwait', '978-99965': 'Macau', '978-99964': 'Nicaragua', '978-99963': 'Cambodia', '978-99962': 'Mongolia', '978-99961': 'El Salvador', '978-99960': 'Malawi', '978-99969': 'Oman', '978-99968': 'Botswana', '978-9976': 'Tanzania', '978-9977': 'Costa Rica', '978-9974': 'Uruguay', '978-9975': 'Moldova', '978-9972': 'Peru', '978-9973': 'Tunisia', '978-9970': 'Uganda', '978-9971': 'Singapore', '978-99975': 'Tajikistan', '978-9978': 'Ecuador', '978-9979': 'Iceland', '978-602': 'Indonesia', '978-603': 'Saudi Arabia', '978-600': 'Iran', '978-601': 'Kazakhstan', '978-606': 'Romania', '978-607': 'Mexico', '978-604': 'Vietnam', '978-605': 'Turkey', '978-608': 'Macedonia', '978-609': 'Lithuania'}
identifiers = (('978-0', '978-1', '978-2', '978-3', '978-4', '978-5', '978-7'), ('978-80', '978-81', '978-82', '978-83', '978-84', '978-85', '978-86', '978-87', '978-88', '978-89', '978-90', '978-91', '978-92', '978-93', '978-94', '979-10', '979-11', '979-12'), ('978-600', '978-601', '978-602', '978-603', '978-604', '978-605', '978-606', '978-607', '978-608', '978-609', '978-611', '978-612', '978-613', '978-614', '978-615', '978-616', '978-617', '978-618', '978-619', '978-620', '978-621', '978-950', '978-951', '978-952', '978-953', '978-954', '978-955', '978-956', '978-957', '978-958', '978-959', '978-960', '978-961', '978-962', '978-963', '978-964', '978-965', '978-966', '978-967', '978-968', '978-969', '978-970', '978-971', '978-972', '978-973', '978-974', '978-975', '978-976', '978-977', '978-978', '978-979', '978-980', '978-981', '978-982', '978-983', '978-984', '978-985', '978-986', '978-987', '978-988', '978-989'), ('978-9924', '978-9925', '978-9926', '978-9927', '978-9928', '978-9929', '978-9930', '978-9931', '978-9932', '978-9933', '978-9934', '978-9935', '978-9936', '978-9937', '978-9938', '978-9939', '978-9940', '978-9941', '978-9942', '978-9943', '978-9944', '978-9945', '978-9946', '978-9947', '978-9948', '978-9949', '978-9950', '978-9951', '978-9952', '978-9953', '978-9954', '978-9955', '978-9956', '978-9957', '978-9958', '978-9959', '978-9960', '978-9961', '978-9962', '978-9963', '978-9964', '978-9965', '978-9966', '978-9967', '978-9968', '978-9970', '978-9971', '978-9972', '978-9973', '978-9974', '978-9975', '978-9976', '978-9977', '978-9978', '978-9979', '978-9980', '978-9981', '978-9982', '978-9983', '978-9984', '978-9985', '978-9986', '978-9987', '978-9988', '978-9989'), ('978-99901', '978-99902', '978-99903', '978-99904', '978-99905', '978-99906', '978-99908', '978-99909', '978-99910', '978-99911', '978-99912', '978-99913', '978-99914', '978-99915', '978-99916', '978-99917', '978-99918', '978-99919', '978-99920', '978-99921', '978-99922', '978-99923', '978-99924', '978-99925', '978-99926', '978-99927', '978-99928', '978-99929', '978-99930', '978-99931', '978-99932', '978-99933', '978-99934', '978-99935', '978-99936', '978-99937', '978-99938', '978-99939', '978-99940', '978-99941', '978-99942', '978-99943', '978-99944', '978-99945', '978-99946', '978-99947', '978-99948', '978-99949', '978-99950', '978-99951', '978-99952', '978-99953', '978-99954', '978-99955', '978-99956', '978-99957', '978-99958', '978-99959', '978-99960', '978-99961', '978-99962', '978-99963', '978-99964', '978-99965', '978-99966', '978-99967', '978-99968', '978-99969', '978-99970', '978-99971', '978-99972', '978-99973', '978-99974', '978-99975', '978-99976', '978-99977'))
RDDATE='2015060310:50:18WEST'
isbnlib-3.5.6/isbnlib/_data/data4mask.py 0000664 0000000 0000000 00000064547 12533556027 0020114 0 ustar 00root root 0000000 0000000 # flake8: noqa
# GeneratedWith: mk_data4mask.py (isbntools)
# MessageSource: http://www.isbn-international.org/agency?rmxml=1
# MessageDate: Wed, 3 Jun 2015 11:50:18 CEST
# MessageSerialNumber: 69eba68e-f50d-4193-9a48-c9f378be91f0
ranges = {'978-99970': ((0, 4999999, 1), (5000000, 8999999, 2), (9000000, 9999999, 3)), '978-7': ((0, 999999, 2), (1000000, 4999999, 3), (5000000, 7999999, 4), (8000000, 8999999, 5), (9000000, 9999999, 6)), '978-4': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9499999, 6), (9500000, 9999999, 7)), '978-5': ((0, 49999, 5), (50000, 99999, 4), (100000, 1999999, 2), (2000000, 4209999, 3), (4210000, 4299999, 4), (4300000, 4309999, 3), (4310000, 4399999, 4), (4400000, 4409999, 3), (4410000, 4499999, 4), (4500000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9099999, 6), (9100000, 9199999, 5), (9200000, 9299999, 4), (9300000, 9499999, 5), (9500000, 9500999, 7), (9501000, 9799999, 4), (9800000, 9899999, 5), (9900000, 9909999, 7), (9910000, 9999999, 4)), '978-2': ((0, 1999999, 2), (2000000, 3499999, 3), (3500000, 3999999, 5), (4000000, 6999999, 3), (7000000, 8399999, 4), (8400000, 8999999, 5), (9000000, 9499999, 6), (9500000, 9999999, 7)), '978-3': ((0, 299999, 2), (300000, 339999, 3), (340000, 369999, 4), (370000, 399999, 5), (400000, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9499999, 6), (9500000, 9539999, 7), (9540000, 9699999, 5), (9700000, 9899999, 7), (9900000, 9949999, 5), (9950000, 9999999, 5)), '978-0': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9499999, 6), (9500000, 9999999, 7)), '978-1': ((0, 999999, 2), (1000000, 3999999, 3), (4000000, 5499999, 4), (5500000, 8697999, 5), (8698000, 9989999, 6), (9990000, 9999999, 7)), '978-9968': ((0, 4999999, 2), (5000000, 9399999, 3), (9400000, 9999999, 4)), '978-9961': ((0, 2999999, 1), (3000000, 6999999, 2), (7000000, 9499999, 3), (9500000, 9999999, 4)), '978-9960': ((0, 5999999, 2), (6000000, 8999999, 3), (9000000, 9999999, 4)), '978-9963': ((0, 1999999, 1), (2000000, 2499999, 4), (2500000, 2799999, 3), (2800000, 2999999, 4), (3000000, 5499999, 2), (5500000, 7349999, 3), (7350000, 7499999, 4), (7500000, 9999999, 4)), '978-9962': ((0, 5499999, 2), (5500000, 5599999, 4), (5600000, 5999999, 2), (6000000, 8499999, 3), (8500000, 9999999, 4)), '978-9965': ((0, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9964': ((0, 6999999, 1), (7000000, 9499999, 2), (9500000, 9999999, 3)), '978-9967': ((0, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9966': ((0, 1499999, 3), (1500000, 1999999, 4), (2000000, 6999999, 2), (7000000, 7499999, 4), (7500000, 9599999, 3), (9600000, 9999999, 4)), '978-967': ((0, 99999, 2), (100000, 999999, 4), (1000000, 1999999, 5), (2000000, 2999999, 0), (3000000, 4999999, 3), (5000000, 5999999, 4), (6000000, 8999999, 2), (9000000, 9899999, 3), (9900000, 9989999, 4), (9990000, 9999999, 5)), '978-966': ((0, 1299999, 2), (1300000, 1399999, 3), (1400000, 1499999, 2), (1500000, 1699999, 4), (1700000, 1999999, 3), (2000000, 2789999, 4), (2790000, 2899999, 3), (2900000, 2999999, 4), (3000000, 6999999, 3), (7000000, 8999999, 4), (9000000, 9099999, 5), (9100000, 9499999, 3), (9500000, 9799999, 5), (9800000, 9999999, 3)), '978-965': ((0, 1999999, 2), (2000000, 5999999, 3), (6000000, 6999999, 0), (7000000, 7999999, 4), (8000000, 8999999, 0), (9000000, 9999999, 5)), '978-964': ((0, 1499999, 2), (1500000, 2499999, 3), (2500000, 2999999, 4), (3000000, 5499999, 3), (5500000, 8999999, 4), (9000000, 9699999, 5), (9700000, 9899999, 3), (9900000, 9999999, 4)), '978-963': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9999999, 4)), '978-962': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8699999, 5), (8700000, 8999999, 4), (9000000, 9999999, 3)), '978-961': ((0, 1999999, 2), (2000000, 5999999, 3), (6000000, 8999999, 4), (9000000, 9499999, 5), (9500000, 9999999, 0)), '978-960': ((0, 1999999, 2), (2000000, 6599999, 3), (6600000, 6899999, 4), (6900000, 6999999, 3), (7000000, 8499999, 4), (8500000, 9299999, 5), (9300000, 9399999, 2), (9400000, 9799999, 4), (9800000, 9999999, 5)), '978-9985': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 8999999, 3), (9000000, 9999999, 4)), '978-969': ((0, 1999999, 1), (2000000, 2299999, 2), (2300000, 2399999, 5), (2400000, 3999999, 2), (4000000, 7499999, 3), (7500000, 9999999, 4)), '978-968': ((100000, 3999999, 2), (4000000, 4999999, 3), (5000000, 7999999, 4), (8000000, 8999999, 3), (9000000, 9999999, 4)), '978-93': ((0, 999999, 2), (1000000, 4999999, 3), (5000000, 7999999, 4), (8000000, 9499999, 5), (9500000, 9999999, 6)), '978-99971': ((0, 5999999, 1), (6000000, 8499999, 2), (8500000, 9999999, 3)), '978-94': ((0, 5999999, 3), (6000000, 8999999, 4), (9000000, 9999999, 5)), '978-99972': ((0, 4999999, 1), (5000000, 8999999, 2), (9000000, 9999999, 3)), '978-99973': ((0, 3999999, 1), (4000000, 7999999, 2), (8000000, 9999999, 3)), '978-99909': ((0, 3999999, 1), (4000000, 9499999, 2), (9500000, 9999999, 3)), '978-99908': ((0, 999999, 1), (1000000, 8999999, 2), (9000000, 9999999, 3)), '978-99905': ((0, 3999999, 1), (4000000, 7999999, 2), (8000000, 9999999, 3)), '978-99904': ((0, 5999999, 1), (6000000, 8999999, 2), (9000000, 9999999, 3)), '978-99906': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 6999999, 3), (7000000, 8999999, 2), (9000000, 9499999, 2), (9500000, 9999999, 3)), '978-99901': ((0, 4999999, 2), (5000000, 7999999, 3), (8000000, 9999999, 2)), '978-99903': ((0, 1999999, 1), (2000000, 8999999, 2), (9000000, 9999999, 3)), '978-99902': ((0, 9999999, 0),), '978-99976': ((0, 1999999, 1), (2000000, 5999999, 2), (6000000, 7999999, 3), (8000000, 9999999, 0)), '978-99977': ((0, 1999999, 1), (2000000, 3999999, 0), (4000000, 6999999, 2), (7000000, 7999999, 3), (8000000, 9999999, 0)), '978-974': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9499999, 5), (9500000, 9999999, 4)), '978-975': ((0, 199999, 5), (200000, 2499999, 2), (2500000, 5999999, 3), (6000000, 9199999, 4), (9200000, 9899999, 5), (9900000, 9999999, 3)), '978-976': ((0, 3999999, 1), (4000000, 5999999, 2), (6000000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-977': ((0, 1999999, 2), (2000000, 4999999, 3), (5000000, 6999999, 4), (7000000, 8499999, 3), (8500000, 8999999, 5), (9000000, 9999999, 2)), '978-970': ((100000, 5999999, 2), (6000000, 8999999, 3), (9000000, 9099999, 4), (9100000, 9699999, 5), (9700000, 9999999, 4)), '978-971': ((0, 159999, 3), (160000, 199999, 4), (200000, 299999, 2), (300000, 599999, 4), (600000, 4999999, 2), (5000000, 8499999, 3), (8500000, 9099999, 4), (9100000, 9599999, 5), (9600000, 9699999, 4), (9700000, 9899999, 2), (9900000, 9999999, 4)), '978-972': ((0, 1999999, 1), (2000000, 5499999, 2), (5500000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-973': ((0, 999999, 1), (1000000, 1699999, 3), (1700000, 1999999, 4), (2000000, 5499999, 2), (5500000, 7599999, 3), (7600000, 8499999, 4), (8500000, 8899999, 5), (8900000, 9499999, 4), (9500000, 9999999, 5)), '978-978': ((0, 1999999, 3), (2000000, 2999999, 4), (3000000, 7999999, 5), (8000000, 8999999, 4), (9000000, 9999999, 3)), '978-979': ((0, 999999, 3), (1000000, 1499999, 4), (1500000, 1999999, 5), (2000000, 2999999, 2), (3000000, 3999999, 4), (4000000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-9959': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9499999, 3), (9500000, 9699999, 4), (9700000, 9799999, 3), (9800000, 9999999, 2)), '978-99918': ((0, 3999999, 1), (4000000, 7999999, 2), (8000000, 9999999, 3)), '978-99919': ((0, 2999999, 1), (3000000, 3999999, 3), (4000000, 6999999, 2), (7000000, 7999999, 2), (8000000, 8499999, 3), (8500000, 8999999, 3), (9000000, 9999999, 3)), '978-99916': ((0, 2999999, 1), (3000000, 6999999, 2), (7000000, 9999999, 3)), '978-99917': ((0, 2999999, 1), (3000000, 8999999, 2), (9000000, 9999999, 3)), '978-99914': ((0, 4999999, 1), (5000000, 8999999, 2), (9000000, 9999999, 3)), '978-99915': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99912': ((0, 3999999, 1), (4000000, 5999999, 3), (6000000, 8999999, 2), (9000000, 9999999, 3)), '978-99913': ((0, 2999999, 1), (3000000, 3599999, 2), (3600000, 5999999, 0), (6000000, 6049999, 3), (6050000, 9999999, 0)), '978-99910': ((0, 2999999, 1), (3000000, 8999999, 2), (9000000, 9999999, 3)), '978-99911': ((0, 5999999, 2), (6000000, 9999999, 3)), '978-9928': ((0, 999999, 2), (1000000, 3999999, 3), (4000000, 4999999, 4), (5000000, 9999999, 0)), '978-90': ((0, 1999999, 2), (2000000, 4999999, 3), (5000000, 6999999, 4), (7000000, 7999999, 5), (8000000, 8499999, 6), (8500000, 8999999, 4), (9000000, 9099999, 2), (9100000, 9399999, 0), (9400000, 9499999, 2), (9500000, 9999999, 0)), '978-91': ((0, 1999999, 1), (2000000, 4999999, 2), (5000000, 6499999, 3), (6500000, 6999999, 0), (7000000, 7999999, 4), (8000000, 8499999, 0), (8500000, 9499999, 5), (9500000, 9699999, 0), (9700000, 9999999, 6)), '978-92': ((0, 5999999, 1), (6000000, 7999999, 2), (8000000, 8999999, 3), (9000000, 9499999, 4), (9500000, 9899999, 5), (9900000, 9999999, 6)), '978-9984': ((0, 4999999, 2), (5000000, 8999999, 3), (9000000, 9999999, 4)), '978-9983': ((0, 7999999, 0), (8000000, 9499999, 2), (9500000, 9899999, 3), (9900000, 9999999, 4)), '978-9982': ((0, 7999999, 2), (8000000, 9899999, 3), (9900000, 9999999, 4)), '978-9981': ((0, 999999, 2), (1000000, 1599999, 3), (1600000, 1999999, 4), (2000000, 7999999, 2), (8000000, 9499999, 3), (9500000, 9999999, 4)), '978-9980': ((0, 3999999, 1), (4000000, 8999999, 2), (9000000, 9899999, 3), (9900000, 9999999, 4)), '978-9989': ((0, 999999, 1), (1000000, 1999999, 3), (2000000, 2999999, 4), (3000000, 5999999, 2), (6000000, 9499999, 3), (9500000, 9999999, 4)), '978-9988': ((0, 2999999, 1), (3000000, 5499999, 2), (5500000, 7499999, 3), (7500000, 9999999, 4)), '978-99923': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9999999, 3)), '978-99922': ((0, 3999999, 1), (4000000, 6999999, 2), (7000000, 9999999, 3)), '978-99921': ((0, 1999999, 1), (2000000, 6999999, 2), (7000000, 7999999, 3), (8000000, 8999999, 1), (9000000, 9999999, 2)), '978-99920': ((0, 4999999, 1), (5000000, 8999999, 2), (9000000, 9999999, 3)), '978-99927': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 9999999, 3)), '978-99926': ((0, 999999, 1), (1000000, 5999999, 2), (6000000, 8699999, 3), (8700000, 8999999, 2), (9000000, 9999999, 2)), '978-99925': ((0, 3999999, 1), (4000000, 7999999, 2), (8000000, 9999999, 3)), '978-99924': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9999999, 3)), '978-99929': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99928': ((0, 999999, 1), (1000000, 7999999, 2), (8000000, 9999999, 3)), '978-9932': ((0, 3999999, 2), (4000000, 8499999, 3), (8500000, 9999999, 4)), '978-9933': ((0, 999999, 1), (1000000, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9930': ((0, 4999999, 2), (5000000, 9399999, 3), (9400000, 9999999, 4)), '978-9931': ((0, 2999999, 2), (3000000, 8999999, 3), (9000000, 9999999, 4)), '978-9936': ((0, 1999999, 1), (2000000, 3999999, 2), (4000000, 7999999, 3), (8000000, 9999999, 4)), '978-9937': ((0, 2999999, 1), (3000000, 4999999, 2), (5000000, 7999999, 3), (8000000, 9999999, 4)), '978-9934': ((0, 999999, 1), (1000000, 4999999, 2), (5000000, 7999999, 3), (8000000, 9999999, 4)), '978-9935': ((0, 999999, 1), (1000000, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '979-12': ((0, 1999999, 0), (2000000, 2009999, 3), (2010000, 9999999, 0)), '979-11': ((0, 2499999, 2), (2500000, 5499999, 3), (5500000, 8499999, 4), (8500000, 9499999, 5), (9500000, 9999999, 6)), '978-9939': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 8999999, 3), (9000000, 9999999, 4)), '978-958': ((0, 5699999, 2), (5700000, 5999999, 5), (6000000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-959': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 9999999, 5)), '978-956': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 9999999, 4)), '978-957': ((0, 299999, 2), (300000, 499999, 4), (500000, 1999999, 2), (2000000, 2099999, 4), (2100000, 2799999, 2), (2800000, 3099999, 5), (3100000, 4399999, 2), (4400000, 8199999, 3), (8200000, 9699999, 4), (9700000, 9999999, 5)), '978-954': ((0, 2899999, 2), (2900000, 2999999, 4), (3000000, 7999999, 3), (8000000, 8999999, 4), (9000000, 9299999, 5), (9300000, 9999999, 4)), '978-955': ((0, 1999999, 4), (2000000, 4099999, 2), (4100000, 4399999, 5), (4400000, 4499999, 5), (4500000, 4999999, 4), (5000000, 5499999, 5), (5500000, 7499999, 3), (7500000, 7999999, 4), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-952': ((0, 1999999, 2), (2000000, 4999999, 3), (5000000, 5999999, 4), (6000000, 6599999, 2), (6600000, 6699999, 4), (6700000, 6999999, 5), (7000000, 7999999, 4), (8000000, 9499999, 2), (9500000, 9899999, 4), (9900000, 9999999, 5)), '978-953': ((0, 999999, 1), (1000000, 1499999, 2), (1500000, 5099999, 3), (5100000, 5499999, 2), (5500000, 5999999, 5), (6000000, 9499999, 4), (9500000, 9999999, 5)), '978-950': ((0, 4999999, 2), (5000000, 8999999, 3), (9000000, 9899999, 4), (9900000, 9999999, 5)), '978-951': ((0, 1999999, 1), (2000000, 5499999, 2), (5500000, 8899999, 3), (8900000, 9499999, 4), (9500000, 9999999, 5)), '978-89': ((0, 2499999, 2), (2500000, 5499999, 3), (5500000, 8499999, 4), (8500000, 9499999, 5), (9500000, 9699999, 6), (9700000, 9899999, 5), (9900000, 9999999, 3)), '978-88': ((0, 1999999, 2), (2000000, 5999999, 3), (6000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9099999, 6), (9100000, 9299999, 3), (9300000, 9399999, 4), (9400000, 9499999, 6), (9500000, 9999999, 5)), '978-87': ((0, 2999999, 2), (3000000, 3999999, 0), (4000000, 6499999, 3), (6500000, 6999999, 0), (7000000, 7999999, 4), (8000000, 8499999, 0), (8500000, 9499999, 5), (9500000, 9699999, 0), (9700000, 9999999, 6)), '978-86': ((0, 2999999, 2), (3000000, 5999999, 3), (6000000, 7999999, 4), (8000000, 8999999, 5), (9000000, 9999999, 6)), '978-85': ((0, 1999999, 2), (2000000, 5499999, 3), (5500000, 5999999, 4), (6000000, 6999999, 5), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9599999, 6), (9600000, 9799999, 2), (9800000, 9999999, 5)), '978-84': ((0, 1399999, 2), (1400000, 1499999, 3), (1500000, 1999999, 5), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9199999, 4), (9200000, 9239999, 6), (9240000, 9299999, 5), (9300000, 9499999, 6), (9500000, 9699999, 5), (9700000, 9999999, 4)), '978-83': ((0, 1999999, 2), (2000000, 5999999, 3), (6000000, 6999999, 5), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9999999, 6)), '978-82': ((0, 1999999, 2), (2000000, 6899999, 3), (6900000, 6999999, 6), (7000000, 8999999, 4), (9000000, 9899999, 5), (9900000, 9999999, 6)), '978-81': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9999999, 6)), '978-80': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8499999, 4), (8500000, 8999999, 5), (9000000, 9999999, 6)), '978-99934': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9999999, 3)), '978-99935': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 6999999, 3), (7000000, 8999999, 1), (9000000, 9999999, 2)), '978-99936': ((0, 999999, 1), (1000000, 5999999, 2), (6000000, 9999999, 3)), '978-99937': ((0, 1999999, 1), (2000000, 5999999, 2), (6000000, 9999999, 3)), '978-99930': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99931': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99932': ((0, 999999, 1), (1000000, 5999999, 2), (6000000, 6999999, 3), (7000000, 7999999, 1), (8000000, 9999999, 2)), '978-99933': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 9999999, 3)), '978-620': ((0, 9999999, 1),), '978-621': ((0, 2999999, 2), (3000000, 3999999, 0), (4000000, 5999999, 3), (6000000, 7999999, 0), (8000000, 8999999, 4), (9000000, 9499999, 0), (9500000, 9999999, 5)), '978-99938': ((0, 1999999, 1), (2000000, 5999999, 2), (6000000, 8999999, 3), (9000000, 9999999, 2)), '978-99939': ((0, 5999999, 1), (6000000, 8999999, 2), (9000000, 9999999, 3)), '978-9925': ((0, 2999999, 1), (3000000, 5499999, 2), (5500000, 7349999, 3), (7350000, 9999999, 4)), '978-9924': ((0, 2999999, 0), (3000000, 3999999, 2), (4000000, 4999999, 0), (5000000, 6499999, 3), (6500000, 8999999, 0), (9000000, 9999999, 4)), '978-9927': ((0, 999999, 2), (1000000, 3999999, 3), (4000000, 4999999, 4), (5000000, 9999999, 0)), '978-9926': ((0, 1999999, 1), (2000000, 3999999, 2), (4000000, 7999999, 3), (8000000, 9999999, 4)), '978-9929': ((0, 3999999, 1), (4000000, 5499999, 2), (5500000, 7999999, 3), (8000000, 9999999, 4)), '978-9938': ((0, 7999999, 2), (8000000, 9499999, 3), (9500000, 9999999, 4)), '979-10': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8999999, 4), (9000000, 9759999, 5), (9760000, 9999999, 6)), '978-9987': ((0, 3999999, 2), (4000000, 8799999, 3), (8800000, 9999999, 4)), '978-99941': ((0, 2999999, 1), (3000000, 7999999, 2), (8000000, 9999999, 3)), '978-99940': ((0, 999999, 1), (1000000, 6999999, 2), (7000000, 9999999, 3)), '978-99943': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 9999999, 3)), '978-99942': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99945': ((0, 5999999, 1), (6000000, 8999999, 2), (9000000, 9999999, 3)), '978-99944': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99947': ((0, 2999999, 1), (3000000, 6999999, 2), (7000000, 9999999, 3)), '978-99946': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 9999999, 3)), '978-99949': ((0, 1999999, 1), (2000000, 8999999, 2), (9000000, 9999999, 3)), '978-99948': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-9950': ((0, 2999999, 2), (3000000, 8499999, 3), (8500000, 9999999, 4)), '978-9951': ((0, 3999999, 2), (4000000, 8499999, 3), (8500000, 9999999, 4)), '978-9952': ((0, 1999999, 1), (2000000, 3999999, 2), (4000000, 7999999, 3), (8000000, 9999999, 4)), '978-9953': ((0, 999999, 1), (1000000, 3999999, 2), (4000000, 5999999, 3), (6000000, 8999999, 2), (9000000, 9999999, 4)), '978-9954': ((0, 1999999, 1), (2000000, 3999999, 2), (4000000, 7999999, 3), (8000000, 9999999, 4)), '978-9955': ((0, 3999999, 2), (4000000, 9299999, 3), (9300000, 9999999, 4)), '978-9956': ((0, 999999, 1), (1000000, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9957': ((0, 3999999, 2), (4000000, 6999999, 3), (7000000, 8499999, 2), (8500000, 8799999, 4), (8800000, 9999999, 2)), '978-9958': ((0, 199999, 2), (200000, 299999, 3), (300000, 399999, 4), (400000, 899999, 3), (900000, 999999, 4), (1000000, 1899999, 2), (1900000, 1999999, 4), (2000000, 4999999, 2), (5000000, 8999999, 3), (9000000, 9999999, 4)), '978-9986': ((0, 3999999, 2), (4000000, 8999999, 3), (9000000, 9399999, 4), (9400000, 9699999, 3), (9700000, 9999999, 2)), '978-989': ((0, 1999999, 1), (2000000, 5499999, 2), (5500000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-988': ((0, 1199999, 2), (1200000, 1499999, 5), (1500000, 1699999, 5), (1700000, 1999999, 5), (2000000, 7999999, 3), (8000000, 9699999, 4), (9700000, 9999999, 5)), '978-985': ((0, 3999999, 2), (4000000, 5999999, 3), (6000000, 8999999, 4), (9000000, 9999999, 5)), '978-984': ((0, 3999999, 2), (4000000, 7999999, 3), (8000000, 8999999, 4), (9000000, 9999999, 5)), '978-987': ((0, 999999, 2), (1000000, 1999999, 4), (2000000, 2999999, 5), (3000000, 3599999, 2), (3600000, 3999999, 4), (4000000, 4199999, 4), (4200000, 4399999, 2), (4400000, 4499999, 4), (4500000, 4899999, 5), (4900000, 4999999, 4), (5000000, 8999999, 3), (9000000, 9499999, 4), (9500000, 9999999, 5)), '978-986': ((0, 1199999, 2), (1200000, 5599999, 3), (5600000, 7999999, 4), (8000000, 9999999, 5)), '978-981': ((0, 1199999, 2), (1200000, 1699999, 2), (1700000, 1999999, 5), (2000000, 2899999, 3), (2900000, 2999999, 3), (3000000, 3099999, 4), (3100000, 3999999, 3), (4000000, 9999999, 4)), '978-980': ((0, 1999999, 2), (2000000, 5999999, 3), (6000000, 9999999, 4)), '978-983': ((0, 199999, 2), (200000, 1999999, 3), (2000000, 3999999, 4), (4000000, 4499999, 5), (4500000, 4999999, 2), (5000000, 7999999, 2), (8000000, 8999999, 3), (9000000, 9899999, 4), (9900000, 9999999, 5)), '978-982': ((0, 999999, 2), (1000000, 6999999, 3), (7000000, 8999999, 2), (9000000, 9799999, 4), (9800000, 9999999, 5)), '978-99952': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99953': ((0, 2999999, 1), (3000000, 7999999, 2), (8000000, 9399999, 3), (9400000, 9999999, 2)), '978-99950': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99951': ((0, 9999999, 0),), '978-99956': ((0, 5999999, 2), (6000000, 8599999, 3), (8600000, 9999999, 2)), '978-99957': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9999999, 3)), '978-99954': ((0, 2999999, 1), (3000000, 6999999, 2), (7000000, 8799999, 3), (8800000, 9999999, 2)), '978-99955': ((0, 1999999, 1), (2000000, 5999999, 2), (6000000, 7999999, 3), (8000000, 9999999, 2)), '978-99958': ((0, 4999999, 1), (5000000, 9399999, 2), (9400000, 9499999, 3), (9500000, 9999999, 3)), '978-99959': ((0, 2999999, 1), (3000000, 5999999, 2), (6000000, 9999999, 3)), '978-9943': ((0, 2999999, 2), (3000000, 3999999, 3), (4000000, 9749999, 4), (9750000, 9999999, 3)), '978-9942': ((0, 8499999, 2), (8500000, 8999999, 4), (9000000, 9849999, 3), (9850000, 9999999, 4)), '978-9941': ((0, 999999, 1), (1000000, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9940': ((0, 1999999, 1), (2000000, 4999999, 2), (5000000, 8999999, 3), (9000000, 9999999, 4)), '978-9947': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9999999, 3)), '978-9946': ((0, 1999999, 1), (2000000, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9945': ((0, 99999, 2), (100000, 799999, 3), (800000, 3999999, 2), (4000000, 5699999, 3), (5700000, 5799999, 2), (5800000, 8499999, 3), (8500000, 9999999, 4)), '978-9944': ((0, 999999, 4), (1000000, 4999999, 3), (5000000, 5999999, 4), (6000000, 6999999, 2), (7000000, 7999999, 3), (8000000, 8999999, 2), (9000000, 9999999, 3)), '978-9949': ((0, 999999, 1), (1000000, 3999999, 2), (4000000, 7499999, 3), (7500000, 8999999, 2), (9000000, 9999999, 4)), '978-9948': ((0, 3999999, 2), (4000000, 8499999, 3), (8500000, 9999999, 4)), '978-615': ((0, 999999, 2), (1000000, 4999999, 3), (5000000, 7999999, 4), (8000000, 8999999, 5), (9000000, 9999999, 0)), '978-614': ((0, 3999999, 2), (4000000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-617': ((0, 4999999, 2), (5000000, 6999999, 3), (7000000, 8999999, 4), (9000000, 9999999, 5)), '978-616': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 8999999, 4), (9000000, 9999999, 5)), '978-611': ((0, 9999999, 0),), '978-613': ((0, 9999999, 1),), '978-612': ((0, 2999999, 2), (3000000, 3999999, 3), (4000000, 4499999, 4), (4500000, 4999999, 5), (5000000, 9999999, 2)), '978-619': ((0, 1499999, 2), (1500000, 6999999, 3), (7000000, 8999999, 4), (9000000, 9999999, 5)), '978-618': ((0, 1999999, 2), (2000000, 4999999, 3), (5000000, 7999999, 4), (8000000, 9999999, 5)), '978-99974': ((0, 3999999, 0), (4000000, 7999999, 2), (8000000, 9999999, 3)), '978-99967': ((0, 1999999, 1), (2000000, 5999999, 2), (6000000, 8999999, 3), (9000000, 9999999, 0)), '978-99966': ((0, 2999999, 1), (3000000, 6999999, 2), (7000000, 7999999, 3), (8000000, 9499999, 2), (9500000, 9999999, 0)), '978-99965': ((0, 3999999, 1), (4000000, 6999999, 2), (7000000, 9999999, 3)), '978-99964': ((0, 1999999, 1), (2000000, 7999999, 2), (8000000, 9999999, 3)), '978-99963': ((0, 4999999, 2), (5000000, 9199999, 3), (9200000, 9999999, 2)), '978-99962': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99961': ((0, 3999999, 1), (4000000, 8999999, 2), (9000000, 9999999, 3)), '978-99960': ((0, 999999, 1), (1000000, 9499999, 2), (9500000, 9999999, 3)), '978-99969': ((0, 4999999, 1), (5000000, 7999999, 2), (8000000, 9999999, 3)), '978-99968': ((0, 3999999, 1), (4000000, 5999999, 3), (6000000, 8999999, 2), (9000000, 9999999, 3)), '978-9976': ((0, 5999999, 1), (6000000, 8999999, 2), (9000000, 9899999, 3), (9900000, 9999999, 4)), '978-9977': ((0, 8999999, 2), (9000000, 9899999, 3), (9900000, 9999999, 4)), '978-9974': ((0, 2999999, 1), (3000000, 5499999, 2), (5500000, 7499999, 3), (7500000, 9499999, 4), (9500000, 9999999, 2)), '978-9975': ((0, 999999, 1), (1000000, 2999999, 3), (3000000, 3999999, 4), (4000000, 4499999, 4), (4500000, 8999999, 2), (9000000, 9499999, 3), (9500000, 9999999, 4)), '978-9972': ((0, 999999, 2), (1000000, 1999999, 1), (2000000, 2499999, 3), (2500000, 2999999, 4), (3000000, 5999999, 2), (6000000, 8999999, 3), (9000000, 9999999, 4)), '978-9973': ((0, 599999, 2), (600000, 899999, 3), (900000, 999999, 4), (1000000, 6999999, 2), (7000000, 9699999, 3), (9700000, 9999999, 4)), '978-9970': ((0, 3999999, 2), (4000000, 8999999, 3), (9000000, 9999999, 4)), '978-9971': ((0, 5999999, 1), (6000000, 8999999, 2), (9000000, 9899999, 3), (9900000, 9999999, 4)), '978-99975': ((0, 3999999, 1), (4000000, 7999999, 2), (8000000, 9999999, 3)), '978-9978': ((0, 2999999, 2), (3000000, 3999999, 3), (4000000, 9499999, 2), (9500000, 9899999, 3), (9900000, 9999999, 4)), '978-9979': ((0, 4999999, 1), (5000000, 6499999, 2), (6500000, 6599999, 3), (6600000, 7599999, 2), (7600000, 8999999, 3), (9000000, 9999999, 4)), '978-602': ((0, 799999, 2), (800000, 899999, 4), (900000, 1099999, 4), (1100000, 1199999, 4), (1200000, 1399999, 4), (1400000, 1499999, 5), (1500000, 1699999, 4), (1700000, 1799999, 5), (1800000, 1899999, 5), (1900000, 1999999, 5), (2000000, 6999999, 3), (7000000, 7499999, 5), (7500000, 7999999, 4), (8000000, 9499999, 4), (9500000, 9999999, 5)), '978-603': ((0, 499999, 2), (500000, 4999999, 2), (5000000, 7999999, 3), (8000000, 8999999, 4), (9000000, 9999999, 5)), '978-600': ((0, 999999, 2), (1000000, 4999999, 3), (5000000, 8999999, 4), (9000000, 9999999, 5)), '978-601': ((0, 1999999, 2), (2000000, 6999999, 3), (7000000, 7999999, 4), (8000000, 8499999, 5), (8500000, 9999999, 2)), '978-606': ((0, 999999, 1), (1000000, 4999999, 2), (5000000, 7999999, 3), (8000000, 9199999, 4), (9200000, 9999999, 5)), '978-607': ((0, 3999999, 2), (4000000, 7499999, 3), (7500000, 9499999, 4), (9500000, 9999999, 5)), '978-604': ((0, 4999999, 1), (5000000, 8999999, 2), (9000000, 9799999, 3), (9800000, 9999999, 4)), '978-605': ((0, 99999, 0), (100000, 299999, 2), (300000, 399999, 3), (400000, 999999, 2), (1000000, 3999999, 3), (4000000, 5999999, 4), (6000000, 8999999, 5), (9000000, 9999999, 4)), '978-608': ((0, 999999, 1), (1000000, 1999999, 2), (2000000, 4499999, 3), (4500000, 6499999, 4), (6500000, 6999999, 5), (7000000, 9999999, 1)), '978-609': ((0, 3999999, 2), (4000000, 7999999, 3), (8000000, 9499999, 4), (9500000, 9999999, 5))}
RDDATE='2015060310:50:18WEST'
isbnlib-3.5.6/isbnlib/_data/data4tex.py 0000664 0000000 0000000 00000230411 12533556027 0017742 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8:noqa
# pylint: skip-file
# id:01.20140505
# original at https://gist.github.com/798546
unicode_to_tex = {
u"\u0020": b"\\space ",
u"\u0023": b"\\#",
u"\u0024": b"\\textdollar ",
u"\u0025": b"\\%",
u"\u0026": b"\\&",
u"\u0027": b"\\textquotesingle ",
u"\u002A": b"\\ast ",
u"\u005C": b"\\textbackslash ",
u"\u005E": b"\\^{}",
u"\u005F": b"\\_",
u"\u0060": b"\\textasciigrave ",
u"\u007B": b"\\lbrace ",
u"\u007C": b"\\vert ",
u"\u007D": b"\\rbrace ",
u"\u007E": b"\\textasciitilde ",
u"\u00A1": b"\\textexclamdown ",
u"\u00A2": b"\\textcent ",
u"\u00A3": b"\\textsterling ",
u"\u00A4": b"\\textcurrency ",
u"\u00A5": b"\\textyen ",
u"\u00A6": b"\\textbrokenbar ",
u"\u00A7": b"\\textsection ",
u"\u00A8": b"\\textasciidieresis ",
u"\u00A9": b"\\textcopyright ",
u"\u00AA": b"\\textordfeminine ",
u"\u00AB": b"\\guillemotleft ",
u"\u00AC": b"\\lnot ",
u"\u00AD": b"\\-",
u"\u00AE": b"\\textregistered ",
u"\u00AF": b"\\textasciimacron ",
u"\u00B0": b"\\textdegree ",
u"\u00B1": b"\\pm ",
u"\u00B2": b"{^2}",
u"\u00B3": b"{^3}",
u"\u00B4": b"\\textasciiacute ",
u"\u00B5": b"\\mathrm{\\mu}",
u"\u00B6": b"\\textparagraph ",
u"\u00B7": b"\\cdot ",
u"\u00B8": b"\\c{}",
u"\u00B9": b"{^1}",
u"\u00BA": b"\\textordmasculine ",
u"\u00BB": b"\\guillemotright ",
u"\u00BC": b"\\textonequarter ",
u"\u00BD": b"\\textonehalf ",
u"\u00BE": b"\\textthreequarters ",
u"\u00BF": b"\\textquestiondown ",
u"\u00C0": b"\\`{A}",
u"\u00C1": b"\\'{A}",
u"\u00C2": b"\\^{A}",
u"\u00C3": b"\\~{A}",
u"\u00C4": b"\\\"{A}",
u"\u00C5": b"\\AA ",
u"\u00C6": b"\\AE ",
u"\u00C7": b"\\c{C}",
u"\u00C8": b"\\`{E}",
u"\u00C9": b"\\'{E}",
u"\u00CA": b"\\^{E}",
u"\u00CB": b"\\\"{E}",
u"\u00CC": b"\\`{I}",
u"\u00CD": b"\\'{I}",
u"\u00CE": b"\\^{I}",
u"\u00CF": b"\\\"{I}",
u"\u00D0": b"\\DH ",
u"\u00D1": b"\\~{N}",
u"\u00D2": b"\\`{O}",
u"\u00D3": b"\\'{O}",
u"\u00D4": b"\\^{O}",
u"\u00D5": b"\\~{O}",
u"\u00D6": b"\\\"{O}",
u"\u00D7": b"\\texttimes ",
u"\u00D8": b"\\O ",
u"\u00D9": b"\\`{U}",
u"\u00DA": b"\\'{U}",
u"\u00DB": b"\\^{U}",
u"\u00DC": b"\\\"{U}",
u"\u00DD": b"\\'{Y}",
u"\u00DE": b"\\TH ",
u"\u00DF": b"\\ss ",
u"\u00E0": b"\\`{a}",
u"\u00E1": b"\\'{a}",
u"\u00E2": b"\\^{a}",
u"\u00E3": b"\\~{a}",
u"\u00E4": b"\\\"{a}",
u"\u00E5": b"\\aa ",
u"\u00E6": b"\\ae ",
u"\u00E7": b"\\c{c}",
u"\u00E8": b"\\`{e}",
u"\u00E9": b"\\'{e}",
u"\u00EA": b"\\^{e}",
u"\u00EB": b"\\\"{e}",
u"\u00EC": b"\\`{\\i}",
u"\u00ED": b"\\'{\\i}",
u"\u00EE": b"\\^{\\i}",
u"\u00EF": b"\\\"{\\i}",
u"\u00F0": b"\\dh ",
u"\u00F1": b"\\~{n}",
u"\u00F2": b"\\`{o}",
u"\u00F3": b"\\'{o}",
u"\u00F4": b"\\^{o}",
u"\u00F5": b"\\~{o}",
u"\u00F6": b"\\\"{o}",
u"\u00F7": b"\\div ",
u"\u00F8": b"\\o ",
u"\u00F9": b"\\`{u}",
u"\u00FA": b"\\'{u}",
u"\u00FB": b"\\^{u}",
u"\u00FC": b"\\\"{u}",
u"\u00FD": b"\\'{y}",
u"\u00FE": b"\\th ",
u"\u00FF": b"\\\"{y}",
u"\u0100": b"\\={A}",
u"\u0101": b"\\={a}",
u"\u0102": b"\\u{A}",
u"\u0103": b"\\u{a}",
u"\u0104": b"\\k{A}",
u"\u0105": b"\\k{a}",
u"\u0106": b"\\'{C}",
u"\u0107": b"\\'{c}",
u"\u0108": b"\\^{C}",
u"\u0109": b"\\^{c}",
u"\u010A": b"\\.{C}",
u"\u010B": b"\\.{c}",
u"\u010C": b"\\v{C}",
u"\u010D": b"\\v{c}",
u"\u010E": b"\\v{D}",
u"\u010F": b"\\v{d}",
u"\u0110": b"\\DJ ",
u"\u0111": b"\\dj ",
u"\u0112": b"\\={E}",
u"\u0113": b"\\={e}",
u"\u0114": b"\\u{E}",
u"\u0115": b"\\u{e}",
u"\u0116": b"\\.{E}",
u"\u0117": b"\\.{e}",
u"\u0118": b"\\k{E}",
u"\u0119": b"\\k{e}",
u"\u011A": b"\\v{E}",
u"\u011B": b"\\v{e}",
u"\u011C": b"\\^{G}",
u"\u011D": b"\\^{g}",
u"\u011E": b"\\u{G}",
u"\u011F": b"\\u{g}",
u"\u0120": b"\\.{G}",
u"\u0121": b"\\.{g}",
u"\u0122": b"\\c{G}",
u"\u0123": b"\\c{g}",
u"\u0124": b"\\^{H}",
u"\u0125": b"\\^{h}",
u"\u0126": b"{\\fontencoding{LELA}\\selectfont\\char40}",
u"\u0127": b"\\Elzxh ",
u"\u0128": b"\\~{I}",
u"\u0129": b"\\~{\\i}",
u"\u012A": b"\\={I}",
u"\u012B": b"\\={\\i}",
u"\u012C": b"\\u{I}",
u"\u012D": b"\\u{\\i}",
u"\u012E": b"\\k{I}",
u"\u012F": b"\\k{i}",
u"\u0130": b"\\.{I}",
u"\u0131": b"\\i ",
u"\u0132": b"IJ",
u"\u0133": b"ij",
u"\u0134": b"\\^{J}",
u"\u0135": b"\\^{\\j}",
u"\u0136": b"\\c{K}",
u"\u0137": b"\\c{k}",
u"\u0138": b"{\\fontencoding{LELA}\\selectfont\\char91}",
u"\u0139": b"\\'{L}",
u"\u013A": b"\\'{l}",
u"\u013B": b"\\c{L}",
u"\u013C": b"\\c{l}",
u"\u013D": b"\\v{L}",
u"\u013E": b"\\v{l}",
u"\u013F": b"{\\fontencoding{LELA}\\selectfont\\char201}",
u"\u0140": b"{\\fontencoding{LELA}\\selectfont\\char202}",
u"\u0141": b"\\L ",
u"\u0142": b"\\l ",
u"\u0143": b"\\'{N}",
u"\u0144": b"\\'{n}",
u"\u0145": b"\\c{N}",
u"\u0146": b"\\c{n}",
u"\u0147": b"\\v{N}",
u"\u0148": b"\\v{n}",
u"\u0149": b"'n",
u"\u014A": b"\\NG ",
u"\u014B": b"\\ng ",
u"\u014C": b"\\={O}",
u"\u014D": b"\\={o}",
u"\u014E": b"\\u{O}",
u"\u014F": b"\\u{o}",
u"\u0150": b"\\H{O}",
u"\u0151": b"\\H{o}",
u"\u0152": b"\\OE ",
u"\u0153": b"\\oe ",
u"\u0154": b"\\'{R}",
u"\u0155": b"\\'{r}",
u"\u0156": b"\\c{R}",
u"\u0157": b"\\c{r}",
u"\u0158": b"\\v{R}",
u"\u0159": b"\\v{r}",
u"\u015A": b"\\'{S}",
u"\u015B": b"\\'{s}",
u"\u015C": b"\\^{S}",
u"\u015D": b"\\^{s}",
u"\u015E": b"\\c{S}",
u"\u015F": b"\\c{s}",
u"\u0160": b"\\v{S}",
u"\u0161": b"\\v{s}",
u"\u0162": b"\\c{T}",
u"\u0163": b"\\c{t}",
u"\u0164": b"\\v{T}",
u"\u0165": b"\\v{t}",
u"\u0166": b"{\\fontencoding{LELA}\\selectfont\\char47}",
u"\u0167": b"{\\fontencoding{LELA}\\selectfont\\char63}",
u"\u0168": b"\\~{U}",
u"\u0169": b"\\~{u}",
u"\u016A": b"\\={U}",
u"\u016B": b"\\={u}",
u"\u016C": b"\\u{U}",
u"\u016D": b"\\u{u}",
u"\u016E": b"\\r{U}",
u"\u016F": b"\\r{u}",
u"\u0170": b"\\H{U}",
u"\u0171": b"\\H{u}",
u"\u0172": b"\\k{U}",
u"\u0173": b"\\k{u}",
u"\u0174": b"\\^{W}",
u"\u0175": b"\\^{w}",
u"\u0176": b"\\^{Y}",
u"\u0177": b"\\^{y}",
u"\u0178": b"\\\"{Y}",
u"\u0179": b"\\'{Z}",
u"\u017A": b"\\'{z}",
u"\u017B": b"\\.{Z}",
u"\u017C": b"\\.{z}",
u"\u017D": b"\\v{Z}",
u"\u017E": b"\\v{z}",
u"\u0195": b"\\texthvlig ",
u"\u019E": b"\\textnrleg ",
u"\u01AA": b"\\eth ",
u"\u01BA": b"{\\fontencoding{LELA}\\selectfont\\char195}",
u"\u01C2": b"\\textdoublepipe ",
u"\u01F5": b"\\'{g}",
u"\u0250": b"\\Elztrna ",
u"\u0252": b"\\Elztrnsa ",
u"\u0254": b"\\Elzopeno ",
u"\u0256": b"\\Elzrtld ",
u"\u0258": b"{\\fontencoding{LEIP}\\selectfont\\char61}",
u"\u0259": b"\\Elzschwa ",
u"\u025B": b"\\varepsilon ",
u"\u0263": b"\\Elzpgamma ",
u"\u0264": b"\\Elzpbgam ",
u"\u0265": b"\\Elztrnh ",
u"\u026C": b"\\Elzbtdl ",
u"\u026D": b"\\Elzrtll ",
u"\u026F": b"\\Elztrnm ",
u"\u0270": b"\\Elztrnmlr ",
u"\u0271": b"\\Elzltlmr ",
u"\u0272": b"\\Elzltln ",
u"\u0273": b"\\Elzrtln ",
u"\u0277": b"\\Elzclomeg ",
u"\u0278": b"\\textphi ",
u"\u0279": b"\\Elztrnr ",
u"\u027A": b"\\Elztrnrl ",
u"\u027B": b"\\Elzrttrnr ",
u"\u027C": b"\\Elzrl ",
u"\u027D": b"\\Elzrtlr ",
u"\u027E": b"\\Elzfhr ",
u"\u027F": b"{\\fontencoding{LEIP}\\selectfont\\char202}",
u"\u0282": b"\\Elzrtls ",
u"\u0283": b"\\Elzesh ",
u"\u0287": b"\\Elztrnt ",
u"\u0288": b"\\Elzrtlt ",
u"\u028A": b"\\Elzpupsil ",
u"\u028B": b"\\Elzpscrv ",
u"\u028C": b"\\Elzinvv ",
u"\u028D": b"\\Elzinvw ",
u"\u028E": b"\\Elztrny ",
u"\u0290": b"\\Elzrtlz ",
u"\u0292": b"\\Elzyogh ",
u"\u0294": b"\\Elzglst ",
u"\u0295": b"\\Elzreglst ",
u"\u0296": b"\\Elzinglst ",
u"\u029E": b"\\textturnk ",
u"\u02A4": b"\\Elzdyogh ",
u"\u02A7": b"\\Elztesh ",
u"\u02C7": b"\\textasciicaron ",
u"\u02C8": b"\\Elzverts ",
u"\u02CC": b"\\Elzverti ",
u"\u02D0": b"\\Elzlmrk ",
u"\u02D1": b"\\Elzhlmrk ",
u"\u02D2": b"\\Elzsbrhr ",
u"\u02D3": b"\\Elzsblhr ",
u"\u02D4": b"\\Elzrais ",
u"\u02D5": b"\\Elzlow ",
u"\u02D8": b"\\textasciibreve ",
u"\u02D9": b"\\textperiodcentered ",
u"\u02DA": b"\\r{}",
u"\u02DB": b"\\k{}",
u"\u02DC": b"\\texttildelow ",
u"\u02DD": b"\\H{}",
u"\u02E5": b"\\tone{55}",
u"\u02E6": b"\\tone{44}",
u"\u02E7": b"\\tone{33}",
u"\u02E8": b"\\tone{22}",
u"\u02E9": b"\\tone{11}",
u"\u0300": b"\\`",
u"\u0301": b"\\'",
u"\u0302": b"\\^",
u"\u0303": b"\\~",
u"\u0304": b"\\=",
u"\u0306": b"\\u",
u"\u0307": b"\\.",
u"\u0308": b"\\\"",
u"\u030A": b"\\r",
u"\u030B": b"\\H",
u"\u030C": b"\\v",
u"\u030F": b"\\cyrchar\\C",
u"\u0311": b"{\\fontencoding{LECO}\\selectfont\\char177}",
u"\u0318": b"{\\fontencoding{LECO}\\selectfont\\char184}",
u"\u0319": b"{\\fontencoding{LECO}\\selectfont\\char185}",
u"\u0321": b"\\Elzpalh ",
u"\u0322": b"\\Elzrh ",
u"\u0327": b"\\c",
u"\u0328": b"\\k",
u"\u032A": b"\\Elzsbbrg ",
u"\u032B": b"{\\fontencoding{LECO}\\selectfont\\char203}",
u"\u032F": b"{\\fontencoding{LECO}\\selectfont\\char207}",
u"\u0335": b"\\Elzxl ",
u"\u0336": b"\\Elzbar ",
u"\u0337": b"{\\fontencoding{LECO}\\selectfont\\char215}",
u"\u0338": b"{\\fontencoding{LECO}\\selectfont\\char216}",
u"\u033A": b"{\\fontencoding{LECO}\\selectfont\\char218}",
u"\u033B": b"{\\fontencoding{LECO}\\selectfont\\char219}",
u"\u033C": b"{\\fontencoding{LECO}\\selectfont\\char220}",
u"\u033D": b"{\\fontencoding{LECO}\\selectfont\\char221}",
u"\u0361": b"{\\fontencoding{LECO}\\selectfont\\char225}",
u"\u0386": b"\\'{A}",
u"\u0388": b"\\'{E}",
u"\u0389": b"\\'{H}",
u"\u038A": b"\\'{}{I}",
u"\u038C": b"\\'{}O",
u"\u038E": b"\\mathrm{'Y}",
u"\u038F": b"\\mathrm{'\\Omega}",
u"\u0390": b"\\acute{\\ddot{\\iota}}",
u"\u0391": b"\\Alpha ",
u"\u0392": b"\\Beta ",
u"\u0393": b"\\Gamma ",
u"\u0394": b"\\Delta ",
u"\u0395": b"\\Epsilon ",
u"\u0396": b"\\Zeta ",
u"\u0397": b"\\Eta ",
u"\u0398": b"\\Theta ",
u"\u0399": b"\\Iota ",
u"\u039A": b"\\Kappa ",
u"\u039B": b"\\Lambda ",
u"\u039E": b"\\Xi ",
u"\u03A0": b"\\Pi ",
u"\u03A1": b"\\Rho ",
u"\u03A3": b"\\Sigma ",
u"\u03A4": b"\\Tau ",
u"\u03A5": b"\\Upsilon ",
u"\u03A6": b"\\Phi ",
u"\u03A7": b"\\Chi ",
u"\u03A8": b"\\Psi ",
u"\u03A9": b"\\Omega ",
u"\u03AA": b"\\mathrm{\\ddot{I}}",
u"\u03AB": b"\\mathrm{\\ddot{Y}}",
u"\u03AC": b"\\'{$\\alpha$}",
u"\u03AD": b"\\acute{\\epsilon}",
u"\u03AE": b"\\acute{\\eta}",
u"\u03AF": b"\\acute{\\iota}",
u"\u03B0": b"\\acute{\\ddot{\\upsilon}}",
u"\u03B1": b"\\alpha ",
u"\u03B2": b"\\beta ",
u"\u03B3": b"\\gamma ",
u"\u03B4": b"\\delta ",
u"\u03B5": b"\\epsilon ",
u"\u03B6": b"\\zeta ",
u"\u03B7": b"\\eta ",
u"\u03B8": b"\\texttheta ",
u"\u03B9": b"\\iota ",
u"\u03BA": b"\\kappa ",
u"\u03BB": b"\\lambda ",
u"\u03BC": b"\\mu ",
u"\u03BD": b"\\nu ",
u"\u03BE": b"\\xi ",
u"\u03C0": b"\\pi ",
u"\u03C1": b"\\rho ",
u"\u03C2": b"\\varsigma ",
u"\u03C3": b"\\sigma ",
u"\u03C4": b"\\tau ",
u"\u03C5": b"\\upsilon ",
u"\u03C6": b"\\varphi ",
u"\u03C7": b"\\chi ",
u"\u03C8": b"\\psi ",
u"\u03C9": b"\\omega ",
u"\u03CA": b"\\ddot{\\iota}",
u"\u03CB": b"\\ddot{\\upsilon}",
u"\u03CC": b"\\'{o}",
u"\u03CD": b"\\acute{\\upsilon}",
u"\u03CE": b"\\acute{\\omega}",
u"\u03D0": b"\\Pisymbol{ppi022}{87}",
u"\u03D1": b"\\textvartheta ",
u"\u03D2": b"\\Upsilon ",
u"\u03D5": b"\\phi ",
u"\u03D6": b"\\varpi ",
u"\u03DA": b"\\Stigma ",
u"\u03DC": b"\\Digamma ",
u"\u03DD": b"\\digamma ",
u"\u03DE": b"\\Koppa ",
u"\u03E0": b"\\Sampi ",
u"\u03F0": b"\\varkappa ",
u"\u03F1": b"\\varrho ",
u"\u03F4": b"\\textTheta ",
u"\u03F6": b"\\backepsilon ",
u"\u0401": b"\\cyrchar\\CYRYO ",
u"\u0402": b"\\cyrchar\\CYRDJE ",
u"\u0403": b"\\cyrchar{\\'\\CYRG}",
u"\u0404": b"\\cyrchar\\CYRIE ",
u"\u0405": b"\\cyrchar\\CYRDZE ",
u"\u0406": b"\\cyrchar\\CYRII ",
u"\u0407": b"\\cyrchar\\CYRYI ",
u"\u0408": b"\\cyrchar\\CYRJE ",
u"\u0409": b"\\cyrchar\\CYRLJE ",
u"\u040A": b"\\cyrchar\\CYRNJE ",
u"\u040B": b"\\cyrchar\\CYRTSHE ",
u"\u040C": b"\\cyrchar{\\'\\CYRK}",
u"\u040E": b"\\cyrchar\\CYRUSHRT ",
u"\u040F": b"\\cyrchar\\CYRDZHE ",
u"\u0410": b"\\cyrchar\\CYRA ",
u"\u0411": b"\\cyrchar\\CYRB ",
u"\u0412": b"\\cyrchar\\CYRV ",
u"\u0413": b"\\cyrchar\\CYRG ",
u"\u0414": b"\\cyrchar\\CYRD ",
u"\u0415": b"\\cyrchar\\CYRE ",
u"\u0416": b"\\cyrchar\\CYRZH ",
u"\u0417": b"\\cyrchar\\CYRZ ",
u"\u0418": b"\\cyrchar\\CYRI ",
u"\u0419": b"\\cyrchar\\CYRISHRT ",
u"\u041A": b"\\cyrchar\\CYRK ",
u"\u041B": b"\\cyrchar\\CYRL ",
u"\u041C": b"\\cyrchar\\CYRM ",
u"\u041D": b"\\cyrchar\\CYRN ",
u"\u041E": b"\\cyrchar\\CYRO ",
u"\u041F": b"\\cyrchar\\CYRP ",
u"\u0420": b"\\cyrchar\\CYRR ",
u"\u0421": b"\\cyrchar\\CYRS ",
u"\u0422": b"\\cyrchar\\CYRT ",
u"\u0423": b"\\cyrchar\\CYRU ",
u"\u0424": b"\\cyrchar\\CYRF ",
u"\u0425": b"\\cyrchar\\CYRH ",
u"\u0426": b"\\cyrchar\\CYRC ",
u"\u0427": b"\\cyrchar\\CYRCH ",
u"\u0428": b"\\cyrchar\\CYRSH ",
u"\u0429": b"\\cyrchar\\CYRSHCH ",
u"\u042A": b"\\cyrchar\\CYRHRDSN ",
u"\u042B": b"\\cyrchar\\CYRERY ",
u"\u042C": b"\\cyrchar\\CYRSFTSN ",
u"\u042D": b"\\cyrchar\\CYREREV ",
u"\u042E": b"\\cyrchar\\CYRYU ",
u"\u042F": b"\\cyrchar\\CYRYA ",
u"\u0430": b"\\cyrchar\\cyra ",
u"\u0431": b"\\cyrchar\\cyrb ",
u"\u0432": b"\\cyrchar\\cyrv ",
u"\u0433": b"\\cyrchar\\cyrg ",
u"\u0434": b"\\cyrchar\\cyrd ",
u"\u0435": b"\\cyrchar\\cyre ",
u"\u0436": b"\\cyrchar\\cyrzh ",
u"\u0437": b"\\cyrchar\\cyrz ",
u"\u0438": b"\\cyrchar\\cyri ",
u"\u0439": b"\\cyrchar\\cyrishrt ",
u"\u043A": b"\\cyrchar\\cyrk ",
u"\u043B": b"\\cyrchar\\cyrl ",
u"\u043C": b"\\cyrchar\\cyrm ",
u"\u043D": b"\\cyrchar\\cyrn ",
u"\u043E": b"\\cyrchar\\cyro ",
u"\u043F": b"\\cyrchar\\cyrp ",
u"\u0440": b"\\cyrchar\\cyrr ",
u"\u0441": b"\\cyrchar\\cyrs ",
u"\u0442": b"\\cyrchar\\cyrt ",
u"\u0443": b"\\cyrchar\\cyru ",
u"\u0444": b"\\cyrchar\\cyrf ",
u"\u0445": b"\\cyrchar\\cyrh ",
u"\u0446": b"\\cyrchar\\cyrc ",
u"\u0447": b"\\cyrchar\\cyrch ",
u"\u0448": b"\\cyrchar\\cyrsh ",
u"\u0449": b"\\cyrchar\\cyrshch ",
u"\u044A": b"\\cyrchar\\cyrhrdsn ",
u"\u044B": b"\\cyrchar\\cyrery ",
u"\u044C": b"\\cyrchar\\cyrsftsn ",
u"\u044D": b"\\cyrchar\\cyrerev ",
u"\u044E": b"\\cyrchar\\cyryu ",
u"\u044F": b"\\cyrchar\\cyrya ",
u"\u0451": b"\\cyrchar\\cyryo ",
u"\u0452": b"\\cyrchar\\cyrdje ",
u"\u0453": b"\\cyrchar{\\'\\cyrg}",
u"\u0454": b"\\cyrchar\\cyrie ",
u"\u0455": b"\\cyrchar\\cyrdze ",
u"\u0456": b"\\cyrchar\\cyrii ",
u"\u0457": b"\\cyrchar\\cyryi ",
u"\u0458": b"\\cyrchar\\cyrje ",
u"\u0459": b"\\cyrchar\\cyrlje ",
u"\u045A": b"\\cyrchar\\cyrnje ",
u"\u045B": b"\\cyrchar\\cyrtshe ",
u"\u045C": b"\\cyrchar{\\'\\cyrk}",
u"\u045E": b"\\cyrchar\\cyrushrt ",
u"\u045F": b"\\cyrchar\\cyrdzhe ",
u"\u0460": b"\\cyrchar\\CYROMEGA ",
u"\u0461": b"\\cyrchar\\cyromega ",
u"\u0462": b"\\cyrchar\\CYRYAT ",
u"\u0464": b"\\cyrchar\\CYRIOTE ",
u"\u0465": b"\\cyrchar\\cyriote ",
u"\u0466": b"\\cyrchar\\CYRLYUS ",
u"\u0467": b"\\cyrchar\\cyrlyus ",
u"\u0468": b"\\cyrchar\\CYRIOTLYUS ",
u"\u0469": b"\\cyrchar\\cyriotlyus ",
u"\u046A": b"\\cyrchar\\CYRBYUS ",
u"\u046C": b"\\cyrchar\\CYRIOTBYUS ",
u"\u046D": b"\\cyrchar\\cyriotbyus ",
u"\u046E": b"\\cyrchar\\CYRKSI ",
u"\u046F": b"\\cyrchar\\cyrksi ",
u"\u0470": b"\\cyrchar\\CYRPSI ",
u"\u0471": b"\\cyrchar\\cyrpsi ",
u"\u0472": b"\\cyrchar\\CYRFITA ",
u"\u0474": b"\\cyrchar\\CYRIZH ",
u"\u0478": b"\\cyrchar\\CYRUK ",
u"\u0479": b"\\cyrchar\\cyruk ",
u"\u047A": b"\\cyrchar\\CYROMEGARND ",
u"\u047B": b"\\cyrchar\\cyromegarnd ",
u"\u047C": b"\\cyrchar\\CYROMEGATITLO ",
u"\u047D": b"\\cyrchar\\cyromegatitlo ",
u"\u047E": b"\\cyrchar\\CYROT ",
u"\u047F": b"\\cyrchar\\cyrot ",
u"\u0480": b"\\cyrchar\\CYRKOPPA ",
u"\u0481": b"\\cyrchar\\cyrkoppa ",
u"\u0482": b"\\cyrchar\\cyrthousands ",
u"\u0488": b"\\cyrchar\\cyrhundredthousands ",
u"\u0489": b"\\cyrchar\\cyrmillions ",
u"\u048C": b"\\cyrchar\\CYRSEMISFTSN ",
u"\u048D": b"\\cyrchar\\cyrsemisftsn ",
u"\u048E": b"\\cyrchar\\CYRRTICK ",
u"\u048F": b"\\cyrchar\\cyrrtick ",
u"\u0490": b"\\cyrchar\\CYRGUP ",
u"\u0491": b"\\cyrchar\\cyrgup ",
u"\u0492": b"\\cyrchar\\CYRGHCRS ",
u"\u0493": b"\\cyrchar\\cyrghcrs ",
u"\u0494": b"\\cyrchar\\CYRGHK ",
u"\u0495": b"\\cyrchar\\cyrghk ",
u"\u0496": b"\\cyrchar\\CYRZHDSC ",
u"\u0497": b"\\cyrchar\\cyrzhdsc ",
u"\u0498": b"\\cyrchar\\CYRZDSC ",
u"\u0499": b"\\cyrchar\\cyrzdsc ",
u"\u049A": b"\\cyrchar\\CYRKDSC ",
u"\u049B": b"\\cyrchar\\cyrkdsc ",
u"\u049C": b"\\cyrchar\\CYRKVCRS ",
u"\u049D": b"\\cyrchar\\cyrkvcrs ",
u"\u049E": b"\\cyrchar\\CYRKHCRS ",
u"\u049F": b"\\cyrchar\\cyrkhcrs ",
u"\u04A0": b"\\cyrchar\\CYRKBEAK ",
u"\u04A1": b"\\cyrchar\\cyrkbeak ",
u"\u04A2": b"\\cyrchar\\CYRNDSC ",
u"\u04A3": b"\\cyrchar\\cyrndsc ",
u"\u04A4": b"\\cyrchar\\CYRNG ",
u"\u04A5": b"\\cyrchar\\cyrng ",
u"\u04A6": b"\\cyrchar\\CYRPHK ",
u"\u04A7": b"\\cyrchar\\cyrphk ",
u"\u04A8": b"\\cyrchar\\CYRABHHA ",
u"\u04A9": b"\\cyrchar\\cyrabhha ",
u"\u04AA": b"\\cyrchar\\CYRSDSC ",
u"\u04AB": b"\\cyrchar\\cyrsdsc ",
u"\u04AC": b"\\cyrchar\\CYRTDSC ",
u"\u04AD": b"\\cyrchar\\cyrtdsc ",
u"\u04AE": b"\\cyrchar\\CYRY ",
u"\u04AF": b"\\cyrchar\\cyry ",
u"\u04B0": b"\\cyrchar\\CYRYHCRS ",
u"\u04B1": b"\\cyrchar\\cyryhcrs ",
u"\u04B2": b"\\cyrchar\\CYRHDSC ",
u"\u04B3": b"\\cyrchar\\cyrhdsc ",
u"\u04B4": b"\\cyrchar\\CYRTETSE ",
u"\u04B5": b"\\cyrchar\\cyrtetse ",
u"\u04B6": b"\\cyrchar\\CYRCHRDSC ",
u"\u04B7": b"\\cyrchar\\cyrchrdsc ",
u"\u04B8": b"\\cyrchar\\CYRCHVCRS ",
u"\u04B9": b"\\cyrchar\\cyrchvcrs ",
u"\u04BA": b"\\cyrchar\\CYRSHHA ",
u"\u04BB": b"\\cyrchar\\cyrshha ",
u"\u04BC": b"\\cyrchar\\CYRABHCH ",
u"\u04BD": b"\\cyrchar\\cyrabhch ",
u"\u04BE": b"\\cyrchar\\CYRABHCHDSC ",
u"\u04BF": b"\\cyrchar\\cyrabhchdsc ",
u"\u04C0": b"\\cyrchar\\CYRpalochka ",
u"\u04C3": b"\\cyrchar\\CYRKHK ",
u"\u04C4": b"\\cyrchar\\cyrkhk ",
u"\u04C7": b"\\cyrchar\\CYRNHK ",
u"\u04C8": b"\\cyrchar\\cyrnhk ",
u"\u04CB": b"\\cyrchar\\CYRCHLDSC ",
u"\u04CC": b"\\cyrchar\\cyrchldsc ",
u"\u04D4": b"\\cyrchar\\CYRAE ",
u"\u04D5": b"\\cyrchar\\cyrae ",
u"\u04D8": b"\\cyrchar\\CYRSCHWA ",
u"\u04D9": b"\\cyrchar\\cyrschwa ",
u"\u04E0": b"\\cyrchar\\CYRABHDZE ",
u"\u04E1": b"\\cyrchar\\cyrabhdze ",
u"\u04E8": b"\\cyrchar\\CYROTLD ",
u"\u04E9": b"\\cyrchar\\cyrotld ",
u"\u2002": b"\\hspace{0.6em}",
u"\u2003": b"\\hspace{1em}",
u"\u2004": b"\\hspace{0.33em}",
u"\u2005": b"\\hspace{0.25em}",
u"\u2006": b"\\hspace{0.166em}",
u"\u2007": b"\\hphantom{0}",
u"\u2008": b"\\hphantom{,}",
u"\u2009": b"\\hspace{0.167em}",
u"\u2009-0200A-0200A": b"\\;",
u"\u200A": b"\\mkern1mu ",
u"\u2013": b"\\textendash ",
u"\u2014": b"\\textemdash ",
u"\u2015": b"\\rule{1em}{1pt}",
u"\u2016": b"\\Vert ",
u"\u201B": b"\\Elzreapos ",
u"\u201C": b"\\textquotedblleft ",
u"\u201D": b"\\textquotedblright ",
u"\u201E": b",,",
u"\u2020": b"\\textdagger ",
u"\u2021": b"\\textdaggerdbl ",
u"\u2022": b"\\textbullet ",
u"\u2025": b"..",
u"\u2026": b"\\ldots ",
u"\u2030": b"\\textperthousand ",
u"\u2031": b"\\textpertenthousand ",
u"\u2032": b"{'}",
u"\u2033": b"{''}",
u"\u2034": b"{'''}",
u"\u2035": b"\\backprime ",
u"\u2039": b"\\guilsinglleft ",
u"\u203A": b"\\guilsinglright ",
u"\u2057": b"''''",
u"\u205F": b"\\mkern4mu ",
u"\u2060": b"\\nolinebreak ",
u"\u20A7": b"\\ensuremath{\\Elzpes}",
u"\u20AC": b"\\mbox{\\texteuro} ",
u"\u20DB": b"\\dddot ",
u"\u20DC": b"\\ddddot ",
u"\u2102": b"\\mathbb{C}",
u"\u210A": b"\\mathscr{g}",
u"\u210B": b"\\mathscr{H}",
u"\u210C": b"\\mathfrak{H}",
u"\u210D": b"\\mathbb{H}",
u"\u210F": b"\\hslash ",
u"\u2110": b"\\mathscr{I}",
u"\u2111": b"\\mathfrak{I}",
u"\u2112": b"\\mathscr{L}",
u"\u2113": b"\\mathscr{l}",
u"\u2115": b"\\mathbb{N}",
u"\u2116": b"\\cyrchar\\textnumero ",
u"\u2118": b"\\wp ",
u"\u2119": b"\\mathbb{P}",
u"\u211A": b"\\mathbb{Q}",
u"\u211B": b"\\mathscr{R}",
u"\u211C": b"\\mathfrak{R}",
u"\u211D": b"\\mathbb{R}",
u"\u211E": b"\\Elzxrat ",
u"\u2122": b"\\texttrademark ",
u"\u2124": b"\\mathbb{Z}",
u"\u2126": b"\\Omega ",
u"\u2127": b"\\mho ",
u"\u2128": b"\\mathfrak{Z}",
u"\u2129": b"\\ElsevierGlyph{2129}",
u"\u212B": b"\\AA ",
u"\u212C": b"\\mathscr{B}",
u"\u212D": b"\\mathfrak{C}",
u"\u212F": b"\\mathscr{e}",
u"\u2130": b"\\mathscr{E}",
u"\u2131": b"\\mathscr{F}",
u"\u2133": b"\\mathscr{M}",
u"\u2134": b"\\mathscr{o}",
u"\u2135": b"\\aleph ",
u"\u2136": b"\\beth ",
u"\u2137": b"\\gimel ",
u"\u2138": b"\\daleth ",
u"\u2153": b"\\textfrac{1}{3}",
u"\u2154": b"\\textfrac{2}{3}",
u"\u2155": b"\\textfrac{1}{5}",
u"\u2156": b"\\textfrac{2}{5}",
u"\u2157": b"\\textfrac{3}{5}",
u"\u2158": b"\\textfrac{4}{5}",
u"\u2159": b"\\textfrac{1}{6}",
u"\u215A": b"\\textfrac{5}{6}",
u"\u215B": b"\\textfrac{1}{8}",
u"\u215C": b"\\textfrac{3}{8}",
u"\u215D": b"\\textfrac{5}{8}",
u"\u215E": b"\\textfrac{7}{8}",
u"\u2190": b"\\leftarrow ",
u"\u2191": b"\\uparrow ",
u"\u2192": b"\\rightarrow ",
u"\u2193": b"\\downarrow ",
u"\u2194": b"\\leftrightarrow ",
u"\u2195": b"\\updownarrow ",
u"\u2196": b"\\nwarrow ",
u"\u2197": b"\\nearrow ",
u"\u2198": b"\\searrow ",
u"\u2199": b"\\swarrow ",
u"\u219A": b"\\nleftarrow ",
u"\u219B": b"\\nrightarrow ",
u"\u219C": b"\\arrowwaveright ",
u"\u219D": b"\\arrowwaveright ",
u"\u219E": b"\\twoheadleftarrow ",
u"\u21A0": b"\\twoheadrightarrow ",
u"\u21A2": b"\\leftarrowtail ",
u"\u21A3": b"\\rightarrowtail ",
u"\u21A6": b"\\mapsto ",
u"\u21A9": b"\\hookleftarrow ",
u"\u21AA": b"\\hookrightarrow ",
u"\u21AB": b"\\looparrowleft ",
u"\u21AC": b"\\looparrowright ",
u"\u21AD": b"\\leftrightsquigarrow ",
u"\u21AE": b"\\nleftrightarrow ",
u"\u21B0": b"\\Lsh ",
u"\u21B1": b"\\Rsh ",
u"\u21B3": b"\\ElsevierGlyph{21B3}",
u"\u21B6": b"\\curvearrowleft ",
u"\u21B7": b"\\curvearrowright ",
u"\u21BA": b"\\circlearrowleft ",
u"\u21BB": b"\\circlearrowright ",
u"\u21BC": b"\\leftharpoonup ",
u"\u21BD": b"\\leftharpoondown ",
u"\u21BE": b"\\upharpoonright ",
u"\u21BF": b"\\upharpoonleft ",
u"\u21C0": b"\\rightharpoonup ",
u"\u21C1": b"\\rightharpoondown ",
u"\u21C2": b"\\downharpoonright ",
u"\u21C3": b"\\downharpoonleft ",
u"\u21C4": b"\\rightleftarrows ",
u"\u21C5": b"\\dblarrowupdown ",
u"\u21C6": b"\\leftrightarrows ",
u"\u21C7": b"\\leftleftarrows ",
u"\u21C8": b"\\upuparrows ",
u"\u21C9": b"\\rightrightarrows ",
u"\u21CA": b"\\downdownarrows ",
u"\u21CB": b"\\leftrightharpoons ",
u"\u21CC": b"\\rightleftharpoons ",
u"\u21CD": b"\\nLeftarrow ",
u"\u21CE": b"\\nLeftrightarrow ",
u"\u21CF": b"\\nRightarrow ",
u"\u21D0": b"\\Leftarrow ",
u"\u21D1": b"\\Uparrow ",
u"\u21D2": b"\\Rightarrow ",
u"\u21D3": b"\\Downarrow ",
u"\u21D4": b"\\Leftrightarrow ",
u"\u21D5": b"\\Updownarrow ",
u"\u21DA": b"\\Lleftarrow ",
u"\u21DB": b"\\Rrightarrow ",
u"\u21DD": b"\\rightsquigarrow ",
u"\u21F5": b"\\DownArrowUpArrow ",
u"\u2200": b"\\forall ",
u"\u2201": b"\\complement ",
u"\u2202": b"\\partial ",
u"\u2203": b"\\exists ",
u"\u2204": b"\\nexists ",
u"\u2205": b"\\varnothing ",
u"\u2207": b"\\nabla ",
u"\u2208": b"\\in ",
u"\u2209": b"\\not\\in ",
u"\u220B": b"\\ni ",
u"\u220C": b"\\not\\ni ",
u"\u220F": b"\\prod ",
u"\u2210": b"\\coprod ",
u"\u2211": b"\\sum ",
u"\u2213": b"\\mp ",
u"\u2214": b"\\dotplus ",
u"\u2216": b"\\setminus ",
u"\u2217": b"{_\\ast}",
u"\u2218": b"\\circ ",
u"\u2219": b"\\bullet ",
u"\u221A": b"\\surd ",
u"\u221D": b"\\propto ",
u"\u221E": b"\\infty ",
u"\u221F": b"\\rightangle ",
u"\u2220": b"\\angle ",
u"\u2221": b"\\measuredangle ",
u"\u2222": b"\\sphericalangle ",
u"\u2223": b"\\mid ",
u"\u2224": b"\\nmid ",
u"\u2225": b"\\parallel ",
u"\u2226": b"\\nparallel ",
u"\u2227": b"\\wedge ",
u"\u2228": b"\\vee ",
u"\u2229": b"\\cap ",
u"\u222A": b"\\cup ",
u"\u222B": b"\\int ",
u"\u222C": b"\\int\\!\\int ",
u"\u222D": b"\\int\\!\\int\\!\\int ",
u"\u222E": b"\\oint ",
u"\u222F": b"\\surfintegral ",
u"\u2230": b"\\volintegral ",
u"\u2231": b"\\clwintegral ",
u"\u2232": b"\\ElsevierGlyph{2232}",
u"\u2233": b"\\ElsevierGlyph{2233}",
u"\u2234": b"\\therefore ",
u"\u2235": b"\\because ",
u"\u2237": b"\\Colon ",
u"\u2238": b"\\ElsevierGlyph{2238}",
u"\u223A": b"\\mathbin{{:}\\!\\!{-}\\!\\!{:}}",
u"\u223B": b"\\homothetic ",
u"\u223C": b"\\sim ",
u"\u223D": b"\\backsim ",
u"\u223E": b"\\lazysinv ",
u"\u2240": b"\\wr ",
u"\u2241": b"\\not\\sim ",
u"\u2242": b"\\ElsevierGlyph{2242}",
u"\u2242-00338": b"\\NotEqualTilde ",
u"\u2243": b"\\simeq ",
u"\u2244": b"\\not\\simeq ",
u"\u2245": b"\\cong ",
u"\u2246": b"\\approxnotequal ",
u"\u2247": b"\\not\\cong ",
u"\u2248": b"\\approx ",
u"\u2249": b"\\not\\approx ",
u"\u224A": b"\\approxeq ",
u"\u224B": b"\\tildetrpl ",
u"\u224B-00338": b"\\not\\apid ",
u"\u224C": b"\\allequal ",
u"\u224D": b"\\asymp ",
u"\u224E": b"\\Bumpeq ",
u"\u224E-00338": b"\\NotHumpDownHump ",
u"\u224F": b"\\bumpeq ",
u"\u224F-00338": b"\\NotHumpEqual ",
u"\u2250": b"\\doteq ",
u"\u2250-00338": b"\\not\\doteq",
u"\u2251": b"\\doteqdot ",
u"\u2252": b"\\fallingdotseq ",
u"\u2253": b"\\risingdotseq ",
u"\u2254": b":=",
u"\u2255": b"=:",
u"\u2256": b"\\eqcirc ",
u"\u2257": b"\\circeq ",
u"\u2259": b"\\estimates ",
u"\u225A": b"\\ElsevierGlyph{225A}",
u"\u225B": b"\\starequal ",
u"\u225C": b"\\triangleq ",
u"\u225F": b"\\ElsevierGlyph{225F}",
u"\u2260": b"\\not =",
u"\u2261": b"\\equiv ",
u"\u2262": b"\\not\\equiv ",
u"\u2264": b"\\leq ",
u"\u2265": b"\\geq ",
u"\u2266": b"\\leqq ",
u"\u2267": b"\\geqq ",
u"\u2268": b"\\lneqq ",
u"\u2268-0FE00": b"\\lvertneqq ",
u"\u2269": b"\\gneqq ",
u"\u2269-0FE00": b"\\gvertneqq ",
u"\u226A": b"\\ll ",
u"\u226A-00338": b"\\NotLessLess ",
u"\u226B": b"\\gg ",
u"\u226B-00338": b"\\NotGreaterGreater ",
u"\u226C": b"\\between ",
u"\u226D": b"\\not\\kern-0.3em\\times ",
u"\u226E": b"\\not<",
u"\u226F": b"\\not>",
u"\u2270": b"\\not\\leq ",
u"\u2271": b"\\not\\geq ",
u"\u2272": b"\\lessequivlnt ",
u"\u2273": b"\\greaterequivlnt ",
u"\u2274": b"\\ElsevierGlyph{2274}",
u"\u2275": b"\\ElsevierGlyph{2275}",
u"\u2276": b"\\lessgtr ",
u"\u2277": b"\\gtrless ",
u"\u2278": b"\\notlessgreater ",
u"\u2279": b"\\notgreaterless ",
u"\u227A": b"\\prec ",
u"\u227B": b"\\succ ",
u"\u227C": b"\\preccurlyeq ",
u"\u227D": b"\\succcurlyeq ",
u"\u227E": b"\\precapprox ",
u"\u227E-00338": b"\\NotPrecedesTilde ",
u"\u227F": b"\\succapprox ",
u"\u227F-00338": b"\\NotSucceedsTilde ",
u"\u2280": b"\\not\\prec ",
u"\u2281": b"\\not\\succ ",
u"\u2282": b"\\subset ",
u"\u2283": b"\\supset ",
u"\u2284": b"\\not\\subset ",
u"\u2285": b"\\not\\supset ",
u"\u2286": b"\\subseteq ",
u"\u2287": b"\\supseteq ",
u"\u2288": b"\\not\\subseteq ",
u"\u2289": b"\\not\\supseteq ",
u"\u228A": b"\\subsetneq ",
u"\u228A-0FE00": b"\\varsubsetneqq ",
u"\u228B": b"\\supsetneq ",
u"\u228B-0FE00": b"\\varsupsetneq ",
u"\u228E": b"\\uplus ",
u"\u228F": b"\\sqsubset ",
u"\u228F-00338": b"\\NotSquareSubset ",
u"\u2290": b"\\sqsupset ",
u"\u2290-00338": b"\\NotSquareSuperset ",
u"\u2291": b"\\sqsubseteq ",
u"\u2292": b"\\sqsupseteq ",
u"\u2293": b"\\sqcap ",
u"\u2294": b"\\sqcup ",
u"\u2295": b"\\oplus ",
u"\u2296": b"\\ominus ",
u"\u2297": b"\\otimes ",
u"\u2298": b"\\oslash ",
u"\u2299": b"\\odot ",
u"\u229A": b"\\circledcirc ",
u"\u229B": b"\\circledast ",
u"\u229D": b"\\circleddash ",
u"\u229E": b"\\boxplus ",
u"\u229F": b"\\boxminus ",
u"\u22A0": b"\\boxtimes ",
u"\u22A1": b"\\boxdot ",
u"\u22A2": b"\\vdash ",
u"\u22A3": b"\\dashv ",
u"\u22A4": b"\\top ",
u"\u22A5": b"\\perp ",
u"\u22A7": b"\\truestate ",
u"\u22A8": b"\\forcesextra ",
u"\u22A9": b"\\Vdash ",
u"\u22AA": b"\\Vvdash ",
u"\u22AB": b"\\VDash ",
u"\u22AC": b"\\nvdash ",
u"\u22AD": b"\\nvDash ",
u"\u22AE": b"\\nVdash ",
u"\u22AF": b"\\nVDash ",
u"\u22B2": b"\\vartriangleleft ",
u"\u22B3": b"\\vartriangleright ",
u"\u22B4": b"\\trianglelefteq ",
u"\u22B5": b"\\trianglerighteq ",
u"\u22B6": b"\\original ",
u"\u22B7": b"\\image ",
u"\u22B8": b"\\multimap ",
u"\u22B9": b"\\hermitconjmatrix ",
u"\u22BA": b"\\intercal ",
u"\u22BB": b"\\veebar ",
u"\u22BE": b"\\rightanglearc ",
u"\u22C0": b"\\ElsevierGlyph{22C0}",
u"\u22C1": b"\\ElsevierGlyph{22C1}",
u"\u22C2": b"\\bigcap ",
u"\u22C3": b"\\bigcup ",
u"\u22C4": b"\\diamond ",
u"\u22C5": b"\\cdot ",
u"\u22C6": b"\\star ",
u"\u22C7": b"\\divideontimes ",
u"\u22C8": b"\\bowtie ",
u"\u22C9": b"\\ltimes ",
u"\u22CA": b"\\rtimes ",
u"\u22CB": b"\\leftthreetimes ",
u"\u22CC": b"\\rightthreetimes ",
u"\u22CD": b"\\backsimeq ",
u"\u22CE": b"\\curlyvee ",
u"\u22CF": b"\\curlywedge ",
u"\u22D0": b"\\Subset ",
u"\u22D1": b"\\Supset ",
u"\u22D2": b"\\Cap ",
u"\u22D3": b"\\Cup ",
u"\u22D4": b"\\pitchfork ",
u"\u22D6": b"\\lessdot ",
u"\u22D7": b"\\gtrdot ",
u"\u22D8": b"\\verymuchless ",
u"\u22D9": b"\\verymuchgreater ",
u"\u22DA": b"\\lesseqgtr ",
u"\u22DB": b"\\gtreqless ",
u"\u22DE": b"\\curlyeqprec ",
u"\u22DF": b"\\curlyeqsucc ",
u"\u22E2": b"\\not\\sqsubseteq ",
u"\u22E3": b"\\not\\sqsupseteq ",
u"\u22E5": b"\\Elzsqspne ",
u"\u22E6": b"\\lnsim ",
u"\u22E7": b"\\gnsim ",
u"\u22E8": b"\\precedesnotsimilar ",
u"\u22E9": b"\\succnsim ",
u"\u22EA": b"\\ntriangleleft ",
u"\u22EB": b"\\ntriangleright ",
u"\u22EC": b"\\ntrianglelefteq ",
u"\u22ED": b"\\ntrianglerighteq ",
u"\u22EE": b"\\vdots ",
u"\u22EF": b"\\cdots ",
u"\u22F0": b"\\upslopeellipsis ",
u"\u22F1": b"\\downslopeellipsis ",
u"\u2305": b"\\barwedge ",
u"\u2306": b"\\perspcorrespond ",
u"\u2308": b"\\lceil ",
u"\u2309": b"\\rceil ",
u"\u230A": b"\\lfloor ",
u"\u230B": b"\\rfloor ",
u"\u2315": b"\\recorder ",
u"\u2316": b"\\mathchar\"2208",
u"\u231C": b"\\ulcorner ",
u"\u231D": b"\\urcorner ",
u"\u231E": b"\\llcorner ",
u"\u231F": b"\\lrcorner ",
u"\u2322": b"\\frown ",
u"\u2323": b"\\smile ",
u"\u2329": b"\\langle ",
u"\u232A": b"\\rangle ",
u"\u233D": b"\\ElsevierGlyph{E838}",
u"\u23A3": b"\\Elzdlcorn ",
u"\u23B0": b"\\lmoustache ",
u"\u23B1": b"\\rmoustache ",
u"\u2423": b"\\textvisiblespace ",
u"\u2460": b"\\ding{172}",
u"\u2461": b"\\ding{173}",
u"\u2462": b"\\ding{174}",
u"\u2463": b"\\ding{175}",
u"\u2464": b"\\ding{176}",
u"\u2465": b"\\ding{177}",
u"\u2466": b"\\ding{178}",
u"\u2467": b"\\ding{179}",
u"\u2468": b"\\ding{180}",
u"\u2469": b"\\ding{181}",
u"\u24C8": b"\\circledS ",
u"\u2506": b"\\Elzdshfnc ",
u"\u2519": b"\\Elzsqfnw ",
u"\u2571": b"\\diagup ",
u"\u25A0": b"\\ding{110}",
u"\u25A1": b"\\square ",
u"\u25AA": b"\\blacksquare ",
u"\u25AD": b"\\fbox{~~}",
u"\u25AF": b"\\Elzvrecto ",
u"\u25B1": b"\\ElsevierGlyph{E381}",
u"\u25B2": b"\\ding{115}",
u"\u25B3": b"\\bigtriangleup ",
u"\u25B4": b"\\blacktriangle ",
u"\u25B5": b"\\vartriangle ",
u"\u25B8": b"\\blacktriangleright ",
u"\u25B9": b"\\triangleright ",
u"\u25BC": b"\\ding{116}",
u"\u25BD": b"\\bigtriangledown ",
u"\u25BE": b"\\blacktriangledown ",
u"\u25BF": b"\\triangledown ",
u"\u25C2": b"\\blacktriangleleft ",
u"\u25C3": b"\\triangleleft ",
u"\u25C6": b"\\ding{117}",
u"\u25CA": b"\\lozenge ",
u"\u25CB": b"\\bigcirc ",
u"\u25CF": b"\\ding{108}",
u"\u25D0": b"\\Elzcirfl ",
u"\u25D1": b"\\Elzcirfr ",
u"\u25D2": b"\\Elzcirfb ",
u"\u25D7": b"\\ding{119}",
u"\u25D8": b"\\Elzrvbull ",
u"\u25E7": b"\\Elzsqfl ",
u"\u25E8": b"\\Elzsqfr ",
u"\u25EA": b"\\Elzsqfse ",
u"\u25EF": b"\\bigcirc ",
u"\u2605": b"\\ding{72}",
u"\u2606": b"\\ding{73}",
u"\u260E": b"\\ding{37}",
u"\u261B": b"\\ding{42}",
u"\u261E": b"\\ding{43}",
u"\u263E": b"\\rightmoon ",
u"\u263F": b"\\mercury ",
u"\u2640": b"\\venus ",
u"\u2642": b"\\male ",
u"\u2643": b"\\jupiter ",
u"\u2644": b"\\saturn ",
u"\u2645": b"\\uranus ",
u"\u2646": b"\\neptune ",
u"\u2647": b"\\pluto ",
u"\u2648": b"\\aries ",
u"\u2649": b"\\taurus ",
u"\u264A": b"\\gemini ",
u"\u264B": b"\\cancer ",
u"\u264C": b"\\leo ",
u"\u264D": b"\\virgo ",
u"\u264E": b"\\libra ",
u"\u264F": b"\\scorpio ",
u"\u2650": b"\\sagittarius ",
u"\u2651": b"\\capricornus ",
u"\u2652": b"\\aquarius ",
u"\u2653": b"\\pisces ",
u"\u2660": b"\\ding{171}",
u"\u2662": b"\\diamond ",
u"\u2663": b"\\ding{168}",
u"\u2665": b"\\ding{170}",
u"\u2666": b"\\ding{169}",
u"\u2669": b"\\quarternote ",
u"\u266A": b"\\eighthnote ",
u"\u266D": b"\\flat ",
u"\u266E": b"\\natural ",
u"\u266F": b"\\sharp ",
u"\u2701": b"\\ding{33}",
u"\u2702": b"\\ding{34}",
u"\u2703": b"\\ding{35}",
u"\u2704": b"\\ding{36}",
u"\u2706": b"\\ding{38}",
u"\u2707": b"\\ding{39}",
u"\u2708": b"\\ding{40}",
u"\u2709": b"\\ding{41}",
u"\u270C": b"\\ding{44}",
u"\u270D": b"\\ding{45}",
u"\u270E": b"\\ding{46}",
u"\u270F": b"\\ding{47}",
u"\u2710": b"\\ding{48}",
u"\u2711": b"\\ding{49}",
u"\u2712": b"\\ding{50}",
u"\u2713": b"\\ding{51}",
u"\u2714": b"\\ding{52}",
u"\u2715": b"\\ding{53}",
u"\u2716": b"\\ding{54}",
u"\u2717": b"\\ding{55}",
u"\u2718": b"\\ding{56}",
u"\u2719": b"\\ding{57}",
u"\u271A": b"\\ding{58}",
u"\u271B": b"\\ding{59}",
u"\u271C": b"\\ding{60}",
u"\u271D": b"\\ding{61}",
u"\u271E": b"\\ding{62}",
u"\u271F": b"\\ding{63}",
u"\u2720": b"\\ding{64}",
u"\u2721": b"\\ding{65}",
u"\u2722": b"\\ding{66}",
u"\u2723": b"\\ding{67}",
u"\u2724": b"\\ding{68}",
u"\u2725": b"\\ding{69}",
u"\u2726": b"\\ding{70}",
u"\u2727": b"\\ding{71}",
u"\u2729": b"\\ding{73}",
u"\u272A": b"\\ding{74}",
u"\u272B": b"\\ding{75}",
u"\u272C": b"\\ding{76}",
u"\u272D": b"\\ding{77}",
u"\u272E": b"\\ding{78}",
u"\u272F": b"\\ding{79}",
u"\u2730": b"\\ding{80}",
u"\u2731": b"\\ding{81}",
u"\u2732": b"\\ding{82}",
u"\u2733": b"\\ding{83}",
u"\u2734": b"\\ding{84}",
u"\u2735": b"\\ding{85}",
u"\u2736": b"\\ding{86}",
u"\u2737": b"\\ding{87}",
u"\u2738": b"\\ding{88}",
u"\u2739": b"\\ding{89}",
u"\u273A": b"\\ding{90}",
u"\u273B": b"\\ding{91}",
u"\u273C": b"\\ding{92}",
u"\u273D": b"\\ding{93}",
u"\u273E": b"\\ding{94}",
u"\u273F": b"\\ding{95}",
u"\u2740": b"\\ding{96}",
u"\u2741": b"\\ding{97}",
u"\u2742": b"\\ding{98}",
u"\u2743": b"\\ding{99}",
u"\u2744": b"\\ding{100}",
u"\u2745": b"\\ding{101}",
u"\u2746": b"\\ding{102}",
u"\u2747": b"\\ding{103}",
u"\u2748": b"\\ding{104}",
u"\u2749": b"\\ding{105}",
u"\u274A": b"\\ding{106}",
u"\u274B": b"\\ding{107}",
u"\u274D": b"\\ding{109}",
u"\u274F": b"\\ding{111}",
u"\u2750": b"\\ding{112}",
u"\u2751": b"\\ding{113}",
u"\u2752": b"\\ding{114}",
u"\u2756": b"\\ding{118}",
u"\u2758": b"\\ding{120}",
u"\u2759": b"\\ding{121}",
u"\u275A": b"\\ding{122}",
u"\u275B": b"\\ding{123}",
u"\u275C": b"\\ding{124}",
u"\u275D": b"\\ding{125}",
u"\u275E": b"\\ding{126}",
u"\u2761": b"\\ding{161}",
u"\u2762": b"\\ding{162}",
u"\u2763": b"\\ding{163}",
u"\u2764": b"\\ding{164}",
u"\u2765": b"\\ding{165}",
u"\u2766": b"\\ding{166}",
u"\u2767": b"\\ding{167}",
u"\u2776": b"\\ding{182}",
u"\u2777": b"\\ding{183}",
u"\u2778": b"\\ding{184}",
u"\u2779": b"\\ding{185}",
u"\u277A": b"\\ding{186}",
u"\u277B": b"\\ding{187}",
u"\u277C": b"\\ding{188}",
u"\u277D": b"\\ding{189}",
u"\u277E": b"\\ding{190}",
u"\u277F": b"\\ding{191}",
u"\u2780": b"\\ding{192}",
u"\u2781": b"\\ding{193}",
u"\u2782": b"\\ding{194}",
u"\u2783": b"\\ding{195}",
u"\u2784": b"\\ding{196}",
u"\u2785": b"\\ding{197}",
u"\u2786": b"\\ding{198}",
u"\u2787": b"\\ding{199}",
u"\u2788": b"\\ding{200}",
u"\u2789": b"\\ding{201}",
u"\u278A": b"\\ding{202}",
u"\u278B": b"\\ding{203}",
u"\u278C": b"\\ding{204}",
u"\u278D": b"\\ding{205}",
u"\u278E": b"\\ding{206}",
u"\u278F": b"\\ding{207}",
u"\u2790": b"\\ding{208}",
u"\u2791": b"\\ding{209}",
u"\u2792": b"\\ding{210}",
u"\u2793": b"\\ding{211}",
u"\u2794": b"\\ding{212}",
u"\u2798": b"\\ding{216}",
u"\u2799": b"\\ding{217}",
u"\u279A": b"\\ding{218}",
u"\u279B": b"\\ding{219}",
u"\u279C": b"\\ding{220}",
u"\u279D": b"\\ding{221}",
u"\u279E": b"\\ding{222}",
u"\u279F": b"\\ding{223}",
u"\u27A0": b"\\ding{224}",
u"\u27A1": b"\\ding{225}",
u"\u27A2": b"\\ding{226}",
u"\u27A3": b"\\ding{227}",
u"\u27A4": b"\\ding{228}",
u"\u27A5": b"\\ding{229}",
u"\u27A6": b"\\ding{230}",
u"\u27A7": b"\\ding{231}",
u"\u27A8": b"\\ding{232}",
u"\u27A9": b"\\ding{233}",
u"\u27AA": b"\\ding{234}",
u"\u27AB": b"\\ding{235}",
u"\u27AC": b"\\ding{236}",
u"\u27AD": b"\\ding{237}",
u"\u27AE": b"\\ding{238}",
u"\u27AF": b"\\ding{239}",
u"\u27B1": b"\\ding{241}",
u"\u27B2": b"\\ding{242}",
u"\u27B3": b"\\ding{243}",
u"\u27B4": b"\\ding{244}",
u"\u27B5": b"\\ding{245}",
u"\u27B6": b"\\ding{246}",
u"\u27B7": b"\\ding{247}",
u"\u27B8": b"\\ding{248}",
u"\u27B9": b"\\ding{249}",
u"\u27BA": b"\\ding{250}",
u"\u27BB": b"\\ding{251}",
u"\u27BC": b"\\ding{252}",
u"\u27BD": b"\\ding{253}",
u"\u27BE": b"\\ding{254}",
u"\u27F5": b"\\longleftarrow ",
u"\u27F6": b"\\longrightarrow ",
u"\u27F7": b"\\longleftrightarrow ",
u"\u27F8": b"\\Longleftarrow ",
u"\u27F9": b"\\Longrightarrow ",
u"\u27FA": b"\\Longleftrightarrow ",
u"\u27FC": b"\\longmapsto ",
u"\u27FF": b"\\sim\\joinrel\\leadsto",
u"\u2905": b"\\ElsevierGlyph{E212}",
u"\u2912": b"\\UpArrowBar ",
u"\u2913": b"\\DownArrowBar ",
u"\u2923": b"\\ElsevierGlyph{E20C}",
u"\u2924": b"\\ElsevierGlyph{E20D}",
u"\u2925": b"\\ElsevierGlyph{E20B}",
u"\u2926": b"\\ElsevierGlyph{E20A}",
u"\u2927": b"\\ElsevierGlyph{E211}",
u"\u2928": b"\\ElsevierGlyph{E20E}",
u"\u2929": b"\\ElsevierGlyph{E20F}",
u"\u292A": b"\\ElsevierGlyph{E210}",
u"\u2933": b"\\ElsevierGlyph{E21C}",
u"\u2933-00338": b"\\ElsevierGlyph{E21D}",
u"\u2936": b"\\ElsevierGlyph{E21A}",
u"\u2937": b"\\ElsevierGlyph{E219}",
u"\u2940": b"\\Elolarr ",
u"\u2941": b"\\Elorarr ",
u"\u2942": b"\\ElzRlarr ",
u"\u2944": b"\\ElzrLarr ",
u"\u2947": b"\\Elzrarrx ",
u"\u294E": b"\\LeftRightVector ",
u"\u294F": b"\\RightUpDownVector ",
u"\u2950": b"\\DownLeftRightVector ",
u"\u2951": b"\\LeftUpDownVector ",
u"\u2952": b"\\LeftVectorBar ",
u"\u2953": b"\\RightVectorBar ",
u"\u2954": b"\\RightUpVectorBar ",
u"\u2955": b"\\RightDownVectorBar ",
u"\u2956": b"\\DownLeftVectorBar ",
u"\u2957": b"\\DownRightVectorBar ",
u"\u2958": b"\\LeftUpVectorBar ",
u"\u2959": b"\\LeftDownVectorBar ",
u"\u295A": b"\\LeftTeeVector ",
u"\u295B": b"\\RightTeeVector ",
u"\u295C": b"\\RightUpTeeVector ",
u"\u295D": b"\\RightDownTeeVector ",
u"\u295E": b"\\DownLeftTeeVector ",
u"\u295F": b"\\DownRightTeeVector ",
u"\u2960": b"\\LeftUpTeeVector ",
u"\u2961": b"\\LeftDownTeeVector ",
u"\u296E": b"\\UpEquilibrium ",
u"\u296F": b"\\ReverseUpEquilibrium ",
u"\u2970": b"\\RoundImplies ",
u"\u297C": b"\\ElsevierGlyph{E214}",
u"\u297D": b"\\ElsevierGlyph{E215}",
u"\u2980": b"\\Elztfnc ",
u"\u2985": b"\\ElsevierGlyph{3018}",
u"\u2986": b"\\Elroang ",
u"\u2993": b"<\\kern-0.58em(",
u"\u2994": b"\\ElsevierGlyph{E291}",
u"\u2999": b"\\Elzddfnc ",
u"\u299C": b"\\Angle ",
u"\u29A0": b"\\Elzlpargt ",
u"\u29B5": b"\\ElsevierGlyph{E260}",
u"\u29B6": b"\\ElsevierGlyph{E61B}",
u"\u29CA": b"\\ElzLap ",
u"\u29CB": b"\\Elzdefas ",
u"\u29CF": b"\\LeftTriangleBar ",
u"\u29CF-00338": b"\\NotLeftTriangleBar ",
u"\u29D0": b"\\RightTriangleBar ",
u"\u29D0-00338": b"\\NotRightTriangleBar ",
u"\u29DC": b"\\ElsevierGlyph{E372}",
u"\u29EB": b"\\blacklozenge ",
u"\u29F4": b"\\RuleDelayed ",
u"\u2A04": b"\\Elxuplus ",
u"\u2A05": b"\\ElzThr ",
u"\u2A06": b"\\Elxsqcup ",
u"\u2A07": b"\\ElzInf ",
u"\u2A08": b"\\ElzSup ",
u"\u2A0D": b"\\ElzCint ",
u"\u2A0F": b"\\clockoint ",
u"\u2A10": b"\\ElsevierGlyph{E395}",
u"\u2A16": b"\\sqrint ",
u"\u2A25": b"\\ElsevierGlyph{E25A}",
u"\u2A2A": b"\\ElsevierGlyph{E25B}",
u"\u2A2D": b"\\ElsevierGlyph{E25C}",
u"\u2A2E": b"\\ElsevierGlyph{E25D}",
u"\u2A2F": b"\\ElzTimes ",
u"\u2A34": b"\\ElsevierGlyph{E25E}",
u"\u2A35": b"\\ElsevierGlyph{E25E}",
u"\u2A3C": b"\\ElsevierGlyph{E259}",
u"\u2A3F": b"\\amalg ",
u"\u2A53": b"\\ElzAnd ",
u"\u2A54": b"\\ElzOr ",
u"\u2A55": b"\\ElsevierGlyph{E36E}",
u"\u2A56": b"\\ElOr ",
u"\u2A5E": b"\\perspcorrespond ",
u"\u2A5F": b"\\Elzminhat ",
u"\u2A63": b"\\ElsevierGlyph{225A}",
u"\u2A6E": b"\\stackrel{*}{=}",
u"\u2A75": b"\\Equal ",
u"\u2A7D": b"\\leqslant ",
u"\u2A7D-00338": b"\\nleqslant ",
u"\u2A7E": b"\\geqslant ",
u"\u2A7E-00338": b"\\ngeqslant ",
u"\u2A85": b"\\lessapprox ",
u"\u2A86": b"\\gtrapprox ",
u"\u2A87": b"\\lneq ",
u"\u2A88": b"\\gneq ",
u"\u2A89": b"\\lnapprox ",
u"\u2A8A": b"\\gnapprox ",
u"\u2A8B": b"\\lesseqqgtr ",
u"\u2A8C": b"\\gtreqqless ",
u"\u2A95": b"\\eqslantless ",
u"\u2A96": b"\\eqslantgtr ",
u"\u2A9D": b"\\Pisymbol{ppi020}{117}",
u"\u2A9E": b"\\Pisymbol{ppi020}{105}",
u"\u2AA1": b"\\NestedLessLess ",
u"\u2AA1-00338": b"\\NotNestedLessLess ",
u"\u2AA2": b"\\NestedGreaterGreater ",
u"\u2AA2-00338": b"\\NotNestedGreaterGreater ",
u"\u2AAF": b"\\preceq ",
u"\u2AAF-00338": b"\\not\\preceq ",
u"\u2AB0": b"\\succeq ",
u"\u2AB0-00338": b"\\not\\succeq ",
u"\u2AB5": b"\\precneqq ",
u"\u2AB6": b"\\succneqq ",
u"\u2AB7": b"\\precapprox ",
u"\u2AB8": b"\\succapprox ",
u"\u2AB9": b"\\precnapprox ",
u"\u2ABA": b"\\succnapprox ",
u"\u2AC5": b"\\subseteqq ",
u"\u2AC5-00338": b"\\nsubseteqq ",
u"\u2AC6": b"\\supseteqq ",
u"\u2AC6-00338": b"\\nsupseteqq",
u"\u2ACB": b"\\subsetneqq ",
u"\u2ACC": b"\\supsetneqq ",
u"\u2AEB": b"\\ElsevierGlyph{E30D}",
u"\u2AF6": b"\\Elztdcol ",
u"\u2AFD": b"{{/}\\!\\!{/}}",
u"\u2AFD-020E5": b"{\\rlap{\\textbackslash}{{/}\\!\\!{/}}}",
u"\u300A": b"\\ElsevierGlyph{300A}",
u"\u300B": b"\\ElsevierGlyph{300B}",
u"\u3018": b"\\ElsevierGlyph{3018}",
u"\u3019": b"\\ElsevierGlyph{3019}",
u"\u301A": b"\\openbracketleft ",
u"\u301B": b"\\openbracketright ",
u"\uFB00": b"ff",
u"\uFB01": b"fi",
u"\uFB02": b"fl",
u"\uFB03": b"ffi",
u"\uFB04": b"ffl",
u"\uD400": b"\\mathbf{A}",
u"\uD401": b"\\mathbf{B}",
u"\uD402": b"\\mathbf{C}",
u"\uD403": b"\\mathbf{D}",
u"\uD404": b"\\mathbf{E}",
u"\uD405": b"\\mathbf{F}",
u"\uD406": b"\\mathbf{G}",
u"\uD407": b"\\mathbf{H}",
u"\uD408": b"\\mathbf{I}",
u"\uD409": b"\\mathbf{J}",
u"\uD40A": b"\\mathbf{K}",
u"\uD40B": b"\\mathbf{L}",
u"\uD40C": b"\\mathbf{M}",
u"\uD40D": b"\\mathbf{N}",
u"\uD40E": b"\\mathbf{O}",
u"\uD40F": b"\\mathbf{P}",
u"\uD410": b"\\mathbf{Q}",
u"\uD411": b"\\mathbf{R}",
u"\uD412": b"\\mathbf{S}",
u"\uD413": b"\\mathbf{T}",
u"\uD414": b"\\mathbf{U}",
u"\uD415": b"\\mathbf{V}",
u"\uD416": b"\\mathbf{W}",
u"\uD417": b"\\mathbf{X}",
u"\uD418": b"\\mathbf{Y}",
u"\uD419": b"\\mathbf{Z}",
u"\uD41A": b"\\mathbf{a}",
u"\uD41B": b"\\mathbf{b}",
u"\uD41C": b"\\mathbf{c}",
u"\uD41D": b"\\mathbf{d}",
u"\uD41E": b"\\mathbf{e}",
u"\uD41F": b"\\mathbf{f}",
u"\uD420": b"\\mathbf{g}",
u"\uD421": b"\\mathbf{h}",
u"\uD422": b"\\mathbf{i}",
u"\uD423": b"\\mathbf{j}",
u"\uD424": b"\\mathbf{k}",
u"\uD425": b"\\mathbf{l}",
u"\uD426": b"\\mathbf{m}",
u"\uD427": b"\\mathbf{n}",
u"\uD428": b"\\mathbf{o}",
u"\uD429": b"\\mathbf{p}",
u"\uD42A": b"\\mathbf{q}",
u"\uD42B": b"\\mathbf{r}",
u"\uD42C": b"\\mathbf{s}",
u"\uD42D": b"\\mathbf{t}",
u"\uD42E": b"\\mathbf{u}",
u"\uD42F": b"\\mathbf{v}",
u"\uD430": b"\\mathbf{w}",
u"\uD431": b"\\mathbf{x}",
u"\uD432": b"\\mathbf{y}",
u"\uD433": b"\\mathbf{z}",
u"\uD434": b"\\mathsl{A}",
u"\uD435": b"\\mathsl{B}",
u"\uD436": b"\\mathsl{C}",
u"\uD437": b"\\mathsl{D}",
u"\uD438": b"\\mathsl{E}",
u"\uD439": b"\\mathsl{F}",
u"\uD43A": b"\\mathsl{G}",
u"\uD43B": b"\\mathsl{H}",
u"\uD43C": b"\\mathsl{I}",
u"\uD43D": b"\\mathsl{J}",
u"\uD43E": b"\\mathsl{K}",
u"\uD43F": b"\\mathsl{L}",
u"\uD440": b"\\mathsl{M}",
u"\uD441": b"\\mathsl{N}",
u"\uD442": b"\\mathsl{O}",
u"\uD443": b"\\mathsl{P}",
u"\uD444": b"\\mathsl{Q}",
u"\uD445": b"\\mathsl{R}",
u"\uD446": b"\\mathsl{S}",
u"\uD447": b"\\mathsl{T}",
u"\uD448": b"\\mathsl{U}",
u"\uD449": b"\\mathsl{V}",
u"\uD44A": b"\\mathsl{W}",
u"\uD44B": b"\\mathsl{X}",
u"\uD44C": b"\\mathsl{Y}",
u"\uD44D": b"\\mathsl{Z}",
u"\uD44E": b"\\mathsl{a}",
u"\uD44F": b"\\mathsl{b}",
u"\uD450": b"\\mathsl{c}",
u"\uD451": b"\\mathsl{d}",
u"\uD452": b"\\mathsl{e}",
u"\uD453": b"\\mathsl{f}",
u"\uD454": b"\\mathsl{g}",
u"\uD456": b"\\mathsl{i}",
u"\uD457": b"\\mathsl{j}",
u"\uD458": b"\\mathsl{k}",
u"\uD459": b"\\mathsl{l}",
u"\uD45A": b"\\mathsl{m}",
u"\uD45B": b"\\mathsl{n}",
u"\uD45C": b"\\mathsl{o}",
u"\uD45D": b"\\mathsl{p}",
u"\uD45E": b"\\mathsl{q}",
u"\uD45F": b"\\mathsl{r}",
u"\uD460": b"\\mathsl{s}",
u"\uD461": b"\\mathsl{t}",
u"\uD462": b"\\mathsl{u}",
u"\uD463": b"\\mathsl{v}",
u"\uD464": b"\\mathsl{w}",
u"\uD465": b"\\mathsl{x}",
u"\uD466": b"\\mathsl{y}",
u"\uD467": b"\\mathsl{z}",
u"\uD468": b"\\mathbit{A}",
u"\uD469": b"\\mathbit{B}",
u"\uD46A": b"\\mathbit{C}",
u"\uD46B": b"\\mathbit{D}",
u"\uD46C": b"\\mathbit{E}",
u"\uD46D": b"\\mathbit{F}",
u"\uD46E": b"\\mathbit{G}",
u"\uD46F": b"\\mathbit{H}",
u"\uD470": b"\\mathbit{I}",
u"\uD471": b"\\mathbit{J}",
u"\uD472": b"\\mathbit{K}",
u"\uD473": b"\\mathbit{L}",
u"\uD474": b"\\mathbit{M}",
u"\uD475": b"\\mathbit{N}",
u"\uD476": b"\\mathbit{O}",
u"\uD477": b"\\mathbit{P}",
u"\uD478": b"\\mathbit{Q}",
u"\uD479": b"\\mathbit{R}",
u"\uD47A": b"\\mathbit{S}",
u"\uD47B": b"\\mathbit{T}",
u"\uD47C": b"\\mathbit{U}",
u"\uD47D": b"\\mathbit{V}",
u"\uD47E": b"\\mathbit{W}",
u"\uD47F": b"\\mathbit{X}",
u"\uD480": b"\\mathbit{Y}",
u"\uD481": b"\\mathbit{Z}",
u"\uD482": b"\\mathbit{a}",
u"\uD483": b"\\mathbit{b}",
u"\uD484": b"\\mathbit{c}",
u"\uD485": b"\\mathbit{d}",
u"\uD486": b"\\mathbit{e}",
u"\uD487": b"\\mathbit{f}",
u"\uD488": b"\\mathbit{g}",
u"\uD489": b"\\mathbit{h}",
u"\uD48A": b"\\mathbit{i}",
u"\uD48B": b"\\mathbit{j}",
u"\uD48C": b"\\mathbit{k}",
u"\uD48D": b"\\mathbit{l}",
u"\uD48E": b"\\mathbit{m}",
u"\uD48F": b"\\mathbit{n}",
u"\uD490": b"\\mathbit{o}",
u"\uD491": b"\\mathbit{p}",
u"\uD492": b"\\mathbit{q}",
u"\uD493": b"\\mathbit{r}",
u"\uD494": b"\\mathbit{s}",
u"\uD495": b"\\mathbit{t}",
u"\uD496": b"\\mathbit{u}",
u"\uD497": b"\\mathbit{v}",
u"\uD498": b"\\mathbit{w}",
u"\uD499": b"\\mathbit{x}",
u"\uD49A": b"\\mathbit{y}",
u"\uD49B": b"\\mathbit{z}",
u"\uD49C": b"\\mathscr{A}",
u"\uD49E": b"\\mathscr{C}",
u"\uD49F": b"\\mathscr{D}",
u"\uD4A2": b"\\mathscr{G}",
u"\uD4A5": b"\\mathscr{J}",
u"\uD4A6": b"\\mathscr{K}",
u"\uD4A9": b"\\mathscr{N}",
u"\uD4AA": b"\\mathscr{O}",
u"\uD4AB": b"\\mathscr{P}",
u"\uD4AC": b"\\mathscr{Q}",
u"\uD4AE": b"\\mathscr{S}",
u"\uD4AF": b"\\mathscr{T}",
u"\uD4B0": b"\\mathscr{U}",
u"\uD4B1": b"\\mathscr{V}",
u"\uD4B2": b"\\mathscr{W}",
u"\uD4B3": b"\\mathscr{X}",
u"\uD4B4": b"\\mathscr{Y}",
u"\uD4B5": b"\\mathscr{Z}",
u"\uD4B6": b"\\mathscr{a}",
u"\uD4B7": b"\\mathscr{b}",
u"\uD4B8": b"\\mathscr{c}",
u"\uD4B9": b"\\mathscr{d}",
u"\uD4BB": b"\\mathscr{f}",
u"\uD4BD": b"\\mathscr{h}",
u"\uD4BE": b"\\mathscr{i}",
u"\uD4BF": b"\\mathscr{j}",
u"\uD4C0": b"\\mathscr{k}",
u"\uD4C1": b"\\mathscr{l}",
u"\uD4C2": b"\\mathscr{m}",
u"\uD4C3": b"\\mathscr{n}",
u"\uD4C5": b"\\mathscr{p}",
u"\uD4C6": b"\\mathscr{q}",
u"\uD4C7": b"\\mathscr{r}",
u"\uD4C8": b"\\mathscr{s}",
u"\uD4C9": b"\\mathscr{t}",
u"\uD4CA": b"\\mathscr{u}",
u"\uD4CB": b"\\mathscr{v}",
u"\uD4CC": b"\\mathscr{w}",
u"\uD4CD": b"\\mathscr{x}",
u"\uD4CE": b"\\mathscr{y}",
u"\uD4CF": b"\\mathscr{z}",
u"\uD4D0": b"\\mathmit{A}",
u"\uD4D1": b"\\mathmit{B}",
u"\uD4D2": b"\\mathmit{C}",
u"\uD4D3": b"\\mathmit{D}",
u"\uD4D4": b"\\mathmit{E}",
u"\uD4D5": b"\\mathmit{F}",
u"\uD4D6": b"\\mathmit{G}",
u"\uD4D7": b"\\mathmit{H}",
u"\uD4D8": b"\\mathmit{I}",
u"\uD4D9": b"\\mathmit{J}",
u"\uD4DA": b"\\mathmit{K}",
u"\uD4DB": b"\\mathmit{L}",
u"\uD4DC": b"\\mathmit{M}",
u"\uD4DD": b"\\mathmit{N}",
u"\uD4DE": b"\\mathmit{O}",
u"\uD4DF": b"\\mathmit{P}",
u"\uD4E0": b"\\mathmit{Q}",
u"\uD4E1": b"\\mathmit{R}",
u"\uD4E2": b"\\mathmit{S}",
u"\uD4E3": b"\\mathmit{T}",
u"\uD4E4": b"\\mathmit{U}",
u"\uD4E5": b"\\mathmit{V}",
u"\uD4E6": b"\\mathmit{W}",
u"\uD4E7": b"\\mathmit{X}",
u"\uD4E8": b"\\mathmit{Y}",
u"\uD4E9": b"\\mathmit{Z}",
u"\uD4EA": b"\\mathmit{a}",
u"\uD4EB": b"\\mathmit{b}",
u"\uD4EC": b"\\mathmit{c}",
u"\uD4ED": b"\\mathmit{d}",
u"\uD4EE": b"\\mathmit{e}",
u"\uD4EF": b"\\mathmit{f}",
u"\uD4F0": b"\\mathmit{g}",
u"\uD4F1": b"\\mathmit{h}",
u"\uD4F2": b"\\mathmit{i}",
u"\uD4F3": b"\\mathmit{j}",
u"\uD4F4": b"\\mathmit{k}",
u"\uD4F5": b"\\mathmit{l}",
u"\uD4F6": b"\\mathmit{m}",
u"\uD4F7": b"\\mathmit{n}",
u"\uD4F8": b"\\mathmit{o}",
u"\uD4F9": b"\\mathmit{p}",
u"\uD4FA": b"\\mathmit{q}",
u"\uD4FB": b"\\mathmit{r}",
u"\uD4FC": b"\\mathmit{s}",
u"\uD4FD": b"\\mathmit{t}",
u"\uD4FE": b"\\mathmit{u}",
u"\uD4FF": b"\\mathmit{v}",
u"\uD500": b"\\mathmit{w}",
u"\uD501": b"\\mathmit{x}",
u"\uD502": b"\\mathmit{y}",
u"\uD503": b"\\mathmit{z}",
u"\uD504": b"\\mathfrak{A}",
u"\uD505": b"\\mathfrak{B}",
u"\uD507": b"\\mathfrak{D}",
u"\uD508": b"\\mathfrak{E}",
u"\uD509": b"\\mathfrak{F}",
u"\uD50A": b"\\mathfrak{G}",
u"\uD50D": b"\\mathfrak{J}",
u"\uD50E": b"\\mathfrak{K}",
u"\uD50F": b"\\mathfrak{L}",
u"\uD510": b"\\mathfrak{M}",
u"\uD511": b"\\mathfrak{N}",
u"\uD512": b"\\mathfrak{O}",
u"\uD513": b"\\mathfrak{P}",
u"\uD514": b"\\mathfrak{Q}",
u"\uD516": b"\\mathfrak{S}",
u"\uD517": b"\\mathfrak{T}",
u"\uD518": b"\\mathfrak{U}",
u"\uD519": b"\\mathfrak{V}",
u"\uD51A": b"\\mathfrak{W}",
u"\uD51B": b"\\mathfrak{X}",
u"\uD51C": b"\\mathfrak{Y}",
u"\uD51E": b"\\mathfrak{a}",
u"\uD51F": b"\\mathfrak{b}",
u"\uD520": b"\\mathfrak{c}",
u"\uD521": b"\\mathfrak{d}",
u"\uD522": b"\\mathfrak{e}",
u"\uD523": b"\\mathfrak{f}",
u"\uD524": b"\\mathfrak{g}",
u"\uD525": b"\\mathfrak{h}",
u"\uD526": b"\\mathfrak{i}",
u"\uD527": b"\\mathfrak{j}",
u"\uD528": b"\\mathfrak{k}",
u"\uD529": b"\\mathfrak{l}",
u"\uD52A": b"\\mathfrak{m}",
u"\uD52B": b"\\mathfrak{n}",
u"\uD52C": b"\\mathfrak{o}",
u"\uD52D": b"\\mathfrak{p}",
u"\uD52E": b"\\mathfrak{q}",
u"\uD52F": b"\\mathfrak{r}",
u"\uD530": b"\\mathfrak{s}",
u"\uD531": b"\\mathfrak{t}",
u"\uD532": b"\\mathfrak{u}",
u"\uD533": b"\\mathfrak{v}",
u"\uD534": b"\\mathfrak{w}",
u"\uD535": b"\\mathfrak{x}",
u"\uD536": b"\\mathfrak{y}",
u"\uD537": b"\\mathfrak{z}",
u"\uD538": b"\\mathbb{A}",
u"\uD539": b"\\mathbb{B}",
u"\uD53B": b"\\mathbb{D}",
u"\uD53C": b"\\mathbb{E}",
u"\uD53D": b"\\mathbb{F}",
u"\uD53E": b"\\mathbb{G}",
u"\uD540": b"\\mathbb{I}",
u"\uD541": b"\\mathbb{J}",
u"\uD542": b"\\mathbb{K}",
u"\uD543": b"\\mathbb{L}",
u"\uD544": b"\\mathbb{M}",
u"\uD546": b"\\mathbb{O}",
u"\uD54A": b"\\mathbb{S}",
u"\uD54B": b"\\mathbb{T}",
u"\uD54C": b"\\mathbb{U}",
u"\uD54D": b"\\mathbb{V}",
u"\uD54E": b"\\mathbb{W}",
u"\uD54F": b"\\mathbb{X}",
u"\uD550": b"\\mathbb{Y}",
u"\uD552": b"\\mathbb{a}",
u"\uD553": b"\\mathbb{b}",
u"\uD554": b"\\mathbb{c}",
u"\uD555": b"\\mathbb{d}",
u"\uD556": b"\\mathbb{e}",
u"\uD557": b"\\mathbb{f}",
u"\uD558": b"\\mathbb{g}",
u"\uD559": b"\\mathbb{h}",
u"\uD55A": b"\\mathbb{i}",
u"\uD55B": b"\\mathbb{j}",
u"\uD55C": b"\\mathbb{k}",
u"\uD55D": b"\\mathbb{l}",
u"\uD55E": b"\\mathbb{m}",
u"\uD55F": b"\\mathbb{n}",
u"\uD560": b"\\mathbb{o}",
u"\uD561": b"\\mathbb{p}",
u"\uD562": b"\\mathbb{q}",
u"\uD563": b"\\mathbb{r}",
u"\uD564": b"\\mathbb{s}",
u"\uD565": b"\\mathbb{t}",
u"\uD566": b"\\mathbb{u}",
u"\uD567": b"\\mathbb{v}",
u"\uD568": b"\\mathbb{w}",
u"\uD569": b"\\mathbb{x}",
u"\uD56A": b"\\mathbb{y}",
u"\uD56B": b"\\mathbb{z}",
u"\uD56C": b"\\mathslbb{A}",
u"\uD56D": b"\\mathslbb{B}",
u"\uD56E": b"\\mathslbb{C}",
u"\uD56F": b"\\mathslbb{D}",
u"\uD570": b"\\mathslbb{E}",
u"\uD571": b"\\mathslbb{F}",
u"\uD572": b"\\mathslbb{G}",
u"\uD573": b"\\mathslbb{H}",
u"\uD574": b"\\mathslbb{I}",
u"\uD575": b"\\mathslbb{J}",
u"\uD576": b"\\mathslbb{K}",
u"\uD577": b"\\mathslbb{L}",
u"\uD578": b"\\mathslbb{M}",
u"\uD579": b"\\mathslbb{N}",
u"\uD57A": b"\\mathslbb{O}",
u"\uD57B": b"\\mathslbb{P}",
u"\uD57C": b"\\mathslbb{Q}",
u"\uD57D": b"\\mathslbb{R}",
u"\uD57E": b"\\mathslbb{S}",
u"\uD57F": b"\\mathslbb{T}",
u"\uD580": b"\\mathslbb{U}",
u"\uD581": b"\\mathslbb{V}",
u"\uD582": b"\\mathslbb{W}",
u"\uD583": b"\\mathslbb{X}",
u"\uD584": b"\\mathslbb{Y}",
u"\uD585": b"\\mathslbb{Z}",
u"\uD586": b"\\mathslbb{a}",
u"\uD587": b"\\mathslbb{b}",
u"\uD588": b"\\mathslbb{c}",
u"\uD589": b"\\mathslbb{d}",
u"\uD58A": b"\\mathslbb{e}",
u"\uD58B": b"\\mathslbb{f}",
u"\uD58C": b"\\mathslbb{g}",
u"\uD58D": b"\\mathslbb{h}",
u"\uD58E": b"\\mathslbb{i}",
u"\uD58F": b"\\mathslbb{j}",
u"\uD590": b"\\mathslbb{k}",
u"\uD591": b"\\mathslbb{l}",
u"\uD592": b"\\mathslbb{m}",
u"\uD593": b"\\mathslbb{n}",
u"\uD594": b"\\mathslbb{o}",
u"\uD595": b"\\mathslbb{p}",
u"\uD596": b"\\mathslbb{q}",
u"\uD597": b"\\mathslbb{r}",
u"\uD598": b"\\mathslbb{s}",
u"\uD599": b"\\mathslbb{t}",
u"\uD59A": b"\\mathslbb{u}",
u"\uD59B": b"\\mathslbb{v}",
u"\uD59C": b"\\mathslbb{w}",
u"\uD59D": b"\\mathslbb{x}",
u"\uD59E": b"\\mathslbb{y}",
u"\uD59F": b"\\mathslbb{z}",
u"\uD5A0": b"\\mathsf{A}",
u"\uD5A1": b"\\mathsf{B}",
u"\uD5A2": b"\\mathsf{C}",
u"\uD5A3": b"\\mathsf{D}",
u"\uD5A4": b"\\mathsf{E}",
u"\uD5A5": b"\\mathsf{F}",
u"\uD5A6": b"\\mathsf{G}",
u"\uD5A7": b"\\mathsf{H}",
u"\uD5A8": b"\\mathsf{I}",
u"\uD5A9": b"\\mathsf{J}",
u"\uD5AA": b"\\mathsf{K}",
u"\uD5AB": b"\\mathsf{L}",
u"\uD5AC": b"\\mathsf{M}",
u"\uD5AD": b"\\mathsf{N}",
u"\uD5AE": b"\\mathsf{O}",
u"\uD5AF": b"\\mathsf{P}",
u"\uD5B0": b"\\mathsf{Q}",
u"\uD5B1": b"\\mathsf{R}",
u"\uD5B2": b"\\mathsf{S}",
u"\uD5B3": b"\\mathsf{T}",
u"\uD5B4": b"\\mathsf{U}",
u"\uD5B5": b"\\mathsf{V}",
u"\uD5B6": b"\\mathsf{W}",
u"\uD5B7": b"\\mathsf{X}",
u"\uD5B8": b"\\mathsf{Y}",
u"\uD5B9": b"\\mathsf{Z}",
u"\uD5BA": b"\\mathsf{a}",
u"\uD5BB": b"\\mathsf{b}",
u"\uD5BC": b"\\mathsf{c}",
u"\uD5BD": b"\\mathsf{d}",
u"\uD5BE": b"\\mathsf{e}",
u"\uD5BF": b"\\mathsf{f}",
u"\uD5C0": b"\\mathsf{g}",
u"\uD5C1": b"\\mathsf{h}",
u"\uD5C2": b"\\mathsf{i}",
u"\uD5C3": b"\\mathsf{j}",
u"\uD5C4": b"\\mathsf{k}",
u"\uD5C5": b"\\mathsf{l}",
u"\uD5C6": b"\\mathsf{m}",
u"\uD5C7": b"\\mathsf{n}",
u"\uD5C8": b"\\mathsf{o}",
u"\uD5C9": b"\\mathsf{p}",
u"\uD5CA": b"\\mathsf{q}",
u"\uD5CB": b"\\mathsf{r}",
u"\uD5CC": b"\\mathsf{s}",
u"\uD5CD": b"\\mathsf{t}",
u"\uD5CE": b"\\mathsf{u}",
u"\uD5CF": b"\\mathsf{v}",
u"\uD5D0": b"\\mathsf{w}",
u"\uD5D1": b"\\mathsf{x}",
u"\uD5D2": b"\\mathsf{y}",
u"\uD5D3": b"\\mathsf{z}",
u"\uD5D4": b"\\mathsfbf{A}",
u"\uD5D5": b"\\mathsfbf{B}",
u"\uD5D6": b"\\mathsfbf{C}",
u"\uD5D7": b"\\mathsfbf{D}",
u"\uD5D8": b"\\mathsfbf{E}",
u"\uD5D9": b"\\mathsfbf{F}",
u"\uD5DA": b"\\mathsfbf{G}",
u"\uD5DB": b"\\mathsfbf{H}",
u"\uD5DC": b"\\mathsfbf{I}",
u"\uD5DD": b"\\mathsfbf{J}",
u"\uD5DE": b"\\mathsfbf{K}",
u"\uD5DF": b"\\mathsfbf{L}",
u"\uD5E0": b"\\mathsfbf{M}",
u"\uD5E1": b"\\mathsfbf{N}",
u"\uD5E2": b"\\mathsfbf{O}",
u"\uD5E3": b"\\mathsfbf{P}",
u"\uD5E4": b"\\mathsfbf{Q}",
u"\uD5E5": b"\\mathsfbf{R}",
u"\uD5E6": b"\\mathsfbf{S}",
u"\uD5E7": b"\\mathsfbf{T}",
u"\uD5E8": b"\\mathsfbf{U}",
u"\uD5E9": b"\\mathsfbf{V}",
u"\uD5EA": b"\\mathsfbf{W}",
u"\uD5EB": b"\\mathsfbf{X}",
u"\uD5EC": b"\\mathsfbf{Y}",
u"\uD5ED": b"\\mathsfbf{Z}",
u"\uD5EE": b"\\mathsfbf{a}",
u"\uD5EF": b"\\mathsfbf{b}",
u"\uD5F0": b"\\mathsfbf{c}",
u"\uD5F1": b"\\mathsfbf{d}",
u"\uD5F2": b"\\mathsfbf{e}",
u"\uD5F3": b"\\mathsfbf{f}",
u"\uD5F4": b"\\mathsfbf{g}",
u"\uD5F5": b"\\mathsfbf{h}",
u"\uD5F6": b"\\mathsfbf{i}",
u"\uD5F7": b"\\mathsfbf{j}",
u"\uD5F8": b"\\mathsfbf{k}",
u"\uD5F9": b"\\mathsfbf{l}",
u"\uD5FA": b"\\mathsfbf{m}",
u"\uD5FB": b"\\mathsfbf{n}",
u"\uD5FC": b"\\mathsfbf{o}",
u"\uD5FD": b"\\mathsfbf{p}",
u"\uD5FE": b"\\mathsfbf{q}",
u"\uD5FF": b"\\mathsfbf{r}",
u"\uD600": b"\\mathsfbf{s}",
u"\uD601": b"\\mathsfbf{t}",
u"\uD602": b"\\mathsfbf{u}",
u"\uD603": b"\\mathsfbf{v}",
u"\uD604": b"\\mathsfbf{w}",
u"\uD605": b"\\mathsfbf{x}",
u"\uD606": b"\\mathsfbf{y}",
u"\uD607": b"\\mathsfbf{z}",
u"\uD608": b"\\mathsfsl{A}",
u"\uD609": b"\\mathsfsl{B}",
u"\uD60A": b"\\mathsfsl{C}",
u"\uD60B": b"\\mathsfsl{D}",
u"\uD60C": b"\\mathsfsl{E}",
u"\uD60D": b"\\mathsfsl{F}",
u"\uD60E": b"\\mathsfsl{G}",
u"\uD60F": b"\\mathsfsl{H}",
u"\uD610": b"\\mathsfsl{I}",
u"\uD611": b"\\mathsfsl{J}",
u"\uD612": b"\\mathsfsl{K}",
u"\uD613": b"\\mathsfsl{L}",
u"\uD614": b"\\mathsfsl{M}",
u"\uD615": b"\\mathsfsl{N}",
u"\uD616": b"\\mathsfsl{O}",
u"\uD617": b"\\mathsfsl{P}",
u"\uD618": b"\\mathsfsl{Q}",
u"\uD619": b"\\mathsfsl{R}",
u"\uD61A": b"\\mathsfsl{S}",
u"\uD61B": b"\\mathsfsl{T}",
u"\uD61C": b"\\mathsfsl{U}",
u"\uD61D": b"\\mathsfsl{V}",
u"\uD61E": b"\\mathsfsl{W}",
u"\uD61F": b"\\mathsfsl{X}",
u"\uD620": b"\\mathsfsl{Y}",
u"\uD621": b"\\mathsfsl{Z}",
u"\uD622": b"\\mathsfsl{a}",
u"\uD623": b"\\mathsfsl{b}",
u"\uD624": b"\\mathsfsl{c}",
u"\uD625": b"\\mathsfsl{d}",
u"\uD626": b"\\mathsfsl{e}",
u"\uD627": b"\\mathsfsl{f}",
u"\uD628": b"\\mathsfsl{g}",
u"\uD629": b"\\mathsfsl{h}",
u"\uD62A": b"\\mathsfsl{i}",
u"\uD62B": b"\\mathsfsl{j}",
u"\uD62C": b"\\mathsfsl{k}",
u"\uD62D": b"\\mathsfsl{l}",
u"\uD62E": b"\\mathsfsl{m}",
u"\uD62F": b"\\mathsfsl{n}",
u"\uD630": b"\\mathsfsl{o}",
u"\uD631": b"\\mathsfsl{p}",
u"\uD632": b"\\mathsfsl{q}",
u"\uD633": b"\\mathsfsl{r}",
u"\uD634": b"\\mathsfsl{s}",
u"\uD635": b"\\mathsfsl{t}",
u"\uD636": b"\\mathsfsl{u}",
u"\uD637": b"\\mathsfsl{v}",
u"\uD638": b"\\mathsfsl{w}",
u"\uD639": b"\\mathsfsl{x}",
u"\uD63A": b"\\mathsfsl{y}",
u"\uD63B": b"\\mathsfsl{z}",
u"\uD63C": b"\\mathsfbfsl{A}",
u"\uD63D": b"\\mathsfbfsl{B}",
u"\uD63E": b"\\mathsfbfsl{C}",
u"\uD63F": b"\\mathsfbfsl{D}",
u"\uD640": b"\\mathsfbfsl{E}",
u"\uD641": b"\\mathsfbfsl{F}",
u"\uD642": b"\\mathsfbfsl{G}",
u"\uD643": b"\\mathsfbfsl{H}",
u"\uD644": b"\\mathsfbfsl{I}",
u"\uD645": b"\\mathsfbfsl{J}",
u"\uD646": b"\\mathsfbfsl{K}",
u"\uD647": b"\\mathsfbfsl{L}",
u"\uD648": b"\\mathsfbfsl{M}",
u"\uD649": b"\\mathsfbfsl{N}",
u"\uD64A": b"\\mathsfbfsl{O}",
u"\uD64B": b"\\mathsfbfsl{P}",
u"\uD64C": b"\\mathsfbfsl{Q}",
u"\uD64D": b"\\mathsfbfsl{R}",
u"\uD64E": b"\\mathsfbfsl{S}",
u"\uD64F": b"\\mathsfbfsl{T}",
u"\uD650": b"\\mathsfbfsl{U}",
u"\uD651": b"\\mathsfbfsl{V}",
u"\uD652": b"\\mathsfbfsl{W}",
u"\uD653": b"\\mathsfbfsl{X}",
u"\uD654": b"\\mathsfbfsl{Y}",
u"\uD655": b"\\mathsfbfsl{Z}",
u"\uD656": b"\\mathsfbfsl{a}",
u"\uD657": b"\\mathsfbfsl{b}",
u"\uD658": b"\\mathsfbfsl{c}",
u"\uD659": b"\\mathsfbfsl{d}",
u"\uD65A": b"\\mathsfbfsl{e}",
u"\uD65B": b"\\mathsfbfsl{f}",
u"\uD65C": b"\\mathsfbfsl{g}",
u"\uD65D": b"\\mathsfbfsl{h}",
u"\uD65E": b"\\mathsfbfsl{i}",
u"\uD65F": b"\\mathsfbfsl{j}",
u"\uD660": b"\\mathsfbfsl{k}",
u"\uD661": b"\\mathsfbfsl{l}",
u"\uD662": b"\\mathsfbfsl{m}",
u"\uD663": b"\\mathsfbfsl{n}",
u"\uD664": b"\\mathsfbfsl{o}",
u"\uD665": b"\\mathsfbfsl{p}",
u"\uD666": b"\\mathsfbfsl{q}",
u"\uD667": b"\\mathsfbfsl{r}",
u"\uD668": b"\\mathsfbfsl{s}",
u"\uD669": b"\\mathsfbfsl{t}",
u"\uD66A": b"\\mathsfbfsl{u}",
u"\uD66B": b"\\mathsfbfsl{v}",
u"\uD66C": b"\\mathsfbfsl{w}",
u"\uD66D": b"\\mathsfbfsl{x}",
u"\uD66E": b"\\mathsfbfsl{y}",
u"\uD66F": b"\\mathsfbfsl{z}",
u"\uD670": b"\\mathtt{A}",
u"\uD671": b"\\mathtt{B}",
u"\uD672": b"\\mathtt{C}",
u"\uD673": b"\\mathtt{D}",
u"\uD674": b"\\mathtt{E}",
u"\uD675": b"\\mathtt{F}",
u"\uD676": b"\\mathtt{G}",
u"\uD677": b"\\mathtt{H}",
u"\uD678": b"\\mathtt{I}",
u"\uD679": b"\\mathtt{J}",
u"\uD67A": b"\\mathtt{K}",
u"\uD67B": b"\\mathtt{L}",
u"\uD67C": b"\\mathtt{M}",
u"\uD67D": b"\\mathtt{N}",
u"\uD67E": b"\\mathtt{O}",
u"\uD67F": b"\\mathtt{P}",
u"\uD680": b"\\mathtt{Q}",
u"\uD681": b"\\mathtt{R}",
u"\uD682": b"\\mathtt{S}",
u"\uD683": b"\\mathtt{T}",
u"\uD684": b"\\mathtt{U}",
u"\uD685": b"\\mathtt{V}",
u"\uD686": b"\\mathtt{W}",
u"\uD687": b"\\mathtt{X}",
u"\uD688": b"\\mathtt{Y}",
u"\uD689": b"\\mathtt{Z}",
u"\uD68A": b"\\mathtt{a}",
u"\uD68B": b"\\mathtt{b}",
u"\uD68C": b"\\mathtt{c}",
u"\uD68D": b"\\mathtt{d}",
u"\uD68E": b"\\mathtt{e}",
u"\uD68F": b"\\mathtt{f}",
u"\uD690": b"\\mathtt{g}",
u"\uD691": b"\\mathtt{h}",
u"\uD692": b"\\mathtt{i}",
u"\uD693": b"\\mathtt{j}",
u"\uD694": b"\\mathtt{k}",
u"\uD695": b"\\mathtt{l}",
u"\uD696": b"\\mathtt{m}",
u"\uD697": b"\\mathtt{n}",
u"\uD698": b"\\mathtt{o}",
u"\uD699": b"\\mathtt{p}",
u"\uD69A": b"\\mathtt{q}",
u"\uD69B": b"\\mathtt{r}",
u"\uD69C": b"\\mathtt{s}",
u"\uD69D": b"\\mathtt{t}",
u"\uD69E": b"\\mathtt{u}",
u"\uD69F": b"\\mathtt{v}",
u"\uD6A0": b"\\mathtt{w}",
u"\uD6A1": b"\\mathtt{x}",
u"\uD6A2": b"\\mathtt{y}",
u"\uD6A3": b"\\mathtt{z}",
u"\uD6A8": b"\\mathbf{\\Alpha}",
u"\uD6A9": b"\\mathbf{\\Beta}",
u"\uD6AA": b"\\mathbf{\\Gamma}",
u"\uD6AB": b"\\mathbf{\\Delta}",
u"\uD6AC": b"\\mathbf{\\Epsilon}",
u"\uD6AD": b"\\mathbf{\\Zeta}",
u"\uD6AE": b"\\mathbf{\\Eta}",
u"\uD6AF": b"\\mathbf{\\Theta}",
u"\uD6B0": b"\\mathbf{\\Iota}",
u"\uD6B1": b"\\mathbf{\\Kappa}",
u"\uD6B2": b"\\mathbf{\\Lambda}",
u"\uD6B5": b"\\mathbf{\\Xi}",
u"\uD6B7": b"\\mathbf{\\Pi}",
u"\uD6B8": b"\\mathbf{\\Rho}",
u"\uD6B9": b"\\mathbf{\\vartheta}",
u"\uD6BA": b"\\mathbf{\\Sigma}",
u"\uD6BB": b"\\mathbf{\\Tau}",
u"\uD6BC": b"\\mathbf{\\Upsilon}",
u"\uD6BD": b"\\mathbf{\\Phi}",
u"\uD6BE": b"\\mathbf{\\Chi}",
u"\uD6BF": b"\\mathbf{\\Psi}",
u"\uD6C0": b"\\mathbf{\\Omega}",
u"\uD6C1": b"\\mathbf{\\nabla}",
u"\uD6C2": b"\\mathbf{\\Alpha}",
u"\uD6C3": b"\\mathbf{\\Beta}",
u"\uD6C4": b"\\mathbf{\\Gamma}",
u"\uD6C5": b"\\mathbf{\\Delta}",
u"\uD6C6": b"\\mathbf{\\Epsilon}",
u"\uD6C7": b"\\mathbf{\\Zeta}",
u"\uD6C8": b"\\mathbf{\\Eta}",
u"\uD6C9": b"\\mathbf{\\theta}",
u"\uD6CA": b"\\mathbf{\\Iota}",
u"\uD6CB": b"\\mathbf{\\Kappa}",
u"\uD6CC": b"\\mathbf{\\Lambda}",
u"\uD6CF": b"\\mathbf{\\Xi}",
u"\uD6D1": b"\\mathbf{\\Pi}",
u"\uD6D2": b"\\mathbf{\\Rho}",
u"\uD6D3": b"\\mathbf{\\varsigma}",
u"\uD6D4": b"\\mathbf{\\Sigma}",
u"\uD6D5": b"\\mathbf{\\Tau}",
u"\uD6D6": b"\\mathbf{\\Upsilon}",
u"\uD6D7": b"\\mathbf{\\Phi}",
u"\uD6D8": b"\\mathbf{\\Chi}",
u"\uD6D9": b"\\mathbf{\\Psi}",
u"\uD6DA": b"\\mathbf{\\Omega}",
u"\uD6DB": b"\\partial ",
u"\uD6DC": b"\\in",
u"\uD6DD": b"\\mathbf{\\vartheta}",
u"\uD6DE": b"\\mathbf{\\varkappa}",
u"\uD6DF": b"\\mathbf{\\phi}",
u"\uD6E0": b"\\mathbf{\\varrho}",
u"\uD6E1": b"\\mathbf{\\varpi}",
u"\uD6E2": b"\\mathsl{\\Alpha}",
u"\uD6E3": b"\\mathsl{\\Beta}",
u"\uD6E4": b"\\mathsl{\\Gamma}",
u"\uD6E5": b"\\mathsl{\\Delta}",
u"\uD6E6": b"\\mathsl{\\Epsilon}",
u"\uD6E7": b"\\mathsl{\\Zeta}",
u"\uD6E8": b"\\mathsl{\\Eta}",
u"\uD6E9": b"\\mathsl{\\Theta}",
u"\uD6EA": b"\\mathsl{\\Iota}",
u"\uD6EB": b"\\mathsl{\\Kappa}",
u"\uD6EC": b"\\mathsl{\\Lambda}",
u"\uD6EF": b"\\mathsl{\\Xi}",
u"\uD6F1": b"\\mathsl{\\Pi}",
u"\uD6F2": b"\\mathsl{\\Rho}",
u"\uD6F3": b"\\mathsl{\\vartheta}",
u"\uD6F4": b"\\mathsl{\\Sigma}",
u"\uD6F5": b"\\mathsl{\\Tau}",
u"\uD6F6": b"\\mathsl{\\Upsilon}",
u"\uD6F7": b"\\mathsl{\\Phi}",
u"\uD6F8": b"\\mathsl{\\Chi}",
u"\uD6F9": b"\\mathsl{\\Psi}",
u"\uD6FA": b"\\mathsl{\\Omega}",
u"\uD6FB": b"\\mathsl{\\nabla}",
u"\uD6FC": b"\\mathsl{\\Alpha}",
u"\uD6FD": b"\\mathsl{\\Beta}",
u"\uD6FE": b"\\mathsl{\\Gamma}",
u"\uD6FF": b"\\mathsl{\\Delta}",
u"\uD700": b"\\mathsl{\\Epsilon}",
u"\uD701": b"\\mathsl{\\Zeta}",
u"\uD702": b"\\mathsl{\\Eta}",
u"\uD703": b"\\mathsl{\\Theta}",
u"\uD704": b"\\mathsl{\\Iota}",
u"\uD705": b"\\mathsl{\\Kappa}",
u"\uD706": b"\\mathsl{\\Lambda}",
u"\uD709": b"\\mathsl{\\Xi}",
u"\uD70B": b"\\mathsl{\\Pi}",
u"\uD70C": b"\\mathsl{\\Rho}",
u"\uD70D": b"\\mathsl{\\varsigma}",
u"\uD70E": b"\\mathsl{\\Sigma}",
u"\uD70F": b"\\mathsl{\\Tau}",
u"\uD710": b"\\mathsl{\\Upsilon}",
u"\uD711": b"\\mathsl{\\Phi}",
u"\uD712": b"\\mathsl{\\Chi}",
u"\uD713": b"\\mathsl{\\Psi}",
u"\uD714": b"\\mathsl{\\Omega}",
u"\uD715": b"\\partial ",
u"\uD716": b"\\in",
u"\uD717": b"\\mathsl{\\vartheta}",
u"\uD718": b"\\mathsl{\\varkappa}",
u"\uD719": b"\\mathsl{\\phi}",
u"\uD71A": b"\\mathsl{\\varrho}",
u"\uD71B": b"\\mathsl{\\varpi}",
u"\uD71C": b"\\mathbit{\\Alpha}",
u"\uD71D": b"\\mathbit{\\Beta}",
u"\uD71E": b"\\mathbit{\\Gamma}",
u"\uD71F": b"\\mathbit{\\Delta}",
u"\uD720": b"\\mathbit{\\Epsilon}",
u"\uD721": b"\\mathbit{\\Zeta}",
u"\uD722": b"\\mathbit{\\Eta}",
u"\uD723": b"\\mathbit{\\Theta}",
u"\uD724": b"\\mathbit{\\Iota}",
u"\uD725": b"\\mathbit{\\Kappa}",
u"\uD726": b"\\mathbit{\\Lambda}",
u"\uD729": b"\\mathbit{\\Xi}",
u"\uD72B": b"\\mathbit{\\Pi}",
u"\uD72C": b"\\mathbit{\\Rho}",
u"\uD72D": b"\\mathbit{O}",
u"\uD72E": b"\\mathbit{\\Sigma}",
u"\uD72F": b"\\mathbit{\\Tau}",
u"\uD730": b"\\mathbit{\\Upsilon}",
u"\uD731": b"\\mathbit{\\Phi}",
u"\uD732": b"\\mathbit{\\Chi}",
u"\uD733": b"\\mathbit{\\Psi}",
u"\uD734": b"\\mathbit{\\Omega}",
u"\uD735": b"\\mathbit{\\nabla}",
u"\uD736": b"\\mathbit{\\Alpha}",
u"\uD737": b"\\mathbit{\\Beta}",
u"\uD738": b"\\mathbit{\\Gamma}",
u"\uD739": b"\\mathbit{\\Delta}",
u"\uD73A": b"\\mathbit{\\Epsilon}",
u"\uD73B": b"\\mathbit{\\Zeta}",
u"\uD73C": b"\\mathbit{\\Eta}",
u"\uD73D": b"\\mathbit{\\Theta}",
u"\uD73E": b"\\mathbit{\\Iota}",
u"\uD73F": b"\\mathbit{\\Kappa}",
u"\uD740": b"\\mathbit{\\Lambda}",
u"\uD743": b"\\mathbit{\\Xi}",
u"\uD745": b"\\mathbit{\\Pi}",
u"\uD746": b"\\mathbit{\\Rho}",
u"\uD747": b"\\mathbit{\\varsigma}",
u"\uD748": b"\\mathbit{\\Sigma}",
u"\uD749": b"\\mathbit{\\Tau}",
u"\uD74A": b"\\mathbit{\\Upsilon}",
u"\uD74B": b"\\mathbit{\\Phi}",
u"\uD74C": b"\\mathbit{\\Chi}",
u"\uD74D": b"\\mathbit{\\Psi}",
u"\uD74E": b"\\mathbit{\\Omega}",
u"\uD74F": b"\\partial ",
u"\uD750": b"\\in",
u"\uD751": b"\\mathbit{\\vartheta}",
u"\uD752": b"\\mathbit{\\varkappa}",
u"\uD753": b"\\mathbit{\\phi}",
u"\uD754": b"\\mathbit{\\varrho}",
u"\uD755": b"\\mathbit{\\varpi}",
u"\uD756": b"\\mathsfbf{\\Alpha}",
u"\uD757": b"\\mathsfbf{\\Beta}",
u"\uD758": b"\\mathsfbf{\\Gamma}",
u"\uD759": b"\\mathsfbf{\\Delta}",
u"\uD75A": b"\\mathsfbf{\\Epsilon}",
u"\uD75B": b"\\mathsfbf{\\Zeta}",
u"\uD75C": b"\\mathsfbf{\\Eta}",
u"\uD75D": b"\\mathsfbf{\\Theta}",
u"\uD75E": b"\\mathsfbf{\\Iota}",
u"\uD75F": b"\\mathsfbf{\\Kappa}",
u"\uD760": b"\\mathsfbf{\\Lambda}",
u"\uD763": b"\\mathsfbf{\\Xi}",
u"\uD765": b"\\mathsfbf{\\Pi}",
u"\uD766": b"\\mathsfbf{\\Rho}",
u"\uD767": b"\\mathsfbf{\\vartheta}",
u"\uD768": b"\\mathsfbf{\\Sigma}",
u"\uD769": b"\\mathsfbf{\\Tau}",
u"\uD76A": b"\\mathsfbf{\\Upsilon}",
u"\uD76B": b"\\mathsfbf{\\Phi}",
u"\uD76C": b"\\mathsfbf{\\Chi}",
u"\uD76D": b"\\mathsfbf{\\Psi}",
u"\uD76E": b"\\mathsfbf{\\Omega}",
u"\uD76F": b"\\mathsfbf{\\nabla}",
u"\uD770": b"\\mathsfbf{\\Alpha}",
u"\uD771": b"\\mathsfbf{\\Beta}",
u"\uD772": b"\\mathsfbf{\\Gamma}",
u"\uD773": b"\\mathsfbf{\\Delta}",
u"\uD774": b"\\mathsfbf{\\Epsilon}",
u"\uD775": b"\\mathsfbf{\\Zeta}",
u"\uD776": b"\\mathsfbf{\\Eta}",
u"\uD777": b"\\mathsfbf{\\Theta}",
u"\uD778": b"\\mathsfbf{\\Iota}",
u"\uD779": b"\\mathsfbf{\\Kappa}",
u"\uD77A": b"\\mathsfbf{\\Lambda}",
u"\uD77D": b"\\mathsfbf{\\Xi}",
u"\uD77F": b"\\mathsfbf{\\Pi}",
u"\uD780": b"\\mathsfbf{\\Rho}",
u"\uD781": b"\\mathsfbf{\\varsigma}",
u"\uD782": b"\\mathsfbf{\\Sigma}",
u"\uD783": b"\\mathsfbf{\\Tau}",
u"\uD784": b"\\mathsfbf{\\Upsilon}",
u"\uD785": b"\\mathsfbf{\\Phi}",
u"\uD786": b"\\mathsfbf{\\Chi}",
u"\uD787": b"\\mathsfbf{\\Psi}",
u"\uD788": b"\\mathsfbf{\\Omega}",
u"\uD789": b"\\partial ",
u"\uD78A": b"\\in",
u"\uD78B": b"\\mathsfbf{\\vartheta}",
u"\uD78C": b"\\mathsfbf{\\varkappa}",
u"\uD78D": b"\\mathsfbf{\\phi}",
u"\uD78E": b"\\mathsfbf{\\varrho}",
u"\uD78F": b"\\mathsfbf{\\varpi}",
u"\uD790": b"\\mathsfbfsl{\\Alpha}",
u"\uD791": b"\\mathsfbfsl{\\Beta}",
u"\uD792": b"\\mathsfbfsl{\\Gamma}",
u"\uD793": b"\\mathsfbfsl{\\Delta}",
u"\uD794": b"\\mathsfbfsl{\\Epsilon}",
u"\uD795": b"\\mathsfbfsl{\\Zeta}",
u"\uD796": b"\\mathsfbfsl{\\Eta}",
u"\uD797": b"\\mathsfbfsl{\\vartheta}",
u"\uD798": b"\\mathsfbfsl{\\Iota}",
u"\uD799": b"\\mathsfbfsl{\\Kappa}",
u"\uD79A": b"\\mathsfbfsl{\\Lambda}",
u"\uD79D": b"\\mathsfbfsl{\\Xi}",
u"\uD79F": b"\\mathsfbfsl{\\Pi}",
u"\uD7A0": b"\\mathsfbfsl{\\Rho}",
u"\uD7A1": b"\\mathsfbfsl{\\vartheta}",
u"\uD7A2": b"\\mathsfbfsl{\\Sigma}",
u"\uD7A3": b"\\mathsfbfsl{\\Tau}",
u"\uD7A4": b"\\mathsfbfsl{\\Upsilon}",
u"\uD7A5": b"\\mathsfbfsl{\\Phi}",
u"\uD7A6": b"\\mathsfbfsl{\\Chi}",
u"\uD7A7": b"\\mathsfbfsl{\\Psi}",
u"\uD7A8": b"\\mathsfbfsl{\\Omega}",
u"\uD7A9": b"\\mathsfbfsl{\\nabla}",
u"\uD7AA": b"\\mathsfbfsl{\\Alpha}",
u"\uD7AB": b"\\mathsfbfsl{\\Beta}",
u"\uD7AC": b"\\mathsfbfsl{\\Gamma}",
u"\uD7AD": b"\\mathsfbfsl{\\Delta}",
u"\uD7AE": b"\\mathsfbfsl{\\Epsilon}",
u"\uD7AF": b"\\mathsfbfsl{\\Zeta}",
u"\uD7B0": b"\\mathsfbfsl{\\Eta}",
u"\uD7B1": b"\\mathsfbfsl{\\vartheta}",
u"\uD7B2": b"\\mathsfbfsl{\\Iota}",
u"\uD7B3": b"\\mathsfbfsl{\\Kappa}",
u"\uD7B4": b"\\mathsfbfsl{\\Lambda}",
u"\uD7B7": b"\\mathsfbfsl{\\Xi}",
u"\uD7B9": b"\\mathsfbfsl{\\Pi}",
u"\uD7BA": b"\\mathsfbfsl{\\Rho}",
u"\uD7BB": b"\\mathsfbfsl{\\varsigma}",
u"\uD7BC": b"\\mathsfbfsl{\\Sigma}",
u"\uD7BD": b"\\mathsfbfsl{\\Tau}",
u"\uD7BE": b"\\mathsfbfsl{\\Upsilon}",
u"\uD7BF": b"\\mathsfbfsl{\\Phi}",
u"\uD7C0": b"\\mathsfbfsl{\\Chi}",
u"\uD7C1": b"\\mathsfbfsl{\\Psi}",
u"\uD7C2": b"\\mathsfbfsl{\\Omega}",
u"\uD7C3": b"\\partial ",
u"\uD7C4": b"\\in",
u"\uD7C5": b"\\mathsfbfsl{\\vartheta}",
u"\uD7C6": b"\\mathsfbfsl{\\varkappa}",
u"\uD7C7": b"\\mathsfbfsl{\\phi}",
u"\uD7C8": b"\\mathsfbfsl{\\varrho}",
u"\uD7C9": b"\\mathsfbfsl{\\varpi}",
u"\uD7CE": b"\\mathbf{0}",
u"\uD7CF": b"\\mathbf{1}",
u"\uD7D0": b"\\mathbf{2}",
u"\uD7D1": b"\\mathbf{3}",
u"\uD7D2": b"\\mathbf{4}",
u"\uD7D3": b"\\mathbf{5}",
u"\uD7D4": b"\\mathbf{6}",
u"\uD7D5": b"\\mathbf{7}",
u"\uD7D6": b"\\mathbf{8}",
u"\uD7D7": b"\\mathbf{9}",
u"\uD7D8": b"\\mathbb{0}",
u"\uD7D9": b"\\mathbb{1}",
u"\uD7DA": b"\\mathbb{2}",
u"\uD7DB": b"\\mathbb{3}",
u"\uD7DC": b"\\mathbb{4}",
u"\uD7DD": b"\\mathbb{5}",
u"\uD7DE": b"\\mathbb{6}",
u"\uD7DF": b"\\mathbb{7}",
u"\uD7E0": b"\\mathbb{8}",
u"\uD7E1": b"\\mathbb{9}",
u"\uD7E2": b"\\mathsf{0}",
u"\uD7E3": b"\\mathsf{1}",
u"\uD7E4": b"\\mathsf{2}",
u"\uD7E5": b"\\mathsf{3}",
u"\uD7E6": b"\\mathsf{4}",
u"\uD7E7": b"\\mathsf{5}",
u"\uD7E8": b"\\mathsf{6}",
u"\uD7E9": b"\\mathsf{7}",
u"\uD7EA": b"\\mathsf{8}",
u"\uD7EB": b"\\mathsf{9}",
u"\uD7EC": b"\\mathsfbf{0}",
u"\uD7ED": b"\\mathsfbf{1}",
u"\uD7EE": b"\\mathsfbf{2}",
u"\uD7EF": b"\\mathsfbf{3}",
u"\uD7F0": b"\\mathsfbf{4}",
u"\uD7F1": b"\\mathsfbf{5}",
u"\uD7F2": b"\\mathsfbf{6}",
u"\uD7F3": b"\\mathsfbf{7}",
u"\uD7F4": b"\\mathsfbf{8}",
u"\uD7F5": b"\\mathsfbf{9}",
u"\uD7F6": b"\\mathtt{0}",
u"\uD7F7": b"\\mathtt{1}",
u"\uD7F8": b"\\mathtt{2}",
u"\uD7F9": b"\\mathtt{3}",
u"\uD7FA": b"\\mathtt{4}",
u"\uD7FB": b"\\mathtt{5}",
u"\uD7FC": b"\\mathtt{6}",
u"\uD7FD": b"\\mathtt{7}",
u"\uD7FE": b"\\mathtt{8}",
u"\uD7FF": b"\\mathtt{9}",
}
isbnlib-3.5.6/isbnlib/_desc.py 0000664 0000000 0000000 00000002307 12533556027 0016232 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Return a small description of the book."""
from json import loads
from textwrap import fill
from .dev.webservice import query as wsquery
UA = "isbnlib (gzip)"
def goo_desc(isbn):
"""Get description from Google Books api."""
from .registry import metadata_cache # <-- dynamic
cache = metadata_cache
if cache is not None: # pragma: no cover
key = 'gdesc' + isbn
try:
if cache[key]:
return cache[key]
else:
raise # <-- IMPORTANT: usually the caches don't return error!
except:
pass
url = "https://www.googleapis.com/books/v1/volumes?q=isbn+{isbn}"\
"&fields=items/volumeInfo(description)"\
"&maxResults=1".format(isbn=isbn)
content = wsquery(url, user_agent=UA)
try:
content = loads(content)
content = content['items'][0]['volumeInfo']['description']
content = fill(content, width=75) if content else None
if content and cache is not None: # pragma: no cover
cache[key] = content
return content
except KeyError: # pragma: no cover
return
isbnlib-3.5.6/isbnlib/_doitotex.py 0000664 0000000 0000000 00000001104 12533556027 0017145 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Return metadata, of a given DOI, formated as BibTeX."""
import logging
from .dev.webservice import query
LOGGER = logging.getLogger(__name__)
URL = 'http://dx.doi.org/{DOI}'
UA = 'isbnlib (gzip)'
def doi2tex(doi):
"""Get the bibtex ref for doi."""
data = query(URL.format(DOI=doi),
user_agent=UA,
appheaders={'Accept': 'application/x-bibtex; charset=utf-8'}
)
if not data: # pragma: no cover
LOGGER.warning('no data return for doi: %s', doi)
return
return data
isbnlib-3.5.6/isbnlib/_editions.py 0000664 0000000 0000000 00000003406 12533556027 0017133 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Return editions for a given ISBN."""
import logging
from ._core import EAN13
from ._exceptions import NotRecognizedServiceError, NotValidISBNError
from ._thinged import query as ted
from ._wcated import query as wed
PROVIDERS = ('any', 'merge', 'thingl', 'wcat')
TRUEPROVIDERS = ('wcat', 'thingl') # <-- by priority
LOGGER = logging.getLogger(__name__)
def fake_provider_any(isbn):
"""Fake provider 'any' service."""
providers = {'wcat': wed, 'thingl': ted}
for provider in TRUEPROVIDERS:
data = []
try:
data = providers[provider](isbn)
if data:
return data
continue # pragma: no cover
except: # pragma: no cover
continue
return data # pragma: no cover
def fake_provider_merge(isbn):
"""Fake provider 'merge' service."""
data = []
try: # pragma: no cover
wdata = wed(isbn)
if wdata:
tdata = ted(isbn)
if tdata:
data = list(set(wdata + tdata))
return data
raise
except: # pragma: no cover
return data
def editions(isbn, service='wcat'):
"""Return the list of ISBNs of editions related with this ISBN."""
isbn = EAN13(isbn)
if not isbn:
LOGGER.critical('%s is not a valid ISBN', isbn)
raise NotValidISBNError(isbn)
if service == 'any':
return fake_provider_any(isbn)
if service == 'merge':
return fake_provider_merge(isbn)
if service not in PROVIDERS:
LOGGER.critical('%s is not a recognized editions provider', service)
raise NotRecognizedServiceError(service)
return wed(isbn) if service == 'wcat' else ted(isbn)
isbnlib-3.5.6/isbnlib/_exceptions.py 0000664 0000000 0000000 00000002504 12533556027 0017474 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
import sys
def quiet_errors(exc_type, exc_value, traceback):
"""An error format suitable for end user scripts.
Usage: enter the following lines in your script
from isbnlib import quiet_errors
sys.excepthook = quiet_errors
"""
sys.stderr.write('Error: %s\n' % exc_value) # pragma: no cover
class ISBNLibException(Exception):
"""Base class for isbnlib exceptions.
This exception should not be raised directly,
only subclasses of this exception should be used!
"""
def __str__(self):
return getattr(self, 'message', '') # pragma: no cover
class NotRecognizedServiceError(ISBNLibException):
"""Exception raised when the service is not in config.py."""
def __init__(self, service):
self.message = "(%s) is not a recognized service" % service
class NotValidISBNError(ISBNLibException):
"""Exception raised when the ISBN is not valid."""
def __init__(self, isbnlike):
self.message = "(%s) is not a valid ISBN" % isbnlike
class PluginNotLoadedError(ISBNLibException): # pragma: no cover
"""Exception raised when the plugin's loader doesn't load the plugin.
TODO: Delete this in version 4
"""
def __init__(self, path):
self.message = "plugin (%s) wasn't loaded" % path
isbnlib-3.5.6/isbnlib/_ext.py 0000664 0000000 0000000 00000005332 12533556027 0016115 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Extra methods."""
import re
from ._core import EAN13
from ._cover import cover as gcover
from ._desc import goo_desc
from ._editions import editions as eds
from ._gwords import goos
from ._infogroup import infogroup
from ._metadata import query
from ._msk import msk
from .dev._bouth23 import b2u3, u
from .dev.helpers import File, cutoff_tokens, last_first
def mask(isbn, separator='-'):
"""`Mask` a canonical ISBN."""
return msk(isbn, separator)
def meta(isbn, service='default', cache='default'):
"""Get metadata from worldcat.org ('wcat'), Google Books ('goob') , ..."""
service = service if service else 'default'
return query(isbn, service, cache) if isbn else None
def info(isbn):
"""Get language or country assigned to this ISBN."""
return infogroup(isbn)
def editions(isbn, service='wcat'):
"""Return the list of ISBNs of editions related with this ISBN.
'service' can have the values 'any', 'merge', 'thingl' and 'wcat' (default)
"""
return eds(isbn, service)
def isbn_from_words(words):
"""Return the most probable ISBN from a list of words."""
return goos(words)
def doi(isbn):
"""Return a DOI's ISBN-A from a ISBN-13."""
return "10.%s.%s%s/%s%s" % \
tuple(msk(EAN13(isbn), '-').split('-'))
def ren(fp):
"""Rename a file using metadata from an ISBN in his filename."""
cfp = File(fp)
isbn = EAN13(cfp.name)
if not isbn: # pragma: no cover
return
data = meta(isbn)
author = data.get('Authors', u('UNKNOWN'))
if author != u('UNKNOWN'): # pragma: no cover
author = last_first(author[0])['last']
year = data.get('Year', u('UNKNOWN'))
maxlen = 98 - (20 + len(author) + len(year))
title = data.get('Title', u('UNKNOWN'))
if title != u('UNKNOWN'):
regex1 = re.compile(r'[.,_!?/\\]')
regex2 = re.compile('\s\s+')
title = regex1.sub(' ', title)
title = regex2.sub(' ', title)
title = title.strip()
if title == u('UNKNOWN') or not title: # pragma: no cover
return
if ' ' in title: # pragma: no cover
tokens = title.split(' ')
stitle = cutoff_tokens(tokens, maxlen)
title = ' '.join(stitle)
isbn13 = data.get('ISBN-13', u('UNKNOWN'))
new_name = "%s%s_%s_%s" % (author, year, title, isbn13)
return cfp.baserename(b2u3(new_name + cfp.ext))
def cover(isbn, size=2, mode='prt'):
"""Download the cover of the ISBN."""
isbn = EAN13(isbn)
return gcover(isbn, size=size, mode=mode) if isbn else None
def desc(isbn):
"""Return a descripion of the ISBN."""
isbn = EAN13(isbn)
return goo_desc(isbn) if isbn else None
isbnlib-3.5.6/isbnlib/_goob.py 0000664 0000000 0000000 00000004557 12533556027 0016253 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the Google Books (JSON API v1) service for metadata."""
import logging
from .dev import stdmeta
from .dev._bouth23 import u
from .dev._exceptions import (ISBNNotConsistentError,
NoDataForSelectorError, RecordMappingError)
from .dev.webquery import query as wquery
UA = 'isbnlib (gzip)'
SERVICE_URL = 'https://www.googleapis.com/books/v1/volumes?q=isbn+{isbn}'\
'&fields=items/volumeInfo(title,authors,publisher,publishedDate,language,'\
'industryIdentifiers)&maxResults=1'
LOGGER = logging.getLogger(__name__)
def _mapper(isbn, records):
"""Mapp: canonical <- records."""
# canonical: ISBN-13, Title, Authors, Publisher, Year, Language
try:
canonical = {}
canonical['ISBN-13'] = u(isbn)
canonical['Title'] = records.get('title', u('')).replace(' :', ':')
canonical['Authors'] = records.get('authors', [u('')])
canonical['Publisher'] = records.get('publisher', u(''))
if 'publishedDate' in records \
and len(records['publishedDate']) >= 4:
canonical['Year'] = records['publishedDate'][0:4]
else: # pragma: no cover
canonical['Year'] = u('')
canonical['Language'] = records.get('language', u(''))
except: # pragma: no cover
LOGGER.debug("RecordMappingError for %s with data %s", isbn, records)
raise RecordMappingError(isbn)
# call stdmeta for extra cleanning and validation
return stdmeta(canonical)
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
# put the selected data in records
try:
recs = data['items'][0]['volumeInfo']
except: # pragma: no cover
LOGGER.debug('NoDataForSelectorError for %s', isbn)
raise NoDataForSelectorError(isbn)
# consistency check (isbn request = isbn response)
if recs:
ids = recs.get('industryIdentifiers', '')
if isbn not in repr(ids): # pragma: no cover
LOGGER.debug('ISBNNotConsistentError for %s (%s)', isbn, repr(ids))
raise ISBNNotConsistentError("%s not in %s" % (isbn, repr(ids)))
# map canonical <- records
return _mapper(isbn, recs)
def query(isbn):
"""Query the Google Books (JSON API v1) service for metadata."""
data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
return _records(isbn, data)
isbnlib-3.5.6/isbnlib/_goom.py 0000664 0000000 0000000 00000004434 12533556027 0016260 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the Google Books (JSON API v1) for metadata."""
import logging
from .dev import stdmeta
from .dev._bouth23 import u
from .dev._exceptions import (NoDataForSelectorError, RecordMappingError)
from .dev.webquery import query as wquery
UA = 'isbnlib (gzip)'
SERVICE_URL = 'https://www.googleapis.com/books/v1/volumes?q={words}'\
'&fields=items/volumeInfo(title,authors,publisher,publishedDate,'\
'language,industryIdentifiers)&maxResults=10'
LOGGER = logging.getLogger(__name__)
def _mapper(record):
"""Map canonical <- record."""
# canonical:
# -> ISBN-13, Title, Authors, Publisher, Year, Language
try:
# mapping: canonical <- records
if 'industryIdentifiers' not in record: # pragma: no cover
return
canonical = {}
isbn = None
for ident in record['industryIdentifiers']:
if ident['type'] == 'ISBN_13':
isbn = ident['identifier']
break
if not isbn: # pragma: no cover
return
canonical['ISBN-13'] = isbn
canonical['Title'] = record.get('title', u('')).replace(' :', ':')
canonical['Authors'] = record.get('authors', [])
canonical['Publisher'] = record.get('publisher', u(''))
if 'publishedDate' in record \
and len(record['publishedDate']) >= 4:
canonical['Year'] = record['publishedDate'][0:4]
else: # pragma: no cover
canonical['Year'] = u('')
canonical['Language'] = record.get('language', u(''))
except: # pragma: no cover
raise RecordMappingError(isbn)
# call stdmeta for extra cleanning and validation
return stdmeta(canonical)
def _records(words, data):
"""Classify (canonically) the parsed data."""
# put the selected data in records
try:
recs = [d['volumeInfo'] for d in data['items']]
except: # pragma: no cover
LOGGER.debug('NoDataForSelectorError for (%s)', words)
raise NoDataForSelectorError(words)
# map canonical <- records
return [_mapper(r) for r in recs if _mapper(r)]
def query(words):
"""Query the Google Books (JSON API v1) for metadata."""
data = wquery(SERVICE_URL.format(words=words.replace(' ', '+')), UA)
return _records(words, data)
isbnlib-3.5.6/isbnlib/_gwords.py 0000664 0000000 0000000 00000001476 12533556027 0016627 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Use Google to get an ISBN from words from title and author's name."""
import logging
from ._core import get_canonical_isbn, get_isbnlike
from .dev import webservice
LOGGER = logging.getLogger(__name__)
def goos(words):
"""Use Google to get an ISBN from words from title and author's name."""
service_url = "http://www.google.com/search?q={words}+ISBN"
search_url = service_url.format(words=words.replace(' ', '+'))
user_agent = 'w3m/0.5.2'
content = webservice.query(search_url, user_agent)
isbns = get_isbnlike(content)
for item in isbns:
isbn = get_canonical_isbn(item, output='isbn13')
if isbn:
break
if not isbns or not isbn: # pragma: no cover
LOGGER.debug('No ISBN found for %s', words)
return
return isbn
isbnlib-3.5.6/isbnlib/_imcache.py 0000664 0000000 0000000 00000001422 12533556027 0016702 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Read and write to a dict-like cache."""
from collections import MutableMapping
class IMCache(MutableMapping):
"""Read and write to a dict-like cache."""
MAXLEN = 1000
def __init__(self, maxlen=MAXLEN, *a, **k):
self.filepath = 'IN MEMORY'
self.maxlen = maxlen
self.d = dict(*a, **k)
while len(self) > maxlen: # pragma: no cache
self.popitem()
def __iter__(self):
return iter(self.d)
def __len__(self):
return len(self.d)
def __getitem__(self, k):
return self.d[k]
def __setitem__(self, k, v):
if k not in self and len(self) == self.maxlen:
self.popitem()
self.d[k] = v
def __delitem__(self, k):
del self.d[k]
isbnlib-3.5.6/isbnlib/_infogroup.py 0000664 0000000 0000000 00000001532 12533556027 0017323 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Get the Language/Country of an ISBN."""
import logging
from ._core import EAN13
from ._data.data4info import d, identifiers
from ._exceptions import NotValidISBNError
LOGGER = logging.getLogger(__name__)
def infogroup(isbn):
"""Get the Language/Country of this ISBN."""
# if isbn is not a valid ISBN this def can give a wrong result!
# => clean and validate
isbn = EAN13(isbn)
if not isbn:
LOGGER.critical('%s is not a valid ISBN', isbn)
raise NotValidISBNError(isbn)
# put isbn in the form 978-...
prefix = isbn[0:3] + '-'
isbn = prefix + isbn[3:]
dtxt = d
idents = identifiers
ixi, ixf = 4, 5
for ident in idents:
iid = prefix + isbn[ixi:ixf]
ixf += 1
# stop if identifier is found
if iid in ident:
return dtxt[iid]
isbnlib-3.5.6/isbnlib/_isbndb.py 0000664 0000000 0000000 00000005315 12533556027 0016557 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the isbndb.org service for metadata."""
import logging
import re
from .config import apikeys
from .dev import stdmeta
from .dev._bouth23 import u
from .dev._exceptions import (DataWrongShapeError, ISBNNotConsistentError,
NoAPIKeyError, NoDataForSelectorError,
RecordMappingError)
from .dev.webquery import query as wquery
UA = 'isbnlib (gzip)'
SERVICE_URL = 'http://isbndb.com/api/v2/json/{apikey}/book/{isbn}'
PATT_YEAR = re.compile(r'\d{4}')
LOGGER = logging.getLogger(__name__)
def _mapper(isbn, records):
"""Map canonical <- records."""
# canonical:
# -> ISBN-13, Title, Authors, Publisher, Year, Language
try:
# mapping: canonical <- records
canonical = {}
canonical['ISBN-13'] = u(isbn)
# assert isbn == records['isbn13'], "isbn was mungled!"
canonical['Title'] = records.get('title', u(''))
authors = [a['name'] for a in records['author_data']]
canonical['Authors'] = authors
canonical['Publisher'] = records.get('publisher_name', u(''))
canonical['Year'] = u('')
if 'edition_info' in records:
match = re.search(PATT_YEAR, records['edition_info'])
if match:
canonical['Year'] = str(match.group(0))
canonical['Language'] = records.get('language', u(''))
except:
raise RecordMappingError(isbn)
# call stdmeta for extra cleanning and validation
return stdmeta(canonical)
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
# check status
try:
err = data.get('error', '')
if err:
raise
except:
LOGGER.debug('DataWrongShapeError for %s with status %s',
isbn, err)
raise DataWrongShapeError("error: '%s' for isbn %s" % (err, isbn))
# put the selected data in records
try:
recs = data['data'][0]
except: # pragma: no cover
LOGGER.debug('NoDataForSelectorError for %s', isbn)
raise NoDataForSelectorError(isbn)
# consistency check (isbn request = isbn response)
if recs:
ids = recs.get('isbn13', '')
if isbn not in repr(ids): # pragma: no cover
LOGGER.debug('ISBNNotConsistentError for %s (%s)', isbn, repr(ids))
raise ISBNNotConsistentError("%s not in %s" % (isbn, repr(ids)))
# map canonical <- records
return _mapper(isbn, recs)
def query(isbn):
"""Query the isbndb.org service for metadata."""
if not apikeys.get('isbndb'):
raise NoAPIKeyError
data = wquery(SERVICE_URL.format(apikey=apikeys['isbndb'], isbn=isbn),
user_agent=UA)
return _records(isbn, data)
isbnlib-3.5.6/isbnlib/_merge.py 0000664 0000000 0000000 00000002377 12533556027 0016422 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Provide metadata by merging metadata from other providers."""
from . import config
from ._goob import query as qgoob
from ._wcat import query as qwcat
from .dev import Metadata, vias
def query(isbn, processor=None):
"""Query function for the 'merge provider' (waterfall model)."""
if not processor:
processor = config.options.get('VIAS_MERGE', processor).lower()
if not processor: # pragma: no cover
processor = 'serial'
named_tasks = (('wcat', qwcat), ('goob', qgoob))
if processor == 'parallel':
results = vias.parallel(named_tasks, isbn)
elif processor == 'serial':
results = vias.serial(named_tasks, isbn)
elif processor == 'multi':
results = vias.multi(named_tasks, isbn)
rw = results.get('wcat', None)
rg = results.get('goob', None)
if not rw and not rg: # pragma: no cover
return None
md = Metadata(rw) if rw else None
if md and rg:
# Overwrite with Authors and Language from Google
md.merge(rg, overwrite=('Authors'))
return md.value
if not md and rg: # pragma: no cover
md = Metadata(rg)
return md.value
return md.value if not rg and rw else None # pragma: no cover
isbnlib-3.5.6/isbnlib/_metadata.py 0000664 0000000 0000000 00000002277 12533556027 0017102 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query providers for metadata."""
from ._core import EAN13
from ._exceptions import NotRecognizedServiceError, NotValidISBNError
from .registry import services
def query(isbn, service='default', cache='default'):
"""Query worldcat.org, Google Books (JSON API), ... for metadata."""
from .registry import metadata_cache # <-- dinamic now!
ean = EAN13(isbn) # <-- XXX maybe this is too strict?
if not ean:
raise NotValidISBNError(isbn)
isbn = ean
if cache == 'default':
cache = metadata_cache
if service != 'default' and service not in services: # pragma: no cover
raise NotRecognizedServiceError(service)
if cache is None: # pragma: no cover
return services[service](isbn)
key = isbn + service
try:
if cache[key]:
return cache[key]
else: # pragma: no cover
raise # <-- IMPORTANT: usually the caches don't return error!
except:
meta = services[service](isbn)
if meta:
cache[key] = meta
return meta if meta else None
isbnlib-3.5.6/isbnlib/_msk.py 0000664 0000000 0000000 00000003565 12533556027 0016115 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Hyphenate an ISBN."""
import logging
from ._core import EAN13, canonical, to_isbn13
from ._data.data4mask import ranges
from ._exceptions import NotValidISBNError
LOGGER = logging.getLogger(__name__)
def msk(isbn, separator='-'):
"""Transform a canonical ISBN to a `masked` one.
`Mask` the ISBN, separating by identifier
ISBN-10 identifiers: country-publisher-title-check
Used the iterative version of the `sliding-window` algorithm.
Not pretty, but fast! Lines 42-52 implement the search loop.
O(n) for n (number of keys),
if data structure like 'ranges' in data4mask.py
"""
ib = canonical(isbn)
ean = EAN13(ib)
if len(ib) not in (10, 13) or ean is None:
LOGGER.critical('%s is not a valid ISBN', isbn)
raise NotValidISBNError(isbn)
isbn10 = False
if len(ib) == 10:
check10 = ib[-1]
ib = to_isbn13(ib)
isbn10 = True
idx = None
check = ib[-1:] # <-- hack!
cur = 3
igi = cur
buf = ib[igi:cur + 1]
group = ib[0:cur] + '-' + buf
for _ in range(6): # pragma: no cover
if group in ranges:
sevens = ib[cur + 1:cur + 8].ljust(7, '0')
for l in ranges[group]:
if l[0] <= int(sevens) <= l[1]:
idx = l[2]
break
break
cur += 1
buf = ib[igi:cur + 1]
group = group + buf[-1:] # <-- hack!
if idx:
if isbn10:
group = group[4:]
check = check10
return separator.join([group, ib[cur + 1:cur + idx + 1],
ib[cur + idx + 1:-1], check])
LOGGER.warning('identifier not found! '
'Please, update the program.') # pragma: no cover
return # pragma: no cover
isbnlib-3.5.6/isbnlib/_openl.py 0000664 0000000 0000000 00000004031 12533556027 0016425 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the openlibrary.org service for metadata."""
import logging
import re
from .dev import stdmeta
from .dev._bouth23 import u
from .dev._exceptions import NoDataForSelectorError, RecordMappingError
from .dev.webquery import query as wquery
UA = 'isbnlib (gzip)'
SERVICE_URL = 'http://openlibrary.org/api/books?bibkeys='\
'ISBN:{isbn}&format=json&jscmd=data'
LOGGER = logging.getLogger(__name__)
def _mapper(isbn, records):
"""Map canonical <- records."""
# canonical:
# -> ISBN-13, Title, Authors, Publisher, Year, Language
try:
# mapping: canonical <- records
canonical = {}
canonical['ISBN-13'] = u(isbn)
canonical['Title'] = records.get('title', u('')).replace(' :', ':')
canonical['Authors'] = [a['name'] for a in
records.get('authors', ({'name': u('')},))]
canonical['Publisher'] = records.get('publishers',
[{'name': u('')}, ])[0]['name']
canonical['Year'] = u('')
strdate = records.get('publish_date', u(''))
if strdate: # pragma: no cover
match = re.search(r'\d{4}', strdate)
if match:
canonical['Year'] = match.group(0)
except: # pragma: no cover
LOGGER.debug("RecordMappingError for %s with data %s", isbn, records)
raise RecordMappingError(isbn)
# call stdmeta for extra cleanning and validation
return stdmeta(canonical)
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
try:
# put the selected data in records
records = data['ISBN:%s' % isbn]
except: # pragma: no cover
LOGGER.debug('NoDataForSelectorError for %s', isbn)
raise NoDataForSelectorError(isbn)
# map canonical <- records
return _mapper(isbn, records)
def query(isbn):
"""Query the openlibrary.org service for metadata."""
data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
return _records(isbn, data)
isbnlib-3.5.6/isbnlib/_thinged.py 0000664 0000000 0000000 00000002155 12533556027 0016737 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the ThingISBN api (Library Thing) for related ISBNs."""
import logging
from xml.dom.minidom import parseString
from ._core import EAN13
from .dev.webquery import query as wquery
LOGGER = logging.getLogger(__name__)
UA = 'isbnlib (gzip)'
SERVICE_URL = 'http://www.librarything.com/api/thingISBN/{isbn}'
def _get_text(topnode):
"""Get the text values in the child nodes."""
text = ""
for node in topnode.childNodes:
if node.nodeType == node.TEXT_NODE:
text = text + node.data
return text
def parser_thinged(xml):
"""Parse the response from the ThingISBN service."""
dom = parseString(xml)
nodes = dom.getElementsByTagName("idlist")[0].getElementsByTagName("isbn")
return [EAN13(_get_text(isbn)) for isbn in nodes]
def query(isbn):
"""Query the worldcat.org service for related ISBNs."""
data = wquery(SERVICE_URL.format(isbn=isbn),
user_agent=UA,
parser=parser_thinged)
if not data: # pragma: no cover
LOGGER.debug('No data from ThingISBN for isbn %s', isbn)
return data
isbnlib-3.5.6/isbnlib/_wcat.py 0000664 0000000 0000000 00000004670 12533556027 0016257 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the worldcat.org xID service for metadata."""
import logging
from .dev import stdmeta
from .dev._bouth23 import u
from .dev._exceptions import (DataWrongShapeError, ISBNNotConsistentError,
NoDataForSelectorError, RecordMappingError)
from .dev.webquery import query as wquery
UA = 'isbnlib (gzip)'
SERVICE_URL = 'http://xisbn.worldcat.org/webservices/xid/isbn/{isbn}?'\
'method=getMetadata&format=json&fl=title,author,year,publisher,lang'
LOGGER = logging.getLogger(__name__)
def _mapper(isbn, records):
"""Mapp: canonical <- records."""
# canonical: ISBN-13, Title, Authors, Publisher, Year, Language
try:
canonical = {}
canonical['ISBN-13'] = u(isbn)
canonical['Title'] = records.get('title', u('')).replace(' :', ':')
buf = records.get('author', u(''))
canonical['Authors'] = [x.strip('. ') for x in buf.split(';')]
canonical['Publisher'] = records.get('publisher', u(''))
canonical['Year'] = records.get('year', u(''))
canonical['Language'] = records.get('lang', u(''))
except: # pragma: no cover
LOGGER.debug("RecordMappingError for %s with data %s", isbn, records)
raise RecordMappingError(isbn)
# call stdmeta for extra cleanning and validation
return stdmeta(canonical)
def _records(isbn, data):
"""Classify (canonically) the parsed data."""
# check status
try:
status = data['stat']
if status != 'ok':
raise
except:
LOGGER.debug('DataWrongShapeError for %s with status %s',
isbn, status)
raise DataWrongShapeError("status: '%s' for isbn %s" % (status, isbn))
# put the selected data in records
try:
recs = data['list'][0]
except: # pragma: no cover
LOGGER.debug('NoDataForSelectorError for %s', isbn)
raise NoDataForSelectorError(isbn)
# consistency check (isbn request = isbn response)
if recs:
ids = recs.get('isbn', '')
if isbn not in repr(ids): # pragma: no cover
LOGGER.debug('ISBNNotConsistentError for %s (%s)', isbn, repr(ids))
raise ISBNNotConsistentError("%s not in %s" % (isbn, repr(ids)))
# map canonical <- records
return _mapper(isbn, recs)
def query(isbn):
"""Query the worldcat.org service for metadata."""
data = wquery(SERVICE_URL.format(isbn=isbn), user_agent=UA)
return _records(isbn, data)
isbnlib-3.5.6/isbnlib/_wcated.py 0000664 0000000 0000000 00000002477 12533556027 0016573 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query the worldcat.org xID service for related ISBNs."""
import logging
from ast import literal_eval
from .dev._exceptions import DataWrongShapeError, NoDataForSelectorError
from .dev.webquery import query as wquery
LOGGER = logging.getLogger(__name__)
UA = 'isbnlib (gzip)'
SERVICE_URL = 'http://xisbn.worldcat.org/webservices/xid/isbn/{isbn}?'\
'method=getEditions&format=python'
def _editions(isbn, data):
"""Return the records from the parsed response."""
# check status
try:
status = data['stat']
if status != 'ok':
raise # pragma: no cover
except: # pragma: no cover
LOGGER.debug('DataWrongShapeError for %s with status %s',
isbn, status)
raise DataWrongShapeError("status: '%s' for isbn %s" % (status, isbn))
# put the selected data in records
try:
recs = [ib['isbn'][0] for ib in data['list']]
except: # pragma: no cover
LOGGER.debug('NoDataForSelectorError for %s', isbn)
raise NoDataForSelectorError(isbn)
return recs
def query(isbn):
"""Query the worldcat.org service for related ISBNs."""
data = wquery(SERVICE_URL.format(isbn=isbn),
user_agent=UA,
parser=literal_eval)
return _editions(isbn, data)
isbnlib-3.5.6/isbnlib/config.py 0000664 0000000 0000000 00000002352 12533556027 0016422 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Config file for isbnlib."""
# --> Import only external modules! <--
import socket
# Timeouts
SOCKETS_TIMEOUT = 12 # seconds
THREADS_TIMEOUT = 11 # seconds
def setsocketstimeout(seconds):
"""Set the value of SOCKETS_TIMEOUT (in seconds)."""
global SOCKETS_TIMEOUT
SOCKETS_TIMEOUT = seconds
return socket.setdefaulttimeout(SOCKETS_TIMEOUT)
# socket timeout is not exposed at urllib2 level so I had to import the
# module and set a default value for all the sockets (timeout in seconds)
# however this should be done at top level due to strong side effects...
setsocketstimeout(SOCKETS_TIMEOUT)
# THREADS_TIMEOUT is a parameter used downstream by Thread calls (see vias.py)
def setthreadstimeout(seconds): # pragma: no cover
"""Set the value of THREADS_TIMEOUT (in seconds)."""
global THREADS_TIMEOUT
THREADS_TIMEOUT = seconds
# API keys
apikeys = {}
def add_apikey(service, apikey): # pragma: no cover
"""Add API keys.
add_apikey('isbndb', 'JuHytr6') [is fake!]
"""
apikeys[service] = apikey
# Generic Options
options = {'VIAS_MERGE': 'serial'}
def set_option(option, value): # pragma: no cover
"""Set the value for option."""
options[option] = value
isbnlib-3.5.6/isbnlib/dev/ 0000775 0000000 0000000 00000000000 12533556027 0015357 5 ustar 00root root 0000000 0000000 isbnlib-3.5.6/isbnlib/dev/__init__.py 0000664 0000000 0000000 00000002160 12533556027 0017467 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
from . import bouth23, helpers, vias
from ._data import Metadata, stdmeta
from ._exceptions import (DataNotFoundAtServiceError, DataWrongShapeError,
ISBNLibDevException, ISBNLibHTTPError,
ISBNLibURLError, NoAPIKeyError,
NoDataForSelectorError, NotValidMetadataError,
RecordMappingError, ServiceIsDownError)
from .webquery import WEBQuery
from .webservice import WEBService
# alias
ISBNToolsDevException = ISBNLibDevException
ISBNToolsHTTPError = ISBNLibHTTPError
ISBNToolsURLError = ISBNLibURLError
__all__ = ('ISBNToolsDevException',
'ISBNLibDevException',
'ISBNToolsHTTPError', 'ISBNToolsURLError',
'ISBNLibHTTPError', 'ISBNLibURLError',
'DataNotFoundAtServiceError',
'ServiceIsDownError', 'DataWrongShapeError',
'NotValidMetadataError',
'NoDataForSelectorError',
'RecordMappingError', 'NoAPIKeyError',
'Metadata', 'stdmeta',
'WEBService', 'WEBQuery', 'vias', 'bouth23', 'helpers'
)
isbnlib-3.5.6/isbnlib/dev/_bouth23.py 0000664 0000000 0000000 00000001435 12533556027 0017361 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8:noqa
# pylint: skip-file
"""Help code to run in py2 and py3."""
import sys
if sys.version < '3':
def s(x):
return x
def b(x):
return x
def u(x):
try:
return unicode(x, "utf-8")
except TypeError:
return x
def b2u3(x):
return x.encode("utf-8")
def type3str():
return type(u'')
def bstream(x):
from StringIO import StringIO
return StringIO(x)
else:
def s(x):
return x.decode("utf-8", 'ignore')
def b(x):
return x.encode("utf-8")
def u(x):
return x
def b2u3(x):
return x
def type3str():
return type('')
def bstream(x):
from io import BytesIO
return BytesIO(x)
isbnlib-3.5.6/isbnlib/dev/_coverscache.py 0000664 0000000 0000000 00000011324 12533556027 0020356 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Read and write cover cache.
NOTE
1. shelve has different incompatible formats in py2 and py3
2. if some methods detect that the cache is not consistent
they delete the cache and create a new one.
3. After purge the cache keeps the records with more hits
and the newests.
4. The design is for safety not for performance! Increasing
MAXLEN can have an high detrimental impact on performance.
Examples:
cc = CoversCache('.covers')
cc['9781408835029'] = (
"http://books.google.com/books/content?id=uUcvgfTYTRnjh"\
"&printsec=frontcover"\
"&img=1&zoom=2&edge=curl&source=gbs_api",
".covers/slot01/9781408835029.jpg"
)
cc['9781408835029']
cc.hits('9781408835029')
cc.keys()
cc.files()
cc.sync()
cc.make()
cc.delete()
del cc['9781408835029']
"""
import os
import shutil
import sys
from random import randint
from ._shelvecache import ShelveCache
WINDOWS = os.name == 'nt'
PY3 = sys.version > '3'
class CoversCache(object):
"""Covers cache."""
CACHEFOLDER = '.covers'
INDEXFN = '.index'
WINSHADOWIDX = INDEXFN + '.dat'
MAXLEN = 3000
NSLOTS = 10
def __init__(self, cachepath=CACHEFOLDER):
"""Initialize attributes."""
self.cachepath = cachepath
self._indexpath = os.path.join(cachepath, self.INDEXFN)
if WINDOWS and PY3:
if not os.path.isfile(os.path.join(cachepath, self.WINSHADOWIDX)):
self.make()
elif not os.path.isfile(self._indexpath):
self.make()
self._index = ShelveCache(self._indexpath)
self._index.MAXLEN = self.MAXLEN
if len(self._index) > self.MAXLEN:
self.purge()
def __getitem__(self, key):
"""Read cache."""
try:
url, pth = self._index[key]
pth = os.path.join(self.cachepath, pth)
return (url, pth)
except:
return None
def __setitem__(self, key, value):
"""Write to cache."""
url, pth = value
try:
if pth and os.path.isfile(pth) and url:
tocache = os.path.join(self._get_slot(), os.path.basename(pth))
target = os.path.join(self.cachepath, tocache)
shutil.copyfile(pth, target)
if os.path.isfile(target):
self._index[key] = (url, tocache)
return True
return False
else:
raise
except:
return False
def __delitem__(self, key):
"""Delete record with key."""
try:
del self._index[key]
return True
except:
return False
def __len__(self):
"""Return the number of keys in cache."""
return len(self._index.keys()) if self._index.keys() else 0
def keys(self):
"""Return the number of keys in cache."""
return self._index.keys()
def hits(self, key):
"""Return the number of hits for key."""
return self._index.hits(key)
def _create_slots(self):
for slot in range(self.NSLOTS):
name = "slot%02d" % slot
pth = os.path.join(self.cachepath, name)
if not os.path.exists(pth):
os.mkdir(pth)
def make(self):
"""Init the cache."""
# 1. Delete if available
if os.path.isdir(self.cachepath):
self.delete()
# 2. Make folder
os.mkdir(self.cachepath)
# 3. Create Index
self._index = ShelveCache(self._indexpath)
# 4. Create slots
self._create_slots()
def _get_slot(self):
return "slot%02d" % randint(0, self.NSLOTS - 1)
def files(self):
pths = []
for root, _, fls in os.walk(self.cachepath):
for fn in fls:
pths.append(os.path.join(root, fn))
return pths
def sync(self):
"""Sync index entries with disk files."""
# clear index entries not on disk
checked = [self._indexpath]
for key in self._index.keys():
url, pth = self._index[key]
pth = os.path.join(self.cachepath, pth)
if not os.path.isfile(pth):
self._index[key] = (url, None)
checked.append(pth)
# delete files not on index
diff = tuple(set(self.files()) - set(checked))
for fp in diff:
if self.INDEXFN not in fp:
os.remove(fp)
def purge(self):
try:
self._index.purge()
self.sync()
return True
except:
return False
def delete(self):
self._index = None
return shutil.rmtree(self.cachepath)
isbnlib-3.5.6/isbnlib/dev/_data.py 0000664 0000000 0000000 00000006352 12533556027 0017007 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Handle metadata objects."""
import logging
from ._bouth23 import type3str, u
from ._exceptions import NotValidMetadataError
from ._helpers import normalize_space, titlecase
# For now you cannot add custom fields!
FIELDS = ('ISBN-13', 'Title', 'Authors', 'Publisher', 'Year', 'Language')
LOGGER = logging.getLogger(__name__)
class Metadata(object):
"""Class for metadata objects."""
def __init__(self, record=None):
"""Initialize attributes."""
self._content = None
self._set_empty()
if record:
self._content.update((k, v) for k, v in list(record.items()))
if not self._validate():
self._set_empty()
LOGGER.debug(record)
raise NotValidMetadataError()
self.clean()
@staticmethod
def fields(): # pragma: no cover
"""Return a list of value's fields."""
return list(FIELDS)
def clean(self, broom=normalize_space, exclude=()):
"""Clean fields of value."""
self._content.update((k, broom(v)) for k, v
in list(self._content.items())
if k != 'Authors' and k not in exclude)
if 'Authors' not in exclude:
self._content['Authors'] = [broom(i) for i in
self._content['Authors']]
self._content['Title'] = self._content['Title'].strip(',.:;-_ ')
if self._content['Language'].lower() in ('en', 'eng', 'english'):
self._content['Title'] = titlecase(self._content['Title'])
@property
def value(self):
"""Get value."""
return self._content
@value.setter
def value(self, record): # pragma: no cover
"""Set value."""
self._content.update((k, v) for k, v in list(record.items()))
if not self._validate():
self._set_empty()
LOGGER.debug(record)
raise NotValidMetadataError()
self.clean()
@value.deleter
def value(self): # pragma: no cover
"""Delete value."""
self._set_empty()
def merge(self, record, overwrite=(),
overrule=lambda x: x == u('') or x == [u('')]):
"""Merge the record with value."""
# by default do nothing
self._content.update((k, v) for k, v in list(record.items())
if k in overwrite and not overrule(v) or
self._content[k] == u(''))
if not self._validate(): # pragma: no cover
self._set_empty()
LOGGER.debug(record)
raise NotValidMetadataError()
self.clean()
def _validate(self):
"""Validate value."""
# 'minimal' check
for k in self._content:
if not type(self._content[k]) is type3str():
if k != 'Authors':
return False
if not type(self._content['Authors']) is list:
return False
return True
def _set_empty(self):
"""Set an empty value record."""
self._content = dict.fromkeys(list(FIELDS), u(''))
self._content['Authors'] = [u('')]
def stdmeta(records):
"""Function API to the class."""
dt = Metadata(records)
return dt.value
isbnlib-3.5.6/isbnlib/dev/_exceptions.py 0000664 0000000 0000000 00000004525 12533556027 0020257 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
""" Exceptions for isbnlib.dev
The classes in isbnlib.dev should use the exceptions below.
"""
class ISBNLibDevException(Exception):
""" Base class for isbnlib.dev exceptions
This exception should not be raised directly,
only subclasses of this exception should be used!
"""
def __init__(self, msg=None):
if msg:
self.message = '%s (%s)' % (self.message, msg)
def __str__(self):
return getattr(self, 'message', '') # pragma: no cover
class ISBNLibHTTPError(ISBNLibDevException):
""" Exception raised for HTTP related errors
"""
message = "an HTTP error has ocurred"
class ISBNLibURLError(ISBNLibDevException):
""" Exception raised for URL related errors
"""
message = "an URL error has ocurred"
class DataNotFoundAtServiceError(ISBNLibDevException):
""" Exception raised when there is no target data from the service
"""
message = "the target data was not found at this service"
class ServiceIsDownError(ISBNLibDevException):
""" Exception raised when the service is not available
"""
message = "the service is down (try later)"
class DataWrongShapeError(ISBNLibDevException):
""" Exception raised when the data hasn't the expected format
"""
message = "the data hasn't the expected format"
class NoDataForSelectorError(ISBNLibDevException):
""" Exception raised when there is no data for the selector
"""
message = "no data for this selector"
class NotValidMetadataError(ISBNLibDevException):
""" Exception raised when the metadata hasn't the expected format
"""
message = "the metadata hasn't the expected format"
class ISBNNotConsistentError(ISBNLibDevException):
""" Exception raised when the isbn request != isbn response
"""
message = "isbn request != isbn response"
class RecordMappingError(ISBNLibDevException):
""" Exception raised when the mapping records -> canonical doesn't work
"""
message = "the mapping `canonical <- records` doesn't work"
class NoAPIKeyError(ISBNLibDevException):
""" Exception raised when the API Key for a service is not found
"""
message = "this service needs an API key"
class FileNotFoundError(ISBNLibDevException):
""" Exception raised when a given file doesn't exist
"""
message = "the file wasn't found"
isbnlib-3.5.6/isbnlib/dev/_files.py 0000664 0000000 0000000 00000006373 12533556027 0017203 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Helper module to work with files."""
import fnmatch
import logging
import os
import re
from stat import S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR
from ._exceptions import FileNotFoundError
MAXLEN = 120
ILEGAL = r'<>:"/\|?*'
LOGGER = logging.getLogger(__name__)
MODE666 = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
class File(object):
"""Easy manipulation of files in the SAME directory."""
def __init__(self, fp):
"""Set and validate the basic properties."""
if not self.isfile(fp):
raise FileNotFoundError(fp)
self.path = os.path.dirname(fp) or os.getcwd()
self.basename = os.path.basename(fp)
self.name, self.ext = os.path.splitext(self.basename)
self.writable = os.access(fp, os.W_OK)
def siblings(self):
"""Collect files and directories in the same directory."""
return [f for f in os.listdir(self.path) if f != self.basename]
@staticmethod
def isfile(path):
"""Check if a given path is a file."""
return os.path.isfile(path)
@staticmethod
def exists(path):
"""Check if a given path is a file or a directory."""
return os.path.exists(path)
@staticmethod
def mkwinsafe(name, space=' '):
"""Delete most common characters not allowed in Windows filenames."""
space = space if space not in ILEGAL else ' '
name = ''.join(c for c in name if c not in ILEGAL)\
.replace(' ', space).strip()
name = re.sub(r'\s\s+', ' ', name) if space == ' ' else name
return name[:MAXLEN]
@staticmethod
def validate(basename):
"""Check for a proper basename."""
if basename != os.path.basename(basename):
LOGGER.critical("This (%s) is not a basename!", basename)
return False
name, ext = os.path.splitext(basename)
if len(name) == 0:
LOGGER.critical("Not a valid name (lenght 0)!")
return False
if len(ext) == 0:
LOGGER.critical("Not a valid extension (lenght 0)!")
return False
return True
def baserename(self, new_basename):
"""Rename the file to a 'safe' basename."""
if not self.validate(new_basename):
return False
name, ext = os.path.splitext(new_basename)
name = self.mkwinsafe(name)
new_basename = name + ext
if new_basename == self.basename:
return True
if new_basename not in self.siblings():
try:
os.rename(self.basename, new_basename)
except OSError as err:
LOGGER.critical("%s", err.message)
return False
self.basename = new_basename
self.name = name
self.ext = ext
return True
else:
LOGGER.info("The file (%s) already exist in the directory!",
new_basename)
return True
@staticmethod
def uxchmod(fp, mode=MODE666):
"""Change the mode of the file (default is 0666)."""
return os.chmod(fp, mode)
def cwdfiles(pattern='*'):
"""List the files in current directory that match a given pattern."""
return fnmatch.filter(os.listdir('.'), pattern)
isbnlib-3.5.6/isbnlib/dev/_fmt.py 0000664 0000000 0000000 00000007260 12533556027 0016663 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""Format canonical in bibliographic formats."""
import re
import uuid
from string import Template
from ._helpers import last_first
bibtex = r"""@book{$ISBN,
title = {$Title},
author = {$AUTHORS},
isbn = {$ISBN},
year = {$Year},
publisher = {$Publisher}
}"""
endnote = r"""%0 Book
%T $Title
%A $AUTHORS
%@ $ISBN
%D $Year
%I $Publisher """
refworks = r"""TY - BOOK
T1 - $Title
A1 - $AUTHORS
SN - $ISBN
Y1 - $Year
PB - $Publisher
ER - """
msword = r'''
$uid
Book
$AUTHORS
$Title
$Year
$Publisher
'''
json = r'''{"type": "book",
"title": "$Title",
"author": [$AUTHORS],
"year": "$Year",
"identifier": [{"type": "ISBN", "id": "$ISBN"}],
"publisher": "$Publisher"}'''
opf = r"""
Book
$uid
$ISBN
$Title
$AUTHORS
$Publisher
$Year
isbnlib [http://github.com/xlcnd/isbnlib]
"""
labels = r"""Type: BOOK
Title: $Title
Author: $AUTHORS
ISBN: $ISBN
Year: $Year
Publisher: $Publisher"""
templates = {
'labels': labels,
'bibtex': bibtex,
'endnote': endnote,
'refworks': refworks,
'msword': msword,
'json': json,
'opf': opf
}
fmts = list(templates.keys())
def _gen_proc(name, canonical):
if 'ISBN-13' in canonical:
canonical['ISBN'] = canonical.pop('ISBN-13')
tpl = templates[name]
return Template(tpl).safe_substitute(canonical)
def _spec_proc(name, fmtrec, authors):
"""Fix the Authors records."""
if name not in fmts:
return
if name == 'labels':
AUTHORS = '\nAuthor: '.join(authors)
elif name == 'bibtex':
AUTHORS = ' and '.join(authors)
elif name == 'refworks':
AUTHORS = '\nA1 - '.join(authors)
elif name == 'endnote':
AUTHORS = '\n%A '.join(authors)
elif name == 'msword':
fmtrec = fmtrec.replace('$uid', str(uuid.uuid4()))
person = r"$last"\
r"$first"
AUTHORS = '\n'.join(
Template(person).safe_substitute(last_first(a))
for a in authors)
elif name == 'json':
AUTHORS = ', '.join('{"name": "$"}'.replace("$", a)
for a in authors)
elif name == 'opf':
fmtrec = fmtrec.replace('$uid', str(uuid.uuid4()))
creator = r'$first $last'
AUTHORS = '\n '.join(
Template(creator).safe_substitute(last_first(author))
for author in authors)
return re.sub(r'\$AUTHORS', AUTHORS, fmtrec)
def fmtbib(fmtname, canonical):
"""Return a canonical record in the selected format."""
return _spec_proc(fmtname, _gen_proc(fmtname, canonical),
canonical['Authors'])
isbnlib-3.5.6/isbnlib/dev/_helpers.py 0000664 0000000 0000000 00000005325 12533556027 0017537 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Private helper functions."""
import re
import sys
from hashlib import md5
from ._bouth23 import b, s
def fake_isbn(title, author='unkown', publisher='unkown', sid=1):
"""Produce a fake ISBN from the (title, author, publisher) of the book."""
key = "%s %s %s" % (title, author, publisher)
# normalize
regex1 = re.compile(r'\?|,|\.|!|\:|;', re.I | re.M | re.S)
regex2 = re.compile(r'\s\s+', re.I | re.M | re.S)
key = regex1.sub(' ', key)
key = regex2.sub(' ', key).strip().lower()
# hash
return (str(sid) + str(int(md5(b(key)).hexdigest()[:10], 16)))[:13]
def in_virtual(): # pragma: no cover
"""Detect if program is running inside a python virtual environment."""
return True if hasattr(sys, 'real_prefix') else False
def normalize_space(item):
"""Normalize white space.
Strips leading and trailing white space and replaces sequences of
white space characters with a single space.
"""
item = re.sub(r'\s\s+', ' ', item)
return item.strip()
def titlecase(st):
"""Format string in title case (for ascii).
Only changes the first character of each word.
"""
try:
st.encode('ascii')
return re.sub(r"[A-Za-z]+('[A-Za-z]+)?",
lambda m: m.group(0)[0].upper() + m.group(0)[1:], st)
except UnicodeDecodeError: # pragma: no cover
return st
def last_first(author):
"""Parse an author name into last (name) and first."""
if ',' in author:
tokens = author.split(',')
last = tokens[0].strip()
first = ' '.join(tokens[1:]).strip().replace(' ', ', ')
else:
tokens = author.split(' ')
last = tokens[-1].strip()
first = ' '.join(tokens[:-1]).strip()
return {'last': last, 'first': first}
def unicode_to_utf8tex(utex, filtre=()):
"""Replace unicode entities with tex entitites and returns utf8 bytes."""
from .._data.data4tex import unicode_to_tex
btex = utex.encode('utf-8')
table = dict((k.encode('utf-8'), v) for k, v in unicode_to_tex.items()
if v not in filtre)
regex = re.compile(b('|'.join(re.escape(s(k)) for k in table)))
return regex.sub(lambda m: table[m.group(0)], btex)
def cutoff_tokens(tokens, cutoff):
"""Keep only the tokens with total length <= cutoff."""
ltokens = [len(t) for t in tokens]
length = 0
stokens = []
for token, l in zip(tokens, ltokens):
if length + l <= cutoff:
length = length + l
stokens.append(token)
else:
break
return stokens
def parse_placeholders(pattern):
"""Return a list of placeholders in a pattern."""
regex = re.compile(r'({[^}]*})')
return regex.findall(pattern)
isbnlib-3.5.6/isbnlib/dev/_shelvecache.py 0000664 0000000 0000000 00000011040 12533556027 0020336 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Read and write shelve cache.
NOTES
1. shelve has different incompatible formats in py2 and py3.
2. If some methods detect that the cache is not consistent
they delete the cache and create a new one.
3. After purge, the cache keeps the records with more hits
and the newests.
4. By opening and closing in each operation, the cache performs badly
for many records (because it doesn't use the 'in memory' part of cache).
So don't increase MAXLEN too much.
5. The cache is optimized for low hit frequency (using a simple dict lookup
not a Bloom filter!).
"""
# TODO rewrite using context managers!
import datetime
import shelve
from time import time as timestamp
class ShelveCache(object):
"""Read and write shelve cache."""
MAXLEN = 2000
CUTOFF = 0.5
def __init__(self, filepath):
"""Initialize attributes."""
self._sh = shelve
self.filepath = filepath
try:
s = self._sh.open(self.filepath)
try:
self._keys = list(s.keys())
if len(self._keys) > self.MAXLEN:
self.purge()
except:
pass
except:
s = self._sh.open(self.filepath, 'n')
self._keys = []
s.close()
def __getitem__(self, key):
"""Read cache."""
if key not in self._keys:
return None
try:
s = self._sh.open(self.filepath, writeback=True)
if s[key]:
s[key]['hits'] += 1
return s[key]['value']
else:
return None
except KeyError:
return None
except ValueError:
self.new()
return None
finally:
s.close()
def __setitem__(self, key, value):
"""Write to cache."""
try:
s = self._sh.open(self.filepath)
s[key] = {'value': value, 'hits': 0, 'timestamp': timestamp()}
self._keys.append(key)
status = True
except:
status = False
finally:
s.close()
return status
def __delitem__(self, key):
"""Delete record with key."""
if key not in self._keys:
return
try:
s = self._sh.open(self.filepath)
del s[key]
self._keys.remove(key)
except KeyError:
return
except ValueError:
self.new()
return
finally:
s.close()
def __len__(self):
"""Return the number of keys in cache."""
return len(self.keys()) if self.keys() else 0
def keys(self):
"""Return list of keys in Cache."""
if self._keys:
return self._keys
try:
s = self._sh.open(self.filepath)
self._keys = list(s.keys())
return self._keys
finally:
s.close()
def ts(self, key):
"""Return the timestamp of the record with key."""
if key not in self._keys:
return None
try:
s = self._sh.open(self.filepath)
ts = s[key]['timestamp'] if s[key] else None
if not ts:
return
fmt = '%Y-%m-%d %H:%M:%S'
return datetime.datetime.fromtimestamp(ts).strftime(fmt)
except KeyError:
return
except ValueError:
self.new()
return
finally:
s.close()
def hits(self, key):
"""Return the number of hits for the record with key."""
if key not in self._keys:
return None
try:
s = self._sh.open(self.filepath)
hts = s[key]['hits'] if s[key] else None
return hts
except KeyError:
return
except ValueError:
self.new()
return
finally:
s.close()
def new(self):
"""Make new cache."""
s = self._sh.open(self.filepath, 'n')
s.close()
self._keys = []
def purge(self):
"""Purge the cache."""
try:
if len(self.keys()) < self.MAXLEN:
return
s = self._sh.open(self.filepath)
data = [(k, s[k]['timestamp'], s[k]['hits']) for k in s.keys()]
data.sort(key=lambda tup: (-tup[2], -tup[1]))
keep = int(self.CUTOFF * self.MAXLEN)
garbk = [k[0] for k in data[keep:]]
for k in garbk:
del s[k]
self._keys = s.keys()
finally:
s.close()
isbnlib-3.5.6/isbnlib/dev/bouth23.py 0000664 0000000 0000000 00000000174 12533556027 0017221 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8:noqa
# pylint: skip-file
"""Help code to run in py2 and py3."""
from ._bouth23 import *
isbnlib-3.5.6/isbnlib/dev/helpers.py 0000664 0000000 0000000 00000001262 12533556027 0017374 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8:noqa
# pylint: skip-file
"""Expose usefull features."""
from .._imcache import IMCache
from ._coverscache import CoversCache
from ._files import File, cwdfiles
from ._fmt import fmtbib, fmts
from ._helpers import unicode_to_utf8tex as to_utf8tex
from ._helpers import (cutoff_tokens, fake_isbn, in_virtual, last_first,
normalize_space, parse_placeholders)
from ._shelvecache import ShelveCache
__all__ = ['CoversCache', 'File', 'IMCache', 'ShelveCache', 'cutoff_tokens', 'cwdfiles',
'fmtbib', 'fmts', 'in_virtual', 'last_first', 'normalize_space',
'parse_placeholders', 'to_utf8tex', 'fake_isbn'
]
isbnlib-3.5.6/isbnlib/dev/vias.py 0000664 0000000 0000000 00000003420 12533556027 0016672 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Process tasks in several modes."""
import logging
from .. import config
LOGGER = logging.getLogger(__name__)
def serial(named_tasks, arg):
"""Serial calls."""
results = {}
for name, task in named_tasks:
try:
results[name] = task(arg)
except: # pragma: no cover
LOGGER.debug("No result in 'serial' for %s[%s](%s)",
task, name, arg)
results[name] = None
return results
def parallel(named_tasks, arg):
"""Threaded calls."""
from threading import Thread
results = {}
def _worker(name, task, arg):
try:
results[name] = task(arg)
except: # pragma: no cover
LOGGER.debug("No result in 'parallel' for %s[%s](%s)",
task, name, arg)
results[name] = None
for name, task in named_tasks:
t = Thread(target=_worker, args=(name, task, arg))
t.start()
t.join(config.THREADS_TIMEOUT)
return results
def multi(named_tasks, arg):
"""Multiprocessing: using several cores (if available)."""
from multiprocessing import Process, Queue
results = {}
q = Queue()
def _worker(name, task, arg, q):
try: # pragma: no cover
q.put((name, task(arg)))
except: # pragma: no cover
LOGGER.debug("No result in 'multi' for %s[%s](%s)",
task, name, arg)
q.put((name, None))
for name, task in named_tasks:
p = Process(target=_worker, args=(name, task, arg, q))
p.start()
p.join(config.THREADS_TIMEOUT)
q.put('STOP')
while True:
el = q.get()
if el == 'STOP':
break
results[el[0]] = el[1]
return results
isbnlib-3.5.6/isbnlib/dev/webquery.py 0000664 0000000 0000000 00000004133 12533556027 0017575 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Base class to query a webservice and parse the result to py objects."""
import json
import logging
from time import sleep, time as timestamp
from . import webservice
from ._exceptions import DataNotFoundAtServiceError, ServiceIsDownError
UA = 'isbnlib (gzip)'
OUT_OF_SERVICE = 'Temporarily out of service'
BOOK_NOT_FOUND = 'No results match your search'
LOGGER = logging.getLogger(__name__)
THROTTLING = 1
class WEBQuery(object):
"""Base class to query a webservice and parse the result to py objects."""
T = {'id': timestamp()} # noqa
def __init__(self, service_url, ua=UA):
"""Initialize & call webservice."""
srv = service_url[8:20]
last = WEBQuery.T[srv] if srv in WEBQuery.T else 0.0
wait = 0 if timestamp() - last > THROTTLING else THROTTLING
sleep(wait)
self.url = service_url
self.data = webservice.query(service_url, ua)
WEBQuery.T[srv] = timestamp()
def check_data(self, data_checker=None): # pragma: no cover
"""Check the data & handle errors."""
if data_checker:
return data_checker(self.data)
if self.data == '{}':
LOGGER.warning('DataNotFoundAtServiceError for %s', self.url)
raise DataNotFoundAtServiceError(self.url)
if BOOK_NOT_FOUND in self.data:
LOGGER.warning('DataNotFoundAtServiceError for %s', self.url)
raise DataNotFoundAtServiceError(self.url)
if OUT_OF_SERVICE in self.data:
LOGGER.critical('ServiceIsDownError for %s', self.url)
raise ServiceIsDownError(self.url)
return True
def parse_data(self, parser=json.loads):
"""Parse the data (default JSON -> PY)."""
if parser is None: # pragma: no cover
return self.data
return parser(self.data) # <-- data is now unicode
def query(url, user_agent=UA, data_checker=None, parser=json.loads):
"""Put call and return the data from the web service."""
wq = WEBQuery(url, user_agent)
return wq.parse_data(parser) \
if wq.check_data(data_checker) else None
isbnlib-3.5.6/isbnlib/dev/webservice.py 0000664 0000000 0000000 00000005627 12533556027 0020101 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Query web services."""
import gzip
import logging
from ._bouth23 import bstream, s
from ._exceptions import ISBNLibHTTPError, ISBNLibURLError
try: # pragma: no cover
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
except ImportError: # pragma: no cover
from urllib import urlencode
from urllib2 import Request, urlopen, HTTPError, URLError
UA = 'isbnlib (gzip)'
LOGGER = logging.getLogger(__name__)
class WEBService(object):
"""Class to query web services."""
def __init__(self, url, user_agent=UA, values=None, appheaders=None):
"""Initialize main properties."""
self._url = url
# headers to accept gzipped content
headers = {'Accept-Encoding': 'gzip', 'User-Agent': user_agent}
# add more user provided headers
if appheaders: # pragma: no cover
headers.update(appheaders)
# if 'data' it does a PUT request (data must be urlencoded)
data = urlencode(values) if values else None
self._request = Request(url, data, headers=headers)
self.response = None
def _response(self):
"""Check errors on response."""
try:
self.response = urlopen(self._request)
LOGGER.debug('Request headers:\n%s', self._request.header_items())
except HTTPError as e: # pragma: no cover
LOGGER.critical('ISBNLibHTTPError for %s with code %s [%s]',
self._url, e.code, e.msg)
if e.code in (401, 403, 429):
raise ISBNLibHTTPError('%s Are you making many requests?'
% e.code)
if e.code in (502, 504):
raise ISBNLibHTTPError('%s Service temporarily unavailable!'
% e.code)
raise ISBNLibHTTPError('(%s) %s' % (e.code, e.msg))
except URLError as e: # pragma: no cover
LOGGER.critical('ISBNLibURLError for %s with reason %s',
self._url, e.reason)
raise ISBNLibURLError(e.reason)
def data(self):
"""Return the uncompressed data."""
self._response()
LOGGER.debug('Response headers:\n%s', self.response.info())
if self.response.info().get('Content-Encoding') == 'gzip':
buf = bstream(self.response.read())
f = gzip.GzipFile(fileobj=buf)
data = f.read()
else: # pragma: no cover
data = self.response.read()
return s(data)
def query(url, user_agent=UA, values=None, appheaders=None):
"""Query to a web service."""
service = WEBService(url, user_agent=user_agent, values=values,
appheaders=appheaders)
data = service.data()
LOGGER.debug('Raw data from service:\n%s', data)
return data
isbnlib-3.5.6/isbnlib/registry.py 0000664 0000000 0000000 00000004525 12533556027 0017031 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
"""Registry for metadata services, formatters and cache."""
from . import _goob as goob
from . import _isbndb as isbndb
from . import _merge as merge
from . import _openl as openl
from . import _wcat as wcat
from ._imcache import IMCache
from .dev._fmt import fmtbib
# SERVICES
services = {'default': merge.query,
'wcat': wcat.query,
'goob': goob.query,
'merge': merge.query,
'openl': openl.query,
'isbndb': isbndb.query
}
def setdefaultservice(name): # pragma: no cover
"""Set the default service."""
global services
services['default'] = services[name]
def add_service(name, query): # pragma: no cover
"""Add a new service to services."""
global services
services[name] = query
# FORMATTERS
bibformatters = {'default': lambda x: fmtbib('labels', x),
'labels': lambda x: fmtbib('labels', x),
'bibtex': lambda x: fmtbib('bibtex', x),
'endnote': lambda x: fmtbib('endnote', x),
'refworks': lambda x: fmtbib('refworks', x),
'msword': lambda x: fmtbib('msword', x),
'json': lambda x: fmtbib('json', x),
'opf': lambda x: fmtbib('opf', x)} # pragma: no cover
def setdefaultbibformatter(name): # pragma: no cover
"""Set the default formatter."""
global bibformatters
bibformatters['default'] = bibformatters[name]
def add_bibformatter(name, formatter): # pragma: no cover
"""Add a new formatter to formatters."""
global bibformatters
bibformatters[name] = formatter
# CACHE
# if you want a persistant cache you could use
# .dev.helpers ShelveCache(pathtofile)
metadata_cache = IMCache() # should be an instance
def set_cache(cache): # pragma: no cover
"""Set cache for metadata."""
global metadata_cache
metadata_cache = cache
covers_cache = None # should be an instance
def set_covers_cache(cache): # pragma: no cover
"""Set cache for covers."""
global covers_cache
covers_cache = cache
custom_cache = None # should be an instance
def set_custom_cache(cache): # pragma: no cover
"""Set a 'spare' cache."""
global custom_cache
custom_cache = cache
isbnlib-3.5.6/isbnlib/test/ 0000775 0000000 0000000 00000000000 12533556027 0015560 5 ustar 00root root 0000000 0000000 isbnlib-3.5.6/isbnlib/test/__init__.py 0000664 0000000 0000000 00000000000 12533556027 0017657 0 ustar 00root root 0000000 0000000 isbnlib-3.5.6/isbnlib/test/data4tests.py 0000664 0000000 0000000 00000003231 12533556027 0020211 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
ISBNs = r'''
ISBN 9781849284677
qwe iuwer 9780312640583 kjhfds
bh bh isbn 978-0312640583
bh bh isbn 978 031264058 3
bh bh isbn978 031264058 3
ISBN 0-330-28498-3 jhjhISBN 1-58182-008-9
ISBN 2-226-05257-7
ISBN 3-7965-1900-8
ISBN 4-19-830127-1
ISBN 5-85270-001-0
ISBN 978-600-119-125-1
ISBN 978-601-7151-13-3
ISBN 978-602-8328-22-7
ISBN 978-603-500-045-1
ISBN 605-384-057-2
ISBN 978-606-8126-35-7
ISBN 978-607-455-035-1
ISBN 978-608-203-023-4
ISBN 978-612-45165-9-7
ISBN 978-614-404-018-8
ISBN 978-615-5014-99-4
ISBN 7-301-10299-2
ISBN 80-85983-44-3
ISBN 81-7215-399-6
ISBN 82-530-0983-6
ISBN 83-08-01587-5
ISBN 84-86546-08-7
ISBN 85-7531-015-1
ISBN 86-341-0846-5
ISBN 87-595-2277-1
ISBN 88-04-47328-2
ISBN 90-5691-187-2
ISBN 91-1-811692-2
ISBN 92-67-10370-9
ISBN 93-8011-236-7
ISBN 94-414-0063-3
ISBN 950-04-0442-7
ISBN 951-0-11369-7
ISBN 952-471-294-6
ISBN 953-157-105-8
ISBN 954-430-603-X
ISBN 955-20-3051-X
ISBN 956-7291-48-9
ISBN 957-01-7429-3
ISBN 958-04-6278-X
ISBN 959-10-0363-3
ISBN 961-6403-23-0
ISBN 962-04-0195-6
ISBN 963-7971-51-3
ISBN 964-6194-70-2
ISBN 965-359-002-2
ISBN 966-95440-5-X
ISBN 967-978-753-2
ISBN 968-6031-02-2
ISBN 969-031-02-2
ISBN 970-20-0242-7
ISBN 971-8845-10-0
ISBN 972-37-0274-6
ISBN 973-43-0179-9
ISBN 974-85854-7-6
ISBN 975-293-381-5
ISBN 976-640-140-3
ISBN 977-734-520-8
ISBN 978-37186-2-2
ISBN 979-553-483-1
ISBN 980-01-0194-2
ISBN 981-3018-39-9
ISBN 982-301-001-3
ISBN 983-52-0157-9
ISBN 984-458-089-7
ISBN 986-417-191-7
ISBN 987-98184-2-3
ISBN 978-988-00-3827-3
ISBN 978-9928400529
ISBN 978-9929801646
ISBN 978-9930943106
ISBN 978-9933101473
ISBN 978-9934015960
ISBN 978-99937-1-056-1
ISBN 978-99965-2-047-1
'''
# flake8: noqa
isbnlib-3.5.6/isbnlib/test/test_core.py 0000664 0000000 0000000 00000015336 12533556027 0020131 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
from nose.tools import assert_equals
from .._core import (_check_digit10, _check_digit13, _check_structure10,
_check_structure13, is_isbn10, is_isbn13, to_isbn10, to_isbn13,
canonical, clean, notisbn, get_isbnlike, get_canonical_isbn, EAN13)
from .data4tests import ISBNs
# nose tests
def test__check_digit10():
"""Test check digit algo for ISBN-10."""
assert_equals(_check_digit10('082649752'), '7')
assert_equals(_check_digit10('585270001'), '0')
assert_equals(_check_digit10('08264975X'), None)
assert_equals(_check_digit10('08264975'), None)
def test__check_digit13():
"""Test check digit algo for ISBN-13."""
assert_equals(_check_digit13('978082649752'), '9')
assert_equals(_check_digit13('97808264975'), None)
assert_equals(_check_digit13('97808264975X'), None)
def test__check_structure10():
"""Test structure detection for ISBN-10."""
assert_equals(_check_structure10('0826497527'), True)
assert_equals(_check_structure10('0826497X27'), True) # isbnlike!
assert_equals(_check_structure10('0826497XI7'), False)
def test__check_structure13():
"""Test structure detection for ISBN-13."""
assert_equals(_check_structure13('9780826497529'), True)
assert_equals(_check_structure13('978082649752X'), False)
def test_is_isbn10():
"""Test detection and validation for ISBN-10."""
assert_equals(is_isbn10('0826497527'), True)
assert_equals(is_isbn10('isbn 0-8264-9752-7'), True)
assert_equals(is_isbn10('0826497520'), False)
assert_equals(is_isbn10('954430603X'), True)
def test_is_isbn13():
"""Test detection and validation for ISBN-13."""
assert_equals(is_isbn13('9780826497529'), True)
assert_equals(is_isbn13('9791090636071'), True)
assert_equals(is_isbn13('isbn 979-10-90636-07-1'), True)
assert_equals(is_isbn13('9780826497520'), False)
assert_equals(is_isbn13('9700000000000'), False)
assert_equals(is_isbn13('9000000000000'), False)
assert_equals(is_isbn13('9710000000000'), False)
def test_to_isbn10():
"""Test transformation of ISBN to ISBN-10."""
assert_equals(to_isbn10('9780826497529'), '0826497527')
assert_equals(to_isbn10('0826497527'), '0826497527')
assert_equals(to_isbn10('9780826497520'), None) # ISBN13 not valid
assert_equals(to_isbn10('9790826497529'), None)
assert_equals(to_isbn10('97808264975X3'), None)
assert_equals(to_isbn10('978-826497'), None) # (bug #14)
assert_equals(to_isbn10('isbn 0-8264-9752-7'), '0826497527')
assert_equals(to_isbn10('isbn 979-10-90636-07-1'), None)
assert_equals(to_isbn10('isbn 978-0-8264-9752-9'), '0826497527')
assert_equals(to_isbn10('asdadv isbn 978-0-8264-9752-9'), '0826497527')
def test_to_isbn13():
"""Test transformation of ISBN to ISBN-13."""
assert_equals(to_isbn13('0826497527'), '9780826497529')
assert_equals(to_isbn13('9780826497529'), '9780826497529')
assert_equals(to_isbn13('0826497520'), None) # ISBN10 not valid
assert_equals(to_isbn13('08X6497527'), None)
assert_equals(to_isbn13('91-43-01019-9'), '9789143010190') # (bug #14)
assert_equals(to_isbn13('isbn 91-43-01019-9'), '9789143010190')
assert_equals(to_isbn13('asd isbn 979-10-90636-07-1 blabla'), '9791090636071')
def test_clean():
"""Test the cleanning of ISBN-like strings."""
assert_equals(clean(' 978.0826.497529'), '9780826497529')
assert_equals(clean('ISBN: 9791090636071'), 'ISBN 9791090636071')
assert_equals(clean('978,0826497520'), '9780826497520')
def test_notisbn():
"""Test the impossibility of extracting valid ISBN from ISBN-like strings."""
assert_equals(notisbn('0826497527'), False)
assert_equals(notisbn('0826497520'), True)
assert_equals(notisbn('9780826497529', level='strict'), False)
assert_equals(notisbn('9426497529', level='strict'), True)
assert_equals(notisbn('978082649752', level='strict'), True)
assert_equals(notisbn('978082649752', level='loose'), True)
assert_equals(notisbn('9780826400001', level='loose'), False)
assert_equals(notisbn('9780826400001', level='strict'), True)
assert_equals(notisbn('9780826400001', level='badlevel'), None)
assert_equals(notisbn('978 9426497529'), True)
assert_equals(notisbn('9789426497529'), True)
assert_equals(notisbn('979 10 9063607 1'), False)
assert_equals(notisbn('9780826497520'), True)
def test_get_isbnlike():
"""Test the extraction of ISBN-like strings."""
assert_equals(len(get_isbnlike(ISBNs)), 79)
assert_equals(len(get_isbnlike(ISBNs, 'normal')), 79)
assert_equals(len(get_isbnlike(ISBNs, 'strict')), 69)
assert_equals(len(get_isbnlike(ISBNs, 'loose')), 81)
assert_equals(get_isbnlike(ISBNs, 'e'), None)
def test_get_canonical_isbn():
"""Test the extraction of canonical ISBN from ISBN-like string."""
assert_equals(get_canonical_isbn('0826497527', output='bouth'),
'0826497527')
assert_equals(get_canonical_isbn('0826497527'), '0826497527')
assert_equals(get_canonical_isbn('0826497527', output='isbn10'),
'0826497527')
assert_equals(get_canonical_isbn('0826497527', output='isbn13'),
'9780826497529')
assert_equals(get_canonical_isbn('ISBN 0826497527', output='isbn13'),
'9780826497529')
assert_equals(get_canonical_isbn('ISBN 0826497527', output='NOOPTION'),
None)
assert_equals(get_canonical_isbn('0826497520'), None)
assert_equals(get_canonical_isbn('9780826497529'), '9780826497529')
assert_equals(get_canonical_isbn('9780826497520'), None)
assert_equals(get_canonical_isbn('OSX 9780826497529.pdf'), '9780826497529')
def test_canonical():
"""Test the extraction of 'only numbers and X' from ISBN-like string."""
assert_equals(canonical('ISBN 9789720404427'), '9789720404427')
assert_equals(canonical('ISBN-9780826497529'), '9780826497529')
assert_equals(canonical('ISBN9780826497529'), '9780826497529')
assert_equals(canonical('isbn9780826497529'), '9780826497529')
assert_equals(canonical('isbn 0826497527'), '0826497527')
assert_equals(canonical('954430603x'), '954430603X')
def test_EAN13():
"""Test the extraction and validation of EAN13 from ISBN-like string."""
assert_equals(EAN13('ISBN 9789720404427'), None)
assert_equals(EAN13('ISBN 9789720404428'), '9789720404428')
assert_equals(EAN13('ISBN-9780826497529'), '9780826497529')
assert_equals(EAN13('ISBN9780826497529'), '9780826497529')
assert_equals(EAN13('isbn9780826497529'), '9780826497529')
assert_equals(EAN13('isbn 0826497527'), '9780826497529')
assert_equals(EAN13('9700000000000'), None)
assert_equals(EAN13('9000000000000'), None)
assert_equals(EAN13('9710000000000'), None)
isbnlib-3.5.6/isbnlib/test/test_data.py 0000664 0000000 0000000 00000003301 12533556027 0020077 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
""" nose tests
"""
from nose.tools import assert_equals, assert_raises
from ..dev import Metadata, stdmeta
from ..dev._bouth23 import u
def test_stdmeta():
"""Test the transformation of raw records into standard metadata."""
# test stdmeta from data
r={
'ISBN-13': u('9780123456789 '),
'Title': u('Bla. Bla /Title .'),
'Publisher': u(''),
'Year': u('2000'),
'Language': u('en'),
'Authors': [u('author1. mba'), u('author2 ')]
}
R={
'ISBN-13': u('9780123456789'),
'Title': u('Bla. Bla /Title'),
'Publisher': u(''),
'Year': u('2000'),
'Language': u('en'),
'Authors': [u('author1. mba'), u('author2')]
}
A={
'ISBN-13': u('9780123456789 '),
'Title': b'Bla. Bla /Title .',
'Publisher': u(''),
'Year': b'2000',
'Language': u('en'),
'Authors': [u('author1. mba'), u('author2 ')]
}
B={
'ISBN-13': u('9780123456789'),
'Title': u('Bla. Bla /Title .'),
'Publisher': u(''),
'Year': u('2000'),
'Language': u('en'),
'Authors': u('author1')
}
assert_equals(stdmeta(r), R)
assert_equals(stdmeta(R), R)
assert_raises(Exception, stdmeta, A)
assert_raises(Exception, stdmeta, B)
def test_metaclass():
"""Test the creation of a Metadata class from raw records."""
R={
'ISBN-13': u('9780123456789'),
'Title': u('Bla. Bla /Title'),
'Publisher': u(''),
'Year': u('2000'),
'Language': u('en'),
'Authors': [u('author1. mba'), u('author2')]
}
dt = Metadata(R)
assert_equals(dt.value, R)
isbnlib-3.5.6/isbnlib/test/test_doi2tex.py 0000664 0000000 0000000 00000000417 12533556027 0020551 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
from .. import doi2tex
from nose.tools import assert_equals
def test_doi2tex():
"""Test the doi2tex service."""
assert_equals(len(repr(doi2tex('10.2139/ssrn.2411669'))) > 50, True)
isbnlib-3.5.6/isbnlib/test/test_editions.py 0000664 0000000 0000000 00000001636 12533556027 0021015 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
from nose.tools import assert_equals, raises
from .._exceptions import NotRecognizedServiceError, NotValidISBNError
from .._ext import editions
# nose tests
def test_editions1():
"""Test the 'editions' service."""
assert_equals(len(editions('9780156001311', service='wcat')) > 19, True)
assert_equals(len(editions('9780151446476', service='thingl')) > 19, True)
assert_equals(len(editions('9780151446476', service='any')) > 19, True)
assert_equals(len(editions('9780151446476', service='merge')) > 19, True)
@raises(NotValidISBNError)
def test_editions2():
"""Test the 'editions' service error detection (NotValidISBNError)."""
editions('978')
@raises(NotRecognizedServiceError)
def test_editions3():
"""Test the 'editions' service error detection (NotRecognizedServiceError)."""
editions('9780156001311', service='xxx')
isbnlib-3.5.6/isbnlib/test/test_ext.py 0000664 0000000 0000000 00000004706 12533556027 0020000 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
from nose.tools import assert_equals, assert_raises
from .._ext import mask, editions, isbn_from_words, doi, desc, cover
# nose tests
def test_mask():
"""Test 'mask' command."""
assert_equals(mask('5852700010'), '5-85270-001-0')
assert_equals(mask('0330284983'), '0-330-28498-3')
assert_equals(mask('3796519008'), '3-7965-1900-8')
assert_equals(mask('4198301271'), '4-19-830127-1')
assert_equals(mask('2226052577'), '2-226-05257-7')
assert_equals(mask('6053840572'), '605-384-057-2')
assert_equals(mask('7301102992'), '7-301-10299-2')
assert_equals(mask('8085983443'), '80-85983-44-3')
assert_equals(mask('9056911872'), '90-5691-187-2')
assert_equals(mask('9500404427'), '950-04-0442-7')
assert_equals(mask('9800101942'), '980-01-0194-2')
assert_equals(mask('9813018399'), '981-3018-39-9')
assert_equals(mask('9786001191251'), '978-600-119-125-1')
assert_equals(mask('9780321534965'), '978-0-321-53496-5')
assert_equals(mask('9781590593561'), '978-1-59059-356-1')
assert_equals(mask('9789993075899'), '978-99930-75-89-9')
assert_equals(mask('0-330284983'), '0-330-28498-3')
assert_equals(mask('9791090636071'), '979-10-90636-07-1')
assert_equals(mask('9786131796364'), '978-613-1-79636-4') # <-- prefix with 1 rule
assert_equals(mask('isbn 979-10-90636-07-1'), '979-10-90636-07-1')
assert_raises(Exception, mask, '')
assert_raises(Exception, mask, '9786')
assert_raises(Exception, mask, '0000000000000')
def test_isbn_from_words():
"""Test 'isbn_from_words' command."""
assert_equals(len(isbn_from_words('old men and sea')), 13)
def test_doi():
"""Test 'doi' command."""
assert_equals(doi('9780195132861'), '10.978.019/5132861')
assert_equals(doi('9780321534965'), '10.978.0321/534965')
assert_equals(doi('9791090636071'), '10.979.1090636/071')
def test_desc():
"""Test 'desc' command."""
assert_equals(len(desc('9780156001311')) > 10, True)
assert_equals(desc('9780000000000'), None)
def test_cover():
"""Test 'cover' command."""
assert_equals(cover('9780156001311')[1][:13], '9780156001311') # <-- no size 2 (in most areas) but size 1
assert_equals(cover('9780000000000'), None) # <-- invalid ISBN
assert_equals(cover('9781408835029')[1][:13], '9781408835029')
assert_equals(cover('9789727576807')[1], None) # <-- no image of any size
isbnlib-3.5.6/isbnlib/test/test_files.py 0000664 0000000 0000000 00000004240 12533556027 0020273 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
""" nose tests
"""
import locale
import os
from ..dev._files import File, cwdfiles
from nose.tools import assert_equals, assert_raises
WINDOWS = os.name == 'nt'
ENCODING = locale.getpreferredencoding()
if ENCODING == 'UTF-8':
TESTFILE = './ç-deleteme.pdf' if WINDOWS else '/tmp/海明威-deleteme.pdf'
NEW_BASENAME = 'ç-deleteme-PLEASE.pdf' if WINDOWS else '海明威-deleteme-PLEASE.pdf'
else:
print("Your default locale encoding (%s) doesn't allow unicode filenames!" % ENCODING)
TESTFILE = './deleteme.pdf'
NEW_BASENAME = 'deleteme-PLEASE.pdf'
def setup_module():
with open(TESTFILE, 'w') as f:
f.write('ooo')
os.chdir(os.path.dirname(TESTFILE))
def teardown_module():
os.remove(os.path.join(os.path.dirname(TESTFILE), NEW_BASENAME))
def test_isfile():
"""Test if a path is a file."""
f = File(TESTFILE)
assert f.isfile(TESTFILE) == True
def test_exists():
"""Test if a path is a file or a directory."""
f = File(TESTFILE)
assert f.exists(TESTFILE) == True
def test_validate():
"""Test if a string is a valid filename for 'ren' command."""
f = File(TESTFILE)
assert f.validate('basename.pdf') == True
assert f.validate('as/basename.pdf') == False
assert f.validate('.basename.pdf') == True
assert f.validate('.basename') == False
assert f.validate('') == False
def test_mkwinsafe():
"""Test if a string is a valid basename in Windows."""
f = File(TESTFILE)
assert f.mkwinsafe('Açtr: ') == 'Açtr'
assert f.mkwinsafe('as/tiõ') == 'astiõ'
assert f.mkwinsafe('file ""name?') == 'file name'
assert f.mkwinsafe('file ""name?', space='_') == 'file_name'
assert f.mkwinsafe('file name ') == 'file name'
def test_baserename():
"""Test the rename of a basename."""
f = File(TESTFILE)
assert f.baserename(NEW_BASENAME) == True
assert f.baserename(NEW_BASENAME) == True
def test_cwdfiles():
"""Test the renaming of files in cwd."""
assert (NEW_BASENAME in cwdfiles()) == True
assert (NEW_BASENAME in cwdfiles('*.pdf')) == True
assert (NEW_BASENAME in cwdfiles('*.txt')) == False
isbnlib-3.5.6/isbnlib/test/test_fmt.py 0000664 0000000 0000000 00000001673 12533556027 0017766 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
from nose.tools import assert_equals
from ..dev._bouth23 import u
from ..dev._fmt import fmtbib
canonical = {
'ISBN-13': u('9780123456789'),
'Title': u('A book about nothing'),
'Publisher': u('No Paper Press'),
'Year': u('2000'),
'Language': u('en'),
'Authors': [u('John Smith'), u('José Silva')]
}
def test_fmtbib():
"""Test the formating into several bibliographic formats."""
assert_equals(len(fmtbib("bibtex", canonical)), 182)
assert_equals(len(fmtbib("labels", canonical)), 158)
assert_equals(len(fmtbib("endnote", canonical)), 103)
assert_equals(len(fmtbib("msword", canonical)), 485)
assert_equals(len(fmtbib("json", canonical)), 229)
assert_equals(len(fmtbib("refworks", canonical)), 130)
assert_equals(len(fmtbib("opf", canonical)), 861)
isbnlib-3.5.6/isbnlib/test/test_goom.py 0000664 0000000 0000000 00000000452 12533556027 0020133 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
from .. import _goom as goom
from nose.tools import assert_equals
def test_goom():
"""Test the Google's Multiple Books service."""
assert_equals(len(repr(goom.query('the old man and the sea'))) > 1000, True)
isbnlib-3.5.6/isbnlib/test/test_helpers.py 0000664 0000000 0000000 00000003050 12533556027 0020631 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
from ..dev._helpers import last_first, cutoff_tokens, parse_placeholders, fake_isbn
from nose.tools import assert_equals
def test_last_first():
"""Test the parsing of author's name into (Surname, First Name)."""
assert_equals(last_first("Surname, First Name"), {"last": "Surname", "first": "First Name"})
assert_equals(last_first("First Name Surname"), {"last": "Surname", "first": "First Name"})
assert_equals(last_first("Surname1, First1 and Sur2, First2"), {"last": "Surname1", "first": "First1 and Sur2, First2"})
def test_cutoff_tokens():
"""Test the 'cutoff_tokens' function."""
assert_equals(cutoff_tokens(['1', '23', '456'], 3), ['1', '23'])
def test_parse_placeholders():
"""Test the parsing of placeholders."""
assert_equals(parse_placeholders('{isbn}_akaj_{name}'), ['{isbn}', '{name}'])
def test_fake_isbn():
"""Test the 'fake_isbn' function."""
assert_equals(fake_isbn(' Hello?? Wer, ! ksDf: asdf. ; '), '1111006407537')
assert_equals(fake_isbn(' Hello?? Wer, ! ksDf: asdf. ; ', author=''), '1108449680873')
assert_equals(fake_isbn(' Hello?? Wer, ! ksDf: asdf. ; ', author=' '), '1108449680873')
assert_equals(fake_isbn(' Hello?? Wer, ! ksDf: asdf. ; ', author='', publisher=''), '1181593982422')
assert_equals(fake_isbn(' Hello?? Wer, ! ksDf: asdf. ; ', author='a', publisher='K'), '1895031085488')
assert_equals(fake_isbn(' Hello?? Wer, ! ksDf: asdf. ; ', author='A', publisher='k'), '1895031085488')
isbnlib-3.5.6/isbnlib/test/test_info.py 0000664 0000000 0000000 00000002225 12533556027 0020125 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
from .._infogroup import infogroup
from .._ext import info
from nose.tools import assert_equals, assert_raises
# nose tests
def test_infogroup():
"""Test 'infogroup' language/country function."""
assert_equals(infogroup('9789727576807'), 'Portugal')
assert_equals(infogroup('978-972-757-680-7'), 'Portugal')
assert_equals(infogroup('7500117019'), "China, People's Republic")
assert_equals(infogroup('7-5001-1701-9'), "China, People's Republic")
assert_equals(infogroup('9524712946'), 'Finland')
assert_equals(infogroup('0330284983'),
'English language')
assert_equals(infogroup('3796519008'),
'German language')
assert_raises(Exception, infogroup, '92xxxxxxxxxxx')
assert_raises(Exception, infogroup, '')
assert_equals(infogroup('9791090636071'), 'France')
assert_equals(infogroup('9786131796364'), 'Mauritius')
assert_equals(infogroup('9789992158104'), 'Qatar')
def test_ext_info():
"""Test 'info' language/country function."""
assert_equals(info('9524712946'), 'Finland')
assert_raises(Exception, info, '')
isbnlib-3.5.6/isbnlib/test/test_metadata.py 0000664 0000000 0000000 00000003072 12533556027 0020753 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""nose tests for metadata."""
from random import randrange
from .._metadata import query
from .._ext import meta
from nose.tools import assert_equals, assert_raises
def test_query():
"""Test the query of metadata with 'low level' queries."""
# test query from metadata
assert_raises(Exception, query, '9781849692341', 'goog')
assert_raises(Exception, query, '9781849692342', 'goob')
assert_raises(Exception, query, '9781849692341', 'wcat')
assert_equals(len(repr(query('9780321534965', 'wcat'))) > 150, True)
assert_equals(len(repr(query('9780321534965'))) > 150, True)
assert_equals(len(repr(query('9780321534965', 'merge'))) > 150, True)
assert_equals(len(repr(query('9780321534965', 'goob'))) > 150, True)
assert_equals(len(repr(query('9789934015960'))) > 150, True)
assert_equals(len(repr(query(u'9781118241257'))) > 149, True)
assert_raises(Exception, query, '9780000000', 'wcat', None)
assert_raises(Exception, query, randrange(0, 1000000), 'wcat')
def test_ext_meta():
"""Test the query of metadata with 'high level' meta function."""
# test meta from core
assert_equals(len(repr(meta('9780321534965', 'wcat'))) > 150, True)
assert_equals(len(repr(meta('9780321534965', 'merge'))) > 150, True)
assert_equals(len(repr(meta('9780321534965'))) > 150, True)
assert_raises(Exception, meta, '9780000000', 'wcat', None)
assert_raises(Exception, meta, randrange(0, 1000000), 'wcat')
assert_raises(Exception, meta, '9781849692342', 'goob', None)
isbnlib-3.5.6/isbnlib/test/test_openl.py 0000664 0000000 0000000 00000000623 12533556027 0020307 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
""" nose tests
"""
from .._metadata import query
from nose.tools import assert_equals, assert_raises
def test_query():
"""Test 'openl' metadata service."""
# test query from metadata
assert_equals(len(repr(query('9780195132861', 'openl'))) > 140, True)
assert_equals(len(repr(query('9780156001311', 'openl'))) > 140, True)
isbnlib-3.5.6/isbnlib/test/test_rename.py 0000664 0000000 0000000 00000004224 12533556027 0020442 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
import locale
import os
from nose.tools import assert_equals, assert_raises
from .._ext import ren
from ..dev._bouth23 import b2u3, u
from ..dev.helpers import File, cwdfiles
"""
nose tests
"""
WINDOWS = os.name == 'nt'
ENCODING = locale.getpreferredencoding()
if ENCODING != 'UTF-8':
print("Your default locale encoding (%s) doesn't allow unicode filenames!" % ENCODING)
print("=> Some tests could fail.")
TESTFILE_1 = './ç-deleteme.pdf' if WINDOWS else '/tmp/ç-deleteme.pdf'
TESTFILE_2 = './ç-deleteme-PLEASE.pdf' if WINDOWS else '/tmp/ç-deleteme-PLEASE.pdf'
F1 = '9780321534965.pdf'
F2 = '9781597499644.pdf'
F3 = '9781852330729.pdf'
F4 = '9787500117018.pdf'
F5 = '9789727576807.pdf'
F6 = 'Campos2011_Emergências obstétricas_9789727576807.pdf'
F7 = 'Knuth2008_The Art Of Computer Programming_9780321534965.pdf'
F8 = 'Man2001_Genetic Algorithms Concepts And Designs_9781852330729.pdf'
F9 = "O'Connor2012_Violent Python A Cookbook for Hackers, Forensic Analysts, Penetra_9781597499644.pdf"
F10 = '海明威2007_Lao ren yu hai_9787500117018.pdf'
F11 = 'myfile.pdf'
FISBN = [F1, F2, F3, F4, F5]
FFT = [F6, F7, F8, F9, F10]
FILES = FISBN + FFT + [F11]
def create_files(files):
os.chdir(os.path.dirname(TESTFILE_1))
for fn in files:
try:
with open(fn, 'w') as f:
f.write(b2u3('ooo') + b2u3(fn))
except UnicodeEncodeError:
print("Your default locale (%s) doesn't allow non-ascii filenames!" % locale.CODESET)
def delete_files(fnpatt):
os.chdir(os.path.dirname(TESTFILE_1))
for fn in cwdfiles(fnpatt):
os.remove(fn)
def setup_module():
# create_files([u(TESTFILE_1), u(TESTFILE_2)])
os.chdir(os.path.dirname(TESTFILE_1))
create_files(FISBN+[F11])
def teardown_module():
delete_files("*.pdf")
def test_ren():
"""Test 'high level' ren function."""
ren(F1)
assert_equals('Knuth2008_The Art Of Computer Programming_9780321534965.pdf' in cwdfiles("*.pdf"), True)
# create_files([F5])
# ren(F5)
# assert_equals('Campos2011_Emergências obstétricas_9789727576807.pdf' in cwdfiles("*.pdf"), True)
isbnlib-3.5.6/isbnlib/test/test_unicode_to_utf8tex.py 0000664 0000000 0000000 00000000647 12533556027 0023017 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
from ..dev._helpers import unicode_to_utf8tex
from nose.tools import assert_equals
def test_unicode_to_utf8tex():
"""Test 'unicode_to_utf8tex' identity transformation."""
assert_equals(unicode_to_utf8tex(u"\u00E2 \u00F5"), b"\^{a}\space \~{o}")
assert_equals(unicode_to_utf8tex(u"\u00E2 \u00F5", (b"\\space ",)), b"\^{a} \~{o}")
isbnlib-3.5.6/isbnlib/test/test_vias.py 0000664 0000000 0000000 00000001754 12533556027 0020142 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
import os
from .. import _merge as merge
from nose.tools import assert_equals
WINDOWS = os.name == 'nt'
def test_vias_modes():
"""Test 'vias' several modes of operation."""
if WINDOWS:
# appveyor doesn't allow!
return
assert_equals(len(repr(merge.query('9780321534965', 'parallel'))) > 170, True)
assert_equals(len(repr(merge.query('9780321534965', 'multi'))) > 170, True)
assert_equals(len(repr(merge.query('9780321534965', 'serial'))) > 170, True)
def test_vias_cache_cleanning():
"""Test 'vias' cache cleanning for serial."""
# test if the secondary cache (cache in vias) does clears... sequentially
assert_equals(len(repr(merge.query('9781484206546', 'serial'))) < 20, True) # NO METADATA
assert_equals(len(repr(merge.query('9780321534965', 'serial'))) > 170, True)
assert_equals(len(repr(merge.query('9781484206546', 'serial'))) < 20, True) # NO METADATA
isbnlib-3.5.6/isbnlib/test/test_words.py 0000664 0000000 0000000 00000000546 12533556027 0020334 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""
nose tests
"""
from .. import _gwords as words
from nose.tools import assert_equals
def test_words():
"""Test 'isbn_from_words' function."""
assert_equals(len(words.goos('the old man and the sea')), 13)
# assert_equals(words.goos('-ISBN -isbn') in ('9781364200329', None), True)
isbnlib-3.5.6/requirements-appveyor.txt 0000664 0000000 0000000 00000000126 12533556027 0020305 0 ustar 00root root 0000000 0000000 coverage==3.7.1
flake8==2.1.0
nose==1.3.4
tox==1.7.1
setuptools==12.0.4
wheel==0.23.0
isbnlib-3.5.6/requirements-dev.txt 0000664 0000000 0000000 00000000273 12533556027 0017221 0 ustar 00root root 0000000 0000000 coverage==3.7.1
flake8==2.1.0
mccabe==0.2.1
mock==1.0.1
nose==1.3.4
pep8==1.5.7
pep8-naming==0.2.2
pep257==0.3.2
pyflakes==0.8.1
pylint==1.2.1
tox==1.7.1
virtualenv==12.0.5
wheel==0.23.0
isbnlib-3.5.6/requirements.txt 0000664 0000000 0000000 00000000000 12533556027 0016431 0 ustar 00root root 0000000 0000000 isbnlib-3.5.6/setup.cfg 0000664 0000000 0000000 00000000064 12533556027 0015000 0 ustar 00root root 0000000 0000000 [bdist_wheel]
universal=1
[nosetests]
verbosity=1
isbnlib-3.5.6/setup.py 0000664 0000000 0000000 00000004454 12533556027 0014700 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# isbnlib - tools for extracting, cleaning and transforming ISBNs
# Copyright (C) 2014 Alexandre Lima Conde
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
from setuptools import setup
from isbnlib import __version__
setup(
name='isbnlib',
version=__version__,
author='xlcnd',
author_email='xlcnd@outlook.com',
url='https://github.com/xlcnd/isbnlib',
download_url='https://github.com/xlcnd/isbnlib/archive/v3.5.6.zip',
packages=['isbnlib',
'isbnlib/dev',
'isbnlib/_data',
'isbnlib/test',
],
license='LGPL v3',
description='Extract, clean, transform, hyphenate and metadata for ISBNs (International Standard Book Number).',
long_description=open('README.rst').read(),
keywords='ISBN, validate, transform, hyphenate, metadata, World Catalogue, Google Books, Open Library, isbndb.com, BibTeX, EndNote, RefWorks, MSWord, opf, BibJSON, ISBN-A, doi, EAN13',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: OS Independent',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Text Processing :: General',
'Topic :: Software Development :: Libraries :: Python Modules',
],
tests_require=['nose'],
test_suite='nose.collector',
)
isbnlib-3.5.6/tox.ini 0000664 0000000 0000000 00000000461 12533556027 0014473 0 ustar 00root root 0000000 0000000 [flake8]
ignore=N806,E721
exclude=*/test/*,*/_data/*
max-complexity=13
[tox]
envlist=py26,py27,py33,py34,checkers
[testenv]
deps=
nose
coverage
commands=
nosetests -v --with-coverage --cover-package=isbnlib
[testenv:checkers]
basepython=python
deps=
flake8
commands=
flake8 isbnlib