Skip to content

Commit

Permalink
Merge pull request #1996 from Fokko/remove-duplicates
Browse files Browse the repository at this point in the history
Remove the duplicate get_context_modules
  • Loading branch information
beckjake authored Dec 10, 2019
2 parents cc49190 + 284f5a4 commit 40839c7
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions core/dbt/context/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ def __call__(self, var_name, default=_VAR_NOTSET):
return self.get_missing_var(var_name)


def get_pytz_module_context():
context_exports = pytz.__all__
def get_pytz_module_context() -> Dict[str, Any]:
context_exports = pytz.__all__ # type: ignore

return {
name: getattr(pytz, name) for name in context_exports
}


def get_datetime_module_context():
def get_datetime_module_context() -> Dict[str, Any]:
context_exports = [
'date',
'datetime',
Expand All @@ -114,7 +114,7 @@ def get_datetime_module_context():
}


def get_context_modules():
def get_context_modules() -> Dict[str, Dict[str, Any]]:
return {
'pytz': get_pytz_module_context(),
'datetime': get_datetime_module_context(),
Expand Down Expand Up @@ -148,12 +148,6 @@ def log(msg, info=False):


class BaseContext:
def get_context_modules(self):
return {
'pytz': get_pytz_module_context(),
'datetime': get_datetime_module_context(),
}

def to_dict(self) -> Dict[str, Any]:
run_started_at = None
invocation_id = None
Expand All @@ -164,7 +158,7 @@ def to_dict(self) -> Dict[str, Any]:

context: Dict[str, Any] = {
'env_var': env_var,
'modules': self.get_context_modules(),
'modules': get_context_modules(),
'run_started_at': run_started_at,
'invocation_id': invocation_id,
'return': _return,
Expand Down

0 comments on commit 40839c7

Please sign in to comment.