Gnm.StfParseOptions_t¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
col_autofit_array |
r/w |
||
col_import_array |
r/w |
||
col_import_array_len |
r/w |
||
cols_exceeded |
r/w |
||
compiled_terminator |
r/w |
||
formats |
[ |
r/w |
|
formats_curr |
[ |
r/w |
|
formats_decimal |
[ |
r/w |
|
formats_thousand |
[ |
r/w |
|
indicator_2x_is_single |
r/w |
||
locale |
r/w |
||
parsetype |
r/w |
||
ref_count |
r/w |
||
rows_exceeded |
r/w |
||
sep |
r/w |
||
splitpositions |
[ |
r/w |
|
stringindicator |
r/w |
||
terminator |
[ |
r/w |
|
trim_seps |
r/w |
||
trim_spaces |
r/w |
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gnm.StfParseOptions_t¶
- classmethod guess(data)¶
- Parameters:
data (
str
) – the input data.- Returns:
the guessed options.
- Return type:
- classmethod guess_csv(data)¶
- Parameters:
data (
str
) – the CSV input data.- Returns:
the guessed options.
- Return type:
- add_line_terminator(terminator)¶
- Parameters:
terminator (
str
) –
This will add to the line terminators, in both the Fixed width and CSV delimited importers this indicates the end of a
Gnm.row
.
- clear_line_terminator()¶
This will clear the line terminator, in both the Fixed width and CSV delimited importers this indicates the end of a
Gnm.row
.
- csv_set_duplicates(duplicates)¶
- Parameters:
duplicates (
bool
) – a booleanGOffice.value
indicating whether we want to see two separators right behind each other as one
- csv_set_indicator_2x_is_single(indic_2x)¶
- Parameters:
indic_2x (
bool
) – a booleanGOffice.value
indicating whether we want to see two adjacent string indicators as a single string indicator that is part of the cell, rather than a terminator.
- csv_set_separators(character, seps)¶
-
A copy is made of the parameters.
- csv_set_trim_seps(trim_seps)¶
- Parameters:
trim_seps (
bool
) – a booleanGOffice.value
indicating whether we want to ignore separators at the beginning of lines
- fixed_autodiscover(data, data_end)¶
-
Automatically try to discover columns in the text to be parsed. We ignore empty lines (only containing parseoptions->terminator)
FIXME: This is so extremely ugly that I am too tired to rewrite it right now. Think hard of a better more flexible solution…
- fixed_splitpositions_add(position)¶
- Parameters:
position (
int
) –
position will be added to the splitpositions.
- fixed_splitpositions_clear()¶
This will clear the splitpositions (== points on which a line is split)
- free()¶
will free self, note that this will not free the splitpositions member (
GLib.Array
) of the struct, the caller is responsible for that.
- guess_formats(data)¶
- Parameters:
data (
str
) – the CSV input data.
This function attempts to recognize data formats on a column-by-column basis under the assumption that the data in a text file will generally use the same data formats.
This is useful because not all values give sufficient information by themselves to tell what format the data is in. For example, “1/2/2000” is likely to be a date in year 2000, but it is not clear if it is in January or February. If another
GOffice.value
in the same column is “31/1/1999” then it is likely that the former date was in February.Likewise, a
GOffice.value
of “123,456” could mean either 1.23456e5 or 1.23456e2. A laterGOffice.value
of “111,200.22” would clear up the confusion.
- set_trim_spaces(trim_spaces)¶
- Parameters:
trim_spaces (
Gnm.StfTrimType_t
) –
If enabled will trim spaces in every parsed field on left and/or right sides.
- set_type(parsetype)¶
- Parameters:
parsetype (
Gnm.StfParseType_t
) –