From 4872ae9ab0ac2c3dde846d3d396221b5a2c0ad9a Mon Sep 17 00:00:00 2001 From: Automatic Publish Date: Mon, 13 Nov 2017 12:38:21 +0000 Subject: [PATCH 01/53] Deployed 2491c28 with MkDocs version: 0.17.1 --- .nojekyll | 0 404.html | 279 ++++++++ assets/images/favicon.ico | Bin 0 -> 1150 bytes assets/images/icons/bitbucket-670608a71a.svg | 1 + assets/images/icons/github-1da075986e.svg | 1 + assets/images/icons/gitlab-5ad3f9f9e5.svg | 1 + assets/javascripts/application-8e4952e681.js | 1 + assets/javascripts/lunr/lunr.da.js | 1 + assets/javascripts/lunr/lunr.de.js | 1 + assets/javascripts/lunr/lunr.du.js | 1 + assets/javascripts/lunr/lunr.es.js | 1 + assets/javascripts/lunr/lunr.fi.js | 1 + assets/javascripts/lunr/lunr.fr.js | 1 + assets/javascripts/lunr/lunr.hu.js | 1 + assets/javascripts/lunr/lunr.it.js | 1 + assets/javascripts/lunr/lunr.jp.js | 1 + assets/javascripts/lunr/lunr.multi.js | 1 + assets/javascripts/lunr/lunr.no.js | 1 + assets/javascripts/lunr/lunr.pt.js | 1 + assets/javascripts/lunr/lunr.ro.js | 1 + assets/javascripts/lunr/lunr.ru.js | 1 + .../javascripts/lunr/lunr.stemmer.support.js | 1 + assets/javascripts/lunr/lunr.sv.js | 1 + assets/javascripts/lunr/lunr.tr.js | 1 + assets/javascripts/lunr/tinyseg.js | 1 + assets/javascripts/modernizr-e826f8942a.js | 1 + .../application-23f75ab9c7.palette.css | 1 + assets/stylesheets/application-709eec9410.css | 1 + changelog/index.html | 373 ++++++++++ index.html | 526 ++++++++++++++ junit/TESTS-TestSuites.xml | 2 + junit/all-tests.html | 22 + junit/allclasses-frame.html | 11 + junit/alltests-errors.html | 22 + junit/alltests-fails.html | 22 + junit/alltests-skipped.html | 22 + junit/assets/style.css | 157 ++++ junit/index.html | 19 + junit/junit-badge.svg | 1 + junit/junit.xml | 1 + junit/overview-frame.html | 14 + junit/overview-summary.html | 38 + junit/report.html | 671 ++++++++++++++++++ junit/stylesheet.css | 48 ++ mkdocs.yml | 13 + search/search_index.json | 3 + sitemap.xml | 28 + usage/index.html | 389 ++++++++++ 48 files changed, 2686 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 assets/images/favicon.ico create mode 100644 assets/images/icons/bitbucket-670608a71a.svg create mode 100644 assets/images/icons/github-1da075986e.svg create mode 100644 assets/images/icons/gitlab-5ad3f9f9e5.svg create mode 100644 assets/javascripts/application-8e4952e681.js create mode 100644 assets/javascripts/lunr/lunr.da.js create mode 100644 assets/javascripts/lunr/lunr.de.js create mode 100644 assets/javascripts/lunr/lunr.du.js create mode 100644 assets/javascripts/lunr/lunr.es.js create mode 100644 assets/javascripts/lunr/lunr.fi.js create mode 100644 assets/javascripts/lunr/lunr.fr.js create mode 100644 assets/javascripts/lunr/lunr.hu.js create mode 100644 assets/javascripts/lunr/lunr.it.js create mode 100644 assets/javascripts/lunr/lunr.jp.js create mode 100644 assets/javascripts/lunr/lunr.multi.js create mode 100644 assets/javascripts/lunr/lunr.no.js create mode 100644 assets/javascripts/lunr/lunr.pt.js create mode 100644 assets/javascripts/lunr/lunr.ro.js create mode 100644 assets/javascripts/lunr/lunr.ru.js create mode 100644 assets/javascripts/lunr/lunr.stemmer.support.js create mode 100644 assets/javascripts/lunr/lunr.sv.js create mode 100644 assets/javascripts/lunr/lunr.tr.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/modernizr-e826f8942a.js create mode 100644 assets/stylesheets/application-23f75ab9c7.palette.css create mode 100644 assets/stylesheets/application-709eec9410.css create mode 100644 changelog/index.html create mode 100644 index.html create mode 100644 junit/TESTS-TestSuites.xml create mode 100644 junit/all-tests.html create mode 100644 junit/allclasses-frame.html create mode 100644 junit/alltests-errors.html create mode 100644 junit/alltests-fails.html create mode 100644 junit/alltests-skipped.html create mode 100644 junit/assets/style.css create mode 100644 junit/index.html create mode 100644 junit/junit-badge.svg create mode 100644 junit/junit.xml create mode 100644 junit/overview-frame.html create mode 100644 junit/overview-summary.html create mode 100644 junit/report.html create mode 100644 junit/stylesheet.css create mode 100644 mkdocs.yml create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 usage/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..6c334a2 --- /dev/null +++ b/404.html @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mini_lambda + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+ + +
+
+
+ +
+
+
+ + + +
+
+ +

404 - Not found

+ + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/favicon.ico b/assets/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..e85006a3ce1c6fd81faa6d5a13095519c4a6fc96 GIT binary patch literal 1150 zcmd6lF-yZh9L1kl>(HSEK`2y^4yB6->f+$wD)=oNY!UheIt03Q=;qj=;8*Bap_4*& za8yAl;wmmx5Yyi^7dXN-WYdJ-{qNqpcez|5t#Fr0qTSYcPTG`I2PBk8r$~4kg^0zN zCJe(rhix3do!L$bZ+IuZ{i08x=JR3=e+M4pv0KsKA??{u_*EFfo|`p&t`Vf=jn{)F z1fKk9hWsmYwqWAP^JO*5u*R;*L&dX3H$%S7oB$f0{ISh{QVXuncnzN67WQH2`lip7 zhX+VI$6x$1+$8gMjh4+1l0N#8_0Fh=N#EwpKk{SeE!)SHFB@xQFX3y+8sF#_@!bDW eIdI-IC`$c%>bk?KbPeN9RHtL<1^)v~#xMt8oB^@` literal 0 HcmV?d00001 diff --git a/assets/images/icons/bitbucket-670608a71a.svg b/assets/images/icons/bitbucket-670608a71a.svg new file mode 100644 index 0000000..7d95cb2 --- /dev/null +++ b/assets/images/icons/bitbucket-670608a71a.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/icons/github-1da075986e.svg b/assets/images/icons/github-1da075986e.svg new file mode 100644 index 0000000..3cacb2e --- /dev/null +++ b/assets/images/icons/github-1da075986e.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/icons/gitlab-5ad3f9f9e5.svg b/assets/images/icons/gitlab-5ad3f9f9e5.svg new file mode 100644 index 0000000..b036a9b --- /dev/null +++ b/assets/images/icons/gitlab-5ad3f9f9e5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/javascripts/application-8e4952e681.js b/assets/javascripts/application-8e4952e681.js new file mode 100644 index 0000000..49fe7d1 --- /dev/null +++ b/assets/javascripts/application-8e4952e681.js @@ -0,0 +1 @@ +window.app=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=35)}([function(e,t,n){"use strict";var r=n(23)("wks"),i=n(14),o=n(1).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,n){"use strict";var r=n(10),i=n(25);e.exports=n(5)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(11);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=n(1),i=n(2),o=n(6),a=n(14)("src"),s=Function.toString,c=(""+s).split("toString");n(7).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var u="function"==typeof n;u&&(o(n,"name")||i(n,"name",t)),e[t]!==n&&(u&&(o(n,a)||i(n,a,e[t]?""+e[t]:c.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},function(e,t,n){"use strict";e.exports=!n(24)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,n){"use strict";var r=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,n){"use strict";var r=n(3),i=n(38),o=n(39),a=Object.defineProperty;t.f=n(5)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(e){return"object"===(void 0===e?"undefined":r(e))?null!==e:"function"==typeof e}},function(e,t,n){"use strict";var r=n(18);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(9),i=n(0)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,n){"use strict";var r=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},function(e,t,n){"use strict";var r=n(11),i=n(1).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){"use strict";var r=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:r)(e)}},function(e,t,n){"use strict";e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";var r=n(47),i=n(17);e.exports=function(e){return r(i(e))}},function(e,t,n){"use strict";var r=n(23)("keys"),i=n(14);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){"use strict";var r=n(10).f,i=n(6),o=n(0)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={createElement:function(e,t){var n=document.createElement(e);t&&Array.prototype.forEach.call(Object.keys(t),function(e){n.setAttribute(e,t[e])});for(var r=arguments.length,i=Array(r>2?r-2:0),o=2;o0?i(r(e),9007199254740991):0}},function(e,t,n){"use strict";e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){"use strict";e.exports=n(1).document&&document.documentElement},function(e,t,n){"use strict";var r,i,o,a=n(12),s=n(63),c=n(31),u=n(15),l=n(1),f=l.process,h=l.setImmediate,d=l.clearImmediate,p=l.MessageChannel,m=0,y={},v=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},g=function(e){v.call(e.data)};h&&d||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return y[++m]=function(){s("function"==typeof e?e:Function(e),t)},r(m),m},d=function(e){delete y[e]},"process"==n(9)(f)?r=function(e){f.nextTick(a(v,e,1))}:p?(i=new p,o=i.port2,i.port1.onmessage=g,r=a(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",g,!1)):r="onreadystatechange"in u("script")?function(e){c.appendChild(u("script")).onreadystatechange=function(){c.removeChild(this),v.call(e)}}:function(e){setTimeout(a(v,e,1),0)}),e.exports={set:h,clear:d}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var n=0;n=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";var r=n(16),i=n(17);e.exports=function(e){return function(t,n){var o,a,s=String(i(t)),c=r(n),u=s.length;return c<0||c>=u?e?"":void 0:(o=s.charCodeAt(c),o<55296||o>56319||c+1===u||(a=s.charCodeAt(c+1))<56320||a>57343?e?s.charAt(c):o:e?s.slice(c,c+2):a-56320+(o-55296<<10)+65536)}}},function(e,t,n){"use strict";var r=n(43),i=n(25),o=n(21),a={};n(2)(a,n(0)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){"use strict";var r=n(3),i=n(44),o=n(30),a=n(20)("IE_PROTO"),s=function(){},c=function(){var e,t=n(15)("iframe"),r=o.length;for(t.style.display="none",n(31).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(" + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ + + + + +

Changelog

+ +

1.0.0 - First public version

+
    +
  • Initial fork from valid8 sources.
  • +
+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..47afc9e --- /dev/null +++ b/index.html @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mini_lambda + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ + + + + +

python-mini-lambda (mini_lambda)

+

Simple Lambda functions without lambda x: and with string conversion capability

+

Build Status Tests Status codecov Documentation PyPI

+

This idea initially comes from the valid8 validation library. I ended up understanding that there were two complementary ways to provide users with easy-to-use validation functions:

+
    +
  • either to provide a very exhaustive catalog of functions to cover most use cases (is greater than, is between, etc.). Drawback: we need to reinvent all functions that exist already.
  • +
  • or to provide users with the capability to write custom validation functions, in particular using lambdas. Drawback: the lambda x: prefix has to be present everywhere, and users still have to write the exception messages for validation failures.
  • +
+

The mini_lambda library provides an answer to the second item: it allows developers to write simple functions

+

Although initially developed in the context of validation, this library is now fully independent and can serve other use cases.

+

Installing

+
> pip install mini_lambda
+
+ + +

Usage

+

Check the Usage page for more details.

+

Main features

+

TODO

+

See Also

+

The much-broader debate in the python community about alernate lambda syntaxes is interesting, see here

+

Equivalent (python-first)

+

I found the following libraries somehow covering the same use case, with more or less success/features:

+
    +
  • lambdaX
  • +
  • lambdazen. Based on python source code generation at runtime using a decorator. The main drawback is the need to define lambdas inside a decorated function.
  • +
  • fixing lambda and its associated toy library quicklambda. It is not very exhaustive.
  • +
  • pyexpression is quite similar to quicklambda (above)
  • +
  • fz is also inspired by quicklambda (above). Note: it is GPL-licensed.
  • +
+

A bit far from the topic but related: + * letexpr for let expression like Haskell + * calchylus: lisp-like expressions in python based on Hy + * MiniOperators

+

String expression-first

+

These libraries create functions from string expressions. Therefore you cannot rely on your favourite IDE to check your expressions, but it might not be a problem for some users/use cases.

+ +

Others

+

Do you like this library ? You might also like these

+

Want to contribute ?

+

Details on the github page: https://github.com/smarie/python-mini-lambda

+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/junit/TESTS-TestSuites.xml b/junit/TESTS-TestSuites.xml new file mode 100644 index 0000000..511be84 --- /dev/null +++ b/junit/TESTS-TestSuites.xml @@ -0,0 +1,2 @@ + + diff --git a/junit/all-tests.html b/junit/all-tests.html new file mode 100644 index 0000000..c3de1b0 --- /dev/null +++ b/junit/all-tests.html @@ -0,0 +1,22 @@ + + + +Unit Test Results: All Tests + + + +

Unit Test Results.

+ + + + +
Designed for use with JUnit and Ant.
+
+

All Tests

+ + + + +
ClassNameStatusTypeTime(s)
+ + diff --git a/junit/allclasses-frame.html b/junit/allclasses-frame.html new file mode 100644 index 0000000..674585a --- /dev/null +++ b/junit/allclasses-frame.html @@ -0,0 +1,11 @@ + + + +All Unit Test Classes + + + +

Classes

+
+ + diff --git a/junit/alltests-errors.html b/junit/alltests-errors.html new file mode 100644 index 0000000..deb8291 --- /dev/null +++ b/junit/alltests-errors.html @@ -0,0 +1,22 @@ + + + +Unit Test Results: All Errors + + + +

Unit Test Results.

+ + + + +
Designed for use with JUnit and Ant.
+
+

All Errors

+ + + + +
ClassNameStatusTypeTime(s)
+ + diff --git a/junit/alltests-fails.html b/junit/alltests-fails.html new file mode 100644 index 0000000..a762062 --- /dev/null +++ b/junit/alltests-fails.html @@ -0,0 +1,22 @@ + + + +Unit Test Results: All Failures + + + +

Unit Test Results.

+ + + + +
Designed for use with JUnit and Ant.
+
+

All Failures

+ + + + +
ClassNameStatusTypeTime(s)
+ + diff --git a/junit/alltests-skipped.html b/junit/alltests-skipped.html new file mode 100644 index 0000000..a08afc5 --- /dev/null +++ b/junit/alltests-skipped.html @@ -0,0 +1,22 @@ + + + +Unit Test Results: All Skipped + + + +

Unit Test Results.

+ + + + +
Designed for use with JUnit and Ant.
+
+

All Skipped

+ + + + +
ClassNameStatusTypeTime(s)
+ + diff --git a/junit/assets/style.css b/junit/assets/style.css new file mode 100644 index 0000000..c6ab21c --- /dev/null +++ b/junit/assets/style.css @@ -0,0 +1,157 @@ +body { + font-family: Helvetica, Arial, sans-serif; + font-size: 12px; + min-width: 1200px; + color: #999; +} +h2 { + font-size: 16px; + color: black; +} + +p { + color: black; +} + +a { + color: #999; +} + +table { + border-collapse: collapse; +} + +/****************************** + * SUMMARY INFORMATION + ******************************/ + +#environment td { + padding: 5px; + border: 1px solid #E6E6E6; +} + +#environment tr:nth-child(odd) { + background-color: #f6f6f6; +} + +/****************************** + * TEST RESULT COLORS + ******************************/ +span.passed, .passed .col-result { + color: green; +} +span.skipped, span.xfailed, span.rerun, .skipped .col-result, .xfailed .col-result, .rerun .col-result { + color: orange; +} +span.error, span.failed, span.xpassed, .error .col-result, .failed .col-result, .xpassed .col-result { + color: red; +} + + +/****************************** + * RESULTS TABLE + * + * 1. Table Layout + * 2. Extra + * 3. Sorting items + * + ******************************/ + +/*------------------ + * 1. Table Layout + *------------------*/ + +#results-table { + border: 1px solid #e6e6e6; + color: #999; + font-size: 12px; + width: 100% +} + +#results-table th, #results-table td { + padding: 5px; + border: 1px solid #E6E6E6; + text-align: left +} +#results-table th { + font-weight: bold +} + +/*------------------ + * 2. Extra + *------------------*/ + +.log:only-child { + height: inherit +} +.log { + background-color: #e6e6e6; + border: 1px solid #e6e6e6; + color: black; + display: block; + font-family: "Courier New", Courier, monospace; + height: 230px; + overflow-y: scroll; + padding: 5px; + white-space: pre-wrap +} +div.image { + border: 1px solid #e6e6e6; + float: right; + height: 240px; + margin-left: 5px; + overflow: hidden; + width: 320px +} +div.image img { + width: 320px +} +.collapsed { + display: none; +} +.expander::after { + content: " (show details)"; + color: #BBB; + font-style: italic; + cursor: pointer; +} +.collapser::after { + content: " (hide details)"; + color: #BBB; + font-style: italic; + cursor: pointer; +} + +/*------------------ + * 3. Sorting items + *------------------*/ +.sortable { + cursor: pointer; +} + +.sort-icon { + font-size: 0px; + float: left; + margin-right: 5px; + margin-top: 5px; + /*triangle*/ + width: 0; + height: 0; + border-left: 8px solid transparent; + border-right: 8px solid transparent; +} + +.inactive .sort-icon { + /*finish triangle*/ + border-top: 8px solid #E6E6E6; +} + +.asc.active .sort-icon { + /*finish triangle*/ + border-bottom: 8px solid #999; +} + +.desc.active .sort-icon { + /*finish triangle*/ + border-top: 8px solid #999; +} diff --git a/junit/index.html b/junit/index.html new file mode 100644 index 0000000..4163d4e --- /dev/null +++ b/junit/index.html @@ -0,0 +1,19 @@ + + + +Unit Test Results. + + + + + + + + +<h2>Frame Alert</h2> +<p> + This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. + </p> + + + diff --git a/junit/junit-badge.svg b/junit/junit-badge.svg new file mode 100644 index 0000000..874aa44 --- /dev/null +++ b/junit/junit-badge.svg @@ -0,0 +1 @@ +teststests100%100% \ No newline at end of file diff --git a/junit/junit.xml b/junit/junit.xml new file mode 100644 index 0000000..7bf500f --- /dev/null +++ b/junit/junit.xml @@ -0,0 +1 @@ +mini_lambda/tests/test_mini_lambda.py:513: <py._xmlgen.raw object at 0x7f6f0b6ee048> \ No newline at end of file diff --git a/junit/overview-frame.html b/junit/overview-frame.html new file mode 100644 index 0000000..948bdc6 --- /dev/null +++ b/junit/overview-frame.html @@ -0,0 +1,14 @@ + + + +All Unit Test Packages + + + +

+Home +

+

Packages

+
+ + diff --git a/junit/overview-summary.html b/junit/overview-summary.html new file mode 100644 index 0000000..d469d00 --- /dev/null +++ b/junit/overview-summary.html @@ -0,0 +1,38 @@ + + + +Unit Test Results: Summary + + + +

Unit Test Results.

+ + + + +
Designed for use with JUnit and Ant.
+
+

Summary

+ + + + + + + +
TestsFailuresErrorsSkippedSuccess rateTime
0000NaN0.000
+ + + + +
+ Note: failures are anticipated and checked for with assertions while errors are unanticipated. +
+

Packages

+ + + + +
NameTestsErrorsFailuresSkippedTime(s)Time StampHost
+ + diff --git a/junit/report.html b/junit/report.html new file mode 100644 index 0000000..ddfe847 --- /dev/null +++ b/junit/report.html @@ -0,0 +1,671 @@ + + + + + Test Report + + + +

Report generated on 13-Nov-2017 at 12:38:11 by pytest-html v1.16.0

+

Environment

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CItrue
JAVA_HOME/usr/lib/jvm/java-8-oracle
Packages{'py': '1.4.34', 'pytest': '3.2.1', 'pluggy': '0.4.0'}
PlatformLinux-4.4.0-93-generic-x86_64-with-debian-jessie-sid
Plugins{'html': '1.16.0', 'cov': '2.5.1', 'logging': '2015.11.4', 'metadata': '1.5.0'}
Python3.5.3
TRAVIS_BRANCHmaster
TRAVIS_BUILD_ID301372335
TRAVIS_BUILD_NUMBER1
TRAVIS_COMMIT2491c2882238450d88d323c5ddbdec538d554b8b
TRAVIS_COMMIT_MESSAGEAdded Travis configuration files
TRAVIS_COMMIT_RANGE43ae3678ce92...2491c2882238
TRAVIS_EVENT_TYPEpush
TRAVIS_JOB_ID301372336
TRAVIS_JOB_NUMBER1.1
TRAVIS_OS_NAMElinux
TRAVIS_PULL_REQUESTfalse
TRAVIS_REPO_SLUGsmarie/python-mini-lambda
TRAVIS_SUDOtrue
+

Summary

+

31 tests ran in 0.47 seconds.

+ 31 passed, 1 skipped, 0 failed, 0 errors, 0 expected failures, 0 unexpected passes +

Results

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ResultTest FileTestDescriptionDurationLinks
Skippedmini_lambda/tests/test_mini_lambda.pytest_evaluator_long_convertible Long convertible Object : tests that `long` raises the appropriate exception and that equivalent Long() + works 0.00source
+
('mini_lambda/tests/test_mini_lambda.py', 513, 'Skipped: long seems not to be around anymore...')
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_iterable Iterable: tests that `Iter(li)` leads to a valid evaluator and `iter(li)` raises an exception0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_iterator Iterator/Generator: tests that `next()` leads to a valid evaluator0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_iterator_iterable Iterable + Iterator: tests that `next(Iter(li))` leads to a valid evaluator0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_iterable_iterator_and_comparison Iterable + Iterator + Comparable : A complex case where the evaluator is `next(Iter(li)) > 0` 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_comprehension List Comprehension : tests that `[i for i in li]` is forbidden and raises the appropriate exception 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_iterable_any Iterable + any operator: Checks that the any operator raises an exception but that the Any replacement function + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_iterable_all Iterable + all operator: Checks that the all operator raises an exception but that the All replacement function + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_repr Representable Object : tests that repr() raises the correct error message and that the equivalent Repr() + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_complex_1 A complex case with a combination of Repr, Len, and comparisons 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_str Representable Object : tests that str() raises the correct error message and that the equivalent Str() works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_bytes Representable Object : tests that bytes() raises the correct error message and that the equivalent Bytes() + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_sizeof Object : tests that sys.getsizeof() raises the correct error message and that the equivalent Getsizeof() + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_comparable Comparable Object : tests that lt, le, eq, ne, gt, and ge are correctly supported 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_comparable_normal_function_first Tests that the comparison operators works between a function and an evaluator 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_comparable_both_evaluators Tests that it works when the first function is not a function converted to valid8 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_hashable Hashable Object : tests that hash() raises the correct error message and that the equivalent Hash() works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_truth_testable Truth-Testable Object : tests that bool() raises the correct error message and that the equivalent Bool() + works. 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_truth_testable_not Truth-Testable Object : tests that not x raises the correct error message and that the equivalent x.nnot() + works. 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_attribute Object: Tests that obj.foo_field works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_nonexistent_attribute_2 Object: Tests that a valid evaluator accessing a nonexistent attribute will behave as expected and raise the + appropriate exception when evaluated 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_container Container Object : tests that `1 in x` raises the correct error message and that the equivalent x.contains() + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_sized Sized Container Object: tests that len() raises the appropriate error but that the equivalent Len() works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_sized_compared Tests that Len(s) > 2 works as well as (2 <= Len(s)) & (Len(s) < 3)0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_reversible Reversible Container Object : tests that `reversed(x)` works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_mapping Mapping Container Object : tests that `x[i]` works0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_numeric Numeric-like Object : tests that +,-,*,/,%,divmod(),pow(),**,@,//,<<,>>,-,+,abs,~ work 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_int_convertible Int convertible Object : tests that `int` raises the appropriate exception and that equivalent Int() works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_float_convertible Float convertible Object : tests that `float` raises the appropriate exception and that equivalent Float() + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_complex_convertible Complex convertible Object : tests that `complex` raises the appropriate exception and that equivalent + Complex_() works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_oct_convertible oct convertible Object : tests that `oct` raises the appropriate exception and that equivalent Oct() + works 0.00source
+
No log output captured.
Passedmini_lambda/tests/test_mini_lambda.pytest_evaluator_index_slice Object is used as an index : tests that `__index__` raises the appropriate exception and that equivalent Get() + works, and also that Slice works and not slice() 0.00source
+
No log output captured.
\ No newline at end of file diff --git a/junit/stylesheet.css b/junit/stylesheet.css new file mode 100644 index 0000000..c371da6 --- /dev/null +++ b/junit/stylesheet.css @@ -0,0 +1,48 @@ + +body { + font:normal 68% verdana,arial,helvetica; + color:#000000; +} +table tr td, table tr th { + font-size: 68%; +} +table.details tr th{ + font-weight: bold; + text-align:left; + background:#a6caf0; +} +table.details tr td{ + background:#eeeee0; +} + +p { + line-height:1.5em; + margin-top:0.5em; margin-bottom:1.0em; +} +h1 { + margin: 0px 0px 5px; font: 165% verdana,arial,helvetica +} +h2 { + margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica +} +h3 { + margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica +} +h4 { + margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica +} +h5 { + margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica +} +h6 { + margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica +} +.Error { + font-weight:bold; color:red; +} +.Failure { + font-weight:bold; color:purple; +} +.Properties { + text-align:right; +} diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..55cfa4e --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,13 @@ +site_name: mini_lambda +# site_description: 'A short description of my project' +repo_url: https://github.com/smarie/python-mini-lambda +pages: + - Home: index.md + - Usage details: usage.md + - Changelog: changelog.md +theme: material # readthedocs mkdocs + +markdown_extensions: + - admonition # to add notes such as http://squidfunk.github.io/mkdocs-material/extensions/admonition/ + - codehilite(guess_lang=false) + - toc(permalink=true) \ No newline at end of file diff --git a/search/search_index.json b/search/search_index.json new file mode 100644 index 0000000..164bf39 --- /dev/null +++ b/search/search_index.json @@ -0,0 +1,3 @@ +{ + "docs": [] +} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..8db7bd3 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,28 @@ + + + + + + / + 2017-11-13 + daily + + + + + + /usage/ + 2017-11-13 + daily + + + + + + /changelog/ + 2017-11-13 + daily + + + + \ No newline at end of file diff --git a/usage/index.html b/usage/index.html new file mode 100644 index 0000000..2aec6f4 --- /dev/null +++ b/usage/index.html @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Usage details - mini_lambda + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+ + + + + +

Usage details

+

TODO

+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + \ No newline at end of file From 3d2aea58412db5a1dcdf1c4f7d7ec1a5b1279800 Mon Sep 17 00:00:00 2001 From: Automatic Publish Date: Tue, 14 Nov 2017 17:50:29 +0000 Subject: [PATCH 02/53] Deployed 05ba82d with MkDocs version: 0.17.1 --- changelog/index.html | 1 + index.html | 66 ++++++++++++++++++++++- junit/junit.xml | 7 ++- junit/report.html | 122 ++++++++++++++++++++++++++----------------- sitemap.xml | 6 +-- usage/index.html | 43 +-------------- 6 files changed, 150 insertions(+), 95 deletions(-) diff --git a/changelog/index.html b/changelog/index.html index e302c6f..2e684f0 100644 --- a/changelog/index.html +++ b/changelog/index.html @@ -305,6 +305,7 @@

Changelog

1.0.0 - First public version

  • Initial fork from valid8 sources.
  • +
  • Added documentation and printability of expressions, which implied to properly handle operator precedence.
diff --git a/index.html b/index.html index 47afc9e..a11aed4 100644 --- a/index.html +++ b/index.html @@ -432,14 +432,76 @@

InstallingUsage

-

Check the Usage page for more details.

+

The idea is that you start from a magic variable such as x, s, l, df... and you write expressions using it:

+
from mini_lambda import x, s
+from math import log
+
+# here are some lambda functions:
+is_lowercase = s.islower()
+say_hello = 'Hello, ' + s + ' !'
+get_prefix_upper_shebang = s[0:4].upper() + ' !'
+numeric_test_1 = -x > x ** 2
+numeric_test_2 = ((1 - 2 * x) <= -x) | (-x > x ** 2)
+
+ + +

If you know python you should feel at home here, except for two things: | is used instead of or. We will come back to this later.

+

Once you have created a function, it is still in "edit" mode. It means that calling it will create a new function, it will not evaluate it:

+
say_hello_hardcoded = say_hello('world')
+
+type(say_hello_hardcoded)   # <class 'mini_lambda.main._InputEvaluator'>: still a function!
+print(say_hello_hardcoded)  # NotImplementedError: __str__ is not supported by _InputEvaluator
+
+ + +

That's the first main difference with traditional python lambda functions. In order to use your functions, you can either use the explicit evaluate method :

+
is_lowercase.evaluate('Hello')              # returns False
+say_hello.evaluate('world')                 # returns 'Hello, world !'
+get_prefix_upper_shebang.evaluate('hello')  # returns 'HELL !'
+numeric_test_1.evaluate(0.5)                # returns False
+numeric_test_2.evaluate(1)                  # returns True
+
+ + +

Or you can get a real function from the lambda function, and then call it. There are several ways to do that:

+
from mini_lambda import _, L
+
+is_lowercase = is_lowercase.as_function()               # explicitly
+say_hello = _(say_hello)                                # _() is a handy operator to do the same thing
+get_prefix_upper_shebang = L(get_prefix_upper_shebang)  # L() is an alias for _()
+numeric_test_1, numeric_test_2 = _(numeric_test_1, numeric_test_2)  # both accept multiple inputs
+
+# you can now use the functions directly
+is_lowercase('Hello')              # returns False
+say_hello('world')                 # returns 'Hello, world !'
+get_prefix_upper_shebang('hello')  # returns 'HELL !'
+numeric_test_1(0.5)                # returns False
+
+ + +

Finally, the functions that you have created are printable:

+
print(is_lowercase)             # s.islower()
+print(say_hello)                # 'Hello, ' + s + ' !'
+print(get_prefix_upper_shebang) # s[0:4].upper() + ' !'
+print(numeric_test_1)           # -x > x ** 2
+print(numeric_test_2)           # (1 - 2 * x <= -x) | (-x > x ** 2)
+
+ + +

Note that the printed version of numeric_test_2 got rid of my useless parenthesis :)

+

There are of course a few limitations to mini_lambda as compared to full-flavoured python lambda functions, the main one being that you can't mix more than one variable in the same expression for now. Check the Usage page for more details.

Main features

-

TODO

+
    +
  • More compact lambda expressions for single-variable functions
  • +
  • Overriding all operators that can be overriden as of today in python 3.6: the remaining limits come from the language itself, for example chained comparisons are not supported as python casts the partial results to boolean.
  • +
  • printability: expressions can be turned to string representation in order to (hopefully) get interpretable messages more easily, for example when the expression is used in a validation context (see valid8)
  • +

See Also

The much-broader debate in the python community about alernate lambda syntaxes is interesting, see here

Equivalent (python-first)

I found the following libraries somehow covering the same use case, with more or less success/features: