Skip to content

Commit e0906a2

Browse files
committedAug 13, 2015
Re-format import statement
For readability re-formatted the import statement to be alphabetical and multilined. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
1 parent 7ed7845 commit e0906a2

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
 

‎compose/config/config.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
CircularReference,
1414
ComposeFileNotFound,
1515
)
16-
from .validation import validate_service_names, validate_top_level_object, validate_against_schema
16+
from .validation import (
17+
validate_against_schema,
18+
validate_service_names,
19+
validate_top_level_object
20+
)
1721

1822

1923
DOCKER_CONFIG_KEYS = [
@@ -141,7 +145,7 @@ def load(config_details):
141145

142146
service_dicts = []
143147

144-
for service_name, service_dict in list(config.items()):
148+
for service_name, service_dict in list(processed_config.items()):
145149
loader = ServiceLoader(working_dir=working_dir, filename=filename)
146150
service_dict = loader.make_service_dict(service_name, service_dict)
147151
validate_paths(service_dict)

‎compose/config/validation.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from functools import wraps
12
import os
23

34
from docker.utils.ports import split_port
@@ -37,21 +38,25 @@ def format_ports(instance):
3738

3839

3940
def validate_service_names(func):
41+
@wraps(func)
4042
def func_wrapper(config):
41-
for service_name in func(config).keys():
43+
for service_name in config.keys():
4244
if type(service_name) is int:
4345
raise ConfigurationError(
4446
"Service name: {} needs to be a string, eg '{}'".format(service_name, service_name)
4547
)
48+
return func(config)
4649
return func_wrapper
4750

4851

4952
def validate_top_level_object(func):
53+
@wraps(func)
5054
def func_wrapper(config):
51-
if not isinstance(func(config), dict):
55+
if not isinstance(config, dict):
5256
raise ConfigurationError(
5357
"Top level object needs to be a dictionary. Check your .yml file that you have defined a service at the top level."
5458
)
59+
return func(config)
5560
return func_wrapper
5661

5762

0 commit comments

Comments
 (0)