migration
Functions:
| Name | Description |
|---|---|
migrate |
Perform migration of configuration based on the API version. |
replace_line_in_file |
Replace a line in a file based on a given pattern. |
migrate
migrate(cfg: DcspyConfigYaml) -> DcspyConfigYaml
Perform migration of configuration based on the API version.
If the api_ver key does not exist, it is set to 2.3.3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
DcspyConfigYaml
|
Configuration dictionary |
required |
Returns:
| Type | Description |
|---|---|
DcspyConfigYaml
|
Full-migrated dictionary |
Source code in src/dcspy/migration.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
replace_line_in_file
Replace a line in a file based on a given pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The name of the file to replace the line in. |
required |
|
Path
|
The directory path where the file is located. |
required |
|
Pattern
|
The regular expression pattern to search for in the file. |
required |
|
str
|
The text to replace the line matching the pattern with. |
required |
Source code in src/dcspy/migration.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |