chore(frappe): Add typing hints for init methods
This commit is contained in:
parent
d7abbe0e10
commit
0a854ddd2a
1 changed files with 6 additions and 7 deletions
|
|
@ -25,7 +25,7 @@ import importlib
|
|||
import inspect
|
||||
import json
|
||||
import sys
|
||||
from typing import TYPE_CHECKING, Dict, List, Union
|
||||
from typing import TYPE_CHECKING, Dict, List, Optional, Union
|
||||
|
||||
import click
|
||||
from werkzeug.local import Local, release_local
|
||||
|
|
@ -80,7 +80,7 @@ class _dict(dict):
|
|||
return _dict(dict(self).copy())
|
||||
|
||||
|
||||
def _(msg, lang=None, context=None):
|
||||
def _(msg: str, lang: Optional[str] = None, context: str = None) -> str:
|
||||
"""Returns translated string in current lang, if exists.
|
||||
Usage:
|
||||
_('Change')
|
||||
|
|
@ -317,14 +317,13 @@ def get_site_config(sites_path=None, site_path=None):
|
|||
return _dict(config)
|
||||
|
||||
|
||||
def get_conf(site=None):
|
||||
def get_conf(site: Optional[str] = None) -> _dict:
|
||||
if hasattr(local, "conf"):
|
||||
return local.conf
|
||||
|
||||
else:
|
||||
# if no site, get from common_site_config.json
|
||||
with init_site(site):
|
||||
return local.conf
|
||||
# if no site, get from common_site_config.json
|
||||
with init_site(site):
|
||||
return local.conf
|
||||
|
||||
|
||||
class init_site:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue