Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(python) don't include ( ) in functions params match #2490

Merged
merged 4 commits into from Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Expand Up @@ -22,6 +22,7 @@ Parser Engine Changes:

Language Improvements:

- enh(python) Exclude parens from functions params (#2490) [Álvaro Mondéjar][]
mondeja marked this conversation as resolved.
Show resolved Hide resolved
- enh(swift) Add `compactMap` to keywords as built_in (#2478) [Omid Golparvar][]
- enh(nim) adds `func` keyword (#2468) [Adnan Yaqoob][]
- enh(xml) deprecate ActionScript inside script tags (#2444) [Josh Goebel][]
Expand Down Expand Up @@ -2148,4 +2149,3 @@ your comments and question to [highlight.js forum][forum]. And don't be afraid
if you find there some fancy Cyrillic letters -- it's for Russian users too :-)

[forum]: http://softwaremaniacs.org/forum/viewforum.php?id=6

2 changes: 1 addition & 1 deletion src/languages/python.js
Expand Up @@ -86,7 +86,7 @@ export default function(hljs) {
};
var PARAMS = {
className: 'params',
begin: /\(/, end: /\)/,
begin: /\(/, end: /\)/, excludeBegin: true, excludeEnd: true,
contains: ['self', PROMPT, NUMBER, STRING, hljs.HASH_COMMENT_MODE]
};
SUBST.contains = [STRING, NUMBER, PROMPT];
Expand Down
2 changes: 1 addition & 1 deletion test/markup/python-repl/sample.expect.txt
Expand Up @@ -11,7 +11,7 @@ foo = 42"
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="python"><span class="hljs-string">"""</span></span>
<span class="hljs-meta">...</span> <span class="python"><span class="hljs-string">abc</span></span>
<span class="hljs-meta">...</span> <span class="python"><span class="hljs-string">"""</span></span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">test</span><span class="hljs-params">()</span>:</span></span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">test</span>(<span class="hljs-params"></span>):</span></span>
mondeja marked this conversation as resolved.
Show resolved Hide resolved
<span class="hljs-meta">...</span> <span class="python"> <span class="hljs-keyword">pass</span></span>
<span class="hljs-meta">&gt;&gt;&gt;</span>
<span class="hljs-meta">&gt;&gt;&gt;</span>
10 changes: 5 additions & 5 deletions test/markup/python/function-header-comments.expect.txt
@@ -1,10 +1,10 @@
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">foo</span><span class="hljs-params">(
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">foo</span>(<span class="hljs-params">
bar, <span class="hljs-comment"># commment</span>
)</span>:</span>
</span>):</span>
<span class="hljs-keyword">pass</span>


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Foo</span><span class="hljs-params">(collections.namedtuple<span class="hljs-params">(<span class="hljs-string">'Test'</span>)</span>, <span class="hljs-params">(
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Foo</span>(<span class="hljs-params">collections.namedtuple(<span class="hljs-params"><span class="hljs-string">'Test'</span></span>), (<span class="hljs-params">
<span class="hljs-string">'name'</span>, <span class="hljs-comment"># comment</span>
)</span>)</span>:</span>
<span class="hljs-keyword">pass</span>
</span>)</span>):</span>
<span class="hljs-keyword">pass</span>
2 changes: 1 addition & 1 deletion test/markup/python/function-header.expect.txt
@@ -1,2 +1,2 @@
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x: int)</span> -&gt; <span class="hljs-keyword">None</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span>(<span class="hljs-params">x: int</span>) -&gt; <span class="hljs-keyword">None</span>:</span>
<span class="hljs-keyword">pass</span>
2 changes: 1 addition & 1 deletion test/markup/python/matrix-multiplication.expect.txt
Expand Up @@ -2,6 +2,6 @@
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">C</span>:</span>

<span class="hljs-meta"> @decorator</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(self, H, V, beta, r)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span>(<span class="hljs-params">self, H, V, beta, r</span>):</span>
S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)
<span class="hljs-keyword">return</span> S