Skip to content

exceptions

This module all the exceptions raised by this package.

AdjustmentFactorNotInRangeError

Bases: SeedBaseException

Exception raised because adjustment factor not in range.

Parameters:

Name Type Description Default
af float

Adjustment factor property

required
Source code in shift\exceptions.py
328
329
330
331
332
333
334
335
336
337
338
339
340
class AdjustmentFactorNotInRangeError(SeedBaseException):
    """Exception raised because adjustment factor not in range.

    Args:
        af (float): Adjustment factor property
    """

    def __init__(self, af: float):
        self.message = (
            f"Adjustement factor {af} not in "
            + f"({MIN_ADJUSTMENT_FACTOR}, {MAX_ADJUSTMENT_FACTOR}) range!"
        )
        super().__init__(self.message)

AttributeDoesNotExistError

Bases: SeedBaseException

Method is called to early.

Source code in shift\exceptions.py
324
325
class AttributeDoesNotExistError(SeedBaseException):
    """Method is called to early."""

CatalogNotFoundError

Bases: SeedBaseException

Exceptions raised because catalog requested is not found.

Source code in shift\exceptions.py
579
580
class CatalogNotFoundError(SeedBaseException):
    """Exceptions raised because catalog requested is not found."""

ConductorNotFoundForKdrop

Bases: SeedBaseException

Exceptions raised because no conductor is found that satisfies the kdrop.

Parameters:

Name Type Description Default
kdrop float

Voltage drop property

required
Source code in shift\exceptions.py
555
556
557
558
559
560
561
562
563
564
565
566
class ConductorNotFoundForKdrop(SeedBaseException):
    """Exceptions raised because no conductor is found that satisfies the kdrop.

    Args:
        kdrop (float): Voltage drop property
    """

    def __init__(self, kdrop: float):
        self.message = (
            f"No conductor is found that satisfies kdrop of value {kdrop}"
        )
        super().__init__(self.message)

CustomerInvalidPhase

Bases: SeedBaseException

Exceptions raised because number of phase for customer is greater than number of phase used in secondary.

Parameters:

Name Type Description Default
customer_num_phase NumPhase

Number of phase property for customer

required
secondary_num_phase NumPhase

Number of phase for secondary lateral

required
Source code in shift\exceptions.py
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
class CustomerInvalidPhase(SeedBaseException):
    """Exceptions raised because number of phase for customer
    is greater than number of phase used in secondary.

    Args:
        customer_num_phase (NumPhase): Number of phase property for customer
        secondary_num_phase (NumPhase): Number of phase for secondary lateral
    """

    def __init__(
        self, customer_num_phase: NumPhase, secondary_num_phase: NumPhase
    ):
        self.message = (
            f"Number of phase used for load {customer_num_phase}"
            + f" is greater than that used for secondary {secondary_num_phase}"
        )
        super().__init__(self.message)

EarlyMethodCallError

Bases: SeedBaseException

Method is called to early.

Source code in shift\exceptions.py
320
321
class EarlyMethodCallError(SeedBaseException):
    """Method is called to early."""

EmptyAssetStyleDict

Bases: SeedBaseException

Exception raised for empty style dict.

Source code in shift\exceptions.py
219
220
221
222
223
224
225
226
227
class EmptyAssetStyleDict(SeedBaseException):
    """Exception raised for empty style dict."""

    def __init__(self):
        self.message = (
            "Asset specific style can not be"
            + "empty in PLotlyGISNetworkPlot object"
        )
        super().__init__(self.message)

EmptyCatalog

Bases: SeedBaseException

Exceptions raised because no catalog found.

Source code in shift\exceptions.py
356
357
class EmptyCatalog(SeedBaseException):
    """Exceptions raised because no catalog found."""

FileNotFoundError

Bases: SeedBaseException

Exception raised because file path does not exist.

Parameters:

Name Type Description Default
file_path str

File path property

required
Source code in shift\exceptions.py
149
150
151
152
153
154
155
156
157
158
class FileNotFoundError(SeedBaseException):
    """Exception raised because file path does not exist.

    Args:
        file_path (str): File path property
    """

    def __init__(self, file_path: str):
        self.message = f"File {file_path} does not exist!"
        super().__init__(self.message)

FolderNotFoundError

Bases: SeedBaseException

Exception raised because folder not found.

Parameters:

Name Type Description Default
folder_path str

Path to a invalid folder

required
Source code in shift\exceptions.py
257
258
259
260
261
262
263
264
265
266
class FolderNotFoundError(SeedBaseException):
    """Exception raised because folder not found.

    Args:
        folder_path (str): Path to a invalid folder
    """

    def __init__(self, folder_path: str):
        self.message = f"Folder {folder_path} does not exist!"
        super().__init__(self.message)

HTkVlowerthanLTkVError

Bases: SeedBaseException

Exceptions raised because HT kV used is lower than LT kv used.

Parameters:

Name Type Description Default
ht_kv float

High tension kv property

required
lt_kv float

Low tension kv property

required
Source code in shift\exceptions.py
343
344
345
346
347
348
349
350
351
352
353
class HTkVlowerthanLTkVError(SeedBaseException):
    """Exceptions raised because HT kV used is lower than LT kv used.

    Args:
        ht_kv (float): High tension kv property
        lt_kv (float): Low tension kv property
    """

    def __init__(self, ht_kv: float, lt_kv: float):
        self.message = f"HT kV {ht_kv} must be higher than LT kV {lt_kv} !"
        super().__init__(self.message)

IncompleteGeometryConfigurationDict

Bases: SeedBaseException

Exceptions raised because of incomplete geometry configuration dict.

Parameters:

Name Type Description Default
num_phase NumPhase

Number of phase property

required
geometry_dict dict

Geometry metadata

required
Source code in shift\exceptions.py
542
543
544
545
546
547
548
549
550
551
552
class IncompleteGeometryConfigurationDict(SeedBaseException):
    """Exceptions raised because of incomplete geometry configuration dict.

    Args:
        num_phase (NumPhase): Number of phase property
        geometry_dict (dict): Geometry metadata
    """

    def __init__(self, num_phase: NumPhase, geometry_dict: dict):
        self.message = f"{num_phase} key does not exist in {geometry_dict}"
        super().__init__(self.message)

InvalidInputError

Bases: SeedBaseException

Exceptions raised because the input provided is not valid.

Source code in shift\exceptions.py
583
584
class InvalidInputError(SeedBaseException):
    """Exceptions raised because the input provided is not valid."""

InvalidLengthUnitError

Bases: SeedBaseException

Exceptions raised because length unit is invalid.

Parameters:

Name Type Description Default
unit str

Line length unit used

required
Source code in shift\exceptions.py
415
416
417
418
419
420
421
422
423
424
425
426
427
class InvalidLengthUnitError(SeedBaseException):
    """Exceptions raised because length unit is invalid.

    Args:
        unit (str): Line length unit used
    """

    def __init__(self, unit: str):
        self.message = (
            f"Invalid length unit used {unit} "
            + f"please choose one of these units {VALID_LENGTH_UNITS}"
        )
        super().__init__(self.message)

InvalidMapboxStyle

Bases: SeedBaseException

Exception raised because specified style is not accepted.

Parameters:

Name Type Description Default
style str

Style property used for mapbox

required
Source code in shift\exceptions.py
204
205
206
207
208
209
210
211
212
213
214
215
216
class InvalidMapboxStyle(SeedBaseException):
    """Exception raised because specified style is not accepted.

    Args:
        style (str): Style property used for mapbox
    """

    def __init__(self, style: str):
        self.message = (
            f"Style {style} is not a valid style. "
            + f"Please one of these styles {MAP_STYLES}"
        )
        super().__init__(self.message)

InvalidNodeType

Bases: SeedBaseException

Exception because invalid node type is used.

Parameters:

Name Type Description Default
node str

Node type property

required
Source code in shift\exceptions.py
242
243
244
245
246
247
248
249
250
251
252
253
254
class InvalidNodeType(SeedBaseException):
    """Exception because invalid node type is used.

    Args:
        node (str): Node type property
    """

    def __init__(self, node: str):
        self.message = (
            f"Invalid node type: {node}, "
            + "please make sure to use valid node types"
        )
        super().__init__(self.message)

LatitudeNotInRangeError

Bases: SeedBaseException

Exception raised because latitude not in range.

Parameters:

Name Type Description Default
latitude float

Latitude property

required
Source code in shift\exceptions.py
63
64
65
66
67
68
69
70
71
72
73
74
75
class LatitudeNotInRangeError(SeedBaseException):
    """Exception raised because latitude not in range.

    Args:
        latitude (float): Latitude property
    """

    def __init__(self, latitude: float):
        self.message = (
            f"Latitude {latitude} not in "
            + f"({MIN_LATITUDE}, {MAX_LATITUDE}) range!"
        )
        super().__init__(self.message)

LongitudeNotInRangeError

Bases: SeedBaseException

Exception raised because longitude not in range.

Parameters:

Name Type Description Default
longitude float

Longitude property

required
Source code in shift\exceptions.py
78
79
80
81
82
83
84
85
86
87
88
89
90
class LongitudeNotInRangeError(SeedBaseException):
    """Exception raised because longitude not in range.

    Args:
        longitude (float): Longitude property
    """

    def __init__(self, longitude: float):
        self.message = (
            f"Longitude {longitude} not in "
            + f"({MIN_LONGITUDE}, {MAX_LONGITUDE}) range!"
        )
        super().__init__(self.message)

MaxLoopReachedForKmeans

Bases: SeedBaseException

Exception raised because max number of iterations reached for computing optimal cluster number.

Source code in shift\exceptions.py
296
297
298
class MaxLoopReachedForKmeans(SeedBaseException):
    """Exception raised because max number of iterations
    reached for computing optimal cluster number."""

MissingConfigurationAttribute

Bases: SeedBaseException

Exceptions raised because attribute is missing in configuration yaml file.

Source code in shift\exceptions.py
569
570
571
class MissingConfigurationAttribute(SeedBaseException):
    """Exceptions raised because attribute is missing
    in configuration yaml file."""

MissingKeyDataForNetworkNode

Bases: SeedBaseException

Exception because type property is missing for a network node.

Parameters:

Name Type Description Default
type str

type property for missing key

required
Source code in shift\exceptions.py
230
231
232
233
234
235
236
237
238
239
class MissingKeyDataForNetworkNode(SeedBaseException):
    """Exception because type property is missing for a network node.

    Args:
        type (str): type property for missing key
    """

    def __init__(self, type: str):
        self.message = f"`{type}` field is missing in network node data"
        super().__init__(self.message)

MultipleCatalogFoundError

Bases: SeedBaseException

Exceptions raised because multiple records found in the catalog.

Parameters:

Name Type Description Default
records List[dict]

List of records

required
Source code in shift\exceptions.py
360
361
362
363
364
365
366
367
368
369
class MultipleCatalogFoundError(SeedBaseException):
    """Exceptions raised because multiple records found in the catalog.

    Args:
        records (List[dict]): List of records
    """

    def __init__(self, records: List[dict]):
        self.message = f"Multiple records found {records}!"
        super().__init__(self.message)

NegativeAmpacityError

Bases: SeedBaseException

Exceptions raised because Ampacity is negative.

Parameters:

Name Type Description Default
ampacity float

Ampacity property

required
Source code in shift\exceptions.py
466
467
468
469
470
471
472
473
474
475
class NegativeAmpacityError(SeedBaseException):
    """Exceptions raised because Ampacity is negative.

    Args:
        ampacity (float): Ampacity property
    """

    def __init__(self, ampacity: float):
        self.message = f"Ampacity can not be negative but found {ampacity}"
        super().__init__(self.message)

NegativeAreaError

Bases: SeedBaseException

Exception raused because area of the geometry is negative.

Parameters:

Name Type Description Default
area float

Area property

required
Source code in shift\exceptions.py
109
110
111
112
113
114
115
116
117
118
class NegativeAreaError(SeedBaseException):
    """Exception raused because area of the geometry is negative.

    Args:
        area (float): Area property
    """

    def __init__(self, area: float):
        self.message = f"Area = {area} can not be negative"
        super().__init__(self.message)

NegativeDiameterError

Bases: SeedBaseException

Exceptions raised because diameter is negative.

Parameters:

Name Type Description Default
diameter float

Conductor diameter property

required
Source code in shift\exceptions.py
430
431
432
433
434
435
436
437
438
439
class NegativeDiameterError(SeedBaseException):
    """Exceptions raised because diameter is negative.

    Args:
        diameter (float): Conductor diameter property
    """

    def __init__(self, diameter: float):
        self.message = f"Diamater can not be negative but found {diameter}"
        super().__init__(self.message)

NegativeGMRError

Bases: SeedBaseException

Exceptions raised because GMR is negative.

Parameters:

Name Type Description Default
gmr float

Geometric mean radius property

required
Source code in shift\exceptions.py
442
443
444
445
446
447
448
449
450
451
class NegativeGMRError(SeedBaseException):
    """Exceptions raised because GMR is negative.

    Args:
        gmr (float): Geometric mean radius property
    """

    def __init__(self, gmr: float):
        self.message = f"GMR can not be negative but found {gmr}"
        super().__init__(self.message)

NegativeKVError

Bases: SeedBaseException

Exception raised because kV is negative.

Parameters:

Name Type Description Default
kv float

Voltage in KV property

required
Source code in shift\exceptions.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
class NegativeKVError(SeedBaseException):
    """Exception raised because kV is negative.

    Args:
        kv (float): Voltage in KV property
    """

    def __init__(self, kv: float):
        self.message = f"KV = {kv} can not be negative"
        super().__init__(self.message)

NegativeLineLengthError

Bases: SeedBaseException

Exceptions raised because line length is negative.

Parameters:

Name Type Description Default
length float

Line segment's length property

required
Source code in shift\exceptions.py
403
404
405
406
407
408
409
410
411
412
class NegativeLineLengthError(SeedBaseException):
    """Exceptions raised because line length is negative.

    Args:
        length (float): Line segment's length property
    """

    def __init__(self, length: float):
        self.message = f"Line length can not be negative but found {length}"
        super().__init__(self.message)

NegativeResistanceError

Bases: SeedBaseException

Exceptions raised because AC resistance is negative.

Parameters:

Name Type Description Default
r float

AC resistance property

required
Source code in shift\exceptions.py
454
455
456
457
458
459
460
461
462
463
class NegativeResistanceError(SeedBaseException):
    """Exceptions raised because AC resistance is negative.

    Args:
        r (float): AC resistance property
    """

    def __init__(self, r: float):
        self.message = f"AC resistance can not be negative but found {r}"
        super().__init__(self.message)

NegativeStrandsError

Bases: SeedBaseException

Exceptions raised because Number of strands is negative.

Parameters:

Name Type Description Default
num_of_strands float

Number of strands property

required
Source code in shift\exceptions.py
478
479
480
481
482
483
484
485
486
487
488
489
class NegativeStrandsError(SeedBaseException):
    """Exceptions raised because Number of strands is negative.

    Args:
        num_of_strands (float): Number of strands property
    """

    def __init__(self, num_of_strands: float):
        self.message = (
            f"Number of strands can not be negative but found {num_of_strands}"
        )
        super().__init__(self.message)

NegativekVAError

Bases: SeedBaseException

Exception raised because negative kva is used.

Parameters:

Name Type Description Default
kva float

kva property

required
Source code in shift\exceptions.py
284
285
286
287
288
289
290
291
292
293
class NegativekVAError(SeedBaseException):
    """Exception raised because negative kva is used.

    Args:
        kva (float): kva property
    """

    def __init__(self, kva: float):
        self.message = f"kVA = {kva} can not be negative"
        super().__init__(self.message)

NotCompatibleFileError

Bases: SeedBaseException

Exception raised because unexpected file type recieved.

Parameters:

Name Type Description Default
file_path str

File path property

required
expected_type str

Expected file type property

required
Source code in shift\exceptions.py
161
162
163
164
165
166
167
168
169
170
171
172
173
174
class NotCompatibleFileError(SeedBaseException):
    """Exception raised because unexpected file type recieved.

    Args:
        file_path (str): File path property
        expected_type (str): Expected file type property
    """

    def __init__(self, file_path: str, expected_type: str):
        self.message = (
            "Unexpected file type received, "
            + f"expected {expected_type} but got {file_path}"
        )
        super().__init__(self.message)

NotImplementedError

Bases: SeedBaseException

Feature not implmeneted error.

Source code in shift\exceptions.py
587
588
class NotImplementedError(SeedBaseException):
    """Feature not implmeneted error."""

NumberOfClusterNotInRangeError

Bases: SeedBaseException

Exception raised because number of clusters used is not within range.

Parameters:

Name Type Description Default
num_of_clus int

Number of clusters property

required
Source code in shift\exceptions.py
305
306
307
308
309
310
311
312
313
314
315
316
317
class NumberOfClusterNotInRangeError(SeedBaseException):
    """Exception raised because number of clusters used is not within range.

    Args:
        num_of_clus (int): Number of clusters property
    """

    def __init__(self, num_of_clus: int):
        self.message = (
            f"Number of clusters {num_of_clus}"
            + f"must be less than {MIN_NUM_CLUSTER}!"
        )
        super().__init__(self.message)

OperationYearNotInRange

Bases: SeedBaseException

Exceptions raised because year in operation is not within range.

Parameters:

Name Type Description Default
year float

Year property

required
Source code in shift\exceptions.py
372
373
374
375
376
377
378
379
380
381
382
383
384
class OperationYearNotInRange(SeedBaseException):
    """Exceptions raised because year in operation is not within range.

    Args:
        year (float): Year property
    """

    def __init__(self, year: float):
        self.message = (
            "Year in operation must be in range "
            + f"{(MIN_YEAR_OPERATION, MAX_YEAR_OPERATION)}, but found {year}"
        )
        super().__init__(self.message)

PercentageNotInRangeError

Bases: SeedBaseException

Exception raised because percentage set is not within range.

Parameters:

Name Type Description Default
pct float

Percentage property

required
Source code in shift\exceptions.py
269
270
271
272
273
274
275
276
277
278
279
280
281
class PercentageNotInRangeError(SeedBaseException):
    """Exception raised because percentage set is not within range.

    Args:
        pct (float): Percentage property
    """

    def __init__(self, pct: float):
        self.message = (
            f"Percentage {pct} not "
            + f"in ({MIN_PERCENTAGE}, {MAX_PERCENTAGE}) range!"
        )
        super().__init__(self.message)

PercentageSumNotHundred

Bases: SeedBaseException

Exception raised because sum of pct values not equal to 100.

Parameters:

Name Type Description Default
total_pct float

Percentage property

required
Source code in shift\exceptions.py
136
137
138
139
140
141
142
143
144
145
class PercentageSumNotHundred(SeedBaseException):
    """Exception raised because sum of pct values not equal to 100.

    Args:
        total_pct (float): Percentage property
    """

    def __init__(self, total_pct: float):
        self.message = f"Total sum {total_pct} not equal to 100"
        super().__init__(self.message)

PhaseMismatchError

Bases: SeedBaseException

Exceptions raised because phase misatch is encountered.

Parameters:

Name Type Description Default
phase1 Phase

Phase property for one end

required
phase2 Phase

Phase property for other end

required
Source code in shift\exceptions.py
526
527
528
529
530
531
532
533
534
535
536
537
538
539
class PhaseMismatchError(SeedBaseException):
    """Exceptions raised because phase misatch is encountered.

    Args:
        phase1 (Phase): Phase property for one end
        phase2 (Phase): Phase property for other end
    """

    def __init__(self, phase1: Phase, phase2: Phase):
        self.message = (
            f"Attempt to connect phase {phase1}"
            + f" to phase {phase2} is encountered!"
        )
        super().__init__(self.message)

PoleToPoleDistanceNotInRange

Bases: SeedBaseException

Exceptions raised because pole to pole distance is not within range.

Parameters:

Name Type Description Default
distance float

Pole to pole distance property

required
Source code in shift\exceptions.py
387
388
389
390
391
392
393
394
395
396
397
398
399
400
class PoleToPoleDistanceNotInRange(SeedBaseException):
    """Exceptions raised because pole to pole distance is not within range.

    Args:
        distance (float): Pole to pole distance property
    """

    def __init__(self, distance: float):
        self.message = (
            "Pole to pole distance must be in range "
            + f"{(MIN_POLE_TO_POLE_DISTANCE, MAX_POLE_TO_POLE_DISTANCE)}, "
            + f"but found {distance}"
        )
        super().__init__(self.message)

PowerFactorNotInRangeError

Bases: SeedBaseException

Exception raised because power factor not in range.

Parameters:

Name Type Description Default
pf float

Power factor property

required
Source code in shift\exceptions.py
121
122
123
124
125
126
127
128
129
130
131
132
133
class PowerFactorNotInRangeError(SeedBaseException):
    """Exception raised because power factor not in range.

    Args:
        pf (float): Power factor property
    """

    def __init__(self, pf: float):
        self.message = (
            f"Power factor {pf} not in "
            + f"({MIN_POWER_FACTOR}, {MAX_POWER_FACTOR}) range!"
        )
        super().__init__(self.message)

SeedBaseException

Bases: Exception

All exception should derive from this.

Source code in shift\exceptions.py
59
60
class SeedBaseException(Exception):
    """All exception should derive from this."""

UnsupportedFeatureError

Bases: SeedBaseException

Exceptions raised because feature being requested is not yet supported or invalid type is passed.

Source code in shift\exceptions.py
574
575
576
class UnsupportedFeatureError(SeedBaseException):
    """Exceptions raised because feature being requested
    is not yet supported or invalid type is passed."""

UnsupportedFrequencyError

Bases: SeedBaseException

Exceptions raised because unsupported frequency is in use.

Parameters:

Name Type Description Default
freq float

Frequency in hz

required
Source code in shift\exceptions.py
511
512
513
514
515
516
517
518
519
520
521
522
523
class UnsupportedFrequencyError(SeedBaseException):
    """Exceptions raised because unsupported frequency is in use.

    Args:
        freq (float): Frequency in hz
    """

    def __init__(self, freq: float):
        self.message = (
            f"Unsupported frequency is used {freq}"
            + f" please choose one of these frequency {VALID_FREQUENCIES}"
        )
        super().__init__(self.message)

ValidationError

Bases: SeedBaseException

Exception raised bbecause content can not be validated.

Parameters:

Name Type Description Default
errors list

List of error messages.

required
Source code in shift\exceptions.py
177
178
179
180
181
182
183
184
185
186
class ValidationError(SeedBaseException):
    """Exception raised bbecause content can not be validated.

    Args:
        errors (list): List of error messages.
    """

    def __init__(self, errors: list):
        self.message = f"Could not validate the content: {errors}"
        super().__init__(self.message)

WrongInputUsed

Bases: SeedBaseException

Exeption raised becaue wrong input is used.

Source code in shift\exceptions.py
301
302
class WrongInputUsed(SeedBaseException):
    """Exeption raised becaue wrong input is used."""

ZeroKVError

Bases: SeedBaseException

Exception raused because the kV is zero.

Source code in shift\exceptions.py
105
106
class ZeroKVError(SeedBaseException):
    """Exception raused because the kV is zero."""

ZoomLevelNotInRangeError

Bases: SeedBaseException

Exception raised because zoom level defined is not in range.

Parameters:

Name Type Description Default
zoom int

Zoom level property

required
Source code in shift\exceptions.py
189
190
191
192
193
194
195
196
197
198
199
200
201
class ZoomLevelNotInRangeError(SeedBaseException):
    """Exception raised because zoom level defined is not in range.

    Args:
        zoom (int): Zoom level property
    """

    def __init__(self, zoom: int):
        self.message = (
            f"Zoom level {zoom} not in"
            + f"({MIN_ZOOM_LEVEL}, {MAX_ZOOM_LEVEL}) range!"
        )
        super().__init__(self.message)