Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix untyped functions in core/dbt/context/base.py #8525

Merged
merged 5 commits into from
Aug 31, 2023

Commits on Aug 31, 2023

  1. Configuration menu
    Copy the full SHA
    2a77044 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b71d345 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5d18132 View commit details
    Browse the repository at this point in the history
  4. Improve typing BaseContext and functions

    In addition to just adding parameter typing and return typing to
    `BaseContext` functions. We also declared `_context_members_` and
    `_context_attrs_` as properites of `BaseContext` this was necessary
    because they're being accessed in the classes functions. However,
    because they were being indirectly instantiated by the metaclass
    `ContextMeta`, the properties weren't actually known to exist. By
    adding declaring the properties on the `BaseContext`, we let mypy
    know they exist.
    QMalcolm committed Aug 31, 2023
    Configuration menu
    Copy the full SHA
    e9457a0 View commit details
    Browse the repository at this point in the history
  5. Remove bare invocations of @contextmember and @contextproperty,…

    … and add typing to them
    
    Previously `contextmember` and `contextproperty` were 2-in-1 decorators.
    This meant they could be invoked either as `@contextmember` or
    `@contextmember('some_string')`. This was fine until we wanted to return
    typing to the functions. In the instance where the bare decorator was used
    (i.e. no `(...)` were present) an object was expected to be returned. However
    in the instance where parameters were passed on the invocation, a callable
    was expected to be returned. Putting a union of both in the return type
    made the invocations complain about each others' return type. To get around this
    we've dropped the bare invocation as acceptable. The parenthesis are now always
    required, but passing a string in them is optional.
    QMalcolm committed Aug 31, 2023
    Configuration menu
    Copy the full SHA
    a613ef0 View commit details
    Browse the repository at this point in the history