Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions pyreadstat/_readstat_parser.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ cdef object convert_readstat_to_python_value(readstat_value_t value, int index,
cdef py_file_format file_format
cdef object result

cdef char * c_str_value
cdef const char * c_str_value
cdef str py_str_value
cdef int8_t c_int8_value
cdef int16_t c_int16_value
Expand Down Expand Up @@ -385,15 +385,15 @@ cdef int handle_metadata(readstat_metadata_t *metadata, void *ctx) except READST
cdef int var_count, obs_count, mr_len
cdef data_container dc = <data_container> ctx
#cdef object row
cdef char * flabel_orig
cdef char * fencoding_orig
cdef const char * flabel_orig
cdef const char * fencoding_orig
cdef str flabel, fencoding
cdef bint metaonly
cdef char * table
cdef const char * table
cdef int ctime
cdef int mtime
cdef int i = 0
cdef mr_set_t * mr_sets_orig
cdef const mr_set_t * mr_sets_orig
cdef dict mr_sets = {}
cdef str name
cdef list variable_list = []
Expand Down Expand Up @@ -468,9 +468,9 @@ cdef int handle_variable(int index, readstat_variable_t *variable,
if any.
"""

cdef char * var_name,
cdef char * var_label
cdef char * var_format
cdef const char * var_name,
cdef const char * var_label
cdef const char * var_format
cdef str col_name, col_label, label_name, col_format_original, output_format
cdef py_datetime_format col_format_final
cdef readstat_type_t var_type
Expand Down Expand Up @@ -742,7 +742,7 @@ cdef int handle_value_label(char *val_labels, readstat_value_t value, char *labe

cdef data_container dc = <data_container> ctx

cdef char * c_str_value
cdef const char * c_str_value
cdef str py_str_value
cdef int8_t c_int8_value
cdef int16_t c_int16_value
Expand Down Expand Up @@ -905,7 +905,7 @@ cdef void check_exit_status(readstat_error_t retcode) except *:
transforms a readstat exit status to a python error if status is not READSTAT OK
"""

cdef char * err_readstat
cdef const char * err_readstat
cdef str err_message
if retcode != READSTAT_OK:
err_readstat = readstat_error_message(retcode)
Expand Down Expand Up @@ -943,7 +943,7 @@ cdef void run_readstat_parser(char * filename, data_container data, py_file_exte
metaonly = data.metaonly
ctx = <void *>data

#readstat_error_t error = READSTAT_OK;
error = READSTAT_OK;
parser = readstat_parser_init()
metadata_handler = <readstat_metadata_handler> handle_metadata
variable_handler = <readstat_variable_handler> handle_variable
Expand Down
15 changes: 2 additions & 13 deletions pyreadstat/_readstat_writer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ cdef double convert_datetimelike_to_number(dst_file_format file_format, pywriter
converts a datime like python/pandas object to a float
"""

cdef double offset_days, tstamp
cdef double offset_days
cdef double tstamp = 0

if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR:
offset_days = spss_offset_days
Expand Down Expand Up @@ -574,18 +575,6 @@ cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx) noexcept:
else:
return write(fd, data, _len)

cdef void _check_exit_status(readstat_error_t retcode) except *:
"""
transforms a readstat exit status to a python error if status is not READSTAT OK
"""

cdef char * err_readstat
cdef str err_message
if retcode != READSTAT_OK:
err_readstat = readstat_error_message(retcode)
err_message = <str> err_readstat
raise ReadstatError(err_message)

cdef int open_file(bytes filename_bytes):

cdef int fd
Expand Down