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

Apply black + isort code formatting tools #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nirjas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""

from nirjas.main import file_runner # noqa
from nirjas.main import LanguageMapper # noqa
from nirjas.main import LanguageMapper # noqa
from nirjas.main import file_runner # noqa


def extract(file):
Expand Down
2 changes: 1 addition & 1 deletion nirjas/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def readMultiLineDiff(file, startSyntax: str, endSyntax: str):
if startSyntax in line:
copy = True
startLine.append(lineNumber)
line = line[line.find(startSyntax) + len(startSyntax):]
line = line[line.find(startSyntax) + len(startSyntax) :]
if endSyntax in line:
copy = False
line = line[: line.rfind(endSyntax) + len(endSyntax)]
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def cExtractor(file):
Expand Down Expand Up @@ -98,7 +98,7 @@ def cSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/c_sharp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def c_sharpExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def c_sharpSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def cppExtractor(file):
Expand Down Expand Up @@ -98,7 +98,7 @@ def cppSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/css.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax
from nirjas.output import ScanOutput, MultiLine
from nirjas.output import MultiLine, ScanOutput


def cssExtractor(file):
Expand Down Expand Up @@ -81,7 +81,7 @@ def cssSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/dart.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def dartExtractor(file):
Expand Down Expand Up @@ -116,7 +116,7 @@ def dartSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def goExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def goSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/haskell.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def haskellExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def haskellSource(file, new_file: str):
copy = False
found = True
if "-}" in line:
content = content + line[line.rfind("-}") + 2:]
content = content + line[line.rfind("-}") + 2 :]
line = content
copy = True
found = True
Expand Down
6 changes: 3 additions & 3 deletions nirjas/languages/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax
from nirjas.output import ScanOutput, MultiLine
from nirjas.output import MultiLine, ScanOutput


def htmlExtractor(file):
Expand Down Expand Up @@ -96,7 +96,7 @@ def htmlSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand All @@ -107,7 +107,7 @@ def htmlSource(file, new_file: str):
copy = False
found = True
if "-->" in line:
content = content + line[line.rfind("-->") + 3:]
content = content + line[line.rfind("-->") + 3 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def javaExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def javaSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def javascriptExtractor(file):
Expand Down Expand Up @@ -98,7 +98,7 @@ def javascriptSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
13 changes: 8 additions & 5 deletions nirjas/languages/julia.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def juliaExtractor(file):
Expand All @@ -44,7 +44,10 @@ def juliaExtractor(file):
output.lang = "Julia"
output.total_lines = single_line_comment[1]
output.total_lines_of_comments = (
single_line_comment[3] + multiline_single_comment[3] + multiline_double_comment[3] + multiline_hashEqual_comment[3]
single_line_comment[3]
+ multiline_single_comment[3]
+ multiline_double_comment[3]
+ multiline_hashEqual_comment[3]
)
output.blank_lines = single_line_comment[2]

Expand Down Expand Up @@ -126,7 +129,7 @@ def juliaSource(file, new_file: str):
copy = False
found = True
else:
content = content + line[line.rfind('"""') + 3:]
content = content + line[line.rfind('"""') + 3 :]
line = content
copy = True
found = True
Expand All @@ -138,7 +141,7 @@ def juliaSource(file, new_file: str):
copy = False
found = True
else:
content = content + line[line.rfind("'''") + 3:]
content = content + line[line.rfind("'''") + 3 :]
line = content
copy = True
found = True
Expand All @@ -149,7 +152,7 @@ def juliaSource(file, new_file: str):
copy = False
found = True
if "=#" in line:
content = content + line[line.rfind("=#") + 2:]
content = content + line[line.rfind("=#") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/kotlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def kotlinExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def kotlinSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def matlabExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def matlabSource(file, new_file: str):
copy = False
found = True
if "}%" in line:
content = content + line[line.rfind("}%") + 2:]
content = content + line[line.rfind("}%") + 2 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def perlExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def perlSource(file, new_file: str):
copy = False
found = True
if "=cut" in line:
content = content + line[line.rfind("=cut") + 4:]
content = content + line[line.rfind("=cut") + 4 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/php.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def phpExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def phpSource(file, new_file: str):
copy = False
found = True
if "*/" in line:
content = content + line[line.rfind("*/") + 2:]
content = content + line[line.rfind("*/") + 2 :]
line = content
copy = True
found = True
Expand Down
11 changes: 7 additions & 4 deletions nirjas/languages/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def pythonExtractor(file):
Expand All @@ -44,7 +44,10 @@ def pythonExtractor(file):
output.lang = "Python"
output.total_lines = single_line_comment[1]
output.total_lines_of_comments = (
single_line_comment[3] + multiline_single_comment[3] + multiline_double_comment[3])
single_line_comment[3]
+ multiline_single_comment[3]
+ multiline_double_comment[3]
)
output.blank_lines = single_line_comment[2]

if cont_single_line_comment:
Expand Down Expand Up @@ -113,7 +116,7 @@ def pythonSource(file, new_file: str):
copy = False
found = True
else:
content = content + line[line.rfind('"""') + 3:]
content = content + line[line.rfind('"""') + 3 :]
line = content
copy = True
found = True
Expand All @@ -125,7 +128,7 @@ def pythonSource(file, new_file: str):
copy = False
found = True
else:
content = content + line[line.rfind("'''") + 3:]
content = content + line[line.rfind("'''") + 3 :]
line = content
copy = True
found = True
Expand Down
4 changes: 2 additions & 2 deletions nirjas/languages/ruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""

from nirjas.binder import CommentSyntax, contSingleLines
from nirjas.output import ScanOutput, SingleLine, MultiLine
from nirjas.output import MultiLine, ScanOutput, SingleLine


def rubyExtractor(file):
Expand Down Expand Up @@ -95,7 +95,7 @@ def rubySource(file, new_file: str):
copy = False
found = True
if "=end" in line:
content = content + line[line.rfind("=end") + 4:]
content = content + line[line.rfind("=end") + 4 :]
line = content
copy = True
found = True
Expand Down
Loading