File tree Expand file tree Collapse file tree 10 files changed +443
-223
lines changed Expand file tree Collapse file tree 10 files changed +443
-223
lines changed Original file line number Diff line number Diff line change 19
19
- name : Install build and test dependencies
20
20
run : |
21
21
pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
22
- python -m pip install -U pip build pytest unyt wheel meson ninja meson-python patchelf
22
+ python -m pip install -U pip build pytest unyt wheel meson ninja meson-python patchelf pandas
23
23
- name : Install asciidtype
24
24
working-directory : asciidtype
25
25
run : |
78
78
working-directory : stringdtype
79
79
run : |
80
80
ASAN_OPTIONS=detect_leaks=false LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so pytest -s -vvv --color=yes
81
+ pip uninstall -y pandas
82
+ ASAN_OPTIONS=detect_leaks=false LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libasan.so pytest -s -vvv --color=yes
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ build-backend = "mesonpy"
11
11
[tool .black ]
12
12
line-length = 79
13
13
14
+ [tool .isort ]
15
+ profile = " black"
16
+ line_length = 79
17
+
14
18
[project ]
15
19
name = " stringdtype"
16
20
description = " A dtype for storing UTF-8 strings"
Original file line number Diff line number Diff line change 3
3
"""
4
4
5
5
from .missing import NA # isort: skip
6
- from .scalar import StringScalar # isort: skip
6
+ from .scalar import StringScalar , PandasStringScalar # isort: skip
7
7
from ._main import StringDType , _memory_usage
8
8
9
+ try :
10
+ from ._main import PandasStringDType
11
+ except ImportError :
12
+ PandasStringDType = None
13
+
9
14
__all__ = [
10
15
"NA" ,
11
16
"StringDType" ,
12
17
"StringScalar" ,
13
18
"_memory_usage" ,
14
19
]
20
+
21
+ # this happens when pandas isn't importable
22
+ if PandasStringDType is None :
23
+ del PandasStringDType
24
+ else :
25
+ __all__ .extend ("PandasStringDType" )
Original file line number Diff line number Diff line change 1
- """A scalar type needed by the dtype machinery."""
1
+ """Scalar types needed by the dtype machinery."""
2
2
3
3
4
4
class StringScalar (str ):
5
5
pass
6
+
7
+
8
+ class PandasStringScalar (str ):
9
+ pass
Original file line number Diff line number Diff line change @@ -80,17 +80,18 @@ static char *s2s_name = "cast_StringDType_to_StringDType";
80
80
81
81
static NPY_CASTING
82
82
unicode_to_string_resolve_descriptors (PyObject * NPY_UNUSED (self ),
83
- PyArray_DTypeMeta * NPY_UNUSED ( dtypes [2 ]) ,
83
+ PyArray_DTypeMeta * dtypes [2 ],
84
84
PyArray_Descr * given_descrs [2 ],
85
85
PyArray_Descr * loop_descrs [2 ],
86
86
npy_intp * NPY_UNUSED (view_offset ))
87
87
{
88
88
if (given_descrs [1 ] == NULL ) {
89
- StringDTypeObject * new = new_stringdtype_instance (NA_OBJ );
89
+ PyArray_Descr * new = (PyArray_Descr * )new_stringdtype_instance (
90
+ (PyTypeObject * )dtypes [1 ]);
90
91
if (new == NULL ) {
91
92
return (NPY_CASTING )- 1 ;
92
93
}
93
- loop_descrs [1 ] = ( PyArray_Descr * ) new ;
94
+ loop_descrs [1 ] = new ;
94
95
}
95
96
else {
96
97
Py_INCREF (given_descrs [1 ]);
You can’t perform that action at this time.
0 commit comments