Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed May 16, 2018
1 parent 0f1615d commit ef15d46
Show file tree
Hide file tree
Showing 21 changed files with 798 additions and 446 deletions.
24 changes: 24 additions & 0 deletions .devlpr.yml
@@ -0,0 +1,24 @@
format: 1
project:
name: variadic
version: 0.1.3
status: alpha
short_descriptions:
github: Python decorator for very-variadic functions
pypi: Decorator for very-variadic functions
readme:
- "*variadic* is a Python (2.7+ and 3.4+) `function decorator <https://docs.python.org/2/glossary.html#term-decorator>`_"
- to write variadic functions accepting a mix of arguments and iterables of those arguments.
- Oh, and they keep their `argspec <https://docs.python.org/2/library/inspect.html#inspect.getargspec>`_,
- so tools doing introspection (Sphinx doc, IDEs, etc.) will work well.
- No ugly ``f(*args, **kwds)`` in your doc!
has_readme_rst: true
has_github_pages: true
python:
versions:
either:
- at_least: 2.7
less_than: 3
- at_least: 3.4
less_than: 4
single_module: true
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@
/build/
/.coverage
/htmlcov/
_builds
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -4,11 +4,12 @@ python:
- "3.4"
- "3.5"
- "3.6"
dist: trusty
sudo: false
install:
- pip install sphinx coveralls
- pip install --upgrade pip setuptools coverage sphinx coveralls
script:
- coverage run --include=variadic.py setup.py test
- coverage run --include=variadic* setup.py test
- if [ "v$TRAVIS_PYTHON_VERSION" == "v2.7" ]; then python setup.py build_sphinx --builder=doctest; fi
after_success:
- coveralls
Expand Down
32 changes: 22 additions & 10 deletions README.rst
@@ -1,15 +1,28 @@
*variadic* is a Python (2.7+ and 3.4+) `function decorator <https://docs.python.org/2/glossary.html#term-decorator>`__
.. GENI: intro
.. GENERATED SECTION, MANUAL EDITS WILL BE LOST
*variadic* is a Python (2.7+ and 3.4+) `function decorator <https://docs.python.org/2/glossary.html#term-decorator>`_
to write variadic functions accepting a mix of arguments and iterables of those arguments.
Oh, and they keep their `argspec <https://docs.python.org/2/library/inspect.html#inspect.getargspec>`__,
Oh, and they keep their `argspec <https://docs.python.org/2/library/inspect.html#inspect.getargspec>`_,
so tools doing introspection (Sphinx doc, IDEs, etc.) will work well.
No ugly ``f(*args, **kwds)`` in your doc!

It's licensed under the `MIT license <http://choosealicense.com/licenses/mit/>`__.
It's available on the `Python package index <http://pypi.python.org/pypi/variadic>`__,
its `documentation <http://jacquev6.github.io/variadic>`__
and its `source code <https://github.com/jacquev6/variadic>`__ are on GitHub.
.. END OF GENERATED SECTION
.. GENI: info
.. GENERATED SECTION, MANUAL EDITS WILL BE LOST
It's licensed under the `MIT license <http://choosealicense.com/licenses/mit/>`_.
It's available on the `Python package index <http://pypi.python.org/pypi/variadic>`_.
Its `documentation <http://jacquev6.github.io/variadic>`_
and its `source code <https://github.com/jacquev6/variadic>`_ are on GitHub.

.. END OF GENERATED SECTION
Questions? Remarks? Bugs? Want to contribute? `Open an issue <https://github.com/jacquev6/variadic/issues>`__!
.. GENI: badges
.. GENERATED SECTION, MANUAL EDITS WILL BE LOST
Questions? Remarks? Bugs? Want to contribute? `Open an issue <https://github.com/jacquev6/variadic/issues>`_!

.. image:: https://img.shields.io/travis/jacquev6/variadic/master.svg
:target: https://travis-ci.org/jacquev6/variadic
Expand Down Expand Up @@ -41,15 +54,14 @@ Questions? Remarks? Bugs? Want to contribute? `Open an issue <https://github.com
.. image:: https://img.shields.io/github/issues/jacquev6/variadic.svg
:target: https://github.com/jacquev6/variadic/issues

.. image:: https://badge.waffle.io/jacquev6/variadic.png?label=ready&title=ready
:target: https://waffle.io/jacquev6/variadic

.. image:: https://img.shields.io/github/forks/jacquev6/variadic.svg
:target: https://github.com/jacquev6/variadic/network

.. image:: https://img.shields.io/github/stars/jacquev6/variadic.svg
:target: https://github.com/jacquev6/variadic/stargazers

.. END OF GENERATED SECTION
Quick start
===========

Expand Down
6 changes: 5 additions & 1 deletion doc/conf.py
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>
# Copyright 2015-2018 Vincent Jacques <vincent@vincent-jacques.net>

master_doc = "index"
project = "variadic"
Expand Down Expand Up @@ -39,6 +39,10 @@
add_class_names = False


# http://sphinx-doc.org/ext/githubpages.html
extensions.append("sphinx.ext.githubpages")


# http://sphinx-doc.org/ext/doctest.html
extensions.append("sphinx.ext.doctest")
# doctest_path
Expand Down
4 changes: 4 additions & 0 deletions docs/.buildinfo
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 7373e30f28ca8b0d736c2fc57594175f
tags: 645f666f9bcd5a90fca523b33c5a78b7
32 changes: 29 additions & 3 deletions docs/_static/basic.css
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -82,9 +82,21 @@ div.sphinxsidebar input {
}

div.sphinxsidebar #searchbox input[type="text"] {
width: 170px;
float: left;
width: 80%;
padding: 0.25em;
box-sizing: border-box;
}

div.sphinxsidebar #searchbox input[type="submit"] {
float: left;
width: 20%;
border-left: none;
padding: 0.25em;
box-sizing: border-box;
}


img {
border: 0;
max-width: 100%;
Expand Down Expand Up @@ -199,6 +211,11 @@ table.modindextable td {

/* -- general body styles --------------------------------------------------- */

div.body {
min-width: 450px;
max-width: 800px;
}

div.body p, div.body dd, div.body li, div.body blockquote {
-moz-hyphens: auto;
-ms-hyphens: auto;
Expand Down Expand Up @@ -332,6 +349,11 @@ table.docutils {
border-collapse: collapse;
}

table.align-center {
margin-left: auto;
margin-right: auto;
}

table caption span.caption-number {
font-style: italic;
}
Expand Down Expand Up @@ -445,10 +467,14 @@ dd {
margin-left: 30px;
}

dt:target, .highlighted {
dt:target, span.highlighted {
background-color: #fbe54e;
}

rect.highlighted {
fill: #fbe54e;
}

dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
Expand Down
60 changes: 43 additions & 17 deletions docs/_static/doctools.js
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down Expand Up @@ -45,7 +45,7 @@ jQuery.urlencode = encodeURIComponent;
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s == 'undefined')
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
Expand All @@ -66,29 +66,55 @@ jQuery.getQueryParameters = function(s) {
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node) {
if (node.nodeType == 3) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
var span = document.createElement("span");
span.className = className;
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var bbox = span.getBBox();
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
var parentOfText = node.parentNode.parentNode;
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this);
highlight(this, addItems);
});
}
}
return this.each(function() {
highlight(this);
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};

/*
Expand Down Expand Up @@ -131,21 +157,21 @@ var Documentation = {
* i18n support
*/
TRANSLATIONS : {},
PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
LOCALE : 'unknown',

// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext : function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
if (typeof translated === 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
return (typeof translated === 'string') ? translated : translated[0];
},

ngettext : function(singular, plural, n) {
var translated = Documentation.TRANSLATIONS[singular];
if (typeof translated == 'undefined')
if (typeof translated === 'undefined')
return (n == 1) ? singular : plural;
return translated[Documentation.PLURALEXPR(n)];
},
Expand Down Expand Up @@ -180,7 +206,7 @@ var Documentation = {
* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash)
if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
Expand Down Expand Up @@ -216,7 +242,7 @@ var Documentation = {
var src = $(this).attr('src');
var idnum = $(this).attr('id').substr(7);
$('tr.cg-' + idnum).toggle();
if (src.substr(-9) == 'minus.png')
if (src.substr(-9) === 'minus.png')
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
else
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
Expand Down Expand Up @@ -248,7 +274,7 @@ var Documentation = {
var path = document.location.pathname;
var parts = path.split(/\//);
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
if (this == '..')
if (this === '..')
parts.pop();
});
var url = parts.join('/');
Expand Down
9 changes: 9 additions & 0 deletions docs/_static/documentation_options.js
@@ -0,0 +1,9 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.1.3',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};

0 comments on commit ef15d46

Please sign in to comment.