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 1919 - name : Install build and test dependencies
2020 run : |
2121 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
2323 - name : Install asciidtype
2424 working-directory : asciidtype
2525 run : |
7878 working-directory : stringdtype
7979 run : |
8080 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"
1111[tool .black ]
1212line-length = 79
1313
14+ [tool .isort ]
15+ profile = " black"
16+ line_length = 79
17+
1418[project ]
1519name = " stringdtype"
1620description = " A dtype for storing UTF-8 strings"
Original file line number Diff line number Diff line change 33"""
44
55from .missing import NA # isort: skip
6- from .scalar import StringScalar # isort: skip
6+ from .scalar import StringScalar , PandasStringScalar # isort: skip
77from ._main import StringDType , _memory_usage
88
9+ try :
10+ from ._main import PandasStringDType
11+ except ImportError :
12+ PandasStringDType = None
13+
914__all__ = [
1015 "NA" ,
1116 "StringDType" ,
1217 "StringScalar" ,
1318 "_memory_usage" ,
1419]
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."""
22
33
44class StringScalar (str ):
55 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";
8080
8181static NPY_CASTING
8282unicode_to_string_resolve_descriptors (PyObject * NPY_UNUSED (self ),
83- PyArray_DTypeMeta * NPY_UNUSED ( dtypes [2 ]) ,
83+ PyArray_DTypeMeta * dtypes [2 ],
8484 PyArray_Descr * given_descrs [2 ],
8585 PyArray_Descr * loop_descrs [2 ],
8686 npy_intp * NPY_UNUSED (view_offset ))
8787{
8888 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 ]);
9091 if (new == NULL ) {
9192 return (NPY_CASTING )- 1 ;
9293 }
93- loop_descrs [1 ] = ( PyArray_Descr * ) new ;
94+ loop_descrs [1 ] = new ;
9495 }
9596 else {
9697 Py_INCREF (given_descrs [1 ]);
You can’t perform that action at this time.
0 commit comments