Skip to content

Commit ed104b4

Browse files
committed
style: apply black to create_app
1 parent 1fb46ce commit ed104b4

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

pyms/flask/app/create_app.py

+17-8
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def example():
7272
7373
Current services are swagger, request, tracer, metrics
7474
"""
75+
7576
config_resource = CONFIG_BASE
7677
services: List[str] = []
7778
application = Flask
@@ -105,7 +106,9 @@ def init_services(self) -> None:
105106
"""
106107
services_resources = ServicesResource()
107108
for service_name, service in services_resources.get_services():
108-
if service_name not in self.services or not getattr(self, service_name, False):
109+
if service_name not in self.services or not getattr(
110+
self, service_name, False
111+
):
109112
self.services.append(service_name)
110113
setattr(self, service_name, service)
111114

@@ -150,7 +153,7 @@ def init_logger(self) -> None:
150153
:return:
151154
"""
152155
self.application.logger = logger
153-
os.environ['WERKZEUG_RUN_MAIN'] = "true"
156+
os.environ["WERKZEUG_RUN_MAIN"] = "true"
154157

155158
formatter = CustomJsonFormatter()
156159
formatter.add_service_name(self.application.config["APP_NAME"])
@@ -172,11 +175,16 @@ def init_app(self) -> Flask:
172175
:return: None
173176
"""
174177
if self.swagger:
175-
application = self.swagger.init_app(config=self.config.to_flask(), path=self.path)
178+
application = self.swagger.init_app(
179+
config=self.config.to_flask(), path=self.path
180+
)
176181
else:
177182
check_package_exists("flask")
178-
application = Flask(__name__, static_folder=os.path.join(self.path, 'static'),
179-
template_folder=os.path.join(self.path, 'templates'))
183+
application = Flask(
184+
__name__,
185+
static_folder=os.path.join(self.path, "static"),
186+
template_folder=os.path.join(self.path, "templates"),
187+
)
180188

181189
application.root_path = self.path
182190

@@ -192,8 +200,7 @@ def init_metrics(self) -> None:
192200
if self.metrics:
193201
self.application.register_blueprint(self.metrics.metrics_blueprint)
194202
self.metrics.add_logger_handler(
195-
self.application.logger,
196-
self.application.config["APP_NAME"]
203+
self.application.logger, self.application.config["APP_NAME"]
197204
)
198205
self.metrics.monitor(self.application.config["APP_NAME"], self.application)
199206

@@ -230,7 +237,9 @@ def create_app(self) -> Flask:
230237

231238
self.init_metrics()
232239

233-
logger.debug("Started app with PyMS and this services: {}".format(self.services))
240+
logger.debug(
241+
"Started app with PyMS and this services: {}".format(self.services)
242+
)
234243

235244
return self.application
236245

0 commit comments

Comments
 (0)