Parser
ParsedData
¶
Bases: NamedTuple
A named tuple containing the parse result.
Source code in splitgill/indexing/parser.py
13 14 15 16 17 18 19 20 | |
parse(data, options)
¶
Parse the given dict and return a ParsedData named tuple. This is the main entry point for parsing data for indexing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
the dict to parse |
required |
options
|
ParsingOptions
|
the parsing options |
required |
Returns:
| Type | Description |
|---|---|
ParsedData
|
a ParsedData named tuple |
Source code in splitgill/indexing/parser.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
parse_dict(data, options, check_geojson)
¶
Parse the dict and return a ParsedData name tuple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
dict to parse |
required |
options
|
ParsingOptions
|
the parsing options |
required |
check_geojson
|
bool
|
whether to check if the root dict is GeoJSON or not |
required |
Returns:
| Type | Description |
|---|---|
ParsedData
|
a ParsedData named tuple |
Source code in splitgill/indexing/parser.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
parse_list(data, options)
¶
Parse the given list and return a tuple similar to the ParsedData named tuple in form and identical in function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list
|
the list to parse |
required |
options
|
ParsingOptions
|
the parsing options |
required |
Returns:
| Type | Description |
|---|---|
Tuple[list, set, set]
|
a list of parsed values, a set of parsed types, and a set of data types |
Source code in splitgill/indexing/parser.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
parse_value(value, options)
cached
¶
Parse a single value into a dict of typed values. As the typing suggests, this function only deals with ints, floats, strs, and bools. Don't pass it None, lists, or dicts!
The result from this function is cached for performance reasons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[int, str, bool, float]
|
a value |
required |
options
|
ParsingOptions
|
the parsing options |
required |
Returns:
| Type | Description |
|---|---|
dict
|
a dict containing different parsed representations of the value |
Source code in splitgill/indexing/parser.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |