From 1aecbc0ed7918ffd31bbf3763cc21af5feafadc7 Mon Sep 17 00:00:00 2001 From: Matthew Newville Date: Sun, 3 Mar 2024 12:52:35 -0600 Subject: [PATCH] update docs for 0.9.32 --- _sources/api.rst.txt | 2 +- _sources/basics.rst.txt | 6 +- _sources/index.rst.txt | 2 +- _sources/installation.rst.txt | 44 +- _sources/motivation.rst.txt | 61 +- _static/background_b01.png | Bin 0 -> 78 bytes _static/basic.css | 2 +- _static/bizstyle.css | 512 ++++++++++++++ _static/bizstyle.js | 30 + _static/css3-mediaqueries.js | 1 + _static/css3-mediaqueries_src.js | 1104 ++++++++++++++++++++++++++++++ _static/documentation_options.js | 2 +- api.html | 44 +- basics.html | 48 +- genindex.html | 16 +- index.html | 57 +- installation.html | 87 +-- motivation.html | 99 ++- objects.inv | Bin 501 -> 492 bytes py-modindex.html | 16 +- search.html | 16 +- searchindex.js | 2 +- 22 files changed, 1933 insertions(+), 218 deletions(-) create mode 100644 _static/background_b01.png create mode 100644 _static/bizstyle.css create mode 100644 _static/bizstyle.js create mode 100644 _static/css3-mediaqueries.js create mode 100644 _static/css3-mediaqueries_src.js diff --git a/_sources/api.rst.txt b/_sources/api.rst.txt index 4688345..23edcf7 100644 --- a/_sources/api.rst.txt +++ b/_sources/api.rst.txt @@ -1,7 +1,7 @@ .. _asteval_api: ======================== -asteval reference +Asteval Reference ======================== .. _numpy: https://numpy.org diff --git a/_sources/basics.rst.txt b/_sources/basics.rst.txt index a70d9ab..0dcce9f 100644 --- a/_sources/basics.rst.txt +++ b/_sources/basics.rst.txt @@ -1,5 +1,5 @@ ================ -Using asteval +Using Asteval ================ This chapter gives a quick overview of asteval, showing basic usage and the @@ -133,7 +133,7 @@ comprehensions ================ list, dict, and set comprehension are supported, acting just as they do in -Python. Generators, yield, and async programmming are not currently supported. +Python. Generators, yield, and async programming are not currently supported. printing @@ -141,7 +141,7 @@ printing For printing, asteval emulates Python's native :func:`print` function. You can change where output is sent with the ``writer`` argument when creating -the interpreter, or supreess printing all together with the ``no_print`` +the interpreter, or suppress printing all together with the ``no_print`` option. By default, outputs are sent to :py:data:`sys.stdout`. diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt index a9d1eba..ccc8390 100644 --- a/_sources/index.rst.txt +++ b/_sources/index.rst.txt @@ -68,6 +68,6 @@ malicious attacks. :maxdepth: 2 installation - motivation basics api + motivation diff --git a/_sources/installation.rst.txt b/_sources/installation.rst.txt index 980d23a..103c0da 100644 --- a/_sources/installation.rst.txt +++ b/_sources/installation.rst.txt @@ -1,41 +1,43 @@ ==================================== -Downloading and Installation +Installing Asteval ==================================== .. _numpy: https://numpy.org/ +.. _numpy_financial: https://numpy.org/numpy-financial/ .. _github: https://github.com/lmfit/asteval .. _PyPI: https://pypi.org/project/asteval/ Requirements ~~~~~~~~~~~~~~~ -Asteval is a pure Python module. For Python 3.8 and higher, there are no -required dependencies outside of the standard library. If `numpy`_ and -`numpy_financial` are available, Asteval will make use of these libraries. The -test suite requires the `pytest` and `coverage` modules, and building the -documentation requires `sphinx`. +Asteval is a pure Python module. The latest stable version is |release|, which +supports Python 3.8 through 3.12. -The latest stable version of asteval is |release|. +Installing `asteval` requires `setuptools` and `setuptools_scm`. No other +libraries outside of the standard library are required. If `numpy`_ and +`numpy_financial`_ are available, `asteval` will make use of these libraries. +Running the test suite requires the `pytest`, `coverage`, and `pytest-cov` +modules, deployment uses `build` and `twine`, and building the documentation +requires `sphinx`. + +Python 3.8 through 3.12 are tested on Windows, MacOS, and Linux, with and +without `numpy`_ installed. Older Python versions have generally been +supported by `asteval` until they are well past the end of security fixes. That +is, while `asteval` is no longer tested with Python 3.7, the latest release may +continue to work with that version. -Versions 0.9.30 and later support Python 3.8 through 3.11 and are and are -automatically tested with these on Windows, MacOS, and Linux, with and without -`numpy`_ installed. Python versions have generally been supported by `asteval` -until they are well past the end of security fixes - there are no immediate -plans to drop support for Python 3.7, though we are no longer test with it. Support for new versions of the Python 3 series is not guaranteed until some time after the official release of that version, as we may not start testing until late in the "beta" period of development. Historically, the delay has not been too long, though `asteval` may not support newly introduced language features. -At this writing (Asteval 0.9.32, March, 2024), testing is done with Python 3.8 -through 3.12, with and without numpy installed. -Download and Installation +Installing with `pip` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The latest stable version of asteval is |release| and is available at -`PyPI`_ or as a conda package. You should be able to install asteval +The latest stable version of `asteval` is |release| and is available at +`PyPI`_ or as a conda package. You should be able to install `asteval` with:: pip install asteval @@ -53,16 +55,14 @@ The latest development version can be found at the `github`_ repository, and clo git clone https://github.com/lmfit/asteval.git -Installation -~~~~~~~~~~~~~~~~~ - -Installation from source on any platform is:: +Installation from the source tree on any platform is can then be done with:: pip install . License ~~~~~~~~~~~~~ -The ASTEVAL code is distribution under the following license: +The `asteval` code and documentation is distribution under the following +license: .. literalinclude:: ../LICENSE diff --git a/_sources/motivation.rst.txt b/_sources/motivation.rst.txt index dadc3d5..c79f9b6 100644 --- a/_sources/motivation.rst.txt +++ b/_sources/motivation.rst.txt @@ -1,9 +1,9 @@ .. _lmfit: https://github.com/lmfit/lmfit-py .. _xraylarch: https://github.com/xraypy/xraylarch -######################## -Motivation for asteval -######################## +==================================== +Motivation for Asteval +==================================== The asteval module allows you to evaluate a large subset of the Python language from within a python program, without using :py:func:`eval`. It is, in effect, @@ -111,33 +111,34 @@ calculation, and so a reasonable looking calculation such as:: can take a noticeable amount of CPU time - if it does not, changing ``1e8`` to ``9e13`` almost certainly will. As another example, consider the expression ``x**y**z``. For values ``x=y=z=5``, the run time will be well under 0.001 -seconds. For ``x=y=z=8``, run time will still be under 1 sec. Changing to ``x=8, -y=9, z=9``, will cause the statement to take several seconds. With ``x=y=z=9``, -executing that statement may take more than 1 hour on some machines. It is not -hard to come up with short program that would run for hundreds of years, which -probably exceeds anyones threshold for an acceptable run-time. There simply is -not a good way to predict how long any code will take to run from the text of -the code itself: run time cannot be determined lexically. To be clear, for -this exponentiation example, asteval will raise a runtime error, telling you -that an exponent > 10,000 is not allowed. But that happens at runtime, after -the value of the exponent has been evaluated, it does not happen by looking at -the text of the code. And, there is no limit on the size of arrays that can be -created because a check would have to done at runtime. There are countless -other "clever ways" to have very long run times that cannot be readily -predicted from the text. - -The exponential example also demonstrates there is not a good way to check for -a long-running calculation within a single Python process. That calculation is -not stuck within the Python interpreter, but in C code (no doubt the ``pow()`` -function) called by the Python interpreter itself. That call will not return -from the C library to the Python interpreter or allow other threads to run -until that call is done. That means that from within a single process, there -would not be a reliable way to tell asteval (or really, even Python) when a -calculation has taken too long: Denial of Service is hard to detect before it -happens, and even challenging to detect while it is happening. The only -reliable way to li`mit run time is at the level of the operating system, with a -second process watching the execution time of the asteval process and either -try to interrupt it or kill it. +seconds. For ``x=y=z=8``, run time will still be under 1 sec. Changing to +``x=8, y=9, z=9``, will cause the statement to take several seconds. With +``x=y=z=9``, executing that statement may take more than 1 hour on some +machines. It is not hard to come up with short program that would run for +hundreds of years, which probably exceeds anyones threshold for an acceptable +run-time. There simply is not a good way to predict how long any code will +take to run from the text of the code itself: run time cannot be determined +lexically. To be clear, for this exponentiation example, asteval will raise a +runtime error, telling you that an exponent > 10,000 is not allowed. Several +other attempts are made to prevent long-running operations. But these checks +happen at runtime (that is, after the value of the exponent has been +evaluated), it does not happen by looking at the text of the code. Very large +arrays and lists can be created that might approach memory limits. There are +countless other "clever ways" to have very long run times that cannot be +readily predicted from the text. + +The exponential example also highlights the issue that there is not a good way +to check for a long-running calculation within a single Python process. That +calculation is not stuck within the Python interpreter, but in C code (no doubt +the ``pow()`` function) called by the Python interpreter itself. That call +will not return from the C library to the Python interpreter or allow other +threads to run until that call is done. That means that from within a single +process, there would not be a reliable way to tell asteval (or really, even +Python) when a calculation has taken too long: Denial of Service is hard to +detect before it happens, and even challenging to detect while it is happening. +The only reliable way to limit run time is at the level of the operating +system, with a second process watching the execution time of the asteval +process and either try to interrupt it or kill it. For a limited range of problems, you can try to avoid asteval taking too long. For example, you may try to limit the *recursion limit* when diff --git a/_static/background_b01.png b/_static/background_b01.png new file mode 100644 index 0000000000000000000000000000000000000000..353f26dde0803aa172c23e21ef6ac068e1253bc8 GIT binary patch literal 78 zcmeAS@N?(olHy`uVBq!ia0vp^%plAGBp8aFUnK)6QBN1gkP61+AN9}d56}GnU-I97 adu9eB2afnIr`wM~3O!x@T-G@yGywpsd=;et literal 0 HcmV?d00001 diff --git a/_static/basic.css b/_static/basic.css index 30fee9d..c8079f4 100644 --- a/_static/basic.css +++ b/_static/basic.css @@ -55,7 +55,7 @@ div.sphinxsidebarwrapper { div.sphinxsidebar { float: left; - width: 230px; + width: 210px; margin-left: -100%; font-size: 90%; word-wrap: break-word; diff --git a/_static/bizstyle.css b/_static/bizstyle.css new file mode 100644 index 0000000..48b4208 --- /dev/null +++ b/_static/bizstyle.css @@ -0,0 +1,512 @@ +/* + * bizstyle.css_t + * ~~~~~~~~~~~~~~ + * + * Sphinx stylesheet -- business style theme. + * + * :copyright: Copyright 2007-2023 by Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', + 'Verdana', sans-serif; + font-size: 14px; + letter-spacing: -0.01em; + line-height: 150%; + text-align: center; + background-color: white; + background-image: url(background_b01.png); + color: black; + padding: 0; + border-right: 1px solid #336699; + border-left: 1px solid #336699; + + margin: 0px 40px 0px 40px; +} + +div.document { + background-color: white; + text-align: left; + background-repeat: repeat-x; + + -moz-box-shadow: 2px 2px 5px #000; + -webkit-box-shadow: 2px 2px 5px #000; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 240px; + border-left: 1px solid #ccc; +} + +div.body { + margin: 0; + padding: 0.5em 20px 20px 20px; +} +div.bodywrapper { + margin: 0 0 0 calc(210px + 30px); +} + +div.related { + font-size: 1em; + + -moz-box-shadow: 2px 2px 5px #000; + -webkit-box-shadow: 2px 2px 5px #000; +} + +div.related ul { + background-color: #336699; + height: 100%; + overflow: hidden; + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; +} + +div.related ul li { + color: white; + margin: 0; + padding: 0; + height: 2em; + float: left; +} + +div.related ul li.right { + float: right; + margin-right: 5px; +} + +div.related ul li a { + margin: 0; + padding: 0 5px 0 5px; + line-height: 1.75em; + color: #fff; +} + +div.related ul li a:hover { + color: #fff; + text-decoration: underline; +} + +div.sphinxsidebarwrapper { + padding: 0; +} + +div.sphinxsidebar { + padding: 0.5em 12px 12px 12px; + width: 210px; + font-size: 1em; + text-align: left; +} + +div.sphinxsidebar h3, div.sphinxsidebar h4 { + margin: 1em 0 0.5em 0; + font-size: 1em; + padding: 0.1em 0 0.1em 0.5em; + color: white; + border: 1px solid #336699; + background-color: #336699; +} + +div.sphinxsidebar h3 a { + color: white; +} + +div.sphinxsidebar ul { + padding-left: 1.5em; + margin-top: 7px; + padding: 0; + line-height: 130%; +} + +div.sphinxsidebar ul ul { + margin-left: 20px; +} + +div.sphinxsidebar input { + border: 1px solid #336699; +} + +div.footer { + background-color: white; + color: #336699; + padding: 3px 8px 3px 0; + clear: both; + font-size: 0.8em; + text-align: right; + border-bottom: 1px solid #336699; + + -moz-box-shadow: 2px 2px 5px #000; + -webkit-box-shadow: 2px 2px 5px #000; +} + +div.footer a { + color: #336699; + text-decoration: underline; +} + +/* -- body styles ----------------------------------------------------------- */ + +p { + margin: 0.8em 0 0.5em 0; +} + +a { + color: #336699; + text-decoration: none; +} + +a:hover { + color: #336699; + text-decoration: underline; +} + +a:visited { + color: #551a8b; +} + +div.body a { + text-decoration: underline; +} + +h1, h2, h3 { + color: #336699; +} + +h1 { + margin: 0; + padding: 0.7em 0 0.3em 0; + font-size: 1.5em; +} + +h2 { + margin: 1.3em 0 0.2em 0; + font-size: 1.35em; + padding-bottom: .5em; + border-bottom: 1px solid #336699; +} + +h3 { + margin: 1em 0 -0.3em 0; + font-size: 1.2em; + padding-bottom: .3em; + border-bottom: 1px solid #CCCCCC; +} + +div.body h1 a, div.body h2 a, div.body h3 a, +div.body h4 a, div.body h5 a, div.body h6 a { + color: black!important; +} + +h1 a.anchor, h2 a.anchor, h3 a.anchor, +h4 a.anchor, h5 a.anchor, h6 a.anchor { + display: none; + margin: 0 0 0 0.3em; + padding: 0 0.2em 0 0.2em; + color: #aaa!important; +} + +h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, +h5:hover a.anchor, h6:hover a.anchor { + display: inline; +} + +h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover, +h5 a.anchor:hover, h6 a.anchor:hover { + color: #777; + background-color: #eee; +} + +a.headerlink { + color: #c60f0f!important; + font-size: 1em; + margin-left: 6px; + padding: 0 4px 0 4px; + text-decoration: none!important; +} + +a.headerlink:hover { + background-color: #ccc; + color: white!important; +} + +cite, code, tt { + font-family: 'Consolas', 'Deja Vu Sans Mono', + 'Bitstream Vera Sans Mono', monospace; + font-size: 0.95em; + letter-spacing: 0.01em; +} + +code { + background-color: #F2F2F2; + border-bottom: 1px solid #ddd; + color: #333; +} + +code.descname, code.descclassname, code.xref { + border: 0; +} + +hr { + border: 1px solid #abc; + margin: 2em; +} + +a code { + border: 0; + color: #CA7900; +} + +a code:hover { + color: #2491CF; +} + +pre { + background-color: transparent !important; + font-family: 'Consolas', 'Deja Vu Sans Mono', + 'Bitstream Vera Sans Mono', monospace; + font-size: 0.95em; + letter-spacing: 0.015em; + line-height: 120%; + padding: 0.5em; + border-right: 5px solid #ccc; + border-left: 5px solid #ccc; +} + +pre a { + color: inherit; + text-decoration: underline; +} + +td.linenos pre { + padding: 0.5em 0; +} + +div.quotebar { + background-color: #f8f8f8; + max-width: 250px; + float: right; + padding: 2px 7px; + border: 1px solid #ccc; +} + +nav.contents, +aside.topic, +div.topic { + background-color: #f8f8f8; +} + +table { + border-collapse: collapse; + margin: 0 -0.5em 0 -0.5em; +} + +table td, table th { + padding: 0.2em 0.5em 0.2em 0.5em; +} + +div.admonition { + font-size: 0.9em; + margin: 1em 0 1em 0; + border: 3px solid #cccccc; + background-color: #f7f7f7; + padding: 0; +} + +div.admonition p { + margin: 0.5em 1em 0.5em 1em; + padding: 0; +} + +div.admonition li p { + margin-left: 0; +} + +div.admonition pre, div.warning pre { + margin: 0; +} + +div.highlight { + margin: 0.4em 1em; +} + +div.admonition p.admonition-title { + margin: 0; + padding: 0.1em 0 0.1em 0.5em; + color: white; + border-bottom: 3px solid #cccccc; + font-weight: bold; + background-color: #165e83; +} + +div.danger { border: 3px solid #f0908d; background-color: #f0cfa0; } +div.error { border: 3px solid #f0908d; background-color: #ede4cd; } +div.warning { border: 3px solid #f8b862; background-color: #f0cfa0; } +div.caution { border: 3px solid #f8b862; background-color: #ede4cd; } +div.attention { border: 3px solid #f8b862; background-color: #f3f3f3; } +div.important { border: 3px solid #f0cfa0; background-color: #ede4cd; } +div.note { border: 3px solid #f0cfa0; background-color: #f3f3f3; } +div.hint { border: 3px solid #bed2c3; background-color: #f3f3f3; } +div.tip { border: 3px solid #bed2c3; background-color: #f3f3f3; } + +div.danger p.admonition-title, div.error p.admonition-title { + background-color: #b7282e; + border-bottom: 3px solid #f0908d; +} + +div.caution p.admonition-title, +div.warning p.admonition-title, +div.attention p.admonition-title { + background-color: #f19072; + border-bottom: 3px solid #f8b862; +} + +div.note p.admonition-title, div.important p.admonition-title { + background-color: #f8b862; + border-bottom: 3px solid #f0cfa0; +} + +div.hint p.admonition-title, div.tip p.admonition-title { + background-color: #7ebea5; + border-bottom: 3px solid #bed2c3; +} + +div.admonition ul, div.admonition ol, +div.warning ul, div.warning ol { + margin: 0.1em 0.5em 0.5em 3em; + padding: 0; +} + +div.versioninfo { + margin: 1em 0 0 0; + border: 1px solid #ccc; + background-color: #DDEAF0; + padding: 8px; + line-height: 1.3em; + font-size: 0.9em; +} + +.viewcode-back { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', + 'Verdana', sans-serif; +} + +div.viewcode-block:target { + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} + +p.versionchanged span.versionmodified { + font-size: 0.9em; + margin-right: 0.2em; + padding: 0.1em; + background-color: #DCE6A0; +} + +dl.field-list > dt { + color: white; + background-color: #82A0BE; +} + +dl.field-list > dd { + background-color: #f7f7f7; +} + +/* -- table styles ---------------------------------------------------------- */ + +table.docutils { + margin: 1em 0; + padding: 0; + border: 1px solid white; + background-color: #f7f7f7; +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 1px solid white; + border-bottom: 1px solid white; +} + +table.docutils td p { + margin-top: 0; + margin-bottom: 0.3em; +} + +table.field-list td, table.field-list th { + border: 0 !important; + word-break: break-word; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + color: white; + text-align: left; + padding-right: 5px; + background-color: #82A0BE; +} + +div.literal-block-wrapper div.code-block-caption { + background-color: #EEE; + border-style: solid; + border-color: #CCC; + border-width: 1px 5px; +} + +/* WIDE DESKTOP STYLE */ +@media only screen and (min-width: 1176px) { +body { + margin: 0 40px 0 40px; +} +} + +/* TABLET STYLE */ +@media only screen and (min-width: 768px) and (max-width: 991px) { +body { + margin: 0 40px 0 40px; +} +} + +/* MOBILE LAYOUT (PORTRAIT/320px) */ +@media only screen and (max-width: 767px) { +body { + margin: 0; +} +div.bodywrapper { + margin: 0; + width: 100%; + border: none; +} +div.sphinxsidebar { + display: none; +} +} + +/* MOBILE LAYOUT (LANDSCAPE/480px) */ +@media only screen and (min-width: 480px) and (max-width: 767px) { +body { + margin: 0 20px 0 20px; +} +} + +/* RETINA OVERRIDES */ +@media +only screen and (-webkit-min-device-pixel-ratio: 2), +only screen and (min-device-pixel-ratio: 2) { +} + +/* -- end ------------------------------------------------------------------- */ \ No newline at end of file diff --git a/_static/bizstyle.js b/_static/bizstyle.js new file mode 100644 index 0000000..fdcbfad --- /dev/null +++ b/_static/bizstyle.js @@ -0,0 +1,30 @@ +// +// bizstyle.js +// ~~~~~~~~~~~ +// +// Sphinx javascript -- for bizstyle theme. +// +// This theme was created by referring to 'sphinxdoc' +// +// :copyright: Copyright 2007-2023 by Sphinx team, see AUTHORS. +// :license: BSD, see LICENSE for details. +// +const initialiseBizStyle = () => { + if (navigator.userAgent.indexOf("iPhone") > 0 || navigator.userAgent.indexOf("Android") > 0) { + document.querySelector("li.nav-item-0 a").innerText = "Top" + } + const truncator = item => {if (item.textContent.length > 20) { + item.title = item.innerText + item.innerText = item.innerText.substr(0, 17) + "..." + } + } + document.querySelectorAll("div.related:first ul li:not(.right) a").slice(1).forEach(truncator); + document.querySelectorAll("div.related:last ul li:not(.right) a").slice(1).forEach(truncator); +} + +window.addEventListener("resize", + () => (document.querySelector("li.nav-item-0 a").innerText = (window.innerWidth <= 776) ? "Top" : "ASTEVAL: Minimal Python AST evaluator") +) + +if (document.readyState !== "loading") initialiseBizStyle() +else document.addEventListener("DOMContentLoaded", initialiseBizStyle) \ No newline at end of file diff --git a/_static/css3-mediaqueries.js b/_static/css3-mediaqueries.js new file mode 100644 index 0000000..59735f5 --- /dev/null +++ b/_static/css3-mediaqueries.js @@ -0,0 +1 @@ +if(typeof Object.create!=="function"){Object.create=function(e){function t(){}t.prototype=e;return new t}}var ua={toString:function(){return navigator.userAgent},test:function(e){return this.toString().toLowerCase().indexOf(e.toLowerCase())>-1}};ua.version=(ua.toString().toLowerCase().match(/[\s\S]+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1];ua.webkit=ua.test("webkit");ua.gecko=ua.test("gecko")&&!ua.webkit;ua.opera=ua.test("opera");ua.ie=ua.test("msie")&&!ua.opera;ua.ie6=ua.ie&&document.compatMode&&typeof document.documentElement.style.maxHeight==="undefined";ua.ie7=ua.ie&&document.documentElement&&typeof document.documentElement.style.maxHeight!=="undefined"&&typeof XDomainRequest==="undefined";ua.ie8=ua.ie&&typeof XDomainRequest!=="undefined";var domReady=function(){var e=[];var t=function(){if(!arguments.callee.done){arguments.callee.done=true;for(var t=0;t=200&&r.status<300||r.status===304||navigator.userAgent.indexOf("Safari")>-1&&typeof r.status==="undefined"){t(r.responseText)}else{n()}document.documentElement.style.cursor="";r=null}};r.send("")};var l=function(t){t=t.replace(e.REDUNDANT_COMPONENTS,"");t=t.replace(e.REDUNDANT_WHITESPACE,"$1");t=t.replace(e.WHITESPACE_IN_PARENTHESES,"($1)");t=t.replace(e.MORE_WHITESPACE," ");t=t.replace(e.FINAL_SEMICOLONS,"}");return t};var c={stylesheet:function(t){var n={};var r=[],i=[],s=[],o=[];var u=t.cssHelperText;var a=t.getAttribute("media");if(a){var f=a.toLowerCase().split(",")}else{var f=["all"]}for(var l=0;l-1&&a.href&&a.href.length!==0&&!a.disabled){r[r.length]=a}}if(r.length>0){var c=0;var d=function(){c++;if(c===r.length){i()}};var v=function(t){var n=t.href;f(n,function(r){r=l(r).replace(e.RELATIVE_URLS,"url("+n.substring(0,n.lastIndexOf("/"))+"/$1)");t.cssHelperText=r;d()},d)};for(u=0;u0){r.setAttribute("media",t.join(","))}document.getElementsByTagName("head")[0].appendChild(r);if(r.styleSheet){r.styleSheet.cssText=e}else{r.appendChild(document.createTextNode(e))}r.addedWithCssHelper=true;if(typeof n==="undefined"||n===true){cssHelper.parsed(function(t){var n=p(r,e);for(var i in n){if(n.hasOwnProperty(i)){g(i,n[i])}}a("newStyleParsed",r)})}else{r.parsingDisallowed=true}return r},removeStyle:function(e){return e.parentNode.removeChild(e)},parsed:function(e){if(n){s(e)}else{if(typeof t!=="undefined"){if(typeof e==="function"){e(t)}}else{s(e);d()}}},stylesheets:function(e){cssHelper.parsed(function(t){e(m.stylesheets||y("stylesheets"))})},mediaQueryLists:function(e){cssHelper.parsed(function(t){e(m.mediaQueryLists||y("mediaQueryLists"))})},rules:function(e){cssHelper.parsed(function(t){e(m.rules||y("rules"))})},selectors:function(e){cssHelper.parsed(function(t){e(m.selectors||y("selectors"))})},declarations:function(e){cssHelper.parsed(function(t){e(m.declarations||y("declarations"))})},properties:function(e){cssHelper.parsed(function(t){e(m.properties||y("properties"))})},broadcast:a,addListener:function(e,t){if(typeof t==="function"){if(!u[e]){u[e]={listeners:[]}}u[e].listeners[u[e].listeners.length]=t}},removeListener:function(e,t){if(typeof t==="function"&&u[e]){var n=u[e].listeners;for(var r=0;r=a||s&&l0}}else if("device-height"===e.substring(r-13,r)){c=screen.height;if(t!==null){if(u==="length"){return i&&c>=a||s&&c0}}else if("width"===e.substring(r-5,r)){l=document.documentElement.clientWidth||document.body.clientWidth;if(t!==null){if(u==="length"){return i&&l>=a||s&&l0}}else if("height"===e.substring(r-6,r)){c=document.documentElement.clientHeight||document.body.clientHeight;if(t!==null){if(u==="length"){return i&&c>=a||s&&c0}}else if("device-aspect-ratio"===e.substring(r-19,r)){return u==="aspect-ratio"&&screen.width*a[1]===screen.height*a[0]}else if("color-index"===e.substring(r-11,r)){var h=Math.pow(2,screen.colorDepth);if(t!==null){if(u==="absolute"){return i&&h>=a||s&&h0}}else if("color"===e.substring(r-5,r)){var p=screen.colorDepth;if(t!==null){if(u==="absolute"){return i&&p>=a||s&&p0}}else if("resolution"===e.substring(r-10,r)){var d;if(f==="dpcm"){d=o("1cm")}else{d=o("1in")}if(t!==null){if(u==="resolution"){return i&&d>=a||s&&d0}}else{return false}};var a=function(e){var t=e.getValid();var n=e.getExpressions();var r=n.length;if(r>0){for(var i=0;i0){u=false;for(var f=0;f0){l[c++]=","}l[c++]=h}}if(l.length>0){r[r.length]=cssHelper.addStyle("@media "+l.join("")+"{"+e.getCssText()+"}",t,false)}};var l=function(e,t){for(var n=0;n0}}var o=[],u=[];for(var f in i){if(i.hasOwnProperty(f)){o[o.length]=f;if(i[f]){u[u.length]=f}if(f==="all"){n=true}}}if(u.length>0){r[r.length]=cssHelper.addStyle(e.getCssText(),u,false)}var c=e.getMediaQueryLists();if(n){l(c)}else{l(c,o)}};var h=function(e){for(var t=0;td||Math.abs(s-t)>d){e=n;t=s;clearTimeout(r);r=setTimeout(function(){if(!i()){p()}else{cssHelper.broadcast("cssMediaQueriesTested")}},500)}};window.onresize=function(){var e=window.onresize||function(){};return function(){e();s()}}()};var m=document.documentElement;m.style.marginLeft="-32767px";setTimeout(function(){m.style.marginLeft=""},5e3);return function(){if(!i()){cssHelper.addListener("newStyleParsed",function(e){c(e.cssHelperParsed.stylesheet)});cssHelper.addListener("cssMediaQueriesTested",function(){if(ua.ie){m.style.width="1px"}setTimeout(function(){m.style.width="";m.style.marginLeft=""},0);cssHelper.removeListener("cssMediaQueriesTested",arguments.callee)});s();p()}else{m.style.marginLeft=""}v()}}());try{document.execCommand("BackgroundImageCache",false,true)}catch(e){} diff --git a/_static/css3-mediaqueries_src.js b/_static/css3-mediaqueries_src.js new file mode 100644 index 0000000..7878620 --- /dev/null +++ b/_static/css3-mediaqueries_src.js @@ -0,0 +1,1104 @@ +/* +css3-mediaqueries.js - CSS Helper and CSS3 Media Queries Enabler + +author: Wouter van der Graaf +version: 1.0 (20110330) +license: MIT +website: http://code.google.com/p/css3-mediaqueries-js/ + +W3C spec: http://www.w3.org/TR/css3-mediaqueries/ + +Note: use of embedded