File tree Expand file tree Collapse file tree 2 files changed +3
-28
lines changed
{{cookiecutter.tool_identifier}} Expand file tree Collapse file tree 2 files changed +3
-28
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22
3- import decorator
43import flask
54{% if cookiecutter .set_up_mypy == "True" % }from flask .typing import ResponseReturnValue as RRV
65{% endif % }from markupsafe import Markup
76import mwapi {% if cookiecutter .set_up_mypy == "True" % } # type: ignore{% endif %}
87import mwoauth {% if cookiecutter .set_up_mypy == "True" % } # type: ignore{% endif %}
9- import os
108import random
119import requests_oauthlib {% if cookiecutter .set_up_mypy == "True" % } # type: ignore{% endif %}
12- import stat
1310import string
1411import toolforge
1512{% if cookiecutter .set_up_mypy == "True" % }from typing import Optional , Tuple
16- {% endif % }import yaml
17-
13+ {% endif % }
1814
1915app = flask .Flask (__name__ )
2016
2319 email = '{{ cookiecutter.user_email }}' )
2420
2521
26- @decorator .decorator
27- def read_private (func , * args , ** kwargs ):
28- try :
29- f = args [0 ]
30- fd = f .fileno ()
31- except AttributeError :
32- pass
33- except IndexError :
34- pass
35- else :
36- mode = os .stat (fd ).st_mode
37- if (stat .S_IRGRP | stat .S_IROTH ) & mode :
38- name = getattr (f , "name" , "config file" )
39- raise ValueError (f'{ name } is readable to others, '
40- 'must be exclusively user-readable!' )
41- return func (* args , ** kwargs )
42-
43-
4422has_config = app .config .from_file ('config.yaml' ,
45- load = read_private ( yaml . safe_load ) ,
23+ load = toolforge . load_private_yaml ,
4624 silent = True )
4725if not has_config :
4826 print ('config.yaml file not found, assuming local development setup' )
Original file line number Diff line number Diff line change 1- decorator
21{% if cookiecutter.set_up_flake8 == "True" %}flake8
32{% endif %}flask >= 2.0.0
43MarkupSafe
87{% endif %}{% if cookiecutter.set_up_mypy == "True" %}mypy
98{% endif %}PyYAML
109requests_oauthlib
11- toolforge {% if cookiecutter.set_up_mypy == "True" %}
12- types-decorator
13- types-PyYAML {% endif %}
10+ toolforge >= 6.1.0
You can’t perform that action at this time.
0 commit comments