Skip to content

Commit fb33495

Browse files
authored
running black-20.8b1 for linting, pinning version in testing (#168)
Signed-off-by: vsoch <[email protected]>
1 parent c19a33d commit fb33495

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1024
-1047
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ jobs:
1414
- uses: actions/checkout@v2
1515

1616
- name: Setup black linter
17-
run: conda create --quiet --name black black pyflakes
17+
run: conda create --quiet --name black pyflakes
1818

1919
- name: Lint python code with black
2020
run: |
2121
export PATH="/usr/share/miniconda/bin:$PATH"
2222
source activate black
23+
pip install black==20.8b1
2324
black --check spython
2425
2526
- name: Check unused imports with pyflakes

spython/client/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ def get_parser():
117117

118118

119119
def set_verbosity(args):
120-
"""determine the message level in the environment to set based on args.
121-
"""
120+
"""determine the message level in the environment to set based on args."""
122121
level = "INFO"
123122

124123
if args.debug:
@@ -141,8 +140,7 @@ def set_verbosity(args):
141140

142141

143142
def version():
144-
"""version prints the version, both for the user and help output
145-
"""
143+
"""version prints the version, both for the user and help output"""
146144
import spython
147145

148146
return spython.__version__
@@ -153,8 +151,8 @@ def main():
153151
parser = get_parser()
154152

155153
def print_help(return_code=0):
156-
"""print help, including the software version and active client
157-
and exit with return code.
154+
"""print help, including the software version and active client
155+
and exit with return code.
158156
"""
159157
v = version()
160158
print("\nSingularity Python [v%s]\n" % (v))

spython/client/recipe.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717

1818
def main(args, options, parser):
19-
"""This function serves as a wrapper around the DockerParser,
20-
SingularityParser, DockerWriter, and SingularityParser converters.
21-
We can either save to file if args.outfile is defined, or print
22-
to the console if not.
19+
"""This function serves as a wrapper around the DockerParser,
20+
SingularityParser, DockerWriter, and SingularityParser converters.
21+
We can either save to file if args.outfile is defined, or print
22+
to the console if not.
2323
"""
2424
# We need something to work with
2525
if not args.files:

spython/client/shell.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def main(args, options, parser):
2424

2525

2626
def prepare_client(image):
27-
"""prepare a client to embed in a shell with recipe parsers and writers.
28-
"""
27+
"""prepare a client to embed in a shell with recipe parsers and writers."""
2928
# The client will announce itself (backend/database) unless it's get
3029
from spython.main import get_client
3130
from spython.main.parse import parsers
@@ -43,8 +42,7 @@ def prepare_client(image):
4342

4443

4544
def ipython(image):
46-
"""give the user an ipython shell
47-
"""
45+
"""give the user an ipython shell"""
4846
client = prepare_client(image) # pylint: disable=unused-variable
4947

5048
try:
@@ -56,8 +54,7 @@ def ipython(image):
5654

5755

5856
def run_bpython(image):
59-
"""give the user a bpython shell
60-
"""
57+
"""give the user a bpython shell"""
6158
client = prepare_client(image)
6259

6360
try:
@@ -69,8 +66,7 @@ def run_bpython(image):
6966

7067

7168
def python(image):
72-
"""give the user a python shell
73-
"""
69+
"""give the user a python shell"""
7470
import code
7571

7672
client = prepare_client(image)

spython/image/__init__.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def __repr__(self):
2222

2323
def parse_image_name(self, image):
2424
"""
25-
simply split the uri from the image. Singularity handles
26-
parsing of registry, namespace, image.
27-
28-
Parameters
29-
==========
30-
image: the complete image uri to load (e.g., docker://ubuntu)
25+
simply split the uri from the image. Singularity handles
26+
parsing of registry, namespace, image.
27+
28+
Parameters
29+
==========
30+
image: the complete image uri to load (e.g., docker://ubuntu)
3131
3232
"""
3333
self._image = image
@@ -37,27 +37,27 @@ def parse_image_name(self, image):
3737
class Image(ImageBase):
3838
def __init__(self, image=None):
3939
"""An image here is an image file or a record.
40-
The user can choose to load the image when starting the client, or
41-
update the main client with an image. The image object is kept
42-
with the main client to make running additional commands easier.
40+
The user can choose to load the image when starting the client, or
41+
update the main client with an image. The image object is kept
42+
with the main client to make running additional commands easier.
4343
44-
Parameters
45-
==========
46-
image: the image uri to parse (required)
44+
Parameters
45+
==========
46+
image: the image uri to parse (required)
4747
4848
"""
4949
super(Image, self).__init__()
5050
self.parse_image_name(image)
5151

5252
def get_hash(self, image=None):
5353
"""return an md5 hash of the file based on a criteria level. This
54-
is intended to give the file a reasonable version. This only is
55-
useful for actual image files.
56-
57-
Parameters
58-
==========
59-
image: the image path to get hash for (first priority). Second
60-
priority is image path saved with image object, if exists.
54+
is intended to give the file a reasonable version. This only is
55+
useful for actual image files.
56+
57+
Parameters
58+
==========
59+
image: the image path to get hash for (first priority). Second
60+
priority is image path saved with image object, if exists.
6161
6262
"""
6363
hasher = hashlib.md5()

spython/image/cmd/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77

88
def generate_image_commands():
9-
""" The Image client holds the Singularity image command group, mainly
10-
deprecated commands (image.import) and additional command helpers
11-
that are commonly use but not provided by Singularity
9+
"""The Image client holds the Singularity image command group, mainly
10+
deprecated commands (image.import) and additional command helpers
11+
that are commonly use but not provided by Singularity
1212
13-
The levels of verbosity (debug and quiet) are passed from the main
14-
client via the environment variable MESSAGELEVEL.
13+
The levels of verbosity (debug and quiet) are passed from the main
14+
client via the environment variable MESSAGELEVEL.
1515
16-
These commands are added to Client.image under main/__init__.py to
17-
expose subcommands:
16+
These commands are added to Client.image under main/__init__.py to
17+
expose subcommands:
1818
19-
Client.image.export
20-
Client.image.imprt
21-
Client.image.decompress
22-
Client.image.create
19+
Client.image.export
20+
Client.image.imprt
21+
Client.image.decompress
22+
Client.image.create
2323
2424
"""
2525

spython/image/cmd/create.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
def create(self, image_path, size=1024, sudo=False, singularity_options=None):
1313
"""create will create a a new image
1414
15-
Parameters
16-
==========
17-
image_path: full path to image
18-
size: image sizein MiB, default is 1024MiB
19-
filesystem: supported file systems ext3/ext4 (ext[2/3]: default ext3
20-
singularity_options: a list of options to provide to the singularity client
15+
Parameters
16+
==========
17+
image_path: full path to image
18+
size: image sizein MiB, default is 1024MiB
19+
filesystem: supported file systems ext3/ext4 (ext[2/3]: default ext3
20+
singularity_options: a list of options to provide to the singularity client
2121
"""
2222
from spython.utils import check_install
2323

spython/image/cmd/export.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
def export(self, image_path, tmptar=None):
1313
"""export will export an image, sudo must be used.
1414
15-
Parameters
16-
==========
17-
18-
image_path: full path to image
19-
tmptar: if defined, use custom temporary path for tar export
15+
Parameters
16+
==========
17+
18+
image_path: full path to image
19+
tmptar: if defined, use custom temporary path for tar export
2020
2121
"""
2222
from spython.utils import check_install

spython/image/cmd/importcmd.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
def importcmd(self, image_path, input_source):
99
"""import will import (stdin) to the image
1010
11-
Parameters
12-
==========
13-
image_path: path to image to import to.
14-
input_source: input source or file
15-
import_type: if not specified, imports whatever function is given
16-
11+
Parameters
12+
==========
13+
image_path: path to image to import to.
14+
input_source: input source or file
15+
import_type: if not specified, imports whatever function is given
16+
1717
"""
1818
from spython.utils import check_install
1919

spython/instance/__init__.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
class Instance(ImageBase):
1212
def __init__(self, image, start=True, name=None, **kwargs):
1313
"""An instance is an image running as an instance with services.
14-
This class has functions appended under cmd/__init__ and is
15-
instantiated when the user calls Client.
16-
17-
Parameters
18-
==========
19-
image: the Singularity image uri to parse (required)
20-
start: boolean to start the instance (default is True)
21-
name: a name for the instance (will generate RobotName
22-
if not provided)
14+
This class has functions appended under cmd/__init__ and is
15+
instantiated when the user calls Client.
16+
17+
Parameters
18+
==========
19+
image: the Singularity image uri to parse (required)
20+
start: boolean to start the instance (default is True)
21+
name: a name for the instance (will generate RobotName
22+
if not provided)
2323
"""
2424
super(Instance, self).__init__()
2525
self.parse_image_name(image)
@@ -38,7 +38,7 @@ def __init__(self, image, start=True, name=None, **kwargs):
3838

3939
def generate_name(self, name=None):
4040
"""generate a Robot Name for the instance to use, if the user doesn't
41-
supply one.
41+
supply one.
4242
"""
4343
# If no name provided, use robot name
4444
if name is None:
@@ -47,27 +47,26 @@ def generate_name(self, name=None):
4747

4848
def parse_image_name(self, image):
4949
"""
50-
simply split the uri from the image. Singularity handles
51-
parsing of registry, namespace, image.
52-
53-
Parameters
54-
==========
55-
image: the complete image uri to load (e.g., docker://ubuntu)
50+
simply split the uri from the image. Singularity handles
51+
parsing of registry, namespace, image.
52+
53+
Parameters
54+
==========
55+
image: the complete image uri to load (e.g., docker://ubuntu)
5656
5757
"""
5858
self._image = image
5959
self.protocol = "instance"
6060

6161
def get_uri(self):
62-
"""return the image uri (instance://) along with it's name
63-
"""
62+
"""return the image uri (instance://) along with it's name"""
6463
return self.__str__()
6564

6665
# Metadata
6766

6867
def _update_metadata(self, kwargs=None):
6968
"""Extract any additional attributes to hold with the instance
70-
from kwargs
69+
from kwargs
7170
"""
7271

7372
# If not given metadata, use instance.list to get it for container

0 commit comments

Comments
 (0)