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

Deep magic underscore error messages rebase #2843

Merged
merged 26 commits into from
Nov 16, 2020

Commits on Oct 19, 2020

  1. Configuration menu
    Copy the full SHA
    2209b2d View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2020

  1. Configuration menu
    Copy the full SHA
    afd5b7a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b894b89 View commit details
    Browse the repository at this point in the history
  3. Also state when a property doesn't support subscripting

    Shows the property that doesn't support it.
    Need to still update the tests though.
    nicholas-esterer committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    4c659db View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2bf2526 View commit details
    Browse the repository at this point in the history
  5. updated changelog

    nicholas-esterer committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    5695969 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2020

  1. Improved error message when subscripting types that don't support it

    For example, `fig.update_layout(width_x=1)` gives the following error
    message:
    
    TypeError: 'NoneType' object is not subscriptable
    
    Invalid value received for the 'width' property of layout
    
        The 'width' property is a number and may be specified as:
          - An int or float in the interval [10, inf]
    
    Property does not support subscripting:
    width_x
    ~~~~~
    
    because `fig.layout['width']` can't be subscripted (you can't do
    `fig.layout['width']['x'] = 1`)
    nicholas-esterer committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    22b3e03 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c09c03e View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2020

  1. Changed PlotlyKeyError's superclass to KeyError

    But overrode the __str__ method.
    nicholas-esterer committed Nov 4, 2020
    Configuration menu
    Copy the full SHA
    f4be2b1 View commit details
    Browse the repository at this point in the history
  2. BasePlotlyType._raise_on_invalid_property_error raises PlotlyKeyError

    It used to raise ValueError but PlotlyKeyError subclasses KeyError and
    is the more relevant exception. PlotlyKeyError maintains the nice
    printing of the errors, unlike KeyError.
    nicholas-esterer committed Nov 4, 2020
    Configuration menu
    Copy the full SHA
    73051a6 View commit details
    Browse the repository at this point in the history
  3. Cast some errors to PlotlyKeyError

    Because lookup in subclasses of BasePlotlyType and BaseFigure should
    throw KeyError.
    nicholas-esterer committed Nov 4, 2020
    Configuration menu
    Copy the full SHA
    651b712 View commit details
    Browse the repository at this point in the history
  4. Updated the tests to reflect the new Exception behaviour

    I believe the new behaviour is consistent with the previous exception
    behaviour, but we will run the CI tests to be sure.
    nicholas-esterer committed Nov 4, 2020
    Configuration menu
    Copy the full SHA
    9bb2470 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2020

  1. Configuration menu
    Copy the full SHA
    bf4cd97 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7d42ffe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a18b341 View commit details
    Browse the repository at this point in the history
  4. Now subscripting errors triggered on types throwing TypeError

    Before the subscripting error was only thrown for NoneType objects, but
    because stuff like `"hello"["hi"]` and `1["hey"]` also are invalid, and
    these also throw TypeError, then these throw the subscripting error
    message too. HOWEVER, this error is casted to ValueError on property
    assignment and PlotlyKeyError on property read, to keep consistency
    among the exception types.
    nicholas-esterer committed Nov 5, 2020
    Configuration menu
    Copy the full SHA
    4bda7b2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9e1b667 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2020

  1. Changed dict path error display to always ^

    and underneath the whole offending part of the path e.g.,
    
    the_badpart_of_the_path
        ^^^^^^^
    
    for both property and subscripting errors.
    nicholas-esterer committed Nov 9, 2020
    Configuration menu
    Copy the full SHA
    d6aee64 View commit details
    Browse the repository at this point in the history
  2. Try taking length of string-like objects

    then if that fails, try and print the int, then if that fails, truely
    fail. This allows taking the length of unicode objects in Python2.
    nicholas-esterer committed Nov 9, 2020
    Configuration menu
    Copy the full SHA
    c6e5b4d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    82f9bb1 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2020

  1. Configuration menu
    Copy the full SHA
    70f18ca View commit details
    Browse the repository at this point in the history
  2. Complain about trailing underscores, find closest key

    Tests in tests/test_core/test_errors/test_dict_path_errors.py
    not yet updated though.
    nicholas-esterer committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    00851fa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d2bc400 View commit details
    Browse the repository at this point in the history
  4. Key guessing before and after list of valid properties

    Also tripped when no underscore paths are used, e.g.,
    
    fig.data[0].line["colr"] = "blue"
    nicholas-esterer committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    20518c1 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2020

  1. Configuration menu
    Copy the full SHA
    4066ae2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    86f4217 View commit details
    Browse the repository at this point in the history