Skip to content

Commit 816609e

Browse files
Format code with Black
1 parent 730e621 commit 816609e

20 files changed

+621
-540
lines changed

gitmodel/conf.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
DEFAULTS = {
2-
'DEFAULT_SERIALIZER': 'gitmodel.serializers.json',
3-
'LOCK_WAIT_TIMEOUT': 30, # in seconds
4-
'LOCK_WAIT_INTERVAL': 1000, # in milliseconds
5-
'DEFAULT_GIT_USER': ('gitmodel', 'gitmodel@local'),
2+
"DEFAULT_SERIALIZER": "gitmodel.serializers.json",
3+
"LOCK_WAIT_TIMEOUT": 30, # in seconds
4+
"LOCK_WAIT_INTERVAL": 1000, # in milliseconds
5+
"DEFAULT_GIT_USER": ("gitmodel", "gitmodel@local"),
66
}
77

88

@@ -24,4 +24,5 @@ def __getattr__(self, name):
2424
def __setattr__(self, name, value):
2525
self[name] = value
2626

27+
2728
defaults = Config(DEFAULTS)

gitmodel/exceptions.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
class GitModelError(Exception):
22
"""A base exception for other gitmodel-related errors."""
3+
34
pass
45

56

67
class ConfigurationError(GitModelError):
78
"""Raised during configuration errors"""
9+
810
pass
911

1012

1113
class UnsupportedFormat(GitModelError):
1214
"""
1315
Raised when an unsupported serialization format is requested.
1416
"""
17+
1518
pass
1619

1720

1821
class FieldError(GitModelError):
1922
"""
2023
Raised when there is a configuration error with a ``Field``.
2124
"""
25+
2226
pass
2327

2428

2529
class DoesNotExist(GitModelError):
2630
"""
2731
Raised when the object in question can't be found.
2832
"""
33+
2934
pass
3035

3136

3237
class RepositoryError(GitModelError):
3338
"""
3439
Raises during an error while operating with the repository
3540
"""
41+
3642
pass
3743

3844

@@ -46,13 +52,14 @@ class ValidationError(GitModelError):
4652
"""
4753
Raised when an invalid value is encountered
4854
"""
55+
4956
def __init__(self, msg_or_code, field=None, **kwargs):
5057
self.field = field
5158
self.msg_or_code = msg_or_code
5259
if self.field:
53-
msg = self.field.get_error_message(msg_or_code,
54-
default=msg_or_code,
55-
**kwargs)
60+
msg = self.field.get_error_message(
61+
msg_or_code, default=msg_or_code, **kwargs
62+
)
5663
else:
5764
msg = msg_or_code
5865
super(ValidationError, self).__init__(msg)
@@ -62,11 +69,13 @@ class IntegrityError(GitModelError):
6269
"""
6370
Raised when a save results in duplicate values
6471
"""
72+
6573
pass
6674

6775

6876
class ModelNotFound(Exception):
6977
"""
7078
Raised during deserialization if the model class no longer exists
7179
"""
80+
7281
pass

0 commit comments

Comments
 (0)