libNeuroML icon indicating copy to clipboard operation
libNeuroML copied to clipboard

[Bug] Undefined names (various)

Open sanjayankur31 opened this issue 4 years ago • 1 comments
trafficstars

Describe the bug The sources contain a bunch of undefined names that could lead to errors.

To Reproduce

Run flake8 with the following options:

flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

Expected behavior We shouldn't have undefined names in the sources.

Observed behavior

./neuroml/loaders.py:117:19: F821 undefined name 'MorphologyImportError'
            raise MorphologyImportError(s)
                  ^
./neuroml/arraymorph_load_time_benchmark.py:3:9: F821 undefined name 'self'
        self.num_segments = num_segments
        ^
./neuroml/arraymorph_load_time_benchmark.py:9:13: F821 undefined name 'np'
        x = np.linspace(0,10,num_vertices)
            ^
./neuroml/arraymorph_load_time_benchmark.py:10:13: F821 undefined name 'np'
        y = np.zeros(num_vertices)
            ^
./neuroml/arraymorph_load_time_benchmark.py:11:13: F821 undefined name 'np'
        z = np.zeros(num_vertices)
            ^
./neuroml/arraymorph_load_time_benchmark.py:12:13: F821 undefined name 'np'
        d = np.linspace(1,0.01,num_vertices)
            ^
./neuroml/arraymorph_load_time_benchmark.py:14:20: F821 undefined name 'np'
        vertices = np.array([x,y,z,d]).T
                   ^
./neuroml/arraymorph_load_time_benchmark.py:18:26: F821 undefined name 'am'
        big_arraymorph = am.ArrayMorphology(vertices = vertices,
                         ^
./neuroml/arraymorph_load_time_benchmark.py:21:31: F821 undefined name 'np'
        transposed_vertices = np.array([transposed_x,y,z,d]).T
                              ^
./neuroml/arraymorph_load_time_benchmark.py:23:33: F821 undefined name 'am'
        transposed_arraymorph = am.ArrayMorphology(vertices = transposed_vertices,
                                ^
./neuroml/arraymorph_load_time_benchmark.py:27:27: F821 undefined name 'np'
        fatter_vertices = np.array([x,y,z,bigger_d]).T
                          ^
./neuroml/arraymorph_load_time_benchmark.py:29:29: F821 undefined name 'am'
        fatter_arraymorph = am.ArrayMorphology(vertices = fatter_vertices,
                            ^
./neuroml/arraymorph_load_time_benchmark.py:32:24: F821 undefined name 'neuroml'
        neuroml_cell = neuroml.Cell(id='cell_4')
                       ^
./neuroml/arraymorph_load_time_benchmark.py:33:30: F821 undefined name 'neuroml'
        neuroml_morphology = neuroml.Morphology(id = 'my_morph')
                             ^
./neuroml/arraymorph_load_time_benchmark.py:40:23: F821 undefined name 'neuroml'
        self.cell_1 = neuroml.Cell(id='cell_1')
                      ^
./neuroml/arraymorph_load_time_benchmark.py:41:23: F821 undefined name 'neuroml'
        self.cell_2 = neuroml.Cell(id='cell_2')
                      ^
./neuroml/arraymorph_load_time_benchmark.py:42:23: F821 undefined name 'neuroml'
        self.cell_3 = neuroml.Cell(id='cell_3')
                      ^
./neuroml/arraymorph_load_time_benchmark.py:48:25: F821 undefined name 'neuroml'
        self.test_doc = neuroml.NeuroMLDocument(id='TestDocument')
                        ^
./neuroml/benchmarks/arraymorph_benchmarks.py:21:15: E999 SyntaxError: invalid syntax
        print '%r (%r, %r) %2.2f sec' % \
              (method.__name__, args, kw, te-ts)
              ^
./neuroml/nml/nml.py:38:20: F821 undefined name 'basestring'
    BaseStrType_ = basestring
                   ^
./neuroml/nml/nml.py:418:71: F821 undefined name 'unicode'
            elif sys.version_info.major == 2 and isinstance(instring, unicode):
                                                                      ^
1     E999 SyntaxError: invalid syntax
20    F821 undefined name 'self'

System information:

  • OS: [e.g. iOS]: Fedora Linux 34
  • Python version (python --version): python 3.9
  • Version of tools in use (Output of python -c 'import neuroml; print(neuroml.__version__)'): From development at this commit 6439df7

Additional context Most of these are easy to fix, so I'll open a PR. The one symbol I haven't been able to find the definition of is MorphologyImportError. Where/what library defines this?

sanjayankur31 avatar Mar 11 '21 10:03 sanjayankur31

./neuroml/benchmarks/arraymorph_benchmarks.py:21:15: E999 SyntaxError: invalid syntax print '%r (%r, %r) %2.2f sec' %
(method.name, args, kw, te-ts) ^

Is fixed in #98

sanjayankur31 avatar Mar 11 '21 10:03 sanjayankur31