Skip to content

Commit

Permalink
Resolve five undefined names found by flake8 (#112)
Browse files Browse the repository at this point in the history
* Typo: J.kill_vm() --> javabridge.kill_vm()

[flake8](http://flake8.pycqa.org) testing of https://github.com/CellProfiler/python-bioformats on Python 2.7.14

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./bioformats/__init__.py:98:5: F821 undefined name 'J'
    J.kill_vm()
    ^
./bioformats/formatreader.py:751:59: F821 undefined name 'path'
                    "The file, \"%s\", does not exist." % path,
                                                          ^
./bioformats/formatreader.py:752:21: F821 undefined name 'path'
                    path)
                    ^
./bioformats/omexml.py:1164:39: F821 undefined name 'NS_SPW'
            make_text_node(self.node, NS_SPW, "Description", test)
                                      ^
./bioformats/omexml.py:1164:62: F821 undefined name 'test'
            make_text_node(self.node, NS_SPW, "Description", test)
                                                             ^
5     F821 undefined name 'J'
5
```

* Undefined name: ' path' --> 'self.path'

__path__ is an _undefined name_ in the context which will probably raise a __NameError__ at runtime instead of the desired Exception.

* Undefined name: 'test' --> 'text'

__NS_SPW__ is probably somehow related to https://www.openmicroscopy.org/Schemas/SPW/2015-01/SPW.xsd

* Undefined name: NS_SPW --> self.ns['spw']
  • Loading branch information
cclauss authored and AetherUnbound committed Sep 26, 2018
1 parent 5d92c8e commit 22f5bcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bioformats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@
import wx.py.PyCrust

wx.py.PyCrust.main()
J.kill_vm()
javabridge.kill_vm()
4 changes: 2 additions & 2 deletions bioformats/formatreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ def init_reader(self):
je, "java/io/FileNotFoundException"):
raise IOError(
errno.ENOENT,
"The file, \"%s\", does not exist." % path,
path)
"The file, \"%s\", does not exist." % self.path,
self.path)
e2 = IOError(
errno.EINVAL, "Could not load the file as an image (see log for details)",
self.path.encode('utf-8'))
Expand Down
2 changes: 1 addition & 1 deletion bioformats/omexml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ def get_Description(self):
return get_text(description)

def set_Description(self, text):
make_text_node(self.node, NS_SPW, "Description", test)
make_text_node(self.node, self.ns['spw'], "Description", text)
Description = property(get_Description, set_Description)

def get_Well(self):
Expand Down

0 comments on commit 22f5bcb

Please sign in to comment.