diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-01-06 01:11:16 +0000 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-01-06 01:11:16 +0000 |
| commit | 0dd599bbb323387991cd8a3565ea87f36ff0892f (patch) | |
| tree | 26705624c861c0725d1e8fd8555f84705775e1c2 /docs | |
| download | passlib-0dd599bbb323387991cd8a3565ea87f36ff0892f.tar.gz | |
cloning bps to passlib trunk
Diffstat (limited to 'docs')
48 files changed, 3352 insertions, 0 deletions
diff --git a/docs/_static/logo.ico b/docs/_static/logo.ico Binary files differnew file mode 100644 index 0000000..3ac2f26 --- /dev/null +++ b/docs/_static/logo.ico diff --git a/docs/_static/logo.png b/docs/_static/logo.png Binary files differnew file mode 100644 index 0000000..b859c98 --- /dev/null +++ b/docs/_static/logo.png diff --git a/docs/_static/logo.svg b/docs/_static/logo.svg new file mode 100644 index 0000000..43be7d1 --- /dev/null +++ b/docs/_static/logo.svg @@ -0,0 +1,382 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="48" + height="48" + id="svg2383" + sodipodi:version="0.32" + inkscape:version="0.46" + sodipodi:docname="logo.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + inkscape:export-filename="/home/biscuit/dev/libs/bps/trunk/docs/_static/logo.png" + inkscape:export-xdpi="135" + inkscape:export-ydpi="135" + version="1.0" + style="display:inline"> + <defs + id="defs2385"> + <linearGradient + id="linearGradient3426"> + <stop + style="stop-color:#cdcdcd;stop-opacity:1;" + offset="0" + id="stop3428" /> + <stop + style="stop-color:#989898;stop-opacity:1;" + offset="1" + id="stop3430" /> + </linearGradient> + <linearGradient + id="linearGradient3361"> + <stop + style="stop-color:#d1d1d1;stop-opacity:1;" + offset="0" + id="stop3363" /> + <stop + style="stop-color:#85867f;stop-opacity:0;" + offset="1" + id="stop3365" /> + </linearGradient> + <linearGradient + id="linearGradient3343"> + <stop + style="stop-color:#e7e8e7;stop-opacity:1;" + offset="0" + id="stop3345" /> + <stop + id="stop3351" + offset="0.35526317" + style="stop-color:#85867f;stop-opacity:1;" /> + <stop + style="stop-color:#8a8b85;stop-opacity:1;" + offset="0.55263162" + id="stop3357" /> + <stop + style="stop-color:#e8e8e6;stop-opacity:1;" + offset="0.75" + id="stop3353" /> + <stop + id="stop3355" + offset="0.875" + style="stop-color:#e3e3e2;stop-opacity:1;" /> + <stop + style="stop-color:#85867f;stop-opacity:1;" + offset="1" + id="stop3347" /> + </linearGradient> + <linearGradient + id="linearGradient3330"> + <stop + style="stop-color:#63645e;stop-opacity:1;" + offset="0" + id="stop3332" /> + <stop + style="stop-color:#d8d9d7;stop-opacity:1;" + offset="1" + id="stop3334" /> + </linearGradient> + <linearGradient + id="linearGradient3174"> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="0" + id="stop3176" /> + <stop + id="stop3182" + offset="0.02577317" + style="stop-color:#ffffff;stop-opacity:0;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0.68103451;" + offset="0.10257728" + id="stop3184" /> + <stop + id="stop3186" + offset="0.29355666" + style="stop-color:#ffffff;stop-opacity:0;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="0.49417913" + id="stop3188" /> + <stop + id="stop3190" + offset="0.76791382" + style="stop-color:#ffffff;stop-opacity:0.68103451;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0.70689654;" + offset="0.83300149" + id="stop3194" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop3178" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 24 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="48 : 24 : 1" + inkscape:persp3d-origin="24 : 16 : 1" + id="perspective2391" /> + <inkscape:perspective + id="perspective2511" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3174" + id="linearGradient3180" + x1="6.2500014" + y1="26.857143" + x2="39.892857" + y2="26.857143" + gradientUnits="userSpaceOnUse" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3330" + id="radialGradient3338" + cx="24.08217" + cy="6.5837455" + fx="24.08217" + fy="6.5837455" + r="3.3319807" + gradientTransform="matrix(1,0,0,0.3178702,0,4.490969)" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3343" + id="linearGradient3349" + x1="20.156134" + y1="9.6145229" + x2="27.476151" + y2="9.6145229" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3426" + id="linearGradient3432" + x1="20.619965" + y1="4.9160261" + x2="23.637569" + y2="12.999183" + gradientUnits="userSpaceOnUse" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3361" + id="radialGradient3238" + cx="23.637569" + cy="8.9576044" + fx="23.637569" + fy="8.9576044" + r="14.501575" + gradientTransform="matrix(1.0932998,4.0390633e-7,-7.5505546e-8,0.3972952,-2.2053809,5.3987817)" + gradientUnits="userSpaceOnUse" /> + <filter + inkscape:collect="always" + id="filter3252" + x="-0.15294118" + width="1.3058824" + y="-0.55714287" + height="2.1142857"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="3.9395948" + id="feGaussianBlur3254" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="9.8994949" + inkscape:cx="15.162291" + inkscape:cy="22.03092" + inkscape:current-layer="layer2" + showgrid="true" + inkscape:grid-bbox="true" + inkscape:document-units="px" + inkscape:window-width="1272" + inkscape:window-height="723" + inkscape:window-x="0" + inkscape:window-y="25" + borderlayer="true" /> + <metadata + id="metadata2388"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer6" + inkscape:label="shadow" + style="display:inline" + sodipodi:insensitive="true"> + <path + sodipodi:type="arc" + style="opacity:1;fill:#000000;fill-opacity:0.24878049;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3252)" + id="path3370" + sodipodi:cx="24.445692" + sodipodi:cy="38.302536" + sodipodi:rx="30.910667" + sodipodi:ry="8.485281" + d="M 55.356359,38.302536 A 30.910667,8.485281 0 1 1 -6.4649754,38.302536 A 30.910667,8.485281 0 1 1 55.356359,38.302536 z" + transform="matrix(0.7380952,0,0,0.7380952,6.0128136,10.031617)" /> + </g> + <g + inkscape:groupmode="layer" + id="layer4" + inkscape:label="color" + sodipodi:insensitive="true"> + <path + style="fill:#5884bf;fill-opacity:1;stroke:none;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 6.4265364,11.283679 L 40.573462,11.283679 L 40.573462,38.430609 C 30.992581,43.227768 15.769467,43.154069 6.4265364,38.430609 L 6.4265364,11.283679 z" + id="rect2384" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#e13636;fill-opacity:1;stroke:none;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 6.4630916,13.953569 L 40.610016,13.953569 L 40.610017,23.624859 C 31.029136,28.422018 15.806022,28.348319 6.4630916,23.624859 L 6.4630916,13.953569 z" + id="path3200" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#f2db25;fill-opacity:1;stroke:none;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 6.1600462,11.731234 L 40.306972,11.731234 L 40.306972,18.97816 C 30.726091,23.775319 15.502976,23.70162 6.1600461,18.97816 L 6.1600462,11.731234 z" + id="path3198" + sodipodi:nodetypes="ccccc" /> + </g> + <g + inkscape:groupmode="layer" + id="layer3" + inkscape:label="shine" + sodipodi:insensitive="true"> + <path + style="fill:url(#linearGradient3180);fill-opacity:1;stroke:#825540;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 6.4979658,11.498535 L 40.644892,11.498535 L 40.644892,38.645465 C 31.064011,43.442624 15.840896,43.368925 6.4979658,38.645465 L 6.4979658,11.498535 z" + id="path3171" + sodipodi:nodetypes="ccccc" /> + </g> + <g + inkscape:groupmode="layer" + id="layer5" + inkscape:label="text" + sodipodi:insensitive="true" + style="display:inline"> + <path + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Bitstream Vera Serif;-inkscape-font-specification:Bitstream Vera Serif Bold" + d="M 17.060881,32.56056 L 17.060881,31.386704 L 18.914033,31.386704 L 18.914033,19.250394 L 17.060881,19.250394 L 17.060881,18.076537 L 25.647474,18.076537 C 27.413294,18.076552 28.739281,18.374058 29.625443,18.969056 C 30.511579,19.564082 30.954652,20.459833 30.954668,21.656312 C 30.954652,22.516504 30.647411,23.198826 30.032943,23.703285 C 29.424914,24.20776 28.519362,24.524668 27.31628,24.654011 C 28.771623,24.789836 29.887394,25.177888 30.663596,25.818165 C 31.43977,26.458456 31.827865,27.308935 31.82788,28.369604 C 31.827865,29.805397 31.284532,30.862836 30.197883,31.541925 C 29.117674,32.221016 27.422996,32.56056 25.113844,32.56056 L 17.060881,32.56056 M 22.649443,24.12044 L 23.920453,24.12044 C 25.032982,24.120449 25.857682,23.919955 26.394555,23.51896 C 26.931409,23.111516 27.199842,22.490634 27.199852,21.656312 C 27.199842,20.815547 26.937878,20.204366 26.413961,19.82277 C 25.896492,19.441198 25.065322,19.250407 23.920453,19.250394 L 22.649443,19.250394 L 22.649443,24.12044 M 22.649443,31.386704 L 24.036882,31.386704 C 25.272306,31.386705 26.187562,31.14094 26.782651,30.649407 C 27.377717,30.157877 27.675256,29.397943 27.675268,28.369604 C 27.675256,27.334805 27.374484,26.561937 26.772949,26.050996 C 26.171391,25.540069 25.25937,25.284602 24.036882,25.284594 L 22.649443,25.284594 L 22.649443,31.386704" + id="text3202" /> + <text + xml:space="preserve" + style="font-size:5.7741642px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#f7f7f7;stroke-width:0.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.71428576;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans" + x="17.585989" + y="39.817764" + id="text3320" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3324" + x="17.585989" + y="39.817764">+4v</tspan></text> + <text + xml:space="preserve" + style="font-size:0.94746196px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold" + x="-38.376022" + y="37.053452" + id="text3466" + sodipodi:linespacing="125%" + transform="matrix(0,-1,1,0,0,0)"><tspan + sodipodi:role="line" + id="tspan2438" + x="-38.376022" + y="37.053452">This product adheres to all FDA </tspan><tspan + sodipodi:role="line" + id="tspan2440" + x="-38.376022" + y="38.237778"> regulations, and contains at least 50% </tspan><tspan + sodipodi:role="line" + id="tspan2442" + x="-38.376022" + y="39.422108"> bits by volume.</tspan></text> + <text + xml:space="preserve" + style="font-size:0.94746196px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold" + x="-38.067734" + y="12.216213" + id="text3482" + sodipodi:linespacing="125%" + transform="matrix(0,-1,1,0,0,0)"><tspan + sodipodi:role="line" + id="tspan2452" + x="-38.067734" + y="12.216213">Not a floatation device.</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="top" + sodipodi:insensitive="true" + style="display:inline"> + <path + sodipodi:type="arc" + style="opacity:1;fill:#bf8158;fill-opacity:1;stroke:#825540;stroke-width:0.40979934;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path2387" + sodipodi:cx="24.571428" + sodipodi:cy="11.071428" + sodipodi:rx="14.285714" + sodipodi:ry="3.2142856" + d="M 38.857142,11.071428 A 14.285714,3.2142856 0 1 1 10.285714,11.071428 A 14.285714,3.2142856 0 1 1 38.857142,11.071428 z" + transform="matrix(1.1947106,0,0,1.2876026,-5.7128888,-3.1127432)" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#696a64;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.5320197" + id="path3326" + sodipodi:cx="24.748737" + sodipodi:cy="11.129432" + sodipodi:rx="11.818785" + sodipodi:ry="2.0203052" + d="M 36.567522,11.129432 A 11.818785,2.0203052 0 1 1 12.929953,11.129432 A 11.818785,2.0203052 0 1 1 36.567522,11.129432 z" + transform="matrix(1.2606838,0,0,1.5072438,-7.5122541,-5.6599702)" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:url(#radialGradient3238);fill-opacity:1;stroke:url(#linearGradient3432);stroke-width:0.58742505;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path3392" + sodipodi:cx="23.637569" + sodipodi:cy="8.9576044" + sodipodi:rx="14.142136" + sodipodi:ry="3.6870568" + d="M 37.779705,8.9576044 A 14.142136,3.6870568 0 1 1 9.4954338,8.9576044 A 14.142136,3.6870568 0 1 1 37.779705,8.9576044 z" + transform="matrix(0.8219163,0,0,0.5641407,4.2071579,5.9245612)" /> + <path + style="fill:url(#linearGradient3349);fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 19.697975,8.1999896 L 27.375135,8.1999896 L 27.47615,11.230448 C 24.760736,12.324973 22.246648,12.010212 19.79899,11.230448 L 19.697975,8.1999896 z" + id="rect3340" + sodipodi:nodetypes="ccccc" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:url(#radialGradient3338);fill-opacity:1;stroke:none;stroke-width:0.08430404;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path3328" + sodipodi:cx="23.789093" + sodipodi:cy="6.5837455" + sodipodi:rx="3.1819806" + sodipodi:ry="0.90913731" + d="M 26.971074,6.5837455 A 3.1819806,0.90913731 0 1 1 20.607112,6.5837455 A 3.1819806,0.90913731 0 1 1 26.971074,6.5837455 z" + transform="matrix(1.2063492,0,0,1.1135745,-5.1613985,1.0871994)" /> + </g> +</svg> diff --git a/docs/_static/masthead.png b/docs/_static/masthead.png Binary files differnew file mode 100644 index 0000000..154b198 --- /dev/null +++ b/docs/_static/masthead.png diff --git a/docs/_static/masthead.svg b/docs/_static/masthead.svg new file mode 100644 index 0000000..76d9df1 --- /dev/null +++ b/docs/_static/masthead.svg @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="180" + height="52" + id="svg2383" + sodipodi:version="0.32" + inkscape:version="0.47pre4 r22446" + sodipodi:docname="masthead.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + inkscape:export-filename="/home/biscuit/dev/libs/bps/trunk/docs/_static/masthead.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + version="1.0" + style="display:inline"> + <defs + id="defs2385"> + <linearGradient + id="linearGradient3426"> + <stop + style="stop-color:#cdcdcd;stop-opacity:1;" + offset="0" + id="stop3428" /> + <stop + style="stop-color:#989898;stop-opacity:1;" + offset="1" + id="stop3430" /> + </linearGradient> + <linearGradient + id="linearGradient3361"> + <stop + style="stop-color:#d1d1d1;stop-opacity:1;" + offset="0" + id="stop3363" /> + <stop + style="stop-color:#85867f;stop-opacity:0;" + offset="1" + id="stop3365" /> + </linearGradient> + <linearGradient + id="linearGradient3343"> + <stop + style="stop-color:#e7e8e7;stop-opacity:1;" + offset="0" + id="stop3345" /> + <stop + id="stop3351" + offset="0.35526317" + style="stop-color:#85867f;stop-opacity:1;" /> + <stop + style="stop-color:#8a8b85;stop-opacity:1;" + offset="0.55263162" + id="stop3357" /> + <stop + style="stop-color:#e8e8e6;stop-opacity:1;" + offset="0.75" + id="stop3353" /> + <stop + id="stop3355" + offset="0.875" + style="stop-color:#e3e3e2;stop-opacity:1;" /> + <stop + style="stop-color:#85867f;stop-opacity:1;" + offset="1" + id="stop3347" /> + </linearGradient> + <linearGradient + id="linearGradient3330"> + <stop + style="stop-color:#63645e;stop-opacity:1;" + offset="0" + id="stop3332" /> + <stop + style="stop-color:#d8d9d7;stop-opacity:1;" + offset="1" + id="stop3334" /> + </linearGradient> + <linearGradient + id="linearGradient3174"> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="0" + id="stop3176" /> + <stop + id="stop3182" + offset="0.02577317" + style="stop-color:#ffffff;stop-opacity:0;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0.68103451;" + offset="0.10257728" + id="stop3184" /> + <stop + id="stop3186" + offset="0.29355666" + style="stop-color:#ffffff;stop-opacity:0;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="0.49417913" + id="stop3188" /> + <stop + id="stop3190" + offset="0.76791382" + style="stop-color:#ffffff;stop-opacity:0.68103451;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0.70689654;" + offset="0.83300149" + id="stop3194" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop3178" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 24 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="48 : 24 : 1" + inkscape:persp3d-origin="24 : 16 : 1" + id="perspective2391" /> + <inkscape:perspective + id="perspective2511" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3174" + id="linearGradient3180" + x1="6.2500014" + y1="26.857143" + x2="39.892857" + y2="26.857143" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1.230234,0,0,1.230234,1.714269,-5.1906289)" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3330" + id="radialGradient3338" + cx="24.08217" + cy="6.5837455" + fx="24.08217" + fy="6.5837455" + r="3.3319807" + gradientTransform="matrix(1,0,0,0.3178702,0,4.490969)" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3343" + id="linearGradient3349" + x1="20.156134" + y1="9.6145229" + x2="27.476151" + y2="9.6145229" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1.230234,0,0,1.230234,1.714269,-5.1906289)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3426" + id="linearGradient3432" + x1="20.619965" + y1="4.9160261" + x2="23.637569" + y2="12.999183" + gradientUnits="userSpaceOnUse" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient3361" + id="radialGradient3238" + cx="23.637569" + cy="8.9576044" + fx="23.637569" + fy="8.9576044" + r="14.501575" + gradientTransform="matrix(1.0932998,4.0390633e-7,-7.5505546e-8,0.3972952,-2.2053809,5.3987817)" + gradientUnits="userSpaceOnUse" /> + <filter + inkscape:collect="always" + id="filter3534" + x="-0.11470588" + width="1.2294118" + y="-0.41785715" + height="1.8357143"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="2.9546961" + id="feGaussianBlur3536" /> + </filter> + <filter + inkscape:collect="always" + id="filter3222" + x="-0.18431562" + width="1.3686312" + y="-0.46863765" + height="1.9372753"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="7.1308532" + id="feGaussianBlur3224" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#1c4e63" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:zoom="2.4748737" + inkscape:cx="39.98405" + inkscape:cy="11.121273" + inkscape:current-layer="layer6" + showgrid="true" + inkscape:grid-bbox="true" + inkscape:document-units="px" + inkscape:window-width="1920" + inkscape:window-height="1005" + inkscape:window-x="0" + inkscape:window-y="24" + borderlayer="true" + inkscape:window-maximized="1" /> + <metadata + id="metadata2388"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer6" + inkscape:label="shadow" + style="display:inline"> + <path + sodipodi:type="arc" + style="opacity:1;fill:#000000;fill-opacity:0.18811882;stroke:none;stroke-width:0.10000000000000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3534)" + id="path3370" + sodipodi:cx="24.445692" + sodipodi:cy="38.302536" + sodipodi:rx="30.910667" + sodipodi:ry="8.485281" + d="M 55.356359,38.302536 A 30.910667,8.485281 0 1 1 -6.4649754,38.302536 A 30.910667,8.485281 0 1 1 55.356359,38.302536 z" + transform="matrix(0.9080298,0,0,0.9080298,9.111437,7.1506078)" /> + </g> + <g + inkscape:groupmode="layer" + id="layer4" + inkscape:label="color"> + <path + style="fill:#5884bf;fill-opacity:1;stroke:none;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 9.620413,8.6909368 L 51.629123,8.6909368 L 51.629123,42.088015 C 39.842397,47.989643 21.114404,47.898976 9.620413,42.088015 L 9.620413,8.6909368 z" + id="rect2384" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#e13636;fill-opacity:1;stroke:none;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 9.665384,11.975527 L 51.674093,11.975527 L 51.674094,23.873477 C 39.887368,29.775105 21.159375,29.684438 9.665384,23.873477 L 9.665384,11.975527 z" + id="path3200" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#f2db25;fill-opacity:1;stroke:none;stroke-width:0.49592856;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 9.292567,9.2415348 L 51.301278,9.2415348 L 51.301278,18.15695 C 39.514552,24.058578 20.786558,23.967911 9.292567,18.15695 L 9.292567,9.2415348 z" + id="path3198" + sodipodi:nodetypes="ccccc" /> + </g> + <g + inkscape:groupmode="layer" + id="layer3" + inkscape:label="shine"> + <path + style="fill:url(#linearGradient3180);fill-opacity:1;stroke:#825540;stroke-width:0.6101082;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 9.708288,8.9552598 L 51.716999,8.9552598 L 51.716999,42.352338 C 39.930273,48.253966 21.202278,48.163299 9.708288,42.352338 L 9.708288,8.9552598 z" + id="path3171" + sodipodi:nodetypes="ccccc" /> + </g> + <g + inkscape:groupmode="layer" + id="layer5" + inkscape:label="text" + style="display:inline"> + <path + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#f9ee98;stroke-width:0.30597168;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Serif;-inkscape-font-specification:Bitstream Vera Serif Bold" + d="m 22.61279,34.855594 0,-1.360485 2.147781,0 0,-14.065843 -2.147781,0 0,-1.360486 9.951762,0 c 2.046563,1.9e-5 3.583367,0.344825 4.610418,1.03442 1.027021,0.689628 1.540539,1.727793 1.540557,3.114498 -1.8e-5,0.996953 -0.356108,1.787757 -1.068268,2.372418 -0.704699,0.584681 -1.754223,0.951973 -3.148581,1.10188 1.686725,0.157419 2.979891,0.607167 3.8795,1.349241 0.899576,0.74209 1.349374,1.727785 1.349391,2.957088 -1.7e-5,1.664068 -0.629734,2.889627 -1.889147,3.676683 -1.251949,0.787058 -3.216062,1.180586 -5.892342,1.180586 l -9.33329,0 m 6.477079,-9.782 1.473085,0 c 1.289408,1.1e-5 2.245226,-0.23236 2.867455,-0.697108 0.622207,-0.472223 0.933318,-1.191818 0.933331,-2.158788 -1.3e-5,-0.974436 -0.303626,-1.682788 -0.91084,-2.125054 -0.59974,-0.442237 -1.563057,-0.663362 -2.889946,-0.663378 l -1.473085,0 0,5.644328 m 0,8.421515 1.608024,0 c 1.431843,0 2.492613,-0.284838 3.182315,-0.854519 0.689674,-0.569678 1.034518,-1.450432 1.034533,-2.642265 -1.5e-5,-1.19932 -0.348606,-2.095065 -1.045778,-2.68724 -0.697198,-0.592158 -1.754219,-0.888242 -3.17107,-0.88825 l -1.608024,0 0,7.072274" + id="text3202" /> + <text + xml:space="preserve" + style="font-size:7.10357332px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:#f7f7f7;stroke-width:0.12302341;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.71428576;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans" + x="23.349152" + y="44.400631" + id="text3320" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3324" + x="23.349152" + y="44.400631" + style="stroke-width:0.12302341">+4v</tspan></text> + <text + xml:space="preserve" + style="font-size:1.16559994px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold" + x="-42.020859" + y="47.298687" + id="text3466" + sodipodi:linespacing="125%" + transform="matrix(0,-1,1,0,0,0)"><tspan + sodipodi:role="line" + id="tspan2438" + x="-42.020859" + y="47.298687">This product adheres to all FDA </tspan><tspan + sodipodi:role="line" + id="tspan2440" + x="-42.020859" + y="48.755688"> regulations, and contains at least 50% </tspan><tspan + sodipodi:role="line" + id="tspan2442" + x="-42.020859" + y="50.212688"> bits by volume.</tspan></text> + <text + xml:space="preserve" + style="font-size:1.16559994px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold" + x="-41.64159" + y="16.743071" + id="text3482" + sodipodi:linespacing="125%" + transform="matrix(0,-1,1,0,0,0)"><tspan + sodipodi:role="line" + id="tspan2452" + x="-41.64159" + y="16.743071">Not a floatation device.</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="top" + style="display:inline"> + <path + sodipodi:type="arc" + style="opacity:1;fill:#bf8158;fill-opacity:1;stroke:#825540;stroke-width:0.40979934;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path2387" + sodipodi:cx="24.571428" + sodipodi:cy="11.071428" + sodipodi:rx="14.285714" + sodipodi:ry="3.2142856" + d="M 38.857142,11.071428 A 14.285714,3.2142856 0 1 1 10.285714,11.071428 A 14.285714,3.2142856 0 1 1 38.857142,11.071428 z" + transform="matrix(1.4697737,0,0,1.5840526,-5.3139214,-9.0200316)" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:#696a64;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.5320197" + id="path3326" + sodipodi:cx="24.748737" + sodipodi:cy="11.129432" + sodipodi:rx="11.818785" + sodipodi:ry="2.0203052" + d="M 36.567522,11.129432 A 11.818785,2.0203052 0 1 1 12.929953,11.129432 A 11.818785,2.0203052 0 1 1 36.567522,11.129432 z" + transform="matrix(1.5509361,0,0,1.8542626,-7.5275619,-12.153717)" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:url(#radialGradient3238);fill-opacity:1;stroke:url(#linearGradient3432);stroke-width:0.58742505;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path3392" + sodipodi:cx="23.637569" + sodipodi:cy="8.9576044" + sodipodi:rx="14.142136" + sodipodi:ry="3.6870568" + d="M 37.779705,8.9576044 A 14.142136,3.6870568 0 1 1 9.4954338,8.9576044 A 14.142136,3.6870568 0 1 1 37.779705,8.9576044 z" + transform="matrix(1.0111494,0,0,0.6940251,6.890058,2.097968)" /> + <path + style="fill:url(#linearGradient3349);fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" + d="M 25.947388,4.8972774 L 35.392092,4.8972774 L 35.516364,8.6254508 C 32.175769,9.9719728 29.082853,9.5847428 26.07166,8.6254508 L 25.947388,4.8972774 z" + id="rect3340" + sodipodi:nodetypes="ccccc" /> + <path + sodipodi:type="arc" + style="opacity:1;fill:url(#radialGradient3338);fill-opacity:1;stroke:none;stroke-width:0.08430404;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path3328" + sodipodi:cx="23.789093" + sodipodi:cy="6.5837455" + sodipodi:rx="3.1819806" + sodipodi:ry="0.90913731" + d="M 26.971074,6.5837455 A 3.1819806,0.90913731 0 1 1 20.607112,6.5837455 A 3.1819806,0.90913731 0 1 1 26.971074,6.5837455 z" + transform="matrix(1.4840919,0,0,1.3699573,-4.6354593,-3.8531192)" /> + </g> + <g + inkscape:groupmode="layer" + id="layer1" + style="display:inline"> + <text + xml:space="preserve" + style="font-size:51.36699295000000376px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:0.31353134;stroke:none;display:inline;filter:url(#filter3222);font-family:Constantia;-inkscape-font-specification:Constantia Bold Italic;opacity:1" + x="55.297119" + y="43.612377" + id="text3514" + sodipodi:linespacing="125%" + transform="matrix(0.9689059,0,0,0.2882374,15.181422,33.203144)"><tspan + sodipodi:role="line" + id="tspan3516" + x="55.297119" + y="43.612377">BPS</tspan></text> + <text + xml:space="preserve" + style="font-size:49.76978302px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Constantia;-inkscape-font-specification:Constantia Bold Italic" + x="64.488541" + y="41.454266" + id="text2740" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan2742" + x="64.488541" + y="41.454266">BPS</tspan></text> + </g> +</svg> diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..782bb79 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- +# +# BPS documentation build configuration file, created by +# sphinx-quickstart on Mon Mar 2 14:12:06 2009. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# The contents of this file are pickled, so don't put values in the namespace +# that aren't pickleable (module imports are okay, they're removed automatically). +# +# 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, os +from bps import * + +# 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.append(filepath("_exts").abspath) + +# -- General configuration ----------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'bps.unstable.bpsdoc.index_styles', + 'bps.unstable.bpsdoc.relbar_toc', + 'bps.unstable.bpsdoc.nested_sections', + ] + +# 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' + +# The master toctree document. +master_doc = 'contents' +index_doc = 'index' + +# General information about the project. +project = u'BPS' +copyright = u'2004-2009, Assurance Technologies, LLC' + +# 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. +# + +# version: The short X.Y version. +# release: The full version, including alpha/beta/rc tags. +from bps import __version__ as release +from bps.unstable import main_version +version = main_version(release, str=True) + +# 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 documents that shouldn't be included in the build. +unused_docs = [ ] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +##default_role = 'obj' + +# 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 = [ "bps." ] + +# -- Options for all output --------------------------------------------------- +todo_include_todos = True +keep_warnings = True + +# -- Options for HTML output --------------------------------------------------- + +# The style sheet to use for HTML and HTML Help pages. A file of that name +# must exist either in Sphinx' static/ path, or in one of the custom paths +# given in html_static_path. +##html_style = 'bps.css' + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'cloud' + +# 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 = { "roottarget": index_doc } + +# Add any paths that contain custom themes here, relative to this directory. +from bps.unstable.bpsdoc import theme_path +html_theme_path = [theme_path] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +html_title = project + " v" + release + " Documentation" + +# A shorter title for the navigation bar. Default is the same as html_title. +html_short_title = project + " Documentation" + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +html_logo = filepath("_static", "masthead.png") + +# 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 = "logo.ico" + +# 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'] + +# 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_use_modindex = 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, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = project + 'Doc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + (index_doc, project + '.tex', project + u' Documentation', + u'Assurance Technologies, LLC', '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 + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True diff --git a/docs/contents.rst b/docs/contents.rst new file mode 100644 index 0000000..1dcbd88 --- /dev/null +++ b/docs/contents.rst @@ -0,0 +1,35 @@ +================= +Table Of Contents +================= + +.. toctree:: + + Front Page <index> + install + overview + + lib/bps + lib/bps.basic + lib/bps.cache + lib/bps.error.types + lib/bps.error.utils + lib/bps.fs + lib/bps.host + lib/bps.logs + lib/bps.meta + lib/bps.misc + lib/bps.numeric + lib/bps.rng + lib/bps.security + lib/bps.stream + lib/bps.text + lib/bps.types + lib/bps.refs + lib/bps.warndep + + history + roadmap + copyright + +* :ref:`General Index <genindex>` +* :ref:`Module List <modindex>` diff --git a/docs/copyright.rst b/docs/copyright.rst new file mode 100644 index 0000000..22d8f68 --- /dev/null +++ b/docs/copyright.rst @@ -0,0 +1,142 @@ +===================== +Copyrights & Licenses +===================== + +Copyright +========= +The BPS library is (c) 2004-2009 `Assurance Technologies, LLC <http://www.assurancetechnologies.com>`_, +excepting any code noted below as taken from :ref:`third party sources <third-party-software>`. +Such portions are copyright their respective owners. + +License +======= +This library is released under the BSD license; we hope you find it useful. + +:: + + The BPS Python Library + + Copyright (c) 2004-2009 Assurance Technologies, LLC + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +.. _third-party-software: + +Third Party Software +==================== +BPS contains some code taken from various third-party sources, which have their +own licenses (all of which, it should be noted, are BSD-compatible). +The following is a list of these sources, their owners, licenses, and the parts +of BPS derived from them. + +GPW +--- +The class :class:`bps.security.pwgen.GpwGenerator` +is a python implementation of Tom Van Vleck's phonetic +password algorithm `GPW <http://www.multicians.org/thvv/gpw.html>`_. +It's released under informally worded BSD-like terms. + +jBcrypt +------- +`jBCrypt <http://www.mindrot.org/projects/jBCrypt/>`_ is a pure-java +implementation of OpenBSD's BCrypt algorithm, written by Damien Miller, +and released under a BSD license. + +:mod:`bps.security._bcrypt` is a python translation of this code, +which is used as a fallback backend for :class:`bps.security.pwhash.BCrypt` +when the external python library `py-bcrypt <http://www.mindrot.org/projects/py-bcrypt/>`_ +is not available. + +This is the license and copyright for jBCrypt:: + + Copyright (c) 2006 Damien Miller <djm@mindrot.org> + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +MD5-Crypt +--------- +The class :class:`bps.security.pwgen.Md5Crypt` is a pure-python +implementation of the md5-crypt password hashing algorithm. +It's derived from the FreeBSD md5-crypt implementation `<http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/lib/libcrypt/crypt.c?rev=1.2>`_, +which was released under the following license:: + + "THE BEER-WARE LICENSE" (Revision 42): + <phk@login.dknet.dk> wrote this file. As long as you retain this notice you + can do whatever you want with this stuff. If we meet some day, and you think + this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + +PEP 3101 +-------- +:pep:`3101` defines a new string templating system +via the method ``string.format()``, which is built-in +to Python 2.6 and higher. :mod:`bps.text._string_format` is a pure-python +implementation of PEP 3101, used by BPS to backport this feature +to Python 2.5 (see :mod:`bps.text` for usage). + +While the current implementation has been rewritten drastically +(to pass the python 2.6 format() unittests), it was originally +based on the one created by Patrick Maupin and Eric V. Smith, as found in +the PEP 3101 sandbox at `<http://svn.python.org/view/sandbox/trunk/pep3101/>`_. +While no license was attached, it is assumed to have been released +under an equivalent license to the `Python source code`_. + +Python Source Code +------------------ +BPS contains many small fragments taken from the Python 2.6.2 source code, +mainly for the purpose of backporting 2.6 features to python 2.5: + + * :mod:`bps.text._string_format`, contains a modified copy of + Python 2.6's :class:`string.Formatter`, as part of BPS's + Python 2.6-compatible PEP3101 implementation for Python 2.5. + + * :class:`bps.types.namedtuple` is a adaptation of + the Python 2.6 namedtuple class, for use with Python 2.5. + +The Python 2.6.2 source code is licensed under the +`Python Software Foundation License, Version 2 <http://www.python.org/download/releases/2.6.2/license/>`_. + +UnixCrypt.java +-------------- +`UnixCrypt.java <http://www.dynamic.net.au/christos/crypt/UnixCrypt2.txt>`_ +is a pure-java implementation of the historic unix-crypt password hash algorithm. +Originally written by Aki Yoshida, and modified by others, +it was released under a BSD-like license. + +:mod:`bps.security._unix_crypt` is a python translation of this code, +which is used as a fallback backend for :class:`bps.security.pwhash.UnixCrypt` +for platforms where stdlib's :mod:`crypt` is not available. + +This is the license and copyright for UnixCrypt.java:: + + UnixCrypt.java 0.9 96/11/25 + Copyright (c) 1996 Aki Yoshida. All rights reserved. + Permission to use, copy, modify and distribute this software + for non-commercial or commercial purposes and without fee is + hereby granted provided that this copyright notice appears in + all copies. + + modified April 2001 + by Iris Van den Broeke, Daniel Deville + + modified Aug 2005 + by Greg Wilkins (gregw) diff --git a/docs/history.rst b/docs/history.rst new file mode 100644 index 0000000..65b6b52 --- /dev/null +++ b/docs/history.rst @@ -0,0 +1,70 @@ +=============== +Release History +=============== + +The following is a brief account of the BPS release history, +noting all the major releases: + +BPS 4.6 -- 2009-12-1 + * added "bps.security.policy" - a lightweight access control framework + * refactored parts of warndep module, added unittest coverage + * various minor bugfixes + * cleaned up bps' sphinx extensions, theme, and build script + +BPS 4.5 -- 2009-11-6 + Some deprecated filepath methods removed (iterdirlist, rtype, etc). + All code relating to "Undef" singleton now available under "bps.undef". + Minor bugfixes. + +BPS 4.4 -- 2009-9-3 + First release with BPS 3 legacy package completely removed. + Minor improvements and bugfixes. + +BPS 4.3 -- 2009-8-4 + Cleaned up bps.fs package, added unittests for most of bps.fs. + +BPS 4.2 -- 2009-7-24 + BPS3's logging package rewritten from ground up for 4.0. + Very large number of bugfixes and unittests added. + +BPS 4.1 -- 2009-7-11 + Hash algorithm code cleaned up. + Numerous bugfixes and math library improvements. + +BPS 4.0 -- 2009-6-5 + Reorganized and documented whole library. Backward compatibility with 3.x + mostly abandoned. Removed many functions that proved over the years + to be too application-specific to remain here. + +BPS 3.9 -- 2009-6-5 + Maintenance release of the 3.x series. + +BPS 3.7 -- 2009-3-23 + Rewrote host resources module, gained command line framework + +BPS 3.6 -- 2009-2-24 + Numerous deprecations and cleanups + +BPS 3.5 -- 2008-10-12 + Shadow passwords and host resources modules added + +BPS 3.4 -- 2008-5-19 + Many bugfixes; Rewrote logging tools completely + +BPS 3.2 -- 2008-2-4 + Logging system enhancements, all kinds of decorators were added. + Documentation project began. + +BPS 3.0 -- 2006-3-9 + This was the second major reorganization, many features such as the magic filepath + were introduced, though backward compatibility was attempted. + BPS gained main utilities and decorators harvested from in-house projects. + +BPS 2.2 -- 2005-8-15 + Last edition of the 2.x branch. + +BPS 2.0 -- 2004-9-9 + First cleanup, began service as Assurance Technologies' in-house collection of tools. + +BPS 1.0 -- 2003 + Began life as a poor little file that was copied between friends and projects. diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..1ad69e5 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,52 @@ +========================================== +BPS |release| documentation +========================================== + +Introduction +============ +Welcome to the documentation for BPS. + +BPS is a "swiss army knife"-style library, +composed of a number of smaller interdependant modules. +Collectively, these modules form a package which provides +a wide array of useful tools and classes for writing +programs under Python. There are good odds that BPS contains +something useful for any python program, large or small. + +A quick sample of some of the more frequently used modules: + + * :doc:`bps.fs <lib/bps.fs/filepath>` -- object-oriented filesystem access + * :mod:`bps.host` -- desktop and host resources + * :mod:`bps.logs` -- enhancements to Python's logging system + * :mod:`bps.text` -- text parsing and formatting + * :mod:`bps.security.pwhash` -- password hashing algorithms + + ... see the :doc:`library overview <overview>` for a complete list. + +Quick Links +=========== + +.. raw:: html + + <table class="contentstable" align="center"> + <tr> + <td width="50%" valign="top"> + <p class="biglink"><a class="biglink" href="contents.html">Table of Contents</a><br> + <span class="linkdescr">lists all sections and subsections</span></p> + + <p class="biglink"><a class="biglink" href="overview.html">Library Overview</a><br> + <span class="linkdescr">describes how BPS is laid out</span></p> + + </td><td width="50%"> + + <p class="biglink"><a class="biglink" href="genindex.html">General Index</a><br> + <span class="linkdescr">all functions, classes, terms</span></p> + + <p class="biglink"><a class="biglink" href="modindex.html">Module List</a><br> + <span class="linkdescr">quick access to all modules</span></p> + + <p class="biglink"><a class="biglink" href="search.html">Search Page</a><br> + <span class="linkdescr">search this documentation</span></p> + + </td></tr> + </table> diff --git a/docs/install.rst b/docs/install.rst new file mode 100644 index 0000000..2303bdd --- /dev/null +++ b/docs/install.rst @@ -0,0 +1,53 @@ +============ +Installation +============ + +Requirements +============ +BPS tries to use pure-python implementations of things whereever possible, +and have as few dependancies as possible. The current set of requirements is: + + * Python 2.5 or better is required (Python 2.6 is supported). + + * BPS is no longer tested for Python 2.4.x or earlier, + no guarantees are made about whether BPS will work with them. + + * Python 3.0 has **not** been assessed for compatibility. It probably won't work. + + * The `pywin32 <http://sourceforge.net/projects/pywin32/>`_ package is required + when running under windows. + +The following libraries will be used if present, but they are not required: + + * If installed, `py-bcrypt <http://www.mindrot.org/projects/py-bcrypt/>`_ will be + used instead of BPS's slower pure-python bcrypt implementation. + (see :class:`bps.security.pwhash.BCrypt`). + +Installing +========== +BPS can be installed with easy_install, linked/copied into sys.path directly +from it's source directory, or installed using "setup.py". +BPS is pure python, there is nothing to compile or configure. + +Testing +======= +BPS contains a number of unittests (sadly, coverage is not yet complete). +all of which are contained within the :mod:`bps.tests` module, +and are designed to be run use the `nose <http://somethingaboutorange.com/mrl/projects/nose>`_ library. +Once BPS and nose have been installed, you may run the following commands:: + + #to run the full bps test suite + nosetests bps.tests + + #the full suite with some extra longer-running tests + export BPS_DEV_TESTS=true + nosetests bps.tests + +Documentation +============= +BPS uses Sphinx to generate it's documentation. +To create your own copy, make sure you have Sphinx 0.6.3 or better installed, +as well as BPS, and run ``python $SOURCE/docs/make.py clean html``, +where ``$SOURCE`` is the path to the BPS source directory. +Once this completes, point a browser to the file at ``$SOURCE/docs/_build/html/index.html`` +to access the BPS documentation. diff --git a/docs/lib/bps.basic.rst b/docs/lib/bps.basic.rst new file mode 100644 index 0000000..1698f9d --- /dev/null +++ b/docs/lib/bps.basic.rst @@ -0,0 +1,35 @@ +======================================================== +:mod:`bps.basic` -- Manipulation of basic Python objects +======================================================== + +.. module:: bps.basic + :synopsis: tools for manipulating basic python datatypes + +This module contains utilities for manipulating the basic python +datatypes, like :class:`dict` or :class:`list`. It also +contains functions such as would be found in :mod:`functools` +and :mod:`itertools`, under the rationale that functions +and generators can also be considered basic python objects. + +Dictionary Helpers +================== +.. autofunction:: invert_dict +.. autofunction:: zip_dict +.. autofunction:: unzip_dict +.. autofunction:: pop_from_dict +.. autofunction:: update_dict_defaults +.. autofunction:: prefix_from_dict + +Iterator and Functional Helpers +=============================== +.. autofunction:: iter_unique +.. autofunction:: unique + +Set and Sequence Helpers +======================== +.. autofunction:: intersects +.. autofunction:: sameset + +.. + not documented: + .. autofunction:: revpartial diff --git a/docs/lib/bps.cache.rst b/docs/lib/bps.cache.rst new file mode 100644 index 0000000..aba0e80 --- /dev/null +++ b/docs/lib/bps.cache.rst @@ -0,0 +1,26 @@ +================================= +:mod:`bps.cache` -- Caching Tools +================================= + +.. module:: bps.cache + :synopsis: caching tools + +This module defines a number of function decorators, +most of which come in function- and method- specific +variants, and aid in caching. + +Caching Decorators +================== +These decorators allow for quick "memoization" of a function. + +.. autofunction:: cached_function +.. autofunction:: cached_method + +Stateful Decorators +=================== +These decorators allow for quick and easy setup of callbacks, +allowing the decorated method to alert listeners that a value has changed. + +.. autofunction:: stateful_function +.. autofunction:: stateful_method +.. autofunction:: is_stateful diff --git a/docs/lib/bps.error.types.rst b/docs/lib/bps.error.types.rst new file mode 100644 index 0000000..7cf9baa --- /dev/null +++ b/docs/lib/bps.error.types.rst @@ -0,0 +1,73 @@ +=========================================== +:mod:`bps.error.types` -- BPS Error Classes +=========================================== + +.. module:: bps.error.types + :synopsis: All the BPS Error Classes + +This modules contains all the exceptions classes which BPS +defines, stored in one location for easy access. +Some of these are errors raised by various parts of BPS, +while others are helpers designed to be used inside your own code. +Many of them exist mainly to act as pretty-printed helpers +for specific cases of more generic Python exceptions. + +Attribute Errors +========================= +Helpers for creating explicit :exc:`AttributeError` messages. + +.. autoexception:: MissingAttributeError +.. autoexception:: ReadonlyAttributeError +.. autoexception:: PermanentAttributeError +.. autoexception:: UnsetAttributeError + +Function Errors +=============== +These errors are useful when implementing complicated +python functions. + +.. autoexception:: ParamError +.. autoexception:: NormError +.. autoexception:: RangeError + +.. note:: + BPS 3.x used to define an :exc:`InvariantError` which could be raised + when an internal invariant was violated in an application. + However, the common Python practice seems to be + to raise :exc:`AssertionError`. + Unlike ``assert`` statements, raising this error + directly will not be disabling when in optimized mode. + This, ``InvariantError`` was removed, in favor of :exc:`AssertionError`. + +Reference Errors +================ +These errors will be raised by the :mod:`bps.refs` module. + +.. autoexception:: ProxyEmptyError +.. autoexception:: ProxyNestError + +Meta Errors +=========== + +.. autoexception:: AbstractMethodError + +.. + Command Line Errors: + + These errors are useful when implemented code that's + acting as a command line frontend. They are designed + to integrate well with the :mod:`bps.app.command` framework, + see it for more details. + + .. autoexception:: CommandError + .. autoexception:: ParseError + .. autoexception:: InputError + + + Command Class Errors: + + These errors are useful mainly for :mod:`bps.app.command`, + and will not be needed otherwise. + + .. autoexception:: DistTypeError + .. autoexception:: EnvTypeError diff --git a/docs/lib/bps.error.utils.rst b/docs/lib/bps.error.utils.rst new file mode 100644 index 0000000..b733a06 --- /dev/null +++ b/docs/lib/bps.error.utils.rst @@ -0,0 +1,17 @@ +============================================= +:mod:`bps.error.utils` -- BPS Error Utilities +============================================= + +.. module:: bps.error.utils + :synopsis: Utilties for dealing with errors + +This module contains a few utilties used by BPS +for handling errors. :func:`format_exception` in particular +is used by the :class:`bps.logs.formatters.FancyFormatter` to print tracebacks. + +.. autofunction:: format_exception +.. autofunction:: get_sysexit_rc + +.. seealso:: + :func:`bps.develop.trap` + diff --git a/docs/lib/bps.fs.rst b/docs/lib/bps.fs.rst new file mode 100644 index 0000000..8b5bb55 --- /dev/null +++ b/docs/lib/bps.fs.rst @@ -0,0 +1,20 @@ +======================================== +:mod:`bps.fs` -- Filesystem Interaction +======================================== + +.. module:: bps.fs + :synopsis: filesystem interaction + +This module provides a clean object-oriented interface +to the host filesystem, in the form of the :class:`FilePath` object, +as well as a number of additional utilities for accessing the filesystem +and managing permissions: + +* :doc:`The filepath object <bps.fs/filepath>` +* :doc:`Other filesystem utilities <bps.fs/utils>` + +.. toctree:: + :hidden: + + bps.fs/filepath + bps.fs/utils diff --git a/docs/lib/bps.fs/filepath.rst b/docs/lib/bps.fs/filepath.rst new file mode 100644 index 0000000..2ce129f --- /dev/null +++ b/docs/lib/bps.fs/filepath.rst @@ -0,0 +1,91 @@ +==================================== +:mod:`bps.fs` -- The filepath object +==================================== + +.. module:: bps.fs + :synopsis: filesystem interaction + +Overview +======== + +This module provides a clean object-oriented interface +to the host filesystem, in the form of the :class:`FilePath` object. +Objects of this class act just like strings (they are in fact a subclass), +but they contain additional attributes and methods for manipulating +them as paths and interacting with the local filesystem. +The methods and attributes wrap functionality available in the :mod:`os`, +:mod:`os.path`, and :mod:`shutils` modules, and while the full contents +of those modules is not directly available, the common ones are, +and more are added frequently. + +Usage +===== + +Usage is very simple, just call the :func:`filepath` function +with a string, and a new :class:`FilePath` object +will be returned which will act exactly like the original +string, but with additional methods for manipulating the filesystem. + +Some examples using the filepath object:: + + >>> #this imports the default bps3 objects, + >>> #you can alternately use "from bps.fs import filepath" + >>> from bps import * + >>> #this example code assumes the current directory is the bps3 source dir + >>> path = filepath(".") + >>> path #it looks like a string + '.' + >>> type(path) #but it's not + <class 'bps.fs.FilePath'> + >>> #get the absolute path (your exact path will vary) + >>> path.abspath + '/home/elic/dev/libs/bps' + >>> #get a directory listing + >>> path.listdir() + [ '.svn', 'bps', 'docs', 'tests', 'setup.cfg', 'setup.py', 'bps.e4p' ] + >>> #join paths together, equivalent of os.path.join... + >>> #note that this will always use the host-specific path separator + >>> docs = path / "docs" / "_static" + >>> docs + './docs/_static' + >>> #note that under windows, this would appear as '.\\docs\\_static' + >>> #get the absolute version of the path (your result will vary) + >>> docs.abspath + '/home/elic/dev/libs/bps/docs/_static' + >>> #check the filetype of a path + >>> docs.ftype + 'dir' + >>> #touch a path (updating it's mtime & atime) + >>> docs.touch() + + +Creating Filepaths +================== +.. autofunction:: filepath + +Using Filepaths +=============== +.. autoclass:: FilePath + + .. warning:: + + Relative paths will always be relative to the current working directory + *at the time of the method call*, so changing the cwd will usually + result in a different outcome when the instance in question + references a relative path. + +.. note:: + + :class:`FilePath` will probably *never* be extended to include urls + and other similar resources: that was tried in an earlier iteration + of this library, and it was determined there was so little + commonality between the two (filepaths and urls), both in terms + of interface, code, and use cases, that tieing them together + would confusing and without much benefit. A similar-but-separate + UrlPath may be added in the future, however. + +.. todo:: + + :class:`FilePath` needs to support unicode. + Currently waiting for the Python 3.x design team to provide + some guidance-by-example on how to handle differing OS encoding policies. diff --git a/docs/lib/bps.fs/utils.rst b/docs/lib/bps.fs/utils.rst new file mode 100644 index 0000000..a58c4f3 --- /dev/null +++ b/docs/lib/bps.fs/utils.rst @@ -0,0 +1,47 @@ +=========================================== +:mod:`bps.fs` -- Other Filesystem Utilities +=========================================== + +.. currentmodule:: bps.fs + +In addition to :func:`filepath`, this module also provides +some additional utility functions for manipulating the filesystem. + +Permissions +=========== +The following functions deal with file access permissions +(mainly unix-centric, though they are functional under windows). +While they are ostensibly wrappers for similar functions +available under :mod:`os`, these versions provide some enhanced capabilities: + +.. autofunction:: chmod +.. autofunction:: setumask +.. autofunction:: getumask + +Mode Parsing +------------ +To help manipulate symbolic mode strings, +the following helper functions are available: + +.. autofunction:: parse_mode_mask +.. autofunction:: repr_mode_mask + +Other Functions +=============== +This module provides some additional functions for interacting with the filesystem: + +.. autofunction:: is_filepath +.. autofunction:: posix_to_local +.. autofunction:: local_to_posix +.. autofunction:: splitsep +.. autofunction:: is_shortcut +.. autofunction:: read_shortcut + +.. data:: os_has_symlinks + + This is a module-level constant set to ``True`` if the os supports symlinks. + +.. data:: os_has_shortcuts + + This is a module-level constant set to ``True`` if the os supports windows shortcuts (aka LNK files). + This will only be true under windows, though :func:`read_shortcut` will work cross-platform. diff --git a/docs/lib/bps.host.posix.rst b/docs/lib/bps.host.posix.rst new file mode 100644 index 0000000..7f616fb --- /dev/null +++ b/docs/lib/bps.host.posix.rst @@ -0,0 +1,23 @@ +================================================= +:mod:`bps.host.posix` -- Posix-specific Utilties +================================================= + +.. module:: bps.host.posix + :platform: posix + :synopsis: posix-specific utilities + +This contains a number of posix-specific helper functions. +They are either very posix-specific, or simply haven't +been rolled into a common function in :mod:`bps.host` +along with compatriots from other OS modules... + +.. autofunction:: resolve_uid + +.. autofunction:: resolve_gid + +.. autofunction:: resolve_user + +.. autofunction:: resolve_group + +.. autofunction:: chown + diff --git a/docs/lib/bps.host.rst b/docs/lib/bps.host.rst new file mode 100644 index 0000000..63cea1f --- /dev/null +++ b/docs/lib/bps.host.rst @@ -0,0 +1,128 @@ +========================================== +:mod:`bps.host` -- Locating Host Resources +========================================== + +.. module:: bps.host + :synopsis: host resource discovery & desktop interaction + + +This package provides methods for accessing various host resources, +much like stdlib's ``os`` package. In fact, this package +mainly exists to provide routines which ``os`` does not provide, +for one reason or another. + +The this module is broken into the following sections: + +* `Process Management`_ -- OS-agnostic signaling & pid management +* `System Interaction`_ -- finding installed applications +* `Desktop Interaction`_ -- opening, printing, executing files via desktop environment +* `Resource Paths`_ -- helpers for locating home dir, desktop, user config directory, and more. +* `User Accounts`_ -- retrieve basic information about the user accounts on the host system. + +.. toctree:: + :maxdepth: 2 + + bps.host.posix + bps.host.windows + bps.host.utils + +.. note:: + + The main two reasons many of these functions probably are not included in the stdlib + is that this module relies on `pywin32 <http://sourceforge.net/projects/pywin32/>`_ under Windows, + and the fact that this module makes some arbitrary decisions + about path locations which work 90% of cases, but not the 100% that the stdlib requires. + +Usage +===== +The typical use of this module's core functions is to import ``bps.host`` into +your package, and then access it's various methods from the imported object:: + + >>> #note that while this example was written under linux, the host module interface + >>> #is designed to be uniform, so that you can use the *exact same calls* + >>> #to acheive the same effect under windows, without changing your code. + >>> from bps import host + >>> + >>> #check what desktop environment you're running under + >>> host.get_desktop_name() + 'gnome' + >>> + >>> #find location of an executable + >>> host.find_exe("meld") + '/usr/bin/meld' + >>> + >>> #tell desktop to open a file + >>> host.desktop_open("myfile.txt") + >>> + >>> #get current pid + >>> host.get_pid() + 12984 + >>> + >>> #check if a pid is running + >>> host.has_pid(12984) + True + >>> + >>> #kill a pid + >>> host.term_pid(12984) + >>> + +Process Management +================== + +.. function:: get_pid + + Returns current PID. + Alias for ``os.getpid()``, included just for symmetry with the other pid functions. + +.. autofunction:: has_pid +.. autofunction:: term_pid +.. autofunction:: kill_pid + +System Interaction +================== +.. autofunction:: find_exe + +.. attribute:: exe_exts + + This should be a tuple of all the extensions that will be searched + when trying to find an exe. For example, under posix, the list will be ``('',)``, + but under windows the tuple will contain ``('.exe','.bat')``. + +.. todo:: + Would like to add database for detecting & locating applications via windows registry, + or other methods. + +Desktop Interaction +=================== + +.. autofunction:: get_desktop_name +.. autofunction:: desktop_open +.. autofunction:: desktop_compose_email + +Resource Paths +============== +All the resource path functions are designed to quickly +locate the directories that are important to a cross-platform +desktop application, without having to know os-specific details... + +.. autofunction:: get_env_path + +.. autoclass:: EnvPaths + +---- + +The following functions return a :class:`ProgPaths` instance, +with various resource paths chosen according to the default conventions +of the OS you are currently running on, allowing quick and easy +creation of applications which store their config in the right place +no matter what OS you run them on... + +.. autofunction:: get_app_path +.. autofunction:: get_service_path +.. autoclass:: ProgPaths + +User Accounts +============= +.. autofunction:: find_user + +.. autoclass:: UserProfile diff --git a/docs/lib/bps.host.utils.rst b/docs/lib/bps.host.utils.rst new file mode 100644 index 0000000..b3c40b6 --- /dev/null +++ b/docs/lib/bps.host.utils.rst @@ -0,0 +1,20 @@ +=========================================== +:mod:`bps.host.utils` -- General Utilties +=========================================== + +.. module:: bps.host.utils + +Signals +======= +The signal functions provide a enhanced interface +to stdlib's :mod:`signal` module. Much like :mod:`atexit` +enhances the ``sys.exitfunc``, these utilties +allow multiple handlers to be chained to a given unix signal. + +.. autofunction:: has_signal + +.. autofunction:: add_signal_handler + +.. autofunction:: remove_signal_handler + +.. autofunction:: adapt_sig_term diff --git a/docs/lib/bps.host.windows.rst b/docs/lib/bps.host.windows.rst new file mode 100644 index 0000000..120d3a8 --- /dev/null +++ b/docs/lib/bps.host.windows.rst @@ -0,0 +1,23 @@ +====================================================== +:mod:`bps.host.windows` -- Windows-specific Utilities +====================================================== + +.. module:: bps.host.windows + :platform: nt + :synopsis: windows-specific utilities + +This contains a number of windows-specific helper functions. +They are either very windows-specific, or simply haven't +been rolled into a common function in :mod:`bps.host` +along with compatriots from other OS modules... + +.. autofunction:: regpath + +.. autoclass:: RegistryPath + +.. autofunction:: reghandle + +.. autoclass:: RegistryHandle + +.. autofunction:: detect_office_app + diff --git a/docs/lib/bps.logs-config.rst b/docs/lib/bps.logs-config.rst new file mode 100644 index 0000000..521f027 --- /dev/null +++ b/docs/lib/bps.logs-config.rst @@ -0,0 +1,73 @@ +Overview +======== +Python's logging system offers two levels +of interaction when you want to configure the +loggers: you can either interact with +the low-level logger, handler, and formatter objects; +or you can hand it a filepath to a separate file +containing a monolithic configuration of the entire +system. + +The :mod:`bps.logs` package attempts to fill in the +programmatic "middle ground" between these two +styles, through it's :func:`parse_config` +and :func:`config_logging` functions. +Take a large number of input styles, +included external files or strings +containing a full configuration file, +or fragments, all of which are normalized +into a standard dictionary-based data structure. +This may then be manipuled programmatically, re-normalized, +or passed on to the the configuration function, +allowing for complex configuration needs +to be accomplished with a few short commands. + +Normalized Configuration Structure +================================== +The data structure which BPS uses +to represent a set of changes to be applied +to the logging system's configuration is a dictionary +which contains certain predefined keys (none are required unless otherwise noted). +The value attached to each key has a "normalized" format, +which will be the format it is in as returned by :func:`parse_config`, +but there are also other "input" formats, which will be accepted +by :func`parse_config` and returned normalized. +The following keys are recognized: + + ``"levels"`` + If present, this should be a dictionary whose keys + are the names of logger objects, and the corresponding + values the level that logger should be set to. + + formatters + [Optional] + This should be a dictionary mapping formatter names to dicts of formatter options, + to be passed to compile_formatter(). The names may be referred to by the handlers. + handlers + [Optional] + This should be a dictionary mapping handlers names to dicts of handlers options, + to be passed to compile_handler(). The names may be referred to be the output section. + outputs + [Optional] + This should be a dictionary mapping loggers to lists of handler names, + as specified in the handler section, or in the default handler presets. + +The following keywords are accepted by :func:`parse_config`, +and will be merged into one of the above keys during normalization: + + ``"level"`` + This keyword specifies the logging level used by the root logger. + This is a shortcut allowing the master level to be set quickly, + without needing to create a dictionary. + + It will be used as the default value for the "<root>" key + inside the "levels" dictionary (above). + + ``"default_handler"`` + This is a shortcut which allows you to specify just a keywords + for creating a handler, but which will result in all the commands + needed to create the handler and attach it as the sole output + for the root logger. For example, setting ``default_handler=opts`` + will result in the following normalized options: + ``output="<root>=default only", handlers=dict(default=opts)``. + diff --git a/docs/lib/bps.logs-config_format.rst b/docs/lib/bps.logs-config_format.rst new file mode 100755 index 0000000..5744702 --- /dev/null +++ b/docs/lib/bps.logs-config_format.rst @@ -0,0 +1,283 @@ +======================= +BPS Logging File Format +======================= + +The BPS Logging Format is an alternate ini-based file format +for configuring python's builtin logging system. Both this format +and the stdlib format are accepted (and auto-detected) by :func:`bps3.logs.config_logging`. + +.. warning:: + + This documentation currently assumes you are familiar with + the python logging package, it's standard format, + and it's object system. There may eventually be a rewrite to + correct this. + +Why another format? +=================== +Python's builtin logging system specifies a format for configuring the logging +system [#stdfmt]_. While this format offers the ability to configure every +aspect of the logging system, the manner in which it does this is somewhat +verbose, makes some simple tasks much more time consuming than they need to be, +and deciphering an existing config file is not the trivial task it should be. + +A prime example of this issue is configuring the logging levels of a number +of loggers at once. Under the stdlib logging format, you would need to do +the following: + +.. code-block:: cfg + + [loggers] + keys=root,app,app.model,mylib + + [logger_root] + level = WARNING + + [logger_app] + level = DEBUG + + [logger_app.model] + level = INFO + + [logger_mylib] + level = DEBUG + +For doing development work, where various loggers may need to be added and +removed frequently, this format becomes incredibly cumbersome. This +was the main motivation for creating a new format. Under the BPS Logging Format, +the equivalent commands to acheive the above would be: + +.. code-block:: cfg + + [logging:levels] + <root> = WARNING + app = DEBUG + app.model = INFO + mylib = DEBUG + +While a couple of rare features of the stdlib format have not been replicated +in the new format, work is ongoing, and the majority of the features have been +converted over into what is hoped to be a more consise, understandable, and +easily editable format. + +Format Overview +=============== +The BPS Logging Format is based around the ConfigParser's file format. +It defines the following section names, all of which begin with the prefix +``logging:``, and sections lacking this prefix will be ignored. +None of the following sections are required, except where interdepedant +references exist. The sections are as follows: + + `logging:levels`_ + This section lets you configure the logging levels for any logger + in the logging system. + + `logging:options`_ + This section lets you set various global logging system options, + including some custom extensions provided by BPS. + + `logging:output`_ + This section maps loggers to handlers, + allowing you to control where the output of the logging system + is going. + + `logging:handler:$NAME`_ + Sections of this type (eg `logging:handler:myhandler`) define + the configuration to be used when a handler name is referenced + in the `logging:output`_ section. + + `logging:formatter:$NAME`_ + Sections of this type (eg `logging:formatter:myformatter`) define + the configuration to be used when a formatter name is referenced + in a `logging:handler:* <logging:handler:$NAME>`_ section. + +logging:levels +-------------- +This section lets you configure the logging levels for any logger +in the logging system. + +The keys in this section correspond to logger names, +and the values to a predefined logging level. This logging level can +be a predefined name (eg ``NOTSET``, ``DEBUG``, etc), or an integer value ( ``0``, ``10``, etc). +Spaces in the logging level will be ignored, as will any text following a ``#`` symbol, +allowing in-line comments. + +The logger name of ``<root>`` is interpreted as a convenient alias for the empty string, +which corresponds to the root logger of python's logging system. All other logger names +which start with ``<``, contain a series of letters, and end with ``>``, +are considered reserved by this format, for use in an grouping/alias system which is still under development. + +A very verbose example of the ``logging:levels`` section, showing off the various options: + +.. code-block:: cfg + + [logging:levels] + + #this is an example of a full-line comment + + #this will set the root logger level + <root> = WARNING + + app = DEBUG #this is an example of a in-line comment + + #note that "#WARNING" below will be ignored + app.model = INFO #WARNING + + #this uses an integer level + mylib = 10 + +A more compact example, without all the comments: + +.. code-block:: cfg + + [logging:levels] + <root> = WARNING + app = DEBUG + app.model = INFO + mylib = 10 + +.. note:: + If a undefined textual logging level is specified, + a :exc:`KeyError` will be raised at the time this file is loaded. + +logging:options +--------------- + +This section controls for the python logging system. +The following keys are currently recognized (unrecognized +keys will be ignored): + + ``capture_stdout`` + This is a boolean keyword. If set to ``true``, + standard output will be captured, and re-routed to + a logger object named ``sys.stdout``. + If set to ``false``, and stdout is currently being + captured by BPS, the capturing of stdou will be stopped. + + See :mod:`bps3.log.capture` for details. + + ``capture_stderr`` + This functions identically to ``capture_stdout``, + except that it operates on standard error. + + ``capture_warnings`` + This functions similarly to ``capture_stdout``, + except that it captures the warning issued by the + python :mod:`warning` module, and sends such messages + to the logger appropriate for the module which issued + the warning. + + *Setting this option is HIGHLY recommended*, as it will + integrate the warnings module into the logging system + (how python should have had it to begin with). + + ``warning_fmt`` + When used with ``capture_warnings``, this option + allows you to specify a custom warning format string. + See :func:`capture_warnings` for details about the format + of this string, which correponds to the ``fmt`` keyword. + + ``warning_target`` + When used with ``capture_warnings``, this options + allows you to specify a custom target for any warnings + sent to the logging system. + See :func:`capture_warnings` for details about the format + of this string, which correponds to the ``target`` keyword. + +As an example, the following configuration snippet captures +everything from stdout and warnings, and leaves stderr alone: + +.. code-block:: cfg + + [logging:options] + capture_warnings = true + #if no warning_fmt is specified, the default will be used: + #warning_fmt = %(category)s:\n\t message: %(message)s\n\tfilename: %(filename)s\n\t lineno: %(lineno)s + + capture_stderr = true + + #uncomment this next to explicitly release stdout + #capture_stdout = false + +logging:output +-------------- +This section maps loggers to handlers, allowing you to control where the output of the logging system +is going. It consists of "name = handler1, handler2, ..." entries, +which have the effect of attaching (one or more) handlers to the named logger. +If a given entry ends with ``" only"``, any existing handlers attached to the logger +will be removed before adding the specified handlers, and messages +will not propagate past this logger. + +.. todo:: + give examples + +logging:handler:$NAME +--------------------- +If a handler is specified by name in `logging:output`_, +the configuration loader will look for a section with +the corresponding name to determine the handler's class +and configuration. If a handler entry is present, +but not referenced by the `logging:output`_ section +of the that file, it will be ignored. + +It consists of keyword arguments passed to the +:func:`compile_handler` function, which has pretty much +the same syntax as the `fileConfig` format. + +.. todo:: + document keywords, give examples + +logging:formatter:$NAME +----------------------- +This section configures a named formatter, +and must be present for all formatters +referenced in a ``[logging:handler:$NAME]`` section. +It consists of keyword arguments passed to the +`create_formatter` function, which has pretty much +the same syntax as the `fileConfig` format. + + +Example Files +============= + +An example of a full-featured logging config file, +which is probably overkill for a typical application: + +.. code-block:: cfg + + [logging:options] + capture_stdout = false + capture_warnings = true + warning_fmt = %(category)s: %(message)s + + [logging:levels] + <root> = INFO + myapp = DEBUG + pylons = WARNING + + [logging:output] + <root> = console + myapp = syslog + + [logging:handler:console] + class = StreamHandler + args = (sys.stderr,) + level = NOTSET + formatter = generic + startup_msg = True + + [logging:handler:syslog] + class=handlers.SysLogHandler + level=ERROR + formatter=generic + args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER) + + [logging:formatter:generic] + format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s + datefmt = %H:%M:%S + +============= + +.. rubric:: Footnotes + +.. [#stdfmt] `<http://docs.python.org/library/logging.html#configuration-file-format>`_ diff --git a/docs/lib/bps.logs.rst b/docs/lib/bps.logs.rst new file mode 100644 index 0000000..add9fad --- /dev/null +++ b/docs/lib/bps.logs.rst @@ -0,0 +1,34 @@ +===================================== +:mod:`bps.logs` -- Logging Utilities +===================================== + +.. module:: bps.logs + :synopsis: logging utilities + +This module provides a number of extensions to the standard python logging module. +Features include: + + * `setup_std_logging`: a replacement for ``basicConfig()`` for initializing the logging system, + This features many additional features, such as improved default heuristics, + the ability to capture stdout, stderr, and python warnings and rerouting them + through the logging system, etc. + * `config_logging`: a replacement for ``fileConfig()`` which supports a more compact file format. + * `FancyFormatter`: a formatter which supports numerous formatting options + * `log`: a intelligent proxy Logger, which uses module inspection to determine which logger it should invoke + +General usage: + + Call setupLogging() to initialize logging system, + and/or call configLogging(path) to load configuration from a file. + Most of the components (log, the formatters, etc) are designed + to be used individually, they don't require use of any of the other + bps3.logs components. + +.. toctree:: + + bps.logs-config_format + +.. todo:: + + document this module + diff --git a/docs/lib/bps.meta.rst b/docs/lib/bps.meta.rst new file mode 100755 index 0000000..6d11846 --- /dev/null +++ b/docs/lib/bps.meta.rst @@ -0,0 +1,42 @@ +=============================================================== +:mod:`bps.meta` -- Introspection & Monkeypatching +=============================================================== + +.. module:: bps.meta + :synopsis: introspection & monkeypatching + +This module contains various utilities introspection +utilities, to enhance what is already provided through +python's :mod:`inspect` module, + +Interface Tests +=============== +.. autofunction:: is_class +.. autofunction:: is_num +.. autofunction:: is_seq +.. autofunction:: is_oseq +.. autofunction:: is_str + +Class Inspection +================ +.. autofunction:: is_overridden +.. autofunction:: find_attribute + +Module Inspection +================= +.. autofunction:: get_module_exports + +Decorators +=========== +.. autofunction:: abstractmethod +.. autofunction:: decorate_per_instance + +Autosuper +========= +.. autofunction:: instrument_super + +Monkeypatching +============== +.. autofunction:: monkeypatch +.. autofunction:: monkeypatch_mixin + diff --git a/docs/lib/bps.misc.rst b/docs/lib/bps.misc.rst new file mode 100644 index 0000000..e39affb --- /dev/null +++ b/docs/lib/bps.misc.rst @@ -0,0 +1,23 @@ +=============================================== +:mod:`bps.misc` -- Miscellanous Utilities +=============================================== + +.. module:: bps.misc + :synopsis: utilities which fit in no other category + +This module contains everything which didn't naturally +fit in any category handled by an existing module. + +Entries in this module will occasionally be moved +into other modules after an appropriate category is created. +That is done on an as-needed basis when enough related +functions are collected in this module. + +Properties +========== +.. autofunction:: indirect_property +.. autofunction:: constructor_property + +Functions +========= +.. autofunction:: stepped_delay diff --git a/docs/lib/bps.numeric.rst b/docs/lib/bps.numeric.rst new file mode 100644 index 0000000..1fff928 --- /dev/null +++ b/docs/lib/bps.numeric.rst @@ -0,0 +1,55 @@ +================================================= +:mod:`bps.numeric` -- Numeric Tools +================================================= + +.. module:: bps.numeric + :synopsis: mathematical and numeric tools + +Number Theory +============= +.. autofunction:: factors +.. autofunction:: gcd +.. autofunction:: lcm + +Primality Testing +================= +.. autofunction:: is_prime +.. autofunction:: next_prime +.. autofunction:: prev_prime +.. autofunction:: iter_primes + +Numeric Formats +=============== +.. autofunction:: int_to_base +.. autofunction:: float_to_base +.. autofunction:: int_to_roman +.. autofunction:: roman_to_int + +Miscellaneous Functions +======================= +.. autofunction:: sdivmod +.. autofunction:: splitfrac +.. autofunction:: avgsd +.. autofunction:: digits +.. autofunction:: limit + +Bytes Strings +============= +The following functions manipulate strings +as if they were binary data, not characters. +They allow for doing bit-wise boolean operations +on strings, converting them to integers, etc. + +.. note:: + When this module is converted to Python 3.0, + these will all be operations on ``bytes``, not ``str``. + +.. autofunction:: int_to_bytes +.. autofunction:: bytes_to_int +.. autofunction:: list_to_bytes +.. autofunction:: bytes_to_list +.. autofunction:: xor_bytes +.. autofunction:: or_bytes +.. autofunction:: and_bytes +.. autofunction:: invert_bytes +.. autofunction:: binop_bytes diff --git a/docs/lib/bps.refs.rst b/docs/lib/bps.refs.rst new file mode 100644 index 0000000..f23aa8a --- /dev/null +++ b/docs/lib/bps.refs.rst @@ -0,0 +1,22 @@ +================================================= +:mod:`bps.refs` -- Weak Reference and Proxy Tools +================================================= + +.. module:: bps.refs + :synopsis: weak reference and proxy tools + +Properties +========== +.. autofunction:: weakref_property + +Classes +======= +.. autoclass:: SoftValueDict +.. autoclass:: WeakSet + +Proxies +======= +.. autoclass:: ProxyObject + +.. autofunction:: is_proxy_active +.. autofunction:: proxy_using_object diff --git a/docs/lib/bps.rng.rst b/docs/lib/bps.rng.rst new file mode 100644 index 0000000..5869ff4 --- /dev/null +++ b/docs/lib/bps.rng.rst @@ -0,0 +1,71 @@ +================================================= +:mod:`bps.rng` -- Random Number Generation +================================================= + +.. module:: bps.rng + :synopsis: random number generation + +This module is essentially just a wrapper for stdlib's +random module. It provides a few additional +methods for managing & getting random numbers, +but also provides a more useful interface +for the *type* of randomness you want. + +Random Number Generators +======================== +The following random number generator +instances are always available from this module: + +.. data:: random + + This will be an instance of the best pseudo random number generator + available (currently the python builtin prng), with as good + an entropic source as is available for seeding via + the seed() and reseed() methods. + Use this for most non-cryptographic purposes. + +.. data:: srandom + + This will be an instance of the strongest random number generator + available on your system. It will use python's SystemRandom + if os.urandom support is available, otherwise it will fall back + to the same generator as prandom. This should be used + for cryptographic purposes over the normal prng. + + .. warning:: + If urandom is present, this is dependant on the strength + of your system's urandom implementation. If urandom is missing, + the fallback (normal) may not have enough entropy to defend + from attackers. To help this somewhat, it is recommended + to call ``strong.reseed()`` before calls which will consume + randomness for critical purposes, just to help scramble things + as best as possible (reseed is a no-op if urandom is being used). + +.. data:: drandom + + This is a variant of the *random* generator, + except that all outside entropic + sources are disabled, so that it's state is completely + deteremined by the value passed into seed(). + + This is mainly useful in unitests, when you need + to reliably repeat the same results over an over. + +Extra Methods +============= +In addition to the methods provided by stdlib's random module, +all the above rngs will contain the following extra methods: + +.. function:: reseed() + + Unlike seed(), which attempts to set the random number generator's + state explicitly, this method attempts to pull in outside + entropy sources (current rng state, time, etc) to help + randomize the state of your prng as much as possible. + + .. todo:: + In the future, need a way for app to add entropy to the system. + +.. function:: getrandbytes() + +.. function:: weightedchoice() diff --git a/docs/lib/bps.rst b/docs/lib/bps.rst new file mode 100644 index 0000000..6956ec4 --- /dev/null +++ b/docs/lib/bps.rst @@ -0,0 +1,79 @@ +============== +Global Exports +============== + +This page deals lists the objects that are imported +when using the command ``from bps import *``. + +While the BPS package is generally accessed by importing +one one of the submodules, it does offer a limited list +of exports, which are designed to be dropped into your +module's global namespace directly. + +Since populating the global namespace like this usually +causes havoc due to it's implict nature, the objects +exported by default have been limited only to ones +which the BPS authors felt day in and day out were +going to be needed so often, and so unpredictably, +that it would be nice if they were available almost like builtins. +Thus, much of our code begins with the stanza:: + + >>> #import from the bps global namespace + >>> from bps import * + +This ensures a number of very useful objects +are always available. But since this import can be abused, +objects are very rarely added to this list. + +Exported Objects +================ +The following objects will be exported by ``from bps import *``. +While they are documented more fully elsewhere, here is a quick description: + + :func:`abstractmethod() <bps.meta.abstractmethod>` + + This is a very useful decorator to have around if you do a lot + of interface-style class creation. + + .. note:: + A native version has been introduced + in Python 2.6, but that is not yet used by BPS. + + :class:`BaseClass <bps.types.BaseClass>` + + This class can be used as a drop-in replacement for ``object``, + it provides features such as an intelligent ``self.__super`` method, + and a ``cls.__initsubclass__`` method for performing actions + based on the created of inherited classes. + + :func:`filepath() <bps.fs.filepath>` + + This is the constructor for BPS's all-singing-all-dancing filepath object. + It's so useful, this was the first global export added. + Never use `os.path` again! + + :func:`log <bps.logs.log>` + + This is a magic logger object. + Import it into your module and call it, + and through introspection, it will act just like ``logging.getLogger(__name__)``, + and log all messages to the name of the module it was called from. + + :func:`partial` + This is an export of stdlib's `functools.partial <http://docs.python.org/library/functools.html#functools.partial>`_, + since it is used a lot (at least, by the BPS developers it is). + An implementation of this has been exported by BPS since it's inception, + it was only when Python 2.5 was set as a minimum requirement + that BPS started using the stdlib version. + + :data:`Undef <bps.types.Undef>` + + A companion to ``None`` which represents an undefined/missing value. + Same as javascript's "undefined". + + :func:`warn` + + This is an export of stdlib's `warnings.warn <http://docs.python.org/library/warnings.html#warnings.warn>`_. + Warnings should be used much more often then they are, + and that would be encouraged if not for the inconvience + of having to add an import stanza at the top. diff --git a/docs/lib/bps.security.policy.rst b/docs/lib/bps.security.policy.rst new file mode 100644 index 0000000..e6135de --- /dev/null +++ b/docs/lib/bps.security.policy.rst @@ -0,0 +1,106 @@ +================================================================== +:mod:`bps.security.policy` -- Lightweight Access Control Framework +================================================================== + +.. module:: bps.security.policy + :synopsis: lightweight access control framework + +Overview +======== +This module provides a framework for applications +to build complex permission and security policies, +centered around the common "user -> role -> permission" pattern. +This framework is derived from one deployed in a few web applications, +which in turn was inspired by Roundup's `access control mechanism <http://www.roundup-tracker.org/docs/design.html#access-control>`_. +Never-the-less, it's generic enough that it should be suitable for use +by gui and command line applications as well. + +An application can make use of this framework by: + + * creating a :class:`Policy` instance for the application. + * registering all potential roles with the policy + * registering all permissions, as expressed + in terms of actions, roles, and optional guard functions. + * querying the policy either to enumerate a given user's permissions, + or check if the user has permission to perform a specific action. + +.. _permission-question: + +Framing a Permission Question +============================= + +.. todo:: finish write up the structure of the "permission question" + +When an application needs to test whether a user has permission +to perform a given action, the first thing that must be done +to use any policy framework is to encode the question in a format +the permission system understands. This module encodes +permission questions using the following 5 parameters: + + * ``action`` - a string, usually a verb such as ``"update"``, + which represents the action permission is being requested for. + + * ``klass`` - optional string, usually a noun such as ``"BlogEntry"`` + which the action will be acting upon. (Some actions + act globally, and won't have a class specified). + + * ``item`` - optional object, usually an instance of the class identified by ``klass``. + This is generally used when the permission applies to only certain instances + of the class, which must be decided on a case-by-case basis. + + * ``attr`` - optional string, usually a attribute of ``klass`` such as ``"date"``. + This is typically used when the action is restricted on a per-attribute basis. + + * ``scope`` - optional object, usually the owner of the instance + being acted on, or a composite object which the action is being + performed inside of. This is needed very rarely, but there are + some cases, such as when requesting permission to create + a new instance of class which will be stored inside a particular + object, and that object affects the outcome of the permission check. + +Combinations of 1 or more of these parameters can be put together +in order to encode the following questions: + + 1. ``Does {user} have permission to {action}?`` + + 2. ``Does {user} have permission to {action} an object of type {klass}?``. + + 3. ``Does {user} have permission to {action} the object {item} of type {klass}?`` + + 4. ``Does {user} have permission to {action} the attribute {attr} of an object of type {klass}?`` + + 5. ``Does {user} have permission to {action} the attribute {attr} of the object {item} of type {klass}?`` + + 6. ``Does {user} have permission to {action} an object of type {klass} as part of {scope}?``. + As an exmaple: does the user have permission to *create* an object of type + *entry* as part of *<a specific journal instance>*? + +Usage Example +============= + +.. todo:: write usage example for sec policy + +The Policy Class +================ + +.. autoclass:: Policy + +The Support Classes +=================== +The following classes are used internally by :class:`Policy`, +and generally the programmer will not need to create them directly +(though they may need to examine them if preparing a list of +the user's permissions for display). + +.. autoclass:: Role + +.. autoclass:: Permission + +.. + Not documenting these right now, the system is usuable without + knowledge of this bit, although they could be usuable by the guard func, + but no use-case has needed this just yet: + + .. _permissions-constants: + + .. autoclass:: PERM diff --git a/docs/lib/bps.security.pwgen.rst b/docs/lib/bps.security.pwgen.rst new file mode 100644 index 0000000..c657b12 --- /dev/null +++ b/docs/lib/bps.security.pwgen.rst @@ -0,0 +1,15 @@ +================================================ +:mod:`bps.security.pwgen` -- Password Generation +================================================ + +.. module:: bps.security.pwgen + :synopsis: password generation algorithms + +The following single function allows +easy password generation in a number of styles: + +.. autofunction:: generate_secret + +.. todo:: + document internal classes + diff --git a/docs/lib/bps.security.pwhash.rst b/docs/lib/bps.security.pwhash.rst new file mode 100644 index 0000000..b2f0aa1 --- /dev/null +++ b/docs/lib/bps.security.pwhash.rst @@ -0,0 +1,44 @@ +============================================= +:mod:`bps.security.pwhash` - Password Hashing +============================================= + +.. module:: bps.security.pwhash + :synopsis: password hashing (unix-crypt, md5-crypt, etc) + +Overview +======== +This module handles encrypting and verifying password hashes +(such as from unix shadow files). This module contains implementations of most +of the modern password hashing algorithms, +as well as a complex framework for implementing +new algorithms, managing hashes generated +within different contexts with different supported +algorithms, and other features. + +The algorithms currently supported by default in BPS: + + * Unix-Crypt + * MD5-Crypt + * BCrypt + * SHA-Crypt (256 & 512 bit modes) + + * PostgreSQL & MySQL password hashes + +Sections +======== +The documentation for the pwhash module is broken into the following sections: + +* :doc:`Quick Start <bps.security.pwhash/quickstart>` -- frontend funcs for quickly creating / validating hashes +* :doc:`Crypt Contexts <bps.security.pwhash/contexts>` -- for using just the algorithms your application needs +* :doc:`Crypt Algorithms <bps.security.pwhash/algorithms>` -- details of the algorithms BPS implements +* :doc:`Implementing a Custom Crypt Algorithm <bps.security.pwhash/implementation>` -- Roll your own +* :doc:`Helper Functions <bps.security.pwhash/utils>` + +.. toctree:: + :hidden: + + bps.security.pwhash/quickstart + bps.security.pwhash/contexts + bps.security.pwhash/algorithms + bps.security.pwhash/implementation + bps.security.pwhash/utils diff --git a/docs/lib/bps.security.pwhash/algorithms.rst b/docs/lib/bps.security.pwhash/algorithms.rst new file mode 100644 index 0000000..6973313 --- /dev/null +++ b/docs/lib/bps.security.pwhash/algorithms.rst @@ -0,0 +1,49 @@ +============================================= +:mod:`bps.security.pwhash` - Crypt Algorithms +============================================= + +.. currentmodule:: bps.security.pwhash + +All of the crypt algorithms must inherit from :class:`CryptAlgorithm`, +which defines a common interface all algorithms must support. +You may use the algorithms directly, by creating +an instance and calling it as described in :doc:`Implementing a Crypt Algorithm <implementation>`. +However, you will normally will not need to deal with the internals of the algorithms +directly, but rather take advantage of one of the predefined algorithms, +through the :doc:`frontend functions <quickstart>` or a +custom :doc:`crypt context <contexts>`. + +Standard Algorithms +=================== +The following algorithms are all standard password hashing algorithms +used by various Posix operating systems over the years. + +.. note:: + BPS tries to use external accelaration for these classes when possible, + but provides a pure-python fallback so that these algorithms will + ALWAYS be available for use. + +.. autoclass:: UnixCrypt +.. autoclass:: Md5Crypt +.. autoclass:: Sha256Crypt +.. autoclass:: Sha512Crypt +.. autoclass:: BCrypt + +Database Algorithms +=================== +BPS also provides implementations of the hash +algorithms used by MySql and PostgreSQL. + +.. autoclass:: Mysql10Crypt +.. autoclass:: Mysql41Crypt +.. autoclass:: PostgresMd5Crypt + +.. data:: mysql_context + + This context object contains the algorithms used by MySql 4.1 and newer + for storing user passwords. + +.. data:: postgres_context + + This context object should be able to read/write/verify + the values found in the password field of the pg_shadow table in Postgres. diff --git a/docs/lib/bps.security.pwhash/contexts.rst b/docs/lib/bps.security.pwhash/contexts.rst new file mode 100644 index 0000000..3312355 --- /dev/null +++ b/docs/lib/bps.security.pwhash/contexts.rst @@ -0,0 +1,35 @@ +============================================= +:mod:`bps.security.pwhash` - Crypt Contexts +============================================= + +.. currentmodule:: bps.security.pwhash + +For more complex deployment scenarios than +the frontend functions described in :doc:`Quick Start <quickstart>`, +the CryptContext class exists... + +.. autoclass:: CryptContext + +Predefined Contexts +=================== +The following context objects are predefined by BPS: + +.. data:: default_context + + This context object contains all the algorithms + supported by BPS, listed (mostly) in order of strength. + :func:`identify`, :func:`verify`, and :func:`encrypt` + are all merely wrappers for this object's methods + of the same name. + +.. data:: linux_context + + This context object contains only the algorithms + in use on modern linux systems (namely: + unix-crypt, md5-crypt, sha512-crypt). + +.. data:: bsd_context + + This context object contains only the algorithms + in use on modern BSD systems (namely: + unix-crypt, md5-crypt, bcrypt). diff --git a/docs/lib/bps.security.pwhash/implementation.rst b/docs/lib/bps.security.pwhash/implementation.rst new file mode 100644 index 0000000..2bf1661 --- /dev/null +++ b/docs/lib/bps.security.pwhash/implementation.rst @@ -0,0 +1,17 @@ +=================================================================== +:mod:`bps.security.pwhash` - Implementing a Custom Crypt Algorithm +=================================================================== + +.. currentmodule:: bps.security.pwhash + +New password algorithms can be implemented +by subclassing :class:`CryptAlgorithm`, +which provides the underlying framework used +for all the password algorithms. + +To create a new one, +you simple subclass CryptAlgorithm, +and implement the identify, encrypt, and verify methods +(at the very least). + +.. autoclass:: CryptAlgorithm diff --git a/docs/lib/bps.security.pwhash/quickstart.rst b/docs/lib/bps.security.pwhash/quickstart.rst new file mode 100644 index 0000000..44e3fa3 --- /dev/null +++ b/docs/lib/bps.security.pwhash/quickstart.rst @@ -0,0 +1,46 @@ +======================================== +:mod:`bps.security.pwhash` - Quick Start +======================================== + +.. currentmodule:: bps.security.pwhash + +Usage Example +============= +In order to get off the ground quickly, here's an +example of how to quickly encrypt and verify passwords +without having to delve too deeply into this module:: + + >>> from bps.security import pwhash + + >>> #encrypt password using strongest algorithm defined by this module + >>> hash = pwhash.encrypt("too many secrets") + >>> hash + $6$rounds=39000$DNnCxm85LEP1WXUh$IVkALQeSuhr2hcUV90Tv8forzli3K.XwX.1JzPjgwltgvCAgllN3x1jNpG9E1C8IQPm0gEIesqATDyKh/nEnh0' + + >>> #verify password against hash + >>> pwhash.verify("mypass", hash) + False + >>> pwhash.verify("too many secrets", hash) + True + + >>> #identify the algorithm used in a hash + >>> pwhash.identify(hash) + 'sha512-crypt' + + >>> #choose a specific algorithm to use (instead of the default) + >>> hash2 = pwhash.encrypt("too many secrets", alg="bcrypt") + '$2a$11$unZuTsMEjeo5mqFX6rmRduQPBDx9t3djd2voi9W.oFhUDQu1NNMcW' + + >>> #check if we used right algorithm + >>> pwhash.identify(hash2) + 'bcrypt' + + >>> #the hash type is autodetected by verify + >>> pwhash.verify("too many secrets", hash2) + True + +Frontend Functions +================== +.. autofunction:: encrypt +.. autofunction:: verify +.. autofunction:: identify diff --git a/docs/lib/bps.security.pwhash/utils.rst b/docs/lib/bps.security.pwhash/utils.rst new file mode 100644 index 0000000..897349d --- /dev/null +++ b/docs/lib/bps.security.pwhash/utils.rst @@ -0,0 +1,19 @@ +============================================= +:mod:`bps.security.pwhash` - Helper Functions +============================================= + +.. currentmodule:: bps.security.pwhash + +A couple of utility functions are available, +mainly useful when writing custom password hash algorithms. +The ``h64_*`` series of functions all provide +utilities for encoding & decoding strings +under the modified base64 system used by most +of the standard unix hash algorithms. + +.. autofunction:: h64_encode +.. autofunction:: h64_decode +.. autofunction:: h64_gen_salt + +.. autofunction:: is_crypt_context +.. autofunction:: is_crypt_alg diff --git a/docs/lib/bps.security.rst b/docs/lib/bps.security.rst new file mode 100644 index 0000000..c84bc8b --- /dev/null +++ b/docs/lib/bps.security.rst @@ -0,0 +1,17 @@ +====================================== +:mod:`bps.security` -- Security Tools +====================================== + +.. module:: bps.security + :synopsis: security related modules + +This package provides nothing on it's own, +but instead is a collection of a number +of security-related subpackages: + +.. toctree:: + :maxdepth: 1 + + bps.security.pwgen + bps.security.pwhash + bps.security.policy diff --git a/docs/lib/bps.stream.rst b/docs/lib/bps.stream.rst new file mode 100644 index 0000000..9955abd --- /dev/null +++ b/docs/lib/bps.stream.rst @@ -0,0 +1,24 @@ +=============================================== +:mod:`bps.stream` -- Stream & Buffer Utilities +=============================================== + +.. module:: bps.stream + :synopsis: stream (file, StringIO) helpers + +This module contain various stream & buffer related utilities. + +Non-Blocking Reads +================== + +.. autofunction:: nb_read +.. autofunction:: nb_readline_iter +.. autoclass:: nb_readline_list + +Other Functions +=============== +.. autofunction:: get_stream_size + +.. + not listing this one till it's heuristic or use-case is better defined: + + .. autofunction:: get_input_type diff --git a/docs/lib/bps.text.rst b/docs/lib/bps.text.rst new file mode 100755 index 0000000..2dabd11 --- /dev/null +++ b/docs/lib/bps.text.rst @@ -0,0 +1,105 @@ +================================================= +:mod:`bps.text` -- Text parsing & formatting +================================================= + +.. module:: bps.text + :synopsis: text parsing & formatting + +This module provides various methods for manipulating +various types of strings. It includes helpers +for cleaning user input, inflecting english words, +and some other features. + +String Parsing +=============== + +.. autofunction:: asbool +.. autofunction:: condense +.. autofunction:: split_condense + +Filename Sanitizing +=================== +.. autofunction:: clean_filename + +Extending :func:`clean_filename` +-------------------------------- +The clean_filename function is designed to be extended +to suite your own requirements, and yet still perform +optimally. If you have a preset configuration +which you frequently use, simply create an instance +of :class:`FileCleaner`, passing in the appropriate +options for your preset, or clone an existing preset +using ``preset.copy()``. These instances can be called +directly, just like the `clean_filename` function proper. +Or, you may insert it into ``bps3.text.cfg_presets`` +under a custom name, so that it will be globally available +through :func:`clean_filename`. See the source code for more. + +Language Inflection +=================== +BPS implements a language inflector class based off of +the one implemented in Ruby On Rails. Current only English +is supported (but see note below). While the system +is class based, the following public functions +are offered up for easy access: + +.. autofunction:: pluralize +.. autofunction:: singularize +.. autofunction:: countof +.. autofunction:: oneof +.. autofunction:: ordinal + +.. note:: + Currently, there only exists an (American) English language inflector, + but if and when more Inflector subclasses are written for other languages, + this system will be expanded as the use cases require. + +.. + Variable Renaming + ================= + BPS has only the beginnings of support for variable name mangling, + such as converting from ``CamelCase`` to ``lower_case_with_underlines``. + This will hopefully be fleshed out more in the future. + + .. autofunction:: lu_to_cc + +Format String Backport +====================== +Python 2.6 introduced a new formatting system. +BPS contains a pure-python implementation of this system, +so that it is available to Python 2.5 deployments. +Thus, the following methods are aliases for the native +python implementations when available; otherwise +they are backed by a pure-python implementation. + +.. autofunction:: render_format +.. autofunction:: format +.. autoclass:: Formatter + +.. note:: + For Python 2.5 users who *really* want to have ``str.format()`` + available to them directly, they may import :mod:`bps.text.patch_format` + somewhere in their application. By importing this module, + the native strings types of Python 2.5 will be monkeypatched to include + a format method which should be a compatible with the real thing. + This is not imported by default, as it's a somewhat evil thing to do. + +Format String Parsing +===================== +The following functions are available for examining +format strings. They are rarely needed, +but occasionally code has the need to inspect a format string template: + +.. autofunction:: fmt_has_field +.. autofunction:: get_fmt_fields + +.. + these are present, but not documented yet + .. autofunction:: parse_fmt_string + .. autofunction:: parse_fmt_field + + +.. + agent string parsing: + .. autofunction:: parse_agent_string + .. autofunction:: agent_string_has_product diff --git a/docs/lib/bps.types.rst b/docs/lib/bps.types.rst new file mode 100644 index 0000000..6375e6b --- /dev/null +++ b/docs/lib/bps.types.rst @@ -0,0 +1,40 @@ +================================================= +:mod:`bps.types` -- Useful Classes and Types +================================================= + +.. module:: bps.types + :synopsis: useful classes and types + +This module contains most of the classes defined by BPS: + + * `base classes`_ + * `simple data structures`_ + * `dictionary classes`_ + * `other classes`_ + +Base Classes +============ +.. autoclass:: BaseClass +.. autoclass:: BaseMetaClass + +Simple Data Structures +====================== +.. autoclass:: stub + +.. class:: namedtuple + + Returns a new subclass with named tuple fields + + This class is just a backport from Python 2.6. + When BPS is loaded under 2.6 or higher, + the native implementation will be used instead. + +Dictionary Classes +================== +.. autoclass:: CustomDict +.. autoclass:: OrderedDict + +Other Classes +============= +.. autoclass:: CloseableClass + diff --git a/docs/lib/bps.undef.rst b/docs/lib/bps.undef.rst new file mode 100644 index 0000000..0f8441b --- /dev/null +++ b/docs/lib/bps.undef.rst @@ -0,0 +1,37 @@ +========================================== +:mod:`bps.undef` -- The "Undefined" Object +========================================== + +.. module:: bps.undef + :synopsis: provides an "Undef" singleton (ala Javascript) + +Other languages like javascript (and frequently other python libraries) +have the recurring need for a "undefined" singleton, representing +that a value is not specified; this is opposed to ``None`` +which technically represents "no value present", but does double duty +as meaning "undefined" as well. But sometimes, that double duty just doesn't +cut it. BPS provides the following Undef object. + +.. data:: Undef + + The Undef object signals that the value is not defined. + It has the unique property that is it never equal to anything (in a boolean sense), + including itself, much like the sql "NULL" object. + +.. function:: defined(value) + + Helper for checking if a value is or is not the :data:`Undef` object. + This just for completeness, it's equivalent to ``value is not Undef``, + which is typically faster. + +.. function:: undefined(value) + + Inverse of :func:`defined`. + +.. caution:: + Mako's "Undefined" and peak's "NOT_GIVEN" objects are other examples + of this singleton. Hopefully a way will be found to unify these objects + before it becomes a problem. Because of this, it's generally + useful to use Undef as an internal value inside your code, + usually as a default value for a function keyword, + and never use it as a return value. diff --git a/docs/lib/bps.warndep.rst b/docs/lib/bps.warndep.rst new file mode 100644 index 0000000..a234f1b --- /dev/null +++ b/docs/lib/bps.warndep.rst @@ -0,0 +1,29 @@ +======================================================= +:mod:`bps.warndep` -- Warning and deprecation Utilities +======================================================= + +.. module:: bps.warndep + :synopsis: warning & deprecation utilities + +This module contains some helpful functions for +issuing deprecation warnings about methods, +functions, and properties which are about to +be relocated or removed entirely. + +Deprecation Decorators +====================== +These decorators automatically issue +a deprecation warning when the decorated +object is accessed: + +.. autofunction:: deprecated_function +.. autofunction:: deprecated_method + +Deprecation Constructors +======================== +These functions create an entirely new object, +usually wrapping the old object in some manner. + +.. autofunction:: deprecated_property +.. autofunction:: relocated_function + diff --git a/docs/make.py b/docs/make.py new file mode 100644 index 0000000..feeff9d --- /dev/null +++ b/docs/make.py @@ -0,0 +1,3 @@ +"Makefile for Sphinx documentation, adapted to python" +from bps.unstable.bpsdoc.make_helper import SphinxMaker +SphinxMaker.execute(root=__file__) diff --git a/docs/overview.rst b/docs/overview.rst new file mode 100644 index 0000000..aae91cb --- /dev/null +++ b/docs/overview.rst @@ -0,0 +1,154 @@ +================ +Library Overview +================ + +BPS started life in 2003 as an in-house collection of small functions +and tools which were frequently needed by the programmers at +`Assurance Technologies <http://www.assurancetechnologies.com>`_. +Over the years, it has accumlated a more small functions, +but it has also acquired some modules which provide major +new features that go above and beyond simple utility functions. +Since we have benefited greatly from open source software, +this library was released publically in 2009, in order +to fill a few niches for which there is a need (password hashing, +desktop interaction), as well as to simply give something +back to the community. + +.. module:: bps + :synopsis: Root of all BPS modules + +Organization +============ +Everything in BPS falls into two main categories: +There are modules which contain interconnected +functions dealing with a specific topic (the `service modules`_), +and there are the modules which contain smaller utility +functions which aren't really connected to eachother, +but which are grouped together for convience based on a common +subject (the `utility modules`_). You may read through +the entirety of the documentation to find any functions +which might be useful, or jump directly to a submodule +whose services you already know you need. + +Service Modules +=============== +The following modules contain tightly-knit sets of interconnected functions, +and each module provides a unique set of services which would not be possible +without all the functions it contains: + + :mod:`bps.fs` + + This provides a "magic" filepath object, as well as some other filesystem + related helpers. The magic filepath object is a string subclass + which allows you to manipulate filepaths (and interact with the filesystem) + in an object oriented manner. + *Warning: use of this module can be incredibly addictive.* + + :mod:`bps.host` + + This provides a wide array of functions for detecting host resource + paths, managing processes, and interacting with the desktop, + all in a os-neutral manner. + + :mod:`bps.logs` + + This module contains a number of helper utilties + for using python's builting logging module: + + * an easier-to-use logging config format for ini files. + * a more programmatic interface for configuring the logging system. + * ability to capture & redirect stdio, and the warnings module. + + :mod:`bps.security` + + This module contains a sophisticated system for creating & verifying + password hashes, supporting all the major unix password hashing schemes + (in native python no less). + +Utility Modules +=============== +Unlike the service modules, the remaining modules in bps +are collections of smaller standalone functions, grouped +together by common theme: + + :mod:`bps.basic` + + Utility functions for manipulating + common python data structures, such as helpers + for manipulated dicts, sets, and others. + + :mod:`bps.cache` + + Decorators and helpers + for doing memoization and related activities. + + :mod:`bps.error.types` + + Assorted Exceptions classes which are used by BPS + or which may be generally useful. + + :mod:`bps.meta` + + Introspection tools, + decorators for meta-level activities (eg abstract methods), + and monkeypatching. + + :mod:`bps.numeric` + + Numeric related helpers, + mainly as an extension to stdlib's math module. + + :mod:`bps.refs` + + Weak reference helpers and proxy objects. + + :mod:`bps.security` + + Security tools, mainly password hashing and generation. + + :mod:`bps.stream` + + Buffer and stream related tools. + + :mod:`bps.text` + + Tool for manipulating text strings, + and other language related operations. This includes a noun + pluralization function, a function for sanitizing user-provided + filenames, ``asbool``, and more. + *For Python 2.5 users, this also provides a backport of Python 2.6's + "str.format()" system.* + + :mod:`bps.types` + + A collection of assorted classes which are frequently helpful + in programming, such as `bps.types.BaseClass`, which provides + automatic super() support. + + :mod:`bps.warndep` + + Decorators for easily raises deprecation warnings + when you move / relocate functions, methods, and properties + in your application. + + :mod:`bps.misc` + This module contains any tools which don't fit into one of the other + categories. + +The things left out... +=========================== +One other module exists which is purposely not documented: + + :mod:`bps.unstable` + This module contains functions + which have been added to BPS by the developers, but aren't officially + included and documented for any number of reasons... + + * too application specific + * not developed long enough + * not tested enough much + * look neat, but don't have any real world use-cases yet + + Use them if you dare, they may be removed or recoded on the spur + of the moment. The same goes for some of the other + present-but-undocumented functions you may find in the BPS source. diff --git a/docs/roadmap.rst b/docs/roadmap.rst new file mode 100644 index 0000000..4585a9c --- /dev/null +++ b/docs/roadmap.rst @@ -0,0 +1,54 @@ +======= +Roadmap +======= + +Planned Features +================ +The follow is the list of pending tasks which definitely need to be completed +for BPS, roughly in the order they will probably get done: + +* Finish rewriting and documentation BPS's enhancements to the + standard logging system. + +* Clean up "bps.host" interface system, and document it. + +* Make sure config_parser module has been converted. + +* Unittests do not have good overall coverage. + +* The following modules have yet to be documented: + + - bps.numeric + - bps.undef + - bps.logs + +* Release to public. + This is being put off until documentation and unittests are fleshed out more, + and some needed redesigns are done before external apps become dependant + on legacy behaviors. + +Wishlist +======== +The following are things which it would be nice to add to BPS, +but the need is not pressing, and no particular plans have been drawn up: + +* Merge into BPS the security policy framework + currently used by many of our projects. + (probably under "bps.security.policy"). + +* Fix major bug: :func:`bps.fs.filepath` does not support unicode. + +* Merge in the planetbox numeric and stream routines. + +* Merge in the threading and dispatcher routines + from internal "pxhelpers" library. + +* Merge into BPS the user-interaction subsystem from our internal + "automigrate" library (probably under "bps.host.interact"). + +* Merge in "signals", "app.locking", and "app.command" + packages from the internal company library "astllc". + +Todos +===== +.. todolist:: |
