Merge pull request #891 from jdufresne/ws
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trim trailing white space throughout the project
authored by David Lord · committed by GitHub · parents 5ecdc80, 148b6fb · Browse files · 6 files·+55 added−55 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+55 added−55 removed
- tests:+1 added−1 removed
- other:+54 added−54 removed
Provenance
- Commit
f9bb207- Tree
35d3e03- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
5ecdc80- Parent 2
148b6fb
6 files changed+55 added−55 removed
modified:docs/_themes/jinja/static/jinja.css_t+25 added-25 removed
10 unmodified lines11 {% set page_width = '940px' %}12 {% set sidebar_width = '220px' %}13 {% set font_family = 'Georgia, serif' %}14 {% set header_font_family = 'Crimson Text, ' ~ font_family %}15- 15+16 @import url("basic.css");17- 17+18 /* -- page layout ----------------------------------------------------------- */19- 19+20 body {21 font-family: {{ font_family }};22 font-size: 17px;23 background-color: white;22 unmodified lines46 47 hr {48 border: 1px solid #B1B4B6;49 }50- 50+51 div.body {52 background-color: #ffffff;53 color: #3E4349;54 padding: 0 30px 0 30px;2 unmodified lines57 img.floatingflask {58 padding: 0 0 10px 10px;59 float: right;60 }61- 61+62 div.footer {63 width: {{ page_width }};64 margin: 20px auto 30px auto;65 font-size: 14px;7 unmodified lines73 74 div.related {75 display: none;76 }77- 77+78 div.sphinxsidebar a {79 color: #444;80 text-decoration: none;81 border-bottom: 1px dotted #999;1 unmodified line83 84 div.sphinxsidebar a:hover {85 border-bottom: 1px solid #999;86 }87- 87+88 div.sphinxsidebar {89 font-size: 15px;90 line-height: 1.5;91 }6 unmodified lines98 padding: 0 0 20px 0;99 margin: 0;100 text-align: center;101 }102- 102+103 div.sphinxsidebar h3,104 div.sphinxsidebar h4 {105 font-family: {{ font_family }};106 color: #444;5 unmodified lines112 113 div.sphinxsidebar h4 {114 font-size: 20px;115 }116- 116+117 div.sphinxsidebar h3 a {118 color: #444;119 }120 2 unmodified lines123 div.sphinxsidebar p.logo a:hover,124 div.sphinxsidebar h3 a:hover {125 border: none;126 }127- 127+128 div.sphinxsidebar p {129 color: #555;130 margin: 10px 0;131 }2 unmodified lines134 margin: 10px 0;135 padding: 0;136 color: #000;137 }138- 138+139 div.sphinxsidebar input {140 border: 1px solid #ccc;141 font-family: {{ font_family }};142 font-size: 14px;1 unmodified line144 145 div.sphinxsidebar form.search input[name="q"] {146 width: 130px;147 }148- 148+149 /* -- body styles ----------------------------------------------------------- */150- 150+151 a {152 color: #aa0000;153 text-decoration: underline;154 }155- 155+156 a:hover {157 color: #dd0000;158 text-decoration: underline;159 }160- 160+161 div.body h1,162 div.body h2,163 div.body h3,164 div.body h4,4 unmodified lines169 margin: 30px 0px 10px 0px;170 padding: 0;171 color: black;172 }173- 173+174 div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }175 div.body h2 { font-size: 180%; }176 div.body h3 { font-size: 150%; }177 div.body h4 { font-size: 130%; }178 div.body h5 { font-size: 100%; }179 div.body h6 { font-size: 100%; }180- 180+181 a.headerlink {182 color: #ddd;183 padding: 0 4px;184 text-decoration: none;185 }186- 186+187 a.headerlink:hover {188 color: #444;189 background: #eaeaea;190 }191- 191+192 div.body p, div.body dd, div.body li {193 line-height: 1.4em;194 }195 38 unmodified lines234 div.note {235 background-color: #eee;236 border: 1px solid #ccc;237 }238- 238+239 div.seealso {240 background-color: #ffc;241 border: 1px solid #ff6;242 }243- 243+244 div.topic {245 background-color: #eee;246 }247- 247+248 p.admonition-title {249 display: inline;250 }251- 251+252 p.admonition-title:after {253 content: ":";254 }255 85 unmodified lines341 ul, ol {342 margin: 10px 0 10px 30px;343 padding: 0;344 }345- 345+346 pre {347 background: #eee;348 padding: 7px 30px;349 margin: 15px -30px;8 unmodified lines358 dl dl pre {359 margin-left: -90px;360 padding-left: 90px;361 }362- 362+363 tt {364 background-color: #E8EFF0;365 color: #222;366 /* padding: 1px 2px; */30 unmodified linesmodified:docs/api.rst+3 added-3 removed
17 unmodified lines18 :class:`Template` class, an environment is created automatically for you,19 albeit a shared one.20 21 Most applications will create one :class:`Environment` object on application22-initialization and use that to load templates. In some cases however, it's 22+initialization and use that to load templates. In some cases however, it's23 useful to have multiple environments side by side, if different configurations24 are in use.25 26 The simplest way to configure Jinja2 to load templates for your application185 unmodified lines212 213 For a more complex example you can provide a hint. For example214 the :func:`first` filter creates an undefined object that way::215 216- return environment.undefined('no first item, sequence was empty') 216+ return environment.undefined('no first item, sequence was empty')217 218 If it the `name` or `obj` is known (for example because an attribute219 was accessed) it should be passed to the undefined object, even if220 a custom `hint` is provided. This gives undefined objects the616 unmodified lines837 for i in xrange(2, int(math.ceil(math.sqrt(n))) + 1):838 if n % i == 0:839 return False840 return True841- 841 842+843 You can register it on the template environment by updating the844 :attr:`~Environment.tests` dict on the environment::845 846 environment.tests['prime'] = is_prime86 unmodified linesmodified:docs/intro.rst+1 added-1 removed
60 unmodified lines61 which will install the package via `distribute` in development mode. This also62 has the advantage that the C extensions are compiled.63 64 .. _download page: https://pypi.org/project/Jinja2/65-.. _distribute: https://pypi.org/project/distribute/ 65+.. _distribute: https://pypi.org/project/distribute/66 .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools67 .. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall68 .. _pip: https://pypi.org/project/pip/69 .. _git: https://git-scm.org/36 unmodified linesmodified:ext/django2jinja/django2jinja.py+14 added-14 removed
31 unmodified lines32 33 writer = Writer()34 writer.node_handlers[MyNode] = write_my_node35 convert_templates('/path/to/output/folder', writer=writer)36- 36+37 Here is an example hos to automatically translate your django38 variables to jinja2::39- 39+40 import re41 # List of tuple (Match pattern, Replace pattern, Exclusion pattern)42- 42+43 var_re = ((re.compile(r"(u|user)\.is_authenticated"), r"\1.is_authenticated()", None),44 (re.compile(r"\.non_field_errors"), r".non_field_errors()", None),45 (re.compile(r"\.label_tag"), r".label_tag()", None),46 (re.compile(r"\.as_dl"), r".as_dl()", None),47 (re.compile(r"\.as_table"), r".as_table()", None),48 (re.compile(r"\.as_widget"), r".as_widget()", None),49 (re.compile(r"\.as_hidden"), r".as_hidden()", None),50- 50+51 (re.compile(r"\.get_([0-9_\w]+)_url"), r".get_\1_url()", None),52 (re.compile(r"\.url"), r".url()", re.compile(r"(form|calendar).url")),53 (re.compile(r"\.get_([0-9_\w]+)_display"), r".get_\1_display()", None),54 (re.compile(r"loop\.counter"), r"loop.index", None),55 (re.compile(r"loop\.revcounter"), r"loop.revindex", None),56 (re.compile(r"request\.GET\.([0-9_\w]+)"), r"request.GET.get('\1', '')", None),57 (re.compile(r"request\.get_host"), r"request.get_host()", None),58- 58+59 (re.compile(r"\.all(?!_)"), r".all()", None),60 (re.compile(r"\.all\.0"), r".all()[0]", None),61 (re.compile(r"\.([0-9])($|\s+)"), r"[\1]\2", None),62 (re.compile(r"\.items"), r".items()", None),63 )64 writer = Writer(var_re=var_re)65- 65+66 For details about the writing process have a look at the module code.67 68 :copyright: (c) 2009 by the Jinja Team.69 :license: BSD.243 unmodified lines313 def translate_variable_name(self, var):314 """Performs variable name translation."""315 if self.in_loop and var == 'forloop' or var.startswith('forloop.'):316 var = var[3:]317- 317+318 for reg, rep, unless in self.var_re:319 no_unless = unless and unless.search(var) or True320 if reg.search(var) and no_unless:321 var = reg.sub(rep, var)102 unmodified lines424 writer.write('if ')425 join_with = 'and'426 if node.link_type == core_tags.IfNode.LinkTypes.or_:427 join_with = 'or'428- 428+429 for idx, (ifnot, expr) in enumerate(node.bool_exprs):430 if idx:431 writer.write(' %s ' % join_with)432 if ifnot:300 unmodified lines733 name not in writer._filters_warned:734 writer._filters_warned.add(name)735 writer.warn('Filter %s probably doesn\'t exist in Jinja' %736 name)737- 737+738 if not node.vars_to_resolve:739 # No argument, pass the request740 writer.start_variable()741 writer.write('request|')742 writer.write(name)743 writer.end_variable()744- return 745- 744+ return745+746 first_var = node.vars_to_resolve[0]747 args = node.vars_to_resolve[1:]748 writer.start_variable()749- 749+750 # Copied from Writer.filters()751 writer.node(first_var)752- 752+753 writer.write('|')754 writer.write(name)755 if args:756 writer.write('(')4 unmodified lines761 writer.node(var)762 else:763 writer.literal(var.literal)764 writer.write(')')765- writer.end_variable() 765+ writer.end_variable()766 767 # get rid of node now, it shouldn't be used normally768 del nodemodified:scripts/pylintrc+11 added-11 removed
1 # lint Python modules using external checkers.2-# 2+#3 # This is the main checker controlling the other ones and the reports4 # generation. It is itself both a raw checker and an astng checker in order5 # to:6 # * handle message activation / deactivation at the module level7 # * handle some basic but necessary stats'data (number of classes, methods...)8-# 8+#9 [MASTER]10 11 # Specify a configuration file.12 #rcfile=78 unmodified lines91 # * unused variables / imports92 # * undefined variables93 # * redefinition of variable from builtins or from an outer scope94 # * use of variable before assignment95-# 95+#96 [VARIABLES]97 98 # Tells whether we should check for unused import in __init__ files.99 init-import=no6 unmodified lines106 additional-builtins=107 108 109 # try to find bugs in the code using type inference110-# 110+#111 [TYPECHECK]112 113 # Tells whether missing members accessed in mixin class should be ignored. A114 # mixin class is detected if its name ends with "mixin" (case insensitive).16 unmodified lines131 # * required module attributes132 # * dangerous default values as arguments133 # * redefinition of function / method / class134 # * uses of the global statement135-# 135+#136 [BASIC]137 138 # Required attributes for module, separated by a comma139 required-attributes=42 unmodified lines182 183 # checks for sign of poor/misdesign:184 # * number of methods, attributes, local variables...185 # * size, complexity of functions, methods186-# 186+#187 [DESIGN]188 189 # Maximum number of arguments for function / method190 max-args=1227 unmodified lines218 # * external modules dependencies219 # * relative / wildcard imports220 # * cyclic imports221 # * uses of deprecated modules222-# 222+#223 [IMPORTS]224 225 # Deprecated modules which should not be used, separated by a comma226 deprecated-modules=regsub,string,TERMIOS,Bastion,rexec17 unmodified lines244 # * access only to existent members via self245 # * attributes not defined in the __init__ method246 # * supported interfaces implementation247 # * unreachable code248-# 248+#249 [CLASSES]250 251 # List of interface methods to ignore, separated by a comma. This is used for252 # instance to not check methods defines in Zope's Interface base class.5 unmodified lines258 259 # checks for similarities and duplicated code. This computation may be260 # memory / CPU intensive, so you should disable it if you experiments some261 # problems.262-# 262+#263 [SIMILARITIES]264 265 # Minimum lines number of a similarity.266 min-similarity-lines=107 unmodified lines274 275 # checks for:276 # * warning notes in the code like FIXME, XXX277 # * PEP 263: source code with non ascii character but no encoding declaration278-# 278+#279 [MISCELLANEOUS]280 281 # List of note tags to take in consideration, separated by a comma.282 notes=FIXME,XXX,TODO3 unmodified lines286 # * unauthorized constructions287 # * strict indentation288 # * line length289 # * use of <> instead of !=290-# 290+#291 [FORMAT]292 293 # Maximum number of characters on a single line.294 max-line-length=907 unmodified linesmodified:tests/test_api.py+1 added-1 removed
66 unmodified lines67 assert c.next() == item68 c.next()69 assert c.current == 270 c.reset()71- assert c.current == 1 71+ assert c.current == 172 73 def test_expressions(self, env):74 expr = env.compile_expression("foo")75 assert expr() is None265 unmodified lines