Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Nov 27, 2018
1 parent 3bad12f commit 87e216f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions jupytext/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def system(*args, **kwargs):
"""Execute the given bash command"""
kwargs.setdefault('stdout', subprocess.PIPE)
proc = subprocess.Popen(args, **kwargs)
out, err = proc.communicate()
out, _ = proc.communicate()
return out


Expand Down Expand Up @@ -186,14 +186,14 @@ def canonize_format(format_or_ext, file_path=None):
return {'notebook': 'ipynb', 'markdown': 'md', 'rmarkdown': 'Rmd'}[format_or_ext]


def str2bool(input):
def str2bool(value):
"""Parse Yes/No/Default string
https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse"""
if input.lower() in ('yes', 'true', 't', 'y', '1'):
if value.lower() in ('yes', 'true', 't', 'y', '1'):
return True
if input.lower() in ('no', 'false', 'f', 'n', '0'):
if value.lower() in ('no', 'false', 'f', 'n', '0'):
return False
if input.lower() in ('d', 'default', ''):
if value.lower() in ('d', 'default', ''):
return None
raise argparse.ArgumentTypeError('Expected: (Y)es/(T)rue/(N)o/(F)alse/(D)efault')

Expand Down Expand Up @@ -222,8 +222,8 @@ def cli_jupytext(args=None):
'is provided , but then the --from field is mandatory',
nargs='*')
parser.add_argument('--pre-commit', action='store_true',
help="""Run Jupytext on the ipynb files in the git index.
Create a pre-commit hook with:
help="""Run Jupytext on the ipynb files in the git index.
Create a pre-commit hook with:
echo '#!/bin/sh
jupytext --to py:light --pre-commit' > .git/hooks/pre-commit
Expand Down
6 changes: 3 additions & 3 deletions jupytext/contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def kernelspec_from_language(language):
"""Return the kernel specification for the first kernel with a matching language"""
try:
for name in find_kernel_specs():
ks = get_kernel_spec(name)
if ks.language == language or (language == 'c++' and ks.language.startswith('C++')):
return {'name': name, 'language': language, 'display_name': ks.display_name}
kernel_specs = get_kernel_spec(name)
if kernel_specs.language == language or (language == 'c++' and kernel_specs.language.startswith('C++')):
return {'name': name, 'language': language, 'display_name': kernel_specs.display_name}
except (KeyError, ValueError):
pass
return None
Expand Down

0 comments on commit 87e216f

Please sign in to comment.