XsCheck
Source code in AoE2ScenarioParser/objects/support/xs_check.py
20 21 22 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 54 55 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 104 105 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 139 140 141 142 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
Attributes¶
allow_unsupported_versions: bool = False
instance-attribute
¶
bool
Value:
False
If XS-Check should be checked for compatibility
path: Optional[Path]
property
writable
¶
Optional[Path]
The path for a custom XS check binary (One that is not shipped with AoE2ScenarioParser
raise_on_error: bool = False
instance-attribute
¶
bool
Value:
False
If a Python error should be raised if XS-Check encounters an error
version: Tuple[int, int, int] = (0, 2, 1)
class-attribute
instance-attribute
¶
Tuple[int, int, int]
Value:
(0, 2, 1)
xs_encoding = 'utf-8'
instance-attribute
¶
'utf-8'
The encoding that should be used for reading and writing the file with the XS script
Functions¶
def __init__(...)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uuid |
UUID
|
- | required |
Source code in AoE2ScenarioParser/objects/support/xs_check.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
def get_version(...)
¶
Get the version from the xs-check binary
Returns:
Type | Description |
---|---|
Tuple[int, ...]
|
A tuple containing the version xs-check number |
Source code in AoE2ScenarioParser/objects/support/xs_check.py
165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
def is_supported_xs_check_binary(...)
¶
Check if the xs-check binary is supported by this version of AoE2ScenarioParser. Allows an override to easily allow users to use newer versions which might be supported too.
Returns:
Type | Description |
---|---|
bool
|
True if it is supported, False otherwise |
Source code in AoE2ScenarioParser/objects/support/xs_check.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
def validate(...)
¶
Validates the XS file and throws an exception if xs-check finds an error
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xs_file |
Optional[Union[Path, str]]
|
The XS file to validate |
required |
show_tmpfile |
bool
|
If a reference to the tmp file should be displayed |
True
|
Throws
XsCheckValidationError: When xs-check encounters an error
Returns:
Type | Description |
---|---|
True
|
True if no errors are found or xs-check has been disabled, an |
Source code in AoE2ScenarioParser/objects/support/xs_check.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 |
|
def validate_safe(...)
¶
Validates the XS file and and returns a boolean based on if errors were found
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xs_file |
Optional[Union[Path, str]]
|
The XS file to validate |
required |
Returns:
Type | Description |
---|---|
bool
|
True if no errors are found or xs-check has been disabled, False otherwise |
Source code in AoE2ScenarioParser/objects/support/xs_check.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|