Skip to content

Commit

Permalink
fixes to avoid warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Jul 18, 2022
1 parent 917ce57 commit bea3a63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
31 changes: 11 additions & 20 deletions src/omero/columns.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
::
/*
* $Id$
*
* Copyright 2009 Glencoe Software, Inc. All rights reserved.
* Use is subject to license terms supplied in LICENSE.txt
*
*/
Copyright 2009 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""

"""
Expand Down Expand Up @@ -256,27 +250,24 @@ def descriptor(self, pos):

class StringColumnI(AbstractColumn, omero.grid.StringColumn):
"""
StringColumns are actually numpy dtype 'S':
"zero-terminated bytes (not recommended)"
StringColumns are actually numpy dtype 'S': "zero-terminated bytes (not recommended)"
https://github.com/ome/omero-py/blob/v5.6.dev8/src/omero/columns.py#L269
https://docs.scipy.org/doc/numpy-1.15.1/reference/arrays.dtypes.html#specifying-and-constructing-data-types
In any case HDF5 doesn't seem to properly support unicode,
and numexpr doesn't even pretend to support it:
https://github.com/PyTables/PyTables/issues/499
https://github.com/pydata/numexpr/issues/142
https://github.com/pydata/numexpr/issues/150
https://github.com/pydata/numexpr/issues/263
https://github.com/pydata/numexpr/blob/v2.7.0/numexpr/necompiler.py#L340-L341
- https://github.com/PyTables/PyTables/issues/499
- https://github.com/pydata/numexpr/issues/142
- https://github.com/pydata/numexpr/issues/150
- https://github.com/pydata/numexpr/issues/263
- https://github.com/pydata/numexpr/blob/v2.7.0/numexpr/necompiler.py#L340-L341
> import numexpr
> a = "£"
> numexpr.evaluate('a=="£"')
ValueError: unknown type str32
> b = "£".encode()
> numexpr.evaluate('b=="£"')
UnicodeEncodeError: 'ascii' codec can't encode character '\xa3'
in position 0: ordinal not in range(128)
UnicodeEncodeError: 'ascii' codec can't encode character '\xa3' in position 0: ordinal not in range(128)
You should be able to store/load unicode data but you can't use
unicode in a where condition
Expand Down Expand Up @@ -585,9 +576,9 @@ class ObjectFactory(Ice.ObjectFactory):
def __init__(self, cls, f):
try:
self.id = cls.ice_staticId()
except Exception as e:
except Exception:
pass

self.f = f

def create(self, string):
Expand Down
2 changes: 1 addition & 1 deletion src/omero/rtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ class ObjectFactory(Ice.ObjectFactory):
def __init__(self, cls, f):
try:
self.id = cls.ice_staticId()
except Exception as e:
except Exception:
pass
self.f = f

Expand Down

0 comments on commit bea3a63

Please sign in to comment.