Skip to content

Commit

Permalink
Fix the check_data_input_order decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Sep 27, 2021
1 parent 7b2ff17 commit 95fa173
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from inspect import Parameter, signature

import numpy as np
import pygmt
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers.utils import is_nonstr_iter

Expand Down Expand Up @@ -857,7 +858,14 @@ def new_module(*args, **kwargs):
New module instance that raises a warning if positional arguments
are passed.
"""
if len(args) > 0: # positional arguments are used
# plotting function always has the "self" parameter
if len(args) > 1 and isinstance(args[0], pygmt.Figure):
plotting_func = 1
else:
plotting_func = 0

if len(args) > 1 + plotting_func:
# more than one positional arguments are used
msg = (
"The function parameters has been re-ordered as 'data, x, y, [z]' "
f"since {deprecate_version} but you're passing positional arguments. "
Expand Down

0 comments on commit 95fa173

Please sign in to comment.